fix shadow of spaceship

This commit is contained in:
Anna Śmigiel 2023-02-07 21:45:51 +01:00
parent 158c48f703
commit 947d3971c2
9 changed files with 30 additions and 31 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -18,24 +18,24 @@ C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(302,59): warning C4305: "argument"
T=float
]
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(460,29): warning C4018: "<": niezgodność typu ze znakiem/bez znaku
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(501,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(514,108): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(503,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(516,108): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(525,59): warning C4305: "argument": obcięcie z "double" do "T"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(527,59): warning C4305: "argument": obcięcie z "double" do "T"
with
[
T=float
]
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(526,37): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(559,2): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(687,21): warning C4305: "-=": obcięcie z "double" do "float"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(689,21): warning C4305: "+=": obcięcie z "double" do "float"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(528,37): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(561,2): warning C4305: "argument": obcięcie z "double" do "float"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(689,21): warning C4305: "-=": obcięcie z "double" do "float"
C:\Users\annas\Desktop\graf\cw 9\src\room.hpp(691,21): warning C4305: "+=": obcięcie z "double" do "float"
Trwa generowanie kodu
2 of 595 functions ( 0.3%) were compiled, the rest were copied from previous compilation.
1 of 595 functions ( 0.2%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
6 functions had inline decision re-evaluated but remain unchanged
7 functions had inline decision re-evaluated but remain unchanged
Zakończono generowanie kodu
grk-cw9.vcxproj -> C:\Users\annas\Desktop\graf\Release\room.exe

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -213,36 +213,36 @@ void drawObjectDepth(Core::RenderContext& context, glm::mat4 viewProjection, glm
}
//void drawSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
// glDisable(GL_DEPTH_TEST);
// glUseProgram(programSkybox);
// glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
// glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
// glUniformMatrix4fv(glGetUniformLocation(programSkybox, "transformation"), 1, GL_FALSE, (float*)&transformation);
// glUniform1i(glGetUniformLocation(programSkybox, "skybox"), 10);
// Core::SetActiveTexture(texture::cubemapTexture, "skybox", programSkybox, 0);
// glUniform1f(glGetUniformLocation(programSkybox, "exposition"), exposition);
// Core::DrawContext(context);
// glEnable(GL_DEPTH_TEST);
//}
void drawSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
glDisable(GL_DEPTH_TEST);
glUseProgram(programSkybox);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(programSkybox, "transformation"), 1, GL_FALSE, (float*)&transformation);
Core::SetActiveTexture(texture::cubemapTexture, "skybox", programSkybox, 0);
glUniform1i(glGetUniformLocation(programSkybox, "skybox"), 0);
//Core::SetActiveTexture(texture::cubemapTexture, "skybox", programSkybox, 0);
glUniform1f(glGetUniformLocation(programSkybox, "exposition"), exposition);
Core::DrawContext(context);
glEnable(GL_DEPTH_TEST);
}
//void drawSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
// glDisable(GL_DEPTH_TEST);
//
// glUseProgram(programSkybox);
//
// glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
// glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
//
// glUniformMatrix4fv(glGetUniformLocation(programSkybox, "transformation"), 1, GL_FALSE, (float*)&transformation);
// Core::SetActiveTexture(texture::cubemapTexture, "skybox", programSkybox, 0);
// glUniform1f(glGetUniformLocation(programSkybox, "exposition"), exposition);
//
// Core::DrawContext(context);
//
// glEnable(GL_DEPTH_TEST);
//}
void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float roughness, float metallic) {
glActiveTexture(GL_TEXTURE0);
glUniform1i(glGetUniformLocation(program, "depthMap"), 0);
@ -495,6 +495,8 @@ void pingPongBluring()
void renderScene(GLFWwindow* window)
{
spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
spotlightConeDir = spaceshipDir;
lightShipVP = createPerspectiveMatrix(0.5) * glm::lookAt(spotlightPos, spotlightPos + spotlightConeDir, glm::vec3(0, 1, 0));
glClearColor(1.f, 1, 1, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -562,9 +564,6 @@ void renderScene(GLFWwindow* window)
drawObjectPBR(models::displayScreenContext, glm::scale(glm::vec3(0.1,0.1,0.1)) * glm::translate(glm::vec3(-28.5f,9.0f, -20.0f)), glm::vec3(0.0f, 0.0f, 0.0f), 0.0f, 0.3f);
drawObjectPBR(models::chairContext, glm::scale(glm::vec3(0.03,0.03,0.03)) * glm::translate(glm::vec3(-100.5f,0.0f, -35.0f)), glm::vec3(0.0f, 0.0f, 0.0f), 0.0f, 0.2f);
spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
spotlightConeDir = spaceshipDir;
pingPongBluring();
glBindFramebuffer(GL_FRAMEBUFFER, 0);