Beispiel #1
0
 void GUIManager::GetVisibleEntities(RenderList* List)
 {
     for(i32 i = 0;i < m_Elements.size();i++)
     {
         RenderComponent* r = (RenderComponent*)m_Elements[i].get()->GetOwner()->GetComponentByType(CT_RENDER);
         if(!m_Elements[i]->GetOwner()->HasComponentType(CT_RENDER)) continue;
         if(!r->GetMesh()) continue;
         if(r->IsHidden()) continue;
         if(r->GetMesh()->NeedsSync())
         if(r->GetVertexCount() == 0) continue;
         List->AddEntity(m_Elements[i].get()->GetOwner());
     }
 }
Beispiel #2
0
void World::AddEntity(Entity *entity) {
  entities.push_back(entity);

  // Check for RenderComponent and TransformComponent
  RenderComponent *render =
      dynamic_cast<RenderComponent *>(entity->GetComponent(RENDER_COMPONENT));
  TransformComponent *transform = dynamic_cast<TransformComponent *>(
      entity->GetComponent(TRANSFORM_COMPONENT));

  if (render != NULL && transform != NULL) {
    renderer->Add(render->GetMesh(), render->GetMaterial(), transform);
  }

  entity->Init();
}