将项目中的绝对地址全部改为相对地址了

This commit is contained in:
胤龙 2022-12-17 17:04:53 +08:00
parent ff8d48cae4
commit fe28e220ea
4 changed files with 8 additions and 9 deletions

View File

@ -85,14 +85,14 @@ void SceneViewer::initializeGL() {
fragmentShader_ter.dispose(); fragmentShader_ter.dispose();
Model* backpackModel = new Model("D:\\ProgrammingFile\\SceneEditor\\Models\\backpack\\backpack.obj"); Model* backpackModel = new Model("../Models/backpack/backpack.obj");
Logger::info("Model loaded"); Logger::info("Model loaded");
Renderable backpack(backpackModel); Renderable backpack(backpackModel);
_objects.push_back(backpack); _objects.push_back(backpack);
sky = new skybox("D:/ProgrammingFile/SceneEditor/skybox"); sky = new skybox("../skybox");
ter = new Terrain(); ter = new Terrain("../terrain");
_camera.setPosition(glm::vec3(0.0f, 0.0f, 5.0f)); _camera.setPosition(glm::vec3(0.0f, 0.0f, 5.0f));
} }

View File

@ -4,12 +4,12 @@
#include <STBImage/stb_image.h> #include <STBImage/stb_image.h>
#include <vector> #include <vector>
Terrain::Terrain(int rows, int cols):row_num(rows),col_num(cols) { Terrain::Terrain(std::string path){
Vertex.clear(); Vertex.clear();
Indicess.clear(); Indicess.clear();
int imgW, imgH, imgChannel; int imgW, imgH, imgChannel;
unsigned char* data = stbi_load("D:/ProgrammingFile/SceneEditor/terrain/heightmap.jpg", &imgW, &imgH, &imgChannel, 1); unsigned char* data = stbi_load((path + "/heightmap.jpg").c_str(), &imgW, &imgH, &imgChannel, 1);
int index1 = 0, index = 0; int index1 = 0, index = 0;
@ -83,7 +83,7 @@ Terrain::Terrain(int rows, int cols):row_num(rows),col_num(cols) {
OPENGL_EXTRA_FUNCTIONS->glBindVertexArray(0); OPENGL_EXTRA_FUNCTIONS->glBindVertexArray(0);
//textureID = loadTexture2(texName, GL_REPEAT, GL_REPEAT, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR); //textureID = loadTexture2(texName, GL_REPEAT, GL_REPEAT, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
tex = loadTexture("D:/ProgrammingFile/SceneEditor/terrain/rock.jpg"); tex = loadTexture(path + "/texture.jpg");
} }

View File

@ -10,10 +10,9 @@ private:
std::vector<float> Vertex; std::vector<float> Vertex;
std::vector<unsigned int> Indicess; std::vector<unsigned int> Indicess;
unsigned int VAO, VBO, EBO; unsigned int VAO, VBO, EBO;
int row_num, col_num;
public: public:
unsigned int dep, tex; unsigned int tex;
Terrain(int rows = 200, int cols = 200); Terrain(std::string path);
void render(); void render();
unsigned int loadTexture(std::string path); unsigned int loadTexture(std::string path);
}; };

View File

Before

Width:  |  Height:  |  Size: 271 KiB

After

Width:  |  Height:  |  Size: 271 KiB