Exemplo n.º 1
0
void RenderUpdateSystem::AddEntity(Entity * entity)
{
    RenderObject * renderObject = ((RenderComponent*)entity->GetComponent(Component::RENDER_COMPONENT))->GetRenderObject();
    if (!renderObject)return;
	Matrix4 * worldTransformPointer = ((TransformComponent*)entity->GetComponent(Component::TRANSFORM_COMPONENT))->GetWorldTransformPtr();
    renderObject->SetWorldTransformPtr(worldTransformPointer);
    UpdateActiveIndexes(entity, renderObject);
    entityObjectMap.insert(entity, renderObject);
	GetScene()->GetRenderSystem()->RenderPermanent(renderObject);
}
void RenderUpdateSystem::ImmediateEvent(Entity * entity, uint32 event)
{
    if (event == EventSystem::WORLD_TRANSFORM_CHANGED)
    {
        // Update new transform pointer, and mark that transform is changed
        Matrix4 * worldTransformPointer = ((TransformComponent*)entity->GetComponent(Component::TRANSFORM_COMPONENT))->GetWorldTransformPtr();
		RenderObject * object = ((RenderComponent*)entity->GetComponent(Component::RENDER_COMPONENT))->GetRenderObject();
        object->SetWorldTransformPtr(worldTransformPointer);
		entity->GetScene()->renderSystem->MarkForUpdate(object);
    }
    
    //if (event == EventSystem::ACTIVE_CAMERA_CHANGED)
    {
        // entity->GetCameraComponent();
        // RenderSystem::
    }
}