mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-17 00:47:05 +00:00
Implemented TFlags for easy, type-safe bitflags
This commit is contained in:
@@ -27,7 +27,7 @@ void CCollisionNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewIn
|
||||
pRenderer->AddOpaqueMesh(this, -1, AABox(), eDrawSelection);
|
||||
}
|
||||
|
||||
void CCollisionNode::Draw(ERenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& ViewInfo)
|
||||
void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& ViewInfo)
|
||||
{
|
||||
if (!mpCollision) return;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
CCollisionNode(CSceneManager *pScene, CSceneNode *pParent = 0, CCollisionMeshGroup *pCollision = 0);
|
||||
ENodeType NodeType();
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
||||
void Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||
void SetCollision(CCollisionMeshGroup *pCollision);
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ void CLightNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
|
||||
}
|
||||
}
|
||||
|
||||
void CLightNode::Draw(ERenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& ViewInfo)
|
||||
void CLightNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& ViewInfo)
|
||||
{
|
||||
CDrawUtil::DrawLightBillboard(mpLight->GetType(), mpLight->GetColor(), mPosition, BillboardScale(), TintColor(ViewInfo));
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
CLightNode(CSceneManager *pScene, CSceneNode *pParent = 0, CLight *Light = 0);
|
||||
ENodeType NodeType();
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
||||
void Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
void DrawSelection();
|
||||
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||
|
||||
@@ -32,10 +32,10 @@ void CModelNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
|
||||
pRenderer->AddOpaqueMesh(this, -1, AABox(), eDrawSelection);
|
||||
}
|
||||
|
||||
void CModelNode::Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo)
|
||||
void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo)
|
||||
{
|
||||
if (!mpModel) return;
|
||||
if (mForceAlphaOn) Options = (ERenderOptions) (Options & ~eNoAlpha);
|
||||
if (mForceAlphaOn) Options = (FRenderOptions) (Options & ~eNoAlpha);
|
||||
|
||||
if (mLightingEnabled)
|
||||
{
|
||||
@@ -84,7 +84,7 @@ SRayIntersection CModelNode::RayNodeIntersectTest(const CRay &Ray, u32 AssetID,
|
||||
out.ComponentIndex = AssetID;
|
||||
|
||||
CRay TransformedRay = Ray.Transformed(Transform().Inverse());
|
||||
ERenderOptions options = ViewInfo.pRenderer->RenderOptions();
|
||||
FRenderOptions options = ViewInfo.pRenderer->RenderOptions();
|
||||
std::pair<bool,float> Result = mpModel->GetSurface(AssetID)->IntersectsRay(TransformedRay, ((options & eEnableBackfaceCull) == 0));
|
||||
|
||||
if (Result.first)
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
|
||||
virtual ENodeType NodeType();
|
||||
virtual void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
||||
virtual void Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
virtual void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
virtual void DrawSelection();
|
||||
virtual void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
||||
virtual SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
explicit CRootNode(CSceneManager *pScene, CSceneNode *pParent = 0) : CSceneNode(pScene, pParent) {}
|
||||
~CRootNode() {}
|
||||
|
||||
inline ENodeType NodeType() {
|
||||
ENodeType NodeType() {
|
||||
return eRootNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ void CSceneManager::ClearScene()
|
||||
|
||||
void CSceneManager::AddSceneToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
|
||||
{
|
||||
ERenderOptions Options = pRenderer->RenderOptions();
|
||||
FRenderOptions Options = pRenderer->RenderOptions();
|
||||
|
||||
if (Options & eDrawWorld || ViewInfo.GameMode)
|
||||
{
|
||||
@@ -254,7 +254,7 @@ SRayIntersection CSceneManager::SceneRayCast(const CRay& Ray, const SViewInfo& V
|
||||
// Terribly hacky stuff to avoid having tons of redundant code
|
||||
// because I'm too lazy to rewrite CSceneManager right now and fix it
|
||||
// (I'm probably going to do it soon...)
|
||||
ERenderOptions renderOptions = ViewInfo.pRenderer->RenderOptions();
|
||||
FRenderOptions renderOptions = ViewInfo.pRenderer->RenderOptions();
|
||||
|
||||
std::vector<CSceneNode*> *pNodeVectors[5] = {
|
||||
reinterpret_cast<std::vector<CSceneNode*>*>(&mModelNodes),
|
||||
@@ -265,7 +265,7 @@ SRayIntersection CSceneManager::SceneRayCast(const CRay& Ray, const SViewInfo& V
|
||||
};
|
||||
bool NodesVisible[5] = {
|
||||
true, ((renderOptions & eDrawWorld) != 0), ((renderOptions & eDrawWorldCollision) != 0),
|
||||
((renderOptions & ((ERenderOptions) (eDrawObjects | eDrawObjectCollision))) != 0), ((renderOptions & eDrawLights) != 0)
|
||||
((renderOptions & ((FRenderOptions) (eDrawObjects | eDrawObjectCollision))) != 0), ((renderOptions & eDrawLights) != 0)
|
||||
};
|
||||
|
||||
// Override visibility for game mode
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define CSCENENODE_H
|
||||
|
||||
#include "ENodeType.h"
|
||||
#include "Core/Render/ERenderOptions.h"
|
||||
#include "Core/Render/FRenderOptions.h"
|
||||
#include "Core/Render/IRenderable.h"
|
||||
#include "Core/Resource/CLight.h"
|
||||
#include "Core/Resource/CGameArea.h"
|
||||
|
||||
@@ -119,7 +119,7 @@ void CScriptNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
|
||||
if (ShouldDraw)
|
||||
{
|
||||
// Otherwise, we proceed as normal
|
||||
ERenderOptions options = pRenderer->RenderOptions();
|
||||
FRenderOptions options = pRenderer->RenderOptions();
|
||||
|
||||
if ((options & eDrawObjectCollision) && (!ViewInfo.GameMode))
|
||||
mpCollisionNode->AddToRenderer(pRenderer, ViewInfo);
|
||||
@@ -154,7 +154,7 @@ void CScriptNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
|
||||
}
|
||||
}
|
||||
|
||||
void CScriptNode::Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo)
|
||||
void CScriptNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo)
|
||||
{
|
||||
if (!mpInstance) return;
|
||||
|
||||
@@ -282,7 +282,7 @@ void CScriptNode::RayAABoxIntersectTest(CRayCollisionTester& Tester, const SView
|
||||
|
||||
SRayIntersection CScriptNode::RayNodeIntersectTest(const CRay& Ray, u32 AssetID, const SViewInfo& ViewInfo)
|
||||
{
|
||||
ERenderOptions options = ViewInfo.pRenderer->RenderOptions();
|
||||
FRenderOptions options = ViewInfo.pRenderer->RenderOptions();
|
||||
|
||||
SRayIntersection out;
|
||||
out.pNode = this;
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
CScriptNode(CSceneManager *pScene, CSceneNode *pParent = 0, CScriptObject *pObject = 0);
|
||||
ENodeType NodeType();
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
||||
void Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
void DrawSelection();
|
||||
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||
|
||||
@@ -44,7 +44,7 @@ void CStaticNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
|
||||
pRenderer->AddOpaqueMesh(this, -1, AABox(), eDrawSelection);
|
||||
}
|
||||
|
||||
void CStaticNode::Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo)
|
||||
void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo)
|
||||
{
|
||||
if (!mpModel) return;
|
||||
|
||||
@@ -96,7 +96,7 @@ SRayIntersection CStaticNode::RayNodeIntersectTest(const CRay &Ray, u32 AssetID,
|
||||
out.ComponentIndex = AssetID;
|
||||
|
||||
CRay TransformedRay = Ray.Transformed(Transform().Inverse());
|
||||
ERenderOptions options = ViewInfo.pRenderer->RenderOptions();
|
||||
FRenderOptions options = ViewInfo.pRenderer->RenderOptions();
|
||||
std::pair<bool,float> Result = mpModel->GetSurface(AssetID)->IntersectsRay(TransformedRay, ((options & eEnableBackfaceCull) == 0));
|
||||
|
||||
if (Result.first)
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
CStaticNode(CSceneManager *pScene, CSceneNode *pParent = 0, CStaticModel *pModel = 0);
|
||||
ENodeType NodeType();
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
||||
void Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
void DrawSelection();
|
||||
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ENODETYPE
|
||||
#define ENODETYPE
|
||||
#ifndef ENODETYPE_H
|
||||
#define ENODETYPE_H
|
||||
|
||||
enum ENodeType
|
||||
{
|
||||
@@ -12,5 +12,5 @@ enum ENodeType
|
||||
eLightNode
|
||||
};
|
||||
|
||||
#endif // ENODETYPE
|
||||
#endif // ENODETYPE_H
|
||||
|
||||
|
||||
19
src/Core/Scene/EVisibilityFlags.h
Normal file
19
src/Core/Scene/EVisibilityFlags.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef EVISIBILITYFLAGS
|
||||
#define EVISIBILITYFLAGS
|
||||
|
||||
#include <Common/EnumUtil.h>
|
||||
|
||||
enum EVisibilityFlags
|
||||
{
|
||||
eShowNomr = 0x00,
|
||||
eShowWorld = 0x01,
|
||||
eShowWorldCollision = 0x02,
|
||||
eShowObjects = 0x04,
|
||||
eShowObjectCollision = 0x08,
|
||||
eShowLights = 0x10,
|
||||
eShowAll = 0x1F
|
||||
};
|
||||
DEFINE_ENUM_FLAGS(EVisibilityFlags)
|
||||
|
||||
#endif // EVISIBILITYFLAGS
|
||||
|
||||
Reference in New Issue
Block a user