Transparent objects working.

This commit is contained in:
Tleety
2014-05-29 23:59:36 +02:00
parent eb37cc2296
commit cc84f04542
15 changed files with 244 additions and 81 deletions
+14 -6
View File
@@ -69,7 +69,8 @@ public:
}
else
{
EnqueueModel(modelAsset, modelMatrix);
float transparent = modelComponent->Transparent;
EnqueueModel(modelAsset, modelMatrix, transparent);
}
}
@@ -131,7 +132,7 @@ private:
std::shared_ptr<Systems::TransformSystem> m_TransformSystem;
void EnqueueModel(Model* model, glm::mat4 modelMatrix)
void EnqueueModel(Model* model, glm::mat4 modelMatrix, float transparent)
{
for (auto texGroup : model->TextureGroups)
{
@@ -144,8 +145,15 @@ private:
job.StartIndex = texGroup.StartIndex;
job.EndIndex = texGroup.EndIndex;
job.ModelMatrix = modelMatrix;
RenderQueue.Add(job);
job.Transparent = transparent;
if(job.Transparent)
{
RenderQueue.Forward.Add(job);
}
else
{
RenderQueue.Deferred.Add(job);
}
}
}
@@ -167,7 +175,7 @@ private:
job.EndIndex = texGroup.EndIndex;
job.ModelMatrix = modelMatrix;
RenderQueue.Add(job);
RenderQueue.Deferred.Add(job);
}
}
@@ -178,7 +186,7 @@ private:
job.Texture = *texture;
job.ModelMatrix = modelMatrix;
RenderQueue.Add(job);
RenderQueue.Forward.Add(job);
}
};