Added config flag Debug.OutOfBodyExperience that allows you to spawn and view a player from a third person perspective, without the active camera being changed.

This commit is contained in:
2016-02-11 23:45:30 +01:00
parent 44a73ef883
commit b761439c84
5 changed files with 34 additions and 17 deletions
+24 -16
View File
@@ -47,16 +47,8 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
continue;
}
EntityWrapper entity(world, cSprite.EntityID);
// Only render children of a camera if that camera is currently active
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
continue;
}
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
if (!isEntityVisible(entity)) {
continue;
}
@@ -85,6 +77,23 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
}
}
bool RenderSystem::isEntityVisible(EntityWrapper& entity)
{
// Only render children of a camera if that camera is currently active
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
return false;
}
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
bool outOfBodyExperience = ResourceManager::Load<ConfigFile>("Config.ini")->Get<bool>("Debug.OutOfBodyExperience", false);
if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer)) && !outOfBodyExperience) {
return false;
}
return true;
}
bool RenderSystem::isChildOfACamera(EntityWrapper entity)
{
return entity.FirstParentWithComponent("Camera").Valid();
@@ -112,13 +121,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
continue;
}
// Only render children of a camera if that camera is currently active
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
continue;
}
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
if ((entity.HasComponent("HiddenForLocalPlayer") || entity.FirstParentWithComponent("HiddenForLocalPlayer").Valid()) && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
if (!isEntityVisible(entity)) {
continue;
}
@@ -299,6 +302,11 @@ void RenderSystem::fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World*
continue;
}
EntityWrapper entity(world, textComponent.EntityID);
if (!isEntityVisible(entity)) {
continue;
}
Font* font;
try {
font = ResourceManager::Load<Font>(resource);