Models now get a standard normal and specular map if they dont have one

This commit is contained in:
tleety
2015-09-16 16:09:20 +02:00
parent 20fc1232d6
commit 825f6dc991
7 changed files with 22 additions and 6 deletions
+13 -2
View File
@@ -113,6 +113,8 @@ void dd::Renderer::CreateBuffers()
m_ScreenQuad = CreateQuad();
m_UnitQuad = ResourceManager::Load<Model>("Models/Core/UnitQuad.obj");
m_UnitSphere = ResourceManager::Load<Model>("Models/Core/UnitSphere.obj");
m_StandardNormal = ResourceManager::Load<Texture>("Textures/Core/NeutralNormalMap.png");
m_StandardSpecular = ResourceManager::Load<Texture>("Textures/Core/NeutralSpecularMap.png");
glGenRenderbuffers(1, &m_rbDepthBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, m_rbDepthBuffer);
@@ -321,14 +323,23 @@ void dd::Renderer::DrawScene(RenderQueue &objects, ShaderProgram &program)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture);
if (modelJob->NormalTexture != 0) {
if (modelJob->NormalTexture != 0 && false) {
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, modelJob->NormalTexture);
} else {
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, *m_StandardNormal);
}
if (modelJob->SpecularTexture != 0) {
if (modelJob->SpecularTexture != 0 && false) {
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, modelJob->SpecularTexture);
}
else {
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, *m_StandardSpecular);
}
glBindVertexArray(modelJob->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->ElementBuffer);
+1 -1
View File
@@ -116,7 +116,7 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
model->ModelFile = "Models/Test/Brick/Brick.obj";
float x = spaceToEdge + line * spacesBetweenBricks.x;
float y = spaceToEdge + row * spacesBetweenBricks.y;
transform->Scale = glm::vec3(1.6, 0.2, 0.5);
transform->Scale = glm::vec3(1.6, 0.35, 0.5);
transform->Position = glm::vec3(x - 7, y + 1, -10.f);
m_World->CommitEntity(brick);
return;
+1 -1
View File
@@ -199,7 +199,7 @@ bool dd::Systems::PadSystem::OnContact(const dd::Events::Contact &event)
auto ent = m_World->CreateEntity();
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(ent);
transform->Position = glm::vec3(transformBall->Position.x, transformBall->Position.y + 0.01f, -10.f);
transform->Scale = glm::vec3(1.f, 1.f, 1.f);
transform->Scale = glm::vec3(0.5f, 0.5f, 0.5f);
auto model = m_World->AddComponent<Components::Model>(ent);
model->ModelFile = "Models/Test/Ball/Ballopus.obj";
//auto pointlight = m_World->AddComponent<Components::PointLight>(ent);