mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Update model chapter, and add new backpack model to repo (w/ attribution mention). Also use new model on deferred source code.
This commit is contained in:
@@ -69,6 +69,9 @@ int main()
|
||||
return -1;
|
||||
}
|
||||
|
||||
// tell stb_image.h to flip loaded texture's on the y-axis (before loading model).
|
||||
stbi_set_flip_vertically_on_load(true);
|
||||
|
||||
// configure global opengl state
|
||||
// -----------------------------
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -79,7 +82,7 @@ int main()
|
||||
|
||||
// load models
|
||||
// -----------
|
||||
Model ourModel(FileSystem::getPath("resources/objects/nanosuit/nanosuit.obj"));
|
||||
Model ourModel(FileSystem::getPath("resources/objects/backpack/backpack.obj"));
|
||||
|
||||
|
||||
// draw in wireframe
|
||||
@@ -115,8 +118,8 @@ int main()
|
||||
|
||||
// render the loaded model
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(0.0f, -1.75f, 0.0f)); // translate it down so it's at the center of the scene
|
||||
model = glm::scale(model, glm::vec3(0.2f, 0.2f, 0.2f)); // it's a bit too big for our scene, so scale it down
|
||||
model = glm::translate(model, glm::vec3(0.0f, 0.0f, 0.0f)); // translate it down so it's at the center of the scene
|
||||
model = glm::scale(model, glm::vec3(1.0f, 1.0f, 1.0f)); // it's a bit too big for our scene, so scale it down
|
||||
ourShader.setMat4("model", model);
|
||||
ourModel.Draw(ourShader);
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ int main()
|
||||
return -1;
|
||||
}
|
||||
|
||||
// tell stb_image.h to flip loaded texture's on the y-axis (before loading model).
|
||||
stbi_set_flip_vertically_on_load(true);
|
||||
|
||||
// configure global opengl state
|
||||
// -----------------------------
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -84,7 +87,7 @@ int main()
|
||||
|
||||
// load models
|
||||
// -----------
|
||||
Model nanosuit(FileSystem::getPath("resources/objects/nanosuit/nanosuit.obj"));
|
||||
Model nanosuit(FileSystem::getPath("resources/objects/backpack/backpack.obj"));
|
||||
std::vector<glm::vec3> objectPositions;
|
||||
objectPositions.push_back(glm::vec3(-3.0, -3.0, -3.0));
|
||||
objectPositions.push_back(glm::vec3( 0.0, -3.0, -3.0));
|
||||
|
||||
@@ -72,6 +72,9 @@ int main()
|
||||
return -1;
|
||||
}
|
||||
|
||||
// tell stb_image.h to flip loaded texture's on the y-axis (before loading model).
|
||||
stbi_set_flip_vertically_on_load(true);
|
||||
|
||||
// configure global opengl state
|
||||
// -----------------------------
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -84,7 +87,7 @@ int main()
|
||||
|
||||
// load models
|
||||
// -----------
|
||||
Model nanosuit(FileSystem::getPath("resources/objects/nanosuit/nanosuit.obj"));
|
||||
Model nanosuit(FileSystem::getPath("resources/objects/backpack/backpack.obj"));
|
||||
std::vector<glm::vec3> objectPositions;
|
||||
objectPositions.push_back(glm::vec3(-3.0, -3.0, -3.0));
|
||||
objectPositions.push_back(glm::vec3( 0.0, -3.0, -3.0));
|
||||
|
||||
Reference in New Issue
Block a user