Additional models

This commit is contained in:
Kamil_DLC 2021-02-16 22:18:20 +01:00
parent b696d1e4d1
commit a18390da4b

View File

@ -94,6 +94,9 @@ int main(int argc, char** argv)
Shader backpackShader("9.2.geometry_shader.vert", "9.2.geometry_shader.frag"); Shader backpackShader("9.2.geometry_shader.vert", "9.2.geometry_shader.frag");
Model backpackModel("../resources/objects/backpack/backpack.obj"); Model backpackModel("../resources/objects/backpack/backpack.obj");
Shader spaceshipShader("9.2.geometry_shader.vert", "9.2.geometry_shader.frag");
Model spaceshipModel("../resources/objects/spaceship/Intergalactic_Spaceship.obj");
// set up vertex data (and buffer(s)) and configure vertex attributes // set up vertex data (and buffer(s)) and configure vertex attributes
// ------------------------------------------------------------------ // ------------------------------------------------------------------
float cubeVertices[] = { float cubeVertices[] = {
@ -286,14 +289,29 @@ int main(int argc, char** argv)
kniedeShader.setMat4("projection", projection); kniedeShader.setMat4("projection", projection);
kniedeModel.Draw(kniedeShader); kniedeModel.Draw(kniedeShader);
model = glm::translate(glm::mat4(1.0f), glm::vec3(15, -4, 9)); model = glm::translate(glm::mat4(1.0f), glm::vec3(10, -15, -3));
model = glm::translate(model, backpackTranslate);
backpackShader.use(); backpackShader.use();
backpackShader.setMat4("model", model); backpackShader.setMat4("model", model);
backpackShader.setMat4("view", view); backpackShader.setMat4("view", view);
backpackShader.setMat4("projection", projection); backpackShader.setMat4("projection", projection);
backpackModel.Draw(backpackShader); backpackModel.Draw(backpackShader);
//model = glm::translate(glm::mat4(1.0f), glm::vec3(10, -5, 9));
//model = glm::rotate(model, glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f));
//model = glm::rotate(model, glm::radians((float)glfwGetTime() * 8), glm::vec3(0.0f, 0.0f, 1.0f));
//spaceshipShader.use();
//spaceshipShader.setMat4("model", model);
//spaceshipShader.setMat4("view", view);
//spaceshipShader.setMat4("projection", projection);
//spaceshipModel.Draw(spaceshipShader);
model = glm::translate(glm::mat4(1.0f), glm::vec3(15, -4, 9));
model = glm::translate(model, backpackTranslate);
spaceshipShader.use();
spaceshipShader.setMat4("model", model);
spaceshipShader.setMat4("view", view);
spaceshipShader.setMat4("projection", projection);
spaceshipModel.Draw(spaceshipShader);
// draw skybox as last // draw skybox as last
glDepthFunc(GL_LEQUAL); // change depth function so depth test passes when values are equal to depth buffer's content glDepthFunc(GL_LEQUAL); // change depth function so depth test passes when values are equal to depth buffer's content