Tried correcting an error. Unsure if it will work.
This commit is contained in:
parent
823528b75a
commit
05dca4516b
@ -1,7 +1,9 @@
|
|||||||
#version 150
|
#version 150
|
||||||
|
|
||||||
|
in vec4 fragPosition;
|
||||||
|
|
||||||
out float fragmentDepth;
|
out float fragmentDepth;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
fragmentDepth = gl_FragCoord.z;
|
fragmentDepth = fragPosition.z;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,11 @@ in vec3 aNormal;
|
|||||||
in vec3 aTexcoord;
|
in vec3 aTexcoord;
|
||||||
|
|
||||||
uniform mat4 modelViewProjectionMatrix;
|
uniform mat4 modelViewProjectionMatrix;
|
||||||
|
uniform mat4 modelViewMatrix;
|
||||||
|
|
||||||
|
out vec4 fragPosition;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
fragPosition = modelViewMatrix * vec4(aPosition, 1.0);
|
||||||
gl_Position = modelViewProjectionMatrix * vec4(aPosition, 1.0);
|
gl_Position = modelViewProjectionMatrix * vec4(aPosition, 1.0);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,9 @@ void Graphics::render(double time)
|
|||||||
viewMatrix[3][0], viewMatrix[3][1], viewMatrix[3][2], viewMatrix[3][3]
|
viewMatrix[3][0], viewMatrix[3][1], viewMatrix[3][2], viewMatrix[3][3]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
level->render(depthShader, false, &depthViewProjectionMatrix_face);
|
std::vector<glm::mat4> vector = std::vector<glm::mat4>();
|
||||||
|
vector.push_back(viewMatrix);
|
||||||
|
level->render(depthShader, false, &depthViewProjectionMatrix_face, &vector);
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer_cube->getObjectName());
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer_cube->getObjectName());
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer_cube_mirror->getObjectName());
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer_cube_mirror->getObjectName());
|
||||||
glBlitFramebuffer(0, 0, cube_size, cube_size, cube_size, cube_size, 0, 0, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
glBlitFramebuffer(0, 0, cube_size, cube_size, cube_size, cube_size, 0, 0, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||||
|
@ -23,7 +23,7 @@ void Object::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
|||||||
shader->setUniform("shininess", material.getShininess());
|
shader->setUniform("shininess", material.getShininess());
|
||||||
shader->setTexture("uTexture", material.getReference(), 0);
|
shader->setTexture("uTexture", material.getReference(), 0);
|
||||||
// set model matrix
|
// set model matrix
|
||||||
shader->setUniform( "modelMatrix", modelMatrix);
|
shader->setUniform("modelMatrix", modelMatrix);
|
||||||
// set shadowMVPs
|
// set shadowMVPs
|
||||||
glm::mat4 shadowMVPs[5];
|
glm::mat4 shadowMVPs[5];
|
||||||
for(unsigned int i = 0; (i<shadowVPs->size() && i<5); i++) {
|
for(unsigned int i = 0; (i<shadowVPs->size() && i<5); i++) {
|
||||||
@ -32,6 +32,9 @@ void Object::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
|||||||
glUniformMatrix4fv(shader->getUniformLocation("shadowMVPs"),
|
glUniformMatrix4fv(shader->getUniformLocation("shadowMVPs"),
|
||||||
sizeof(shadowMVPs), false, (GLfloat*) shadowMVPs);
|
sizeof(shadowMVPs), false, (GLfloat*) shadowMVPs);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
//shader->setUniform("modelViewMatrix", shadowVPs->at(0) * modelMatrix);
|
||||||
|
}
|
||||||
glm::mat4 mvp = (*viewProjectionMatrix) * modelMatrix;
|
glm::mat4 mvp = (*viewProjectionMatrix) * modelMatrix;
|
||||||
shader->setUniform("modelViewProjectionMatrix", mvp);
|
shader->setUniform("modelViewProjectionMatrix", mvp);
|
||||||
// draw
|
// draw
|
||||||
|
Loading…
Reference in New Issue
Block a user