Cleanup
This commit is contained in:
parent
e659a7ce27
commit
26c9cfdab5
@ -35,6 +35,7 @@ namespace models {
|
||||
Core::RenderContext sphereContext;
|
||||
Core::RenderContext windowContext;
|
||||
Core::RenderContext testContext;
|
||||
Core::RenderContext testFrame;
|
||||
}
|
||||
namespace textures {
|
||||
GLuint test;
|
||||
@ -130,7 +131,7 @@ glm::mat4 createPerspectiveMatrix()
|
||||
return perspectiveMatrix;
|
||||
}
|
||||
|
||||
void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float roughness, float metallic) {
|
||||
void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, float roughness, float metallic) {
|
||||
|
||||
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
|
||||
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
|
||||
@ -142,8 +143,6 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec
|
||||
glUniform1f(glGetUniformLocation(program, "roughness"), roughness);
|
||||
glUniform1f(glGetUniformLocation(program, "metallic"), metallic);
|
||||
|
||||
//glUniform3f(glGetUniformLocation(program, "color"), color.x, color.y, color.z);
|
||||
|
||||
glUniform3f(glGetUniformLocation(program, "cameraPos"), cameraPos.x, cameraPos.y, cameraPos.z);
|
||||
|
||||
glUniform3f(glGetUniformLocation(program, "sunDir"), sunDir.x, sunDir.y, sunDir.z);
|
||||
@ -187,6 +186,7 @@ void renderShadowapSun() {
|
||||
glUseProgram(programDepth);
|
||||
|
||||
glm::mat4 lightVP = glm::ortho(-3.f, 2.3f, -1.3f, 3.f, -1.0f, 40.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0));
|
||||
|
||||
drawObjectDepth(sphereContext,
|
||||
lightVP,
|
||||
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)));
|
||||
@ -251,29 +251,30 @@ void renderScene(GLFWwindow* window)
|
||||
|
||||
glUseProgram(program);
|
||||
|
||||
|
||||
//drawObjectPBR(models::testFrame, glm::mat4(), glm::vec3(0.03f, 0.03f, 0.03f), 0.2f, 0.0f);
|
||||
|
||||
drawObjectPBR(sphereContext,
|
||||
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f))
|
||||
,glm::vec3(0.2, 0.7, 0.3),
|
||||
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)),
|
||||
0.3,
|
||||
0.0);
|
||||
|
||||
drawObjectPBR(sphereContext,
|
||||
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)),
|
||||
glm::vec3(0.5, 0.5, 0.5),
|
||||
0.7,
|
||||
0.0);
|
||||
|
||||
drawObjectPBR(models::bedContext, glm::mat4(), glm::vec3(0.03f, 0.03f, 0.03f), 0.2f, 0.0f);
|
||||
drawObjectPBR(models::chairContext, glm::mat4(), glm::vec3(0.195239f, 0.37728f, 0.8f), 0.4f, 0.0f);
|
||||
drawObjectPBR(models::deskContext, glm::mat4(), glm::vec3(0.428691f, 0.08022f, 0.036889f), 0.2f, 0.0f);
|
||||
drawObjectPBR(models::doorContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
|
||||
drawObjectPBR(models::drawerContext, glm::mat4(), glm::vec3(0.428691f, 0.08022f, 0.036889f), 0.2f, 0.0f);
|
||||
drawObjectPBR(models::marbleBustContext, glm::mat4(), glm::vec3(1.f, 1.f, 1.f), 0.5f, 1.0f);
|
||||
drawObjectPBR(models::materaceContext, glm::mat4(), glm::vec3(0.9f, 0.9f, 0.9f), 0.8f, 0.0f);
|
||||
drawObjectPBR(models::pencilsContext, glm::mat4(), glm::vec3(0.10039f, 0.018356f, 0.001935f), 0.1f, 0.0f);
|
||||
drawObjectPBR(models::planeContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
|
||||
drawObjectPBR(models::roomContext, glm::mat4(), glm::vec3(0.9f, 0.9f, 0.9f), 0.8f, 0.0f);
|
||||
drawObjectPBR(models::windowContext, glm::mat4(), glm::vec3(0.402978f, 0.120509f, 0.057729f), 0.2f, 0.0f);
|
||||
//drawObjectPBR(models::bedContext, glm::mat4(), 0.2f, 0.0f);
|
||||
//drawObjectPBR(models::chairContext, glm::mat4(), 0.4f, 0.0f);
|
||||
//drawObjectPBR(models::deskContext, glm::mat4(), 0.2f, 0.0f);
|
||||
//drawObjectPBR(models::doorContext, glm::mat4(), 0.2f, 0.0f);
|
||||
//drawObjectPBR(models::drawerContext, glm::mat4(), 0.2f, 0.0f);
|
||||
//drawObjectPBR(models::marbleBustContext, glm::mat4(), 0.5f, 1.0f);
|
||||
//drawObjectPBR(models::materaceContext, glm::mat4(), 0.8f, 0.0f);
|
||||
//drawObjectPBR(models::pencilsContext, glm::mat4(), 0.1f, 0.0f);
|
||||
//drawObjectPBR(models::planeContext, glm::mat4(), 0.2f, 0.0f);
|
||||
//drawObjectPBR(models::roomContext, glm::mat4(), 0.8f, 0.0f);
|
||||
//drawObjectPBR(models::windowContext, glm::mat4(), 0.2f, 0.0f);
|
||||
|
||||
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
||||
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
||||
@ -291,8 +292,8 @@ void renderScene(GLFWwindow* window)
|
||||
// );
|
||||
drawObjectPBR(shipContext,
|
||||
glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()) * glm::scale(glm::vec3(0.03f)),
|
||||
glm::vec3(0.3, 0.3, 0.5),
|
||||
0.2,1.0
|
||||
0.2,
|
||||
1.0
|
||||
);
|
||||
|
||||
spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
|
||||
@ -367,6 +368,7 @@ void init(GLFWwindow* window)
|
||||
loadModelToContext("./models/spaceship.obj", models::spaceshipContext);
|
||||
loadModelToContext("./models/sphere.obj", models::sphereContext);
|
||||
loadModelToContext("./models/window.obj", models::windowContext);
|
||||
loadModelToContext("./models2/Frame/Frame.obj", models::testFrame);
|
||||
|
||||
textures::test = Core::LoadTexture("./textures/WindowFrame_Color.png");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user