Skip to content

Commit

Permalink
perf(libs): improvement path
Browse files Browse the repository at this point in the history
  • Loading branch information
ms0g committed Apr 19, 2024
1 parent 2897d02 commit a8897e4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions libs/filesystem/src/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <filesystem>

std::string fs::path(const std::string& p) {
auto cwd = std::filesystem::current_path().string();
cwd.erase(cwd.find_last_of('/'));
return cwd + "/" + p;
auto cwd = std::filesystem::current_path().parent_path();
//cwd.erase(cwd.find_last_of('/'));
return cwd.append(p).string();
}
4 changes: 2 additions & 2 deletions src/configs/configs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define DEBUG
#endif

const std::string SHADER_DIR = "shaders/";
const std::string ASSET_DIR = "assets/";
const std::string SHADER_DIR = "shaders";
const std::string ASSET_DIR = "assets";

constexpr unsigned int SCR_WIDTH = 1600;
constexpr unsigned int SCR_HEIGHT = 900;
Expand Down
4 changes: 2 additions & 2 deletions src/world/skybox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "../shader/shader.h"

Skybox::Skybox() {
mShader = std::make_unique<Shader>(fs::path(SHADER_DIR + "skybox.vert.glsl"),
fs::path(SHADER_DIR + "skybox.frag.glsl"));
mShader = std::make_unique<Shader>(fs::path(SHADER_DIR + "/skybox.vert.glsl"),
fs::path(SHADER_DIR + "/skybox.frag.glsl"));
mShader->activate();
mShader->setInt(mTextures[0].name, 0);

Expand Down
12 changes: 6 additions & 6 deletions src/world/skybox.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ class Skybox {
};

std::vector<std::string> mFaces = {
fs::path(ASSET_DIR + "skybox/right.jpg"),
fs::path(ASSET_DIR + "skybox/left.jpg"),
fs::path(ASSET_DIR + "skybox/top.jpg"),
fs::path(ASSET_DIR + "skybox/bottom.jpg"),
fs::path(ASSET_DIR + "skybox/front.jpg"),
fs::path(ASSET_DIR + "skybox/back.jpg")
fs::path(ASSET_DIR + "/skybox/right.jpg"),
fs::path(ASSET_DIR + "/skybox/left.jpg"),
fs::path(ASSET_DIR + "/skybox/top.jpg"),
fs::path(ASSET_DIR + "/skybox/bottom.jpg"),
fs::path(ASSET_DIR + "/skybox/front.jpg"),
fs::path(ASSET_DIR + "/skybox/back.jpg")
};

std::vector<Texture> mTextures = {
Expand Down
4 changes: 2 additions & 2 deletions src/world/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ World::World(const std::vector<glm::vec3>& initialState) {
mMesh = std::make_unique<CellMesh>(mVertices, mTextures);
mMesh->setup();

mShader = std::make_unique<Shader>(fs::path(SHADER_DIR + "cell.vert.glsl"),
fs::path(SHADER_DIR + "cell.frag.glsl"));
mShader = std::make_unique<Shader>(fs::path(SHADER_DIR + "/cell.vert.glsl"),
fs::path(SHADER_DIR + "/cell.frag.glsl"));

mShader->activate();
mShader->setInt(mTextures[0].name, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/world/world.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class World {
};

std::vector<Texture> mTextures = {
{texture::load(fs::path(ASSET_DIR + "glowing-rocks.jpg").c_str()),
{texture::load(fs::path(ASSET_DIR + "/glowing-rocks.jpg").c_str()),
"texture1",
"glowing-rocks.jpg"}
};
Expand Down

0 comments on commit a8897e4

Please sign in to comment.