Removed temp variables & the "forced" animation in DrawFinalPass

This commit is contained in:
antc13
2016-01-24 15:30:20 +01:00
parent 4c5d17b203
commit 666f1fd878
8 changed files with 19 additions and 38 deletions
+2 -2
View File
@@ -4,6 +4,7 @@ uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
uniform vec4 Color;
uniform vec4 DiffuseColor;
uniform vec2 ScreenDimensions;
layout (binding = 0) uniform sampler2D DiffuseTexture;
layout (binding = 1) uniform sampler2D GlowMap;
@@ -46,7 +47,6 @@ in VertexData{
vec3 Position;
vec3 Normal;
vec2 TextureCoordinate;
vec4 DiffuseColor;
}Input;
out vec4 sceneColor;
@@ -135,7 +135,7 @@ void main()
}
//sceneColor += Input.DiffuseColor;
vec4 color_result = Input.DiffuseColor * (totalLighting.Diffuse + totalLighting.Specular) * diffuseTexel * Color;
vec4 color_result = DiffuseColor * (totalLighting.Diffuse + totalLighting.Specular) * diffuseTexel * Color;
//bloomColor = vec4(0.3, 0.8, 0.6, 1.0);
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
//These if statements should be removed if they are slow.
@@ -5,7 +5,7 @@ DrawColorCorrectionPass::DrawColorCorrectionPass(IRenderer* renderer)
m_Renderer = renderer;
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.obj");
m_Exposure = 1; //TODO: Renderer: Fixa så att denna går att ändra på genom komponent eller setting.
m_Exposure = 0.4; //TODO: Renderer: Fixa så att denna går att ändra på genom komponent eller setting.
InitializeShaderPrograms();
}
+11 -19
View File
@@ -43,7 +43,7 @@ void DrawFinalPass::InitializeShaderPrograms()
m_ForwardPlusProgram->BindFragDataLocation(1, "bloomColor");
m_ForwardPlusProgram->Link();
}
static double tempTime = 0.0;
void DrawFinalPass::Draw(RenderScene& scene)
{
GLERROR("DrawFinalPass::Draw: Pre");
@@ -65,6 +65,7 @@ void DrawFinalPass::Draw(RenderScene& scene)
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
//TODO: Render: Add code for more jobs than modeljobs.
for (auto &job : scene.ForwardJobs) {
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
@@ -80,33 +81,24 @@ void DrawFinalPass::Draw(RenderScene& scene)
} else {
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
}
tempTime += 0.01f;
//TODO: Fixa så att modelsJobs kan spela upp olika animationer och så att den kan få in en tid istället för 1.0f - Hälsningar Johan och Andreas :)
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
auto animation = modelJob->Model->m_RawModel->m_Skeleton->GetAnimation("running");
if (animation != nullptr) {
std::vector<glm::mat4> frameBones = modelJob->Model->m_RawModel->m_Skeleton->GetFrameBones(
*animation,
tempTime
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
/*if(modelJob->GlowMap != nullptr) {
glBindTexture(GL_TEXTURE_2D, modelJob->GlowMap->m_Texture);
if (modelJob->IncandescenceTexture != nullptr) {
glBindTexture(GL_TEXTURE_2D, modelJob->IncandescenceTexture->m_Texture);
} else {
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
}*/
);
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
}
/*if(modelJob->GlowMap != nullptr) {
glBindTexture(GL_TEXTURE_2D, modelJob->GlowMap->m_Texture);
} else {
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
}*/
glBindVertexArray(modelJob->Model->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
}
}
m_FinalPassFrameBuffer.Unbind();
GLERROR("DrawFinalPass::Draw: END");
delete state;
}
-1
View File
@@ -273,7 +273,6 @@ RawModelAssimp::RawModelAssimp(std::string fileName)
m_Skeleton->Animations[animationName] = skelAnim;
}
int k = 0;
}
RawModelAssimp::~RawModelAssimp()
-1
View File
@@ -8,7 +8,6 @@ RawModelCustom::RawModelCustom(std::string fileName)
ReadMeshFile(fileName);
ReadMaterialFile(fileName);
ReadAnimationFile(fileName);
int k = 0;
}
void RawModelCustom::ReadMeshFile(std::string filePath)
+2 -10
View File
@@ -51,18 +51,10 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
model = ResourceManager::Load<::Model, true>(resource);
} catch (const Resource::StillLoadingException&) {
//continue;
#ifdef USING_ASSIMP_AS_IMPORTER
model = ResourceManager::Load<::Model>("Models/WidgetPlaneZ.obj"); // 360NoScope StillLoading mesh
#else
model = ResourceManager::Load<::Model>("Models/WidgetPlaneZ.mesh");
#endif
model = ResourceManager::Load<::Model>("Models/Core/Error.mesh");
} catch (const std::exception&) {
try {
#ifdef USING_ASSIMP_AS_IMPORTER
model = ResourceManager::Load<::Model>("Models/WidgetPlaneZ.obj"); // 360NoScope Error mesh
#else
model = ResourceManager::Load<::Model>("Models/WidgetPlaneZ.mesh");
#endif
model = ResourceManager::Load<::Model>("Models/Core/Error.mesh");
} catch (const std::exception&) {
continue;
}
-1
View File
@@ -87,7 +87,6 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation::Keyf
boneMatrix = parentMatrix * (glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp));
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
int k = 0;
} else {
if (bone->Parent) {
boneMatrix = parentMatrix; // * glm::inverse(bone->OffsetMatrix);
+3 -3
View File
@@ -19,18 +19,18 @@ public:
float ReflectionFactor;
float SpecularExponent;
float DiffuseColor[3]{ 1.0f };
float DiffuseColor[3]{ 1.0f, 1.0f, 1.0f };
unsigned int ColorMapFileLength = 0;
std::string ColorMapFile;
float SpecularColor[3]{ 1.0f };
float SpecularColor[3]{ 1.0f, 1.0f, 1.0f };
unsigned int SpecularMapFileLength = 0;
std::string SpecularMapFile;
unsigned int NormalMapFileLength = 0;
std::string NormalMapFile;
float IncandescenceColor[3]{ 1.0f };
float IncandescenceColor[3]{ 1.0f, 1.0f, 1.0f };
unsigned int IncandescenceMapFileLength = 0;
std::string IncandescenceMapFile;