File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Rasterizer/Rasterizer/src Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 77#include < sstream>
88#include < iostream>
99
10+ #include " ../path.h"
11+
1012namespace Viewer
1113{
1214 class Shader
1315 {
1416 public:
1517 Shader (const std::string& vertexPath, const std::string& fragmentPath)
1618 {
19+ root = Path::Root ({ " Rasterizer" , " Assets" , " Shaders" });
20+
1721 std::string vertexCode;
1822 std::string fragmentCode;
1923
@@ -25,8 +29,8 @@ namespace Viewer
2529
2630 try
2731 {
28- vShaderFile.open (" ../Assets/Shaders/ " + vertexPath);
29- fShaderFile .open (" ../Assets/Shaders/ " + fragmentPath);
32+ vShaderFile.open (root / vertexPath);
33+ fShaderFile .open (root / fragmentPath);
3034
3135 std::stringstream vShaderStream, fShaderStream ;
3236
@@ -77,6 +81,7 @@ namespace Viewer
7781
7882 private:
7983 unsigned int ID;
84+ std::filesystem::path root;
8085
8186 static void CheckCompileErrors (GLuint shader, std::string type)
8287 {
Original file line number Diff line number Diff line change @@ -8,15 +8,13 @@ class Path
88 static std::filesystem::path Root (std::vector<std::string> segments)
99 {
1010 auto root = std::filesystem::current_path ();
11- auto current = root.parent_path (). filename ();
11+ auto current = root.filename ();
1212 while (current.string ().find (" CPURasterizer" ) == std::string::npos)
1313 {
1414 root = root.parent_path ();
15- current = root.parent_path (). filename ();
15+ current = root.filename ();
1616 }
1717
18- root = root.parent_path ();
19-
2018 for (const auto segment : segments)
2119 root /= segment;
2220
You can’t perform that action at this time.
0 commit comments