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:
@@ -18,6 +18,7 @@
|
|||||||
#include "../Core/EPlayerSpawned.h"
|
#include "../Core/EPlayerSpawned.h"
|
||||||
#include "../Core/Octree.h"
|
#include "../Core/Octree.h"
|
||||||
#include "../Collision/EntityAABB.h"
|
#include "../Collision/EntityAABB.h"
|
||||||
|
#include "../Core/ConfigFile.h"
|
||||||
|
|
||||||
class RenderSystem : public ImpureSystem
|
class RenderSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -48,6 +49,9 @@ private:
|
|||||||
void fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
void fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||||
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
|
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
|
||||||
void fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
void fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||||
|
|
||||||
|
bool isEntityVisible(EntityWrapper& entity);
|
||||||
|
|
||||||
bool isChildOfACamera(EntityWrapper entity);
|
bool isChildOfACamera(EntityWrapper entity);
|
||||||
bool isChildOfCurrentCamera(EntityWrapper entity);
|
bool isChildOfCurrentCamera(EntityWrapper entity);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ LoadMap=
|
|||||||
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
|
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
|
||||||
; if false -> Use pool allocation.
|
; if false -> Use pool allocation.
|
||||||
DisableMemoryPool=false
|
DisableMemoryPool=false
|
||||||
|
EditorEnabled=false
|
||||||
|
OutOfBodyExperience=false
|
||||||
|
|
||||||
[Editor]
|
[Editor]
|
||||||
CameraSpeed=3
|
CameraSpeed=3
|
||||||
|
|||||||
@@ -47,16 +47,8 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EntityWrapper entity(world, cSprite.EntityID);
|
EntityWrapper entity(world, cSprite.EntityID);
|
||||||
|
if (!isEntityVisible(entity)) {
|
||||||
// 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))) {
|
|
||||||
continue;
|
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)
|
bool RenderSystem::isChildOfACamera(EntityWrapper entity)
|
||||||
{
|
{
|
||||||
return entity.FirstParentWithComponent("Camera").Valid();
|
return entity.FirstParentWithComponent("Camera").Valid();
|
||||||
@@ -112,13 +121,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only render children of a camera if that camera is currently active
|
if (!isEntityVisible(entity)) {
|
||||||
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))) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +302,11 @@ void RenderSystem::fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World*
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityWrapper entity(world, textComponent.EntityID);
|
||||||
|
if (!isEntityVisible(entity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Font* font;
|
Font* font;
|
||||||
try {
|
try {
|
||||||
font = ResourceManager::Load<Font>(resource);
|
font = ResourceManager::Load<Font>(resource);
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
|||||||
|
|
||||||
// Set the camera to the correct entity
|
// Set the camera to the correct entity
|
||||||
EntityWrapper cameraEntity = e.Player.FirstChildByName("Camera");
|
EntityWrapper cameraEntity = e.Player.FirstChildByName("Camera");
|
||||||
if (cameraEntity.Valid()) {
|
bool outOfBodyExperience = ResourceManager::Load<ConfigFile>("Config.ini")->Get<bool>("Debug.OutOfBodyExperience", false);
|
||||||
|
if (cameraEntity.Valid() && !outOfBodyExperience) {
|
||||||
Events::SetCamera e;
|
Events::SetCamera e;
|
||||||
e.CameraEntity = cameraEntity;
|
e.CameraEntity = cameraEntity;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ MKLINK "%DeployLocation%\Schema\" "resources\Schema" /J
|
|||||||
RMDIR /S /Q "%DeployLocation%\Shaders"
|
RMDIR /S /Q "%DeployLocation%\Shaders"
|
||||||
MKLINK "%DeployLocation%\Shaders\" "resources\Shaders" /J
|
MKLINK "%DeployLocation%\Shaders\" "resources\Shaders" /J
|
||||||
:: Configuration files
|
:: Configuration files
|
||||||
|
DEL "%DeployLocation%\DefaultConfig.ini"
|
||||||
MKLINK "%DeployLocation%\DefaultConfig.ini" "resources\DefaultConfig.ini" /H
|
MKLINK "%DeployLocation%\DefaultConfig.ini" "resources\DefaultConfig.ini" /H
|
||||||
|
DEL "%DeployLocation%\DefaultInput.ini"
|
||||||
MKLINK "%DeployLocation%\DefaultInput.ini" "resources\DefaultInput.ini" /H
|
MKLINK "%DeployLocation%\DefaultInput.ini" "resources\DefaultInput.ini" /H
|
||||||
|
|
||||||
:: Platform specific binaries
|
:: Platform specific binaries
|
||||||
|
|||||||
Reference in New Issue
Block a user