Compare commits
1 Commits
DashFixBranch
...
Cleanup
| Author | SHA1 | Date | |
|---|---|---|---|
| 7834087e75 |
@@ -35,17 +35,19 @@ private:
|
||||
|
||||
EventRelay<RenderSystem, Events::SetCamera> m_ESetCamera;
|
||||
bool OnSetCamera(Events::SetCamera &event);
|
||||
EventRelay<RenderSystem, Events::InputCommand> m_EInputCommand;
|
||||
bool OnInputCommand(const Events::InputCommand& e);
|
||||
EventRelay<RenderSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||
|
||||
void fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||
void fillPointLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||
void fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||
EventRelay<RenderSystem, Events::InputCommand> m_EInputCommand;
|
||||
bool OnInputCommand(const Events::InputCommand& e);
|
||||
|
||||
void fillModels(std::list<std::shared_ptr<RenderJob>>& jobs);
|
||||
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
|
||||
bool isChildOfACamera(EntityWrapper entity);
|
||||
bool isChildOfCurrentCamera(EntityWrapper entity);
|
||||
|
||||
EventRelay<RenderSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -31,6 +31,16 @@ bool RenderSystem::OnSetCamera(Events::SetCamera& e)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenderSystem::isChildOfACamera(EntityWrapper entity)
|
||||
{
|
||||
return entity.FirstParentWithComponent("Camera").Valid();
|
||||
}
|
||||
|
||||
bool RenderSystem::isChildOfCurrentCamera(EntityWrapper entity)
|
||||
{
|
||||
return entity == m_Camera || entity.IsChildOf(m_Camera);
|
||||
}
|
||||
|
||||
void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
|
||||
{
|
||||
auto models = m_World->GetComponents("Model");
|
||||
@@ -50,6 +60,10 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
|
||||
|
||||
EntityWrapper entity(m_World, modelComponent.EntityID);
|
||||
|
||||
// Only render children of a camera if that camera is currently active
|
||||
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
||||
continue;
|
||||
}
|
||||
// Don't render the local player
|
||||
if (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer)) {
|
||||
if (!entity.HasComponent("HealthHUD") && entity.Name() != "Crosshair" && entity.Name() != "Weapon") { //Should work but needs to be fixed. Should only render the things "childed" to the local player camera
|
||||
|
||||
Reference in New Issue
Block a user