Rendering sprites

This commit is contained in:
Stiffly
2014-05-06 13:52:34 +02:00
parent 262d259681
commit 398b157b89
5 changed files with 52 additions and 4 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ void Systems::ParticleSystem::SpawnParticles(EntityID emitterID)
auto particle = m_World->AddComponent<Components::Particle>(ent, "Particle");
particle->LifeTime = emitterComponent->LifeTime;
particle->ScaleSpectrum.push_back(glm::vec3(1)); //TEMP
particle->ScaleSpectrum = emitterComponent->ScaleSpectrum; //TEMP
//particle->ScaleSpectrum.push_back(glm::vec3(1,4,1)); //TEMP
particle->VelocitySpectrum.push_back(particleTransform->Velocity); //TEMP
particle->VelocitySpectrum.push_back(testVel); //TEMP
+11
View File
@@ -55,6 +55,17 @@ void Systems::RenderSystem::UpdateEntity(double dt, EntityID entity, EntityID pa
m_Renderer->GetCamera()->NearClip(cameraComponent->NearClip);
m_Renderer->GetCamera()->FarClip(cameraComponent->FarClip);
}
auto spriteComponent = m_World->GetComponent<Components::Sprite>(entity, "Sprite");
if(spriteComponent != nullptr)
{
//TEMP
Texture* texture = m_World->GetResourceManager()->Load<Texture>("Texture", spriteComponent->SpriteFile);
//glBindTexture(GL_TEXTURE_2D, texture);
auto transform = m_World->GetComponent<Components::Transform>(spriteComponent->Entity, "Transform");
glm::quat orientation2D = glm::angleAxis(glm::eulerAngles(transform->Orientation).z, glm::vec3(0, 0, -1));
m_Renderer->AddTextureToDraw(texture, transform->Position, orientation2D, transform->Scale);
}
}
void Systems::RenderSystem::Initialize()