Rendering FIXED :D

This commit is contained in:
2014-03-09 23:39:54 +01:00
parent 3138eea0c2
commit ce6b570520
10 changed files with 3008 additions and 25 deletions
+3 -9
View File
@@ -1,18 +1,12 @@
#include "RenderSystem.h"
#include "World.h"
void Systems::RenderSystem::OnComponentCreated( std::string type, std:: shared_ptr<Component> component )
{
if(type == "Model")
{
auto modelComponent = std::static_pointer_cast<Components::Model>(component);
if (m_CachedModels.find(modelComponent->ModelFile) != m_CachedModels.end()) {
m_CachedModels[modelComponent->ModelFile] = new Model(modelComponent->ModelFile);
}
}
}
@@ -25,10 +19,10 @@ void Systems::RenderSystem::UpdateEntity( double dt, EntityID entity, EntityID p
if (transformComponent == nullptr)
return;
if (m_CachedModels.find(modelComponent->ModelFile) == m_CachedModels.end()) {
m_CachedModels[modelComponent->ModelFile] = new Model(modelComponent->ModelFile);
}
Model* model = m_CachedModels[modelComponent->ModelFile];
m_Renderer->AddModelToDraw(model, transformComponent->Position, transformComponent->Orientation);
}