Many more things done

This commit is contained in:
Ayumiwii
2016-01-11 19:59:45 +01:00
parent 3467315aef
commit 0630885d92
13 changed files with 153 additions and 37 deletions
+12 -12
View File
@@ -33,14 +33,6 @@ void DrawScenePass::InitializeShaderPrograms()
void DrawScenePass::Draw(RenderQueueCollection& rq)
{
if (TimeDeath > 2.f) {
TimeDeath = 0.f;
}
Origin = glm::vec3(0.f, 0.0f, 0.f);
TimeDeath = TimeDeath + 0.01f;
EndDeath = EndDeath + 0.05f;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERROR("Renderer::Draw PickingPass");
@@ -52,16 +44,24 @@ void DrawScenePass::Draw(RenderQueueCollection& rq)
auto coolDeathAnimationJob = std::dynamic_pointer_cast<CoolDeathAnimationJob>(job);
if (coolDeathAnimationJob) {
GLuint ShaderHandle = m_CoolDeathAnimProgram->GetHandle(); //---
//---
m_CoolDeathAnimProgram->Bind();
//TODO: Kolla upp "header/include/common" shader saken så man slipper skicka in asmycket uniforms
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(coolDeathAnimationJob->ModelMatrix));
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(m_Renderer->Camera()->ViewMatrix()));
glUniformMatrix4fv(glGetUniformLocation(ShaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(m_Renderer->Camera()->ProjectionMatrix()));
glUniform4fv(glGetUniformLocation(ShaderHandle, "Color"), 1, glm::value_ptr(coolDeathAnimationJob->Color));
glUniform3fv(glGetUniformLocation(ShaderHandle, "OriginPos"), 1, glm::value_ptr(Origin));
glUniform1f(glGetUniformLocation(ShaderHandle, "TimeSinceDeath"), TimeDeath);
glUniform1f(glGetUniformLocation(ShaderHandle, "EndOfDeath"), EndDeath);
glUniform3fv(glGetUniformLocation(ShaderHandle, "OriginPos"), 1, glm::value_ptr(coolDeathAnimationJob->OriginPos));
glUniform1f(glGetUniformLocation(ShaderHandle, "TimeSinceDeath"), coolDeathAnimationJob->TimeSinceDeath);
glUniform1f(glGetUniformLocation(ShaderHandle, "EndOfDeath"), coolDeathAnimationJob->EndOfDeath);
glUniform1i(glGetUniformLocation(ShaderHandle, "Gravity"), coolDeathAnimationJob->Gravity);
glUniform1f(glGetUniformLocation(ShaderHandle, "GravityForce"), coolDeathAnimationJob->GravityForce);
glUniform1f(glGetUniformLocation(ShaderHandle, "ObjectRadius"), coolDeathAnimationJob->ObjectRadius);
glUniform4fv(glGetUniformLocation(ShaderHandle, "EndColor"), 1, glm::value_ptr(coolDeathAnimationJob->EndColor));
glUniform1i(glGetUniformLocation(ShaderHandle, "UseRandomness"), coolDeathAnimationJob->UseRandomness);
glUniform1fv(glGetUniformLocation(ShaderHandle, "RandomNumbers"), 10, coolDeathAnimationJob->RandomNumbers.data());
glUniform1f(glGetUniformLocation(ShaderHandle, "RandomnessScalar"), coolDeathAnimationJob->RandomnessScalar);
//TODO: Renderer: bättre textur felhantering samt fler texturer stöd
if (coolDeathAnimationJob->DiffuseTexture != nullptr) {
+24 -5
View File
@@ -90,8 +90,8 @@ void RenderQueueFactory::FillModels(World* world, RenderQueue* renderQueue)
}
for (auto texGroup : model->TextureGroups) {
auto deathComp = world->HasComponent(modelC.EntityID, "CoolDeathAnim");
if (!deathComp) {
bool hasDeathComp = world->HasComponent(modelC.EntityID, "CoolDeathAnim");
if (!hasDeathComp) {
ModelJob job;
job.TextureID = (texGroup.Texture) ? texGroup.Texture->ResourceID : 0;
@@ -112,9 +112,28 @@ void RenderQueueFactory::FillModels(World* world, RenderQueue* renderQueue)
else {
CoolDeathAnimationJob job;
job.TimeSinceDeath = 1.f;
job.EndOfDeath = 15.f;
job.OriginPos = glm::vec3(1000.f, 2.f, 0.f);
auto deathComp = world->GetComponent(modelC.EntityID, "CoolDeathAnim");
job.OriginPos = (glm::vec3)deathComp["OriginPos"];
job.TimeSinceDeath = (double)deathComp["TimeSinceDeath"];
job.EndOfDeath = (double)deathComp["EndOfDeath"];
job.Gravity = (bool)deathComp["Gravity"];
job.GravityForce = (double)deathComp["GravityForce"];
job.ObjectRadius = (double)deathComp["ObjectRadius"];
job.EndColor = (glm::vec4)deathComp["EndColor"];
job.UseRandomness = (bool)deathComp["UseRandomness"];
job.RandomnessScalar = (double)deathComp["RandomnessScalar"];
job.RandomNumbers = {
0.3257552917701f,
0.07601508315467f,
0.57408909014151f,
0.0f,
0.8618231368539f,
0.074957156588769f,
0.39413607511396f,
0.54579346698979f,
0.83222648353885f,
0.83635707285086f };
job.TextureID = (texGroup.Texture) ? texGroup.Texture->ResourceID : 0;
job.DiffuseTexture = texGroup.Texture.get();