Add normal mapping support for gltf
This commit is contained in:
@@ -106,11 +106,6 @@ void ModelEntity::draw(glm::mat4 viewProjMatrix, glm::vec3 viewPosition) const
|
||||
glm::mat4 modelViewProj = viewProjMatrix * m_modelMatrix;
|
||||
m_shaderProgram.setUniform("u_modelViewProjMatrix", modelViewProj);
|
||||
m_shaderProgram.setUniform("u_modelMatrix", m_modelMatrix);
|
||||
|
||||
glm::mat3 normalMatrix = glm::mat3(m_modelMatrix);
|
||||
normalMatrix = glm::transpose(glm::inverse(normalMatrix));
|
||||
m_shaderProgram.setUniform("u_normalMatrix", normalMatrix);
|
||||
|
||||
m_shaderProgram.setUniform("u_viewPosition", viewPosition);
|
||||
|
||||
// Draw the model
|
||||
@@ -119,31 +114,6 @@ void ModelEntity::draw(glm::mat4 viewProjMatrix, glm::vec3 viewPosition) const
|
||||
m_shaderProgram.unbind();
|
||||
}
|
||||
|
||||
void ModelEntity::drawDirectionalShadows(glm::mat4 viewProjMatrix, ShaderProgram *shaderProgram) const
|
||||
{
|
||||
shaderProgram->bind();
|
||||
|
||||
glm::mat4 modelViewProj = viewProjMatrix * m_modelMatrix;
|
||||
shaderProgram->setUniform("u_modelViewProjMatrix", modelViewProj);
|
||||
|
||||
// Draw the model
|
||||
m_model.drawWithoutTextures();
|
||||
|
||||
shaderProgram->unbind();
|
||||
}
|
||||
|
||||
void ModelEntity::drawPointShadows(ShaderProgram *shaderProgram) const
|
||||
{
|
||||
shaderProgram->bind();
|
||||
|
||||
shaderProgram->setUniform("u_modelMatrix", m_modelMatrix);
|
||||
|
||||
// Draw the model
|
||||
m_model.drawWithoutTextures();
|
||||
|
||||
shaderProgram->unbind();
|
||||
}
|
||||
|
||||
Skybox::Skybox(Prototype prototype, Model *cubeModel, ShaderProgram *shaderProgram)
|
||||
: m_cubeModel(cubeModel), m_shaderProgram(shaderProgram), m_vertexArray(cubeModel->getMesh(0)->getVertexArray())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user