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:
Joey de Vries
2020-04-30 14:32:14 +02:00
parent f9ae66b16a
commit 66d51ae668
12 changed files with 199517 additions and 10 deletions

View File

@@ -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);

View File

@@ -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));

View File

@@ -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));