Transparancy now working for forward rendering
This commit is contained in:
@@ -355,7 +355,7 @@ public:
|
||||
glm::mat4 modelMatrix = glm::translate(absoluteTransform.Position)
|
||||
* glm::toMat4(orientation2D)
|
||||
* glm::scale(absoluteTransform.Scale);
|
||||
EnqueueSprite(texturediff, texturenorm, texturespec, modelMatrix, spriteComponent->Color);
|
||||
EnqueueSprite(texturediff, texturenorm, texturespec, modelMatrix, spriteComponent->Color, absoluteTransform.Position.z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ public:
|
||||
}
|
||||
|
||||
// TODO: Get this out of engine.h
|
||||
void EnqueueSprite(Texture* texture, Texture* normalTexture, Texture* specularTexture, glm::mat4 modelMatrix, glm::vec4 color)
|
||||
void EnqueueSprite(Texture* texture, Texture* normalTexture, Texture* specularTexture, glm::mat4 modelMatrix, glm::vec4 color, float depth)
|
||||
{
|
||||
SpriteJob job;
|
||||
job.TextureID = texture->ResourceID;
|
||||
@@ -395,7 +395,7 @@ public:
|
||||
job.SpecularTexture = *specularTexture;
|
||||
job.ModelMatrix = modelMatrix;
|
||||
job.Color = color;
|
||||
job.Depth = (glm::vec4(1,1,1,0) * modelMatrix).z;
|
||||
job.Depth = depth;
|
||||
|
||||
|
||||
m_RendererQueue.Forward.Add(job);
|
||||
|
||||
@@ -209,7 +209,6 @@ void dd::Renderer::Draw(RenderQueueCollection& rq)
|
||||
{
|
||||
|
||||
//DrawDeferred(rq.Deferred, rq.Lights);
|
||||
|
||||
rq.Forward.Jobs.sort(dd::Renderer::DepthSort);
|
||||
DrawForward(rq.Forward, rq.Lights);
|
||||
|
||||
@@ -313,6 +312,10 @@ void dd::Renderer::DrawScene(RenderQueue &objects, ShaderProgram &program)
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderProgramHandle, "MVP"), 1, GL_FALSE, glm::value_ptr(MVP));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderProgramHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelMatrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderProgramHandle, "V"), 1, GL_FALSE, glm::value_ptr(viewMatrix));
|
||||
glUniform3fv(glGetUniformLocation(shaderProgramHandle, "LightPosition"), 1, glm::value_ptr(glm::vec3(0.f,0.f,-9.f)));
|
||||
glUniform3fv(glGetUniformLocation(shaderProgramHandle, "LightSpecular"), 1, glm::value_ptr(glm::vec3(1.f)));
|
||||
glUniform3fv(glGetUniformLocation(shaderProgramHandle, "LightDiffuse"), 1, glm::value_ptr(glm::vec3(1.f)));
|
||||
glUniform1f(glGetUniformLocation(shaderProgramHandle, "LightRadius"), 40.0f);
|
||||
|
||||
glUniform1f(glGetUniformLocation(shaderProgramHandle, "MaterialShininess"), modelJob->Shininess);
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@ void main()
|
||||
vec4 specularTexel = texture(SpecularMap, Input.TextureCoord);
|
||||
|
||||
vec4 diffuseTexel = texture(DiffuseTexture, Input.TextureCoord);
|
||||
|
||||
//frag_Diffuse = phong(Input.Position, normalize(normal), specularTexel.rgb, specularTexel.a);
|
||||
vec4 La = vec4(0.3, 0.3, 0.3, 1.0);
|
||||
vec4 light = phong(Input.Position, normalize(normal), specularTexel.rgb, specularTexel.a);
|
||||
//frag_Diffuse = light;
|
||||
frag_Diffuse = diffuseTexel;
|
||||
}
|
||||
Reference in New Issue
Block a user