mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-06-03 05:01:28 +00:00
A model's surfaces are now depth sorted together (except on world geometry)
This commit is contained in:
parent
af59009b56
commit
f64ee6b3b7
@ -67,11 +67,11 @@ void CRenderBucket::CSubBucket::Draw(const SViewInfo& rkViewInfo)
|
|||||||
{
|
{
|
||||||
const SRenderablePtr& rkPtr = mRenderables[iPtr];
|
const SRenderablePtr& rkPtr = mRenderables[iPtr];
|
||||||
|
|
||||||
if (rkPtr.Command == eDrawMesh)
|
// todo: DrawSelection probably shouldn't be a separate function anymore.
|
||||||
rkPtr.pRenderable->Draw(Options, rkPtr.ComponentIndex, rkViewInfo);
|
if (rkPtr.Command == eDrawSelection)
|
||||||
|
|
||||||
else if (rkPtr.Command == eDrawSelection)
|
|
||||||
rkPtr.pRenderable->DrawSelection();
|
rkPtr.pRenderable->DrawSelection();
|
||||||
|
else
|
||||||
|
rkPtr.pRenderable->Draw(Options, rkPtr.ComponentIndex, rkPtr.Command, rkViewInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
enum ERenderCommand
|
enum ERenderCommand
|
||||||
{
|
{
|
||||||
eDrawMesh,
|
eDrawMesh,
|
||||||
|
eDrawOpaqueParts,
|
||||||
|
eDrawTransparentParts,
|
||||||
eDrawSelection
|
eDrawSelection
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef IRENDERABLE_H
|
#ifndef IRENDERABLE_H
|
||||||
#define IRENDERABLE_H
|
#define IRENDERABLE_H
|
||||||
|
|
||||||
|
#include "ERenderCommand.h"
|
||||||
#include "FRenderOptions.h"
|
#include "FRenderOptions.h"
|
||||||
#include "SViewInfo.h"
|
#include "SViewInfo.h"
|
||||||
#include <Common/types.h>
|
#include <Common/types.h>
|
||||||
@ -13,7 +14,7 @@ public:
|
|||||||
IRenderable() {}
|
IRenderable() {}
|
||||||
virtual ~IRenderable() {}
|
virtual ~IRenderable() {}
|
||||||
virtual void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) = 0;
|
virtual void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) = 0;
|
||||||
virtual void Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& /*rkViewInfo*/) {}
|
virtual void Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& /*rkViewInfo*/) {}
|
||||||
virtual void DrawSelection() {}
|
virtual void DrawSelection() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,26 +35,21 @@ void CCharacterNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkView
|
|||||||
CSkeleton *pSkel = mpCharacter->NodeSkeleton(mActiveCharSet);
|
CSkeleton *pSkel = mpCharacter->NodeSkeleton(mActiveCharSet);
|
||||||
|
|
||||||
if (pModel && rkViewInfo.ShowFlags.HasFlag(eShowObjectGeometry))
|
if (pModel && rkViewInfo.ShowFlags.HasFlag(eShowObjectGeometry))
|
||||||
{
|
AddModelToRenderer(pRenderer, pModel, 0);
|
||||||
if (!pModel->HasTransparency(0))
|
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawMesh);
|
|
||||||
else
|
|
||||||
AddSurfacesToRenderer(pRenderer, pModel, 0, rkViewInfo, eMidground, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSkel)
|
if (pSkel)
|
||||||
{
|
{
|
||||||
if (rkViewInfo.ShowFlags.HasFlag(eShowSkeletons))
|
if (rkViewInfo.ShowFlags.HasFlag(eShowSkeletons))
|
||||||
pRenderer->AddMesh(this, -2, AABox(), false, eDrawMesh, eForeground);
|
pRenderer->AddMesh(this, 0, AABox(), false, eDrawMesh, eForeground);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo)
|
void CCharacterNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
CSkeleton *pSkel = mpCharacter->NodeSkeleton(mActiveCharSet);
|
CSkeleton *pSkel = mpCharacter->NodeSkeleton(mActiveCharSet);
|
||||||
|
|
||||||
// Draw skeleton
|
// Draw skeleton
|
||||||
if (ComponentIndex == -2)
|
if (ComponentIndex == 0)
|
||||||
{
|
{
|
||||||
LoadModelMatrix();
|
LoadModelMatrix();
|
||||||
pSkel->Draw(Options, &mTransformData);
|
pSkel->Draw(Options, &mTransformData);
|
||||||
@ -79,11 +74,7 @@ void CCharacterNode::Draw(FRenderOptions Options, int ComponentIndex, const SVie
|
|||||||
CGraphics::LoadIdentityBoneTransforms();
|
CGraphics::LoadIdentityBoneTransforms();
|
||||||
|
|
||||||
CModel *pModel = mpCharacter->NodeModel(mActiveCharSet);
|
CModel *pModel = mpCharacter->NodeModel(mActiveCharSet);
|
||||||
|
DrawModelParts(pModel, Options, 0, Command);
|
||||||
if (ComponentIndex < 0)
|
|
||||||
pModel->Draw(Options, 0);
|
|
||||||
else
|
|
||||||
pModel->DrawSurface(Options, ComponentIndex, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
virtual ENodeType NodeType();
|
virtual ENodeType NodeType();
|
||||||
virtual void PostLoad();
|
virtual void PostLoad();
|
||||||
virtual void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
virtual void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
virtual void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
virtual void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
virtual SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
virtual SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
||||||
|
|
||||||
CVector3f BonePosition(u32 BoneID);
|
CVector3f BonePosition(u32 BoneID);
|
||||||
|
@ -27,7 +27,7 @@ void CCollisionNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkView
|
|||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& rkViewInfo)
|
void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
if (!mpCollision) return;
|
if (!mpCollision) return;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ public:
|
|||||||
CCollisionNode(CScene *pScene, u32 NodeID, CSceneNode *pParent = 0, CCollisionMeshGroup *pCollision = 0);
|
CCollisionNode(CScene *pScene, u32 NodeID, CSceneNode *pParent = 0, CCollisionMeshGroup *pCollision = 0);
|
||||||
ENodeType NodeType();
|
ENodeType NodeType();
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
||||||
void SetCollision(CCollisionMeshGroup *pCollision);
|
void SetCollision(CCollisionMeshGroup *pCollision);
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,7 @@ void CLightNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLightNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& rkViewInfo)
|
void CLightNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
CDrawUtil::DrawLightBillboard(mpLight->Type(), mpLight->Color(), mPosition, BillboardScale(), TintColor(rkViewInfo));
|
CDrawUtil::DrawLightBillboard(mpLight->Type(), mpLight->Color(), mPosition, BillboardScale(), TintColor(rkViewInfo));
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
CLightNode(CScene *pScene, u32 NodeID, CSceneNode *pParent = 0, CLight *Light = 0);
|
CLightNode(CScene *pScene, u32 NodeID, CSceneNode *pParent = 0, CLight *Light = 0);
|
||||||
ENodeType NodeType();
|
ENodeType NodeType();
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& ViewInfo);
|
||||||
void DrawSelection();
|
void DrawSelection();
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||||
|
@ -35,16 +35,27 @@ void CModelNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo
|
|||||||
if (!rkViewInfo.ViewFrustum.BoxInFrustum(AABox())) return;
|
if (!rkViewInfo.ViewFrustum.BoxInFrustum(AABox())) return;
|
||||||
if (rkViewInfo.GameMode) return;
|
if (rkViewInfo.GameMode) return;
|
||||||
|
|
||||||
if (!mpModel->HasTransparency(mActiveMatSet))
|
// Transparent world models should have each surface processed separately
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawMesh);
|
if (mWorldModel && mpModel->HasTransparency(mActiveMatSet))
|
||||||
|
{
|
||||||
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawOpaqueParts);
|
||||||
|
|
||||||
|
for (u32 iSurf = 0; iSurf < mpModel->GetSurfaceCount(); iSurf++)
|
||||||
|
{
|
||||||
|
if (mpModel->IsSurfaceTransparent(iSurf, mActiveMatSet))
|
||||||
|
pRenderer->AddMesh(this, iSurf, mpModel->GetSurfaceAABox(iSurf).Transformed(Transform()), true, eDrawTransparentParts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other models should just draw all transparent surfaces sequentially
|
||||||
else
|
else
|
||||||
AddSurfacesToRenderer(pRenderer, mpModel, mActiveMatSet, rkViewInfo);
|
AddModelToRenderer(pRenderer, mpModel, mActiveMatSet);
|
||||||
|
|
||||||
if (mSelected)
|
if (mSelected)
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo)
|
void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
if (!mpModel) return;
|
if (!mpModel) return;
|
||||||
if (mForceAlphaOn) Options = (FRenderOptions) (Options & ~eNoAlpha);
|
if (mForceAlphaOn) Options = (FRenderOptions) (Options & ~eNoAlpha);
|
||||||
@ -86,8 +97,8 @@ void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInf
|
|||||||
if (mpModel->IsSkinned())
|
if (mpModel->IsSkinned())
|
||||||
CGraphics::LoadIdentityBoneTransforms();
|
CGraphics::LoadIdentityBoneTransforms();
|
||||||
|
|
||||||
if (ComponentIndex < 0)
|
if (ComponentIndex == -1)
|
||||||
mpModel->Draw(Options, mActiveMatSet);
|
DrawModelParts(mpModel, Options, mActiveMatSet, Command);
|
||||||
else
|
else
|
||||||
mpModel->DrawSurface(Options, ComponentIndex, mActiveMatSet);
|
mpModel->DrawSurface(Options, ComponentIndex, mActiveMatSet);
|
||||||
|
|
||||||
@ -96,11 +107,7 @@ void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInf
|
|||||||
CDrawUtil::UseColorShader(mScanOverlayColor);
|
CDrawUtil::UseColorShader(mScanOverlayColor);
|
||||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ZERO);
|
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ZERO);
|
||||||
Options |= eNoMaterialSetup;
|
Options |= eNoMaterialSetup;
|
||||||
|
DrawModelParts(mpModel, Options, 0, Command);
|
||||||
if (ComponentIndex < 0)
|
|
||||||
mpModel->Draw(Options, 0);
|
|
||||||
else
|
|
||||||
mpModel->DrawSurface(Options, ComponentIndex, mActiveMatSet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public:
|
|||||||
virtual ENodeType NodeType();
|
virtual ENodeType NodeType();
|
||||||
virtual void PostLoad();
|
virtual void PostLoad();
|
||||||
virtual void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
virtual void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
virtual void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
virtual void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
virtual void DrawSelection();
|
virtual void DrawSelection();
|
||||||
virtual void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& rkViewInfo);
|
virtual void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& rkViewInfo);
|
||||||
virtual SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& rkViewInfo);
|
virtual SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& rkViewInfo);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "Core/Render/CDrawUtil.h"
|
#include "Core/Render/CDrawUtil.h"
|
||||||
#include "Core/Resource/CGameArea.h"
|
#include "Core/Resource/CGameArea.h"
|
||||||
#include "Core/Resource/CResCache.h"
|
#include "Core/Resource/CResCache.h"
|
||||||
|
#include <Common/Assert.h>
|
||||||
#include <Math/CTransform4f.h>
|
#include <Math/CTransform4f.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -213,6 +214,43 @@ void CSceneNode::LoadLights(const SViewInfo& rkViewInfo)
|
|||||||
CGraphics::UpdateLightBlock();
|
CGraphics::UpdateLightBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSceneNode::AddModelToRenderer(CRenderer *pRenderer, CModel *pModel, u32 MatSet)
|
||||||
|
{
|
||||||
|
ASSERT(pModel);
|
||||||
|
|
||||||
|
if (!pModel->HasTransparency(MatSet))
|
||||||
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawMesh);
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawOpaqueParts);
|
||||||
|
pRenderer->AddMesh(this, -1, AABox(), true, eDrawTransparentParts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneNode::DrawModelParts(CModel *pModel, FRenderOptions Options, u32 MatSet, ERenderCommand RenderCommand)
|
||||||
|
{
|
||||||
|
// Common rendering functionality
|
||||||
|
if (RenderCommand == eDrawMesh)
|
||||||
|
pModel->Draw(Options, MatSet);
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool DrawOpaque = (RenderCommand == eDrawMesh || RenderCommand == eDrawOpaqueParts);
|
||||||
|
bool DrawTransparent = (RenderCommand == eDrawMesh || RenderCommand == eDrawTransparentParts);
|
||||||
|
|
||||||
|
for (u32 iSurf = 0; iSurf < pModel->GetSurfaceCount(); iSurf++)
|
||||||
|
{
|
||||||
|
bool ShouldRender = ( (DrawOpaque && DrawTransparent) ||
|
||||||
|
(DrawOpaque && !pModel->IsSurfaceTransparent(iSurf, MatSet)) ||
|
||||||
|
(DrawTransparent && pModel->IsSurfaceTransparent(iSurf, MatSet)) );
|
||||||
|
|
||||||
|
if (ShouldRender)
|
||||||
|
pModel->DrawSurface(Options, iSurf, MatSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSceneNode::DrawBoundingBox() const
|
void CSceneNode::DrawBoundingBox() const
|
||||||
{
|
{
|
||||||
CDrawUtil::DrawWireCube(AABox(), CColor::skWhite);
|
CDrawUtil::DrawWireCube(AABox(), CColor::skWhite);
|
||||||
@ -224,21 +262,6 @@ void CSceneNode::DrawRotationArrow() const
|
|||||||
spArrowModel->Draw(eNoRenderOptions, 0);
|
spArrowModel->Draw(eNoRenderOptions, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSceneNode::AddSurfacesToRenderer(CRenderer *pRenderer, CModel *pModel, u32 MatSet, const SViewInfo& rkViewInfo, EDepthGroup DepthGroup /*= eMidground*/, bool DoFrustumTest /*= true*/)
|
|
||||||
{
|
|
||||||
u32 SurfaceCount = pModel->GetSurfaceCount();
|
|
||||||
|
|
||||||
for (u32 iSurf = 0; iSurf < SurfaceCount; iSurf++)
|
|
||||||
{
|
|
||||||
CAABox TransformedBox = pModel->GetSurfaceAABox(iSurf).Transformed(Transform());
|
|
||||||
|
|
||||||
if (!DoFrustumTest || rkViewInfo.ViewFrustum.BoxInFrustum(TransformedBox))
|
|
||||||
{
|
|
||||||
pRenderer->AddMesh(this, (int) iSurf, TransformedBox, pModel->IsSurfaceTransparent(iSurf, MatSet), eDrawMesh, DepthGroup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************ TRANSFORM ************
|
// ************ TRANSFORM ************
|
||||||
void CSceneNode::Translate(const CVector3f& rkTranslation, ETransformSpace TransformSpace)
|
void CSceneNode::Translate(const CVector3f& rkTranslation, ETransformSpace TransformSpace)
|
||||||
{
|
{
|
||||||
|
@ -78,9 +78,10 @@ public:
|
|||||||
void LoadModelMatrix();
|
void LoadModelMatrix();
|
||||||
void BuildLightList(CGameArea *pArea);
|
void BuildLightList(CGameArea *pArea);
|
||||||
void LoadLights(const SViewInfo& rkViewInfo);
|
void LoadLights(const SViewInfo& rkViewInfo);
|
||||||
|
void AddModelToRenderer(CRenderer *pRenderer, CModel *pModel, u32 MatSet);
|
||||||
|
void DrawModelParts(CModel *pModel, FRenderOptions Options, u32 MatSet, ERenderCommand RenderCommand);
|
||||||
void DrawBoundingBox() const;
|
void DrawBoundingBox() const;
|
||||||
void DrawRotationArrow() const;
|
void DrawRotationArrow() const;
|
||||||
void AddSurfacesToRenderer(CRenderer *pRenderer, CModel *pModel, u32 MatSet, const SViewInfo& rkViewInfo, EDepthGroup DepthGroup = eMidground, bool DoFrustumTest = true);
|
|
||||||
|
|
||||||
// Transform
|
// Transform
|
||||||
void Translate(const CVector3f& rkTranslation, ETransformSpace TransformSpace);
|
void Translate(const CVector3f& rkTranslation, ETransformSpace TransformSpace);
|
||||||
|
@ -77,17 +77,14 @@ void CScriptAttachNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkV
|
|||||||
|
|
||||||
if (rkViewInfo.ViewFrustum.BoxInFrustum(AABox()))
|
if (rkViewInfo.ViewFrustum.BoxInFrustum(AABox()))
|
||||||
{
|
{
|
||||||
if (pModel->HasTransparency(0))
|
AddModelToRenderer(pRenderer, pModel, 0);
|
||||||
AddSurfacesToRenderer(pRenderer, pModel, 0, rkViewInfo);
|
|
||||||
else
|
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawMesh);
|
|
||||||
|
|
||||||
if (mpParent->IsSelected() && !rkViewInfo.GameMode)
|
if (mpParent->IsSelected() && !rkViewInfo.GameMode)
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptAttachNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo)
|
void CScriptAttachNode::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCommand Command, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
LoadModelMatrix();
|
LoadModelMatrix();
|
||||||
mpParent->LoadLights(rkViewInfo);
|
mpParent->LoadLights(rkViewInfo);
|
||||||
@ -98,11 +95,7 @@ void CScriptAttachNode::Draw(FRenderOptions Options, int ComponentIndex, const S
|
|||||||
CGraphics::sPixelBlock.TintColor = mpParent->TintColor(rkViewInfo);
|
CGraphics::sPixelBlock.TintColor = mpParent->TintColor(rkViewInfo);
|
||||||
CGraphics::sPixelBlock.TevColor = CColor::skWhite;
|
CGraphics::sPixelBlock.TevColor = CColor::skWhite;
|
||||||
CGraphics::UpdatePixelBlock();
|
CGraphics::UpdatePixelBlock();
|
||||||
|
DrawModelParts(Model(), Options, 0, Command);
|
||||||
if (ComponentIndex < 0)
|
|
||||||
Model()->Draw(Options, 0);
|
|
||||||
else
|
|
||||||
Model()->DrawSurface(Options, ComponentIndex, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptAttachNode::DrawSelection()
|
void CScriptAttachNode::DrawSelection()
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
|
|
||||||
ENodeType NodeType() { return eScriptAttachNode; }
|
ENodeType NodeType() { return eScriptAttachNode; }
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
void DrawSelection();
|
void DrawSelection();
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
||||||
|
@ -151,14 +151,8 @@ void CScriptNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInf
|
|||||||
|
|
||||||
if (!pModel)
|
if (!pModel)
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawMesh);
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawMesh);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
AddModelToRenderer(pRenderer, pModel, 0);
|
||||||
if (!pModel->HasTransparency(0))
|
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawMesh);
|
|
||||||
else
|
|
||||||
AddSurfacesToRenderer(pRenderer, pModel, 0, rkViewInfo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,9 +169,9 @@ void CScriptNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo)
|
void CScriptNode::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCommand Command, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
if (!mpInstance || !mpDisplayAsset) return;
|
if (!mpInstance) return;
|
||||||
|
|
||||||
// Draw model
|
// Draw model
|
||||||
if (UsesModel())
|
if (UsesModel())
|
||||||
@ -219,11 +213,7 @@ void CScriptNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewIn
|
|||||||
|
|
||||||
CGraphics::sPixelBlock.TintColor = TintColor(rkViewInfo);
|
CGraphics::sPixelBlock.TintColor = TintColor(rkViewInfo);
|
||||||
CGraphics::UpdatePixelBlock();
|
CGraphics::UpdatePixelBlock();
|
||||||
|
DrawModelParts(pModel, Options, 0, Command);
|
||||||
if (ComponentIndex < 0)
|
|
||||||
pModel->Draw(Options, 0);
|
|
||||||
else
|
|
||||||
pModel->DrawSurface(Options, ComponentIndex, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no model or billboard, default to drawing a purple box
|
// If no model or billboard, default to drawing a purple box
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
void PostLoad();
|
void PostLoad();
|
||||||
void OnTransformed();
|
void OnTransformed();
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
void DrawSelection();
|
void DrawSelection();
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
||||||
|
@ -52,7 +52,7 @@ void CStaticNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInf
|
|||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo)
|
void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand /*Command*/, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
if (!mpModel) return;
|
if (!mpModel) return;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public:
|
|||||||
ENodeType NodeType();
|
ENodeType NodeType();
|
||||||
void PostLoad();
|
void PostLoad();
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
void DrawSelection();
|
void DrawSelection();
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
||||||
|
@ -234,7 +234,7 @@ void CDamageableTriggerExtra::AddToRenderer(CRenderer *pRenderer, const SViewInf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDamageableTriggerExtra::Draw(FRenderOptions Options, int /*ComponentIndex*/, const SViewInfo& rkViewInfo)
|
void CDamageableTriggerExtra::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
LoadModelMatrix();
|
LoadModelMatrix();
|
||||||
CGraphics::sPixelBlock.TintColor = mpParent->TintColor(rkViewInfo);
|
CGraphics::sPixelBlock.TintColor = mpParent->TintColor(rkViewInfo);
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
void PropertyModified(IProperty *pProperty);
|
void PropertyModified(IProperty *pProperty);
|
||||||
bool ShouldDrawNormalAssets();
|
bool ShouldDrawNormalAssets();
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
void DrawSelection();
|
void DrawSelection();
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 ComponentIndex, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 ComponentIndex, const SViewInfo& rkViewInfo);
|
||||||
|
@ -64,17 +64,14 @@ void CDoorExtra::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo
|
|||||||
|
|
||||||
if (mpParent->IsVisible() && rkViewInfo.ViewFrustum.BoxInFrustum(AABox()))
|
if (mpParent->IsVisible() && rkViewInfo.ViewFrustum.BoxInFrustum(AABox()))
|
||||||
{
|
{
|
||||||
if (mpShieldModel->HasTransparency(0))
|
AddModelToRenderer(pRenderer, mpShieldModel, 0);
|
||||||
AddSurfacesToRenderer(pRenderer, mpShieldModel, 0, rkViewInfo);
|
|
||||||
else
|
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawMesh);
|
|
||||||
|
|
||||||
if (mpParent->IsSelected() && !rkViewInfo.GameMode)
|
if (mpParent->IsSelected() && !rkViewInfo.GameMode)
|
||||||
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
pRenderer->AddMesh(this, -1, AABox(), false, eDrawSelection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDoorExtra::Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo)
|
void CDoorExtra::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCommand Command, const SViewInfo& rkViewInfo)
|
||||||
{
|
{
|
||||||
LoadModelMatrix();
|
LoadModelMatrix();
|
||||||
mpParent->LoadLights(rkViewInfo);
|
mpParent->LoadLights(rkViewInfo);
|
||||||
@ -87,11 +84,7 @@ void CDoorExtra::Draw(FRenderOptions Options, int ComponentIndex, const SViewInf
|
|||||||
CGraphics::sPixelBlock.TintColor = Tint;
|
CGraphics::sPixelBlock.TintColor = Tint;
|
||||||
CGraphics::sPixelBlock.TevColor = CColor::skWhite;
|
CGraphics::sPixelBlock.TevColor = CColor::skWhite;
|
||||||
CGraphics::UpdatePixelBlock();
|
CGraphics::UpdatePixelBlock();
|
||||||
|
DrawModelParts(mpShieldModel, Options, 0, Command);
|
||||||
if (ComponentIndex < 0)
|
|
||||||
mpShieldModel->Draw(Options, 0);
|
|
||||||
else
|
|
||||||
mpShieldModel->DrawSurface(Options, ComponentIndex, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDoorExtra::DrawSelection()
|
void CDoorExtra::DrawSelection()
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
explicit CDoorExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
explicit CDoorExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||||
void PropertyModified(IProperty *pProperty);
|
void PropertyModified(IProperty *pProperty);
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
void DrawSelection();
|
void DrawSelection();
|
||||||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
||||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
||||||
|
@ -36,7 +36,7 @@ void CRadiusSphereExtra::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRadiusSphereExtra::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& /*rkViewInfo*/)
|
void CRadiusSphereExtra::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& /*rkViewInfo*/)
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
glBlendFunc(GL_ONE, GL_ZERO);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
@ -12,7 +12,7 @@ class CRadiusSphereExtra : public CScriptExtra
|
|||||||
public:
|
public:
|
||||||
explicit CRadiusSphereExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
explicit CRadiusSphereExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
CColor Color() const;
|
CColor Color() const;
|
||||||
CAABox Bounds() const;
|
CAABox Bounds() const;
|
||||||
};
|
};
|
||||||
|
@ -172,7 +172,7 @@ void CWaypointExtra::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaypointExtra::Draw(FRenderOptions /*Options*/, int ComponentIndex, const SViewInfo& /*rkViewInfo*/)
|
void CWaypointExtra::Draw(FRenderOptions /*Options*/, int ComponentIndex, ERenderCommand /*Command*/, const SViewInfo& /*rkViewInfo*/)
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
glBlendFunc(GL_ONE, GL_ZERO);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
void OnTransformed();
|
void OnTransformed();
|
||||||
void LinksModified();
|
void LinksModified();
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
CColor TevColor();
|
CColor TevColor();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ void CGizmo::AddToRenderer(CRenderer *pRenderer, const SViewInfo&)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGizmo::Draw(FRenderOptions /*Options*/, int ComponentIndex, const SViewInfo& /*rkViewInfo*/)
|
void CGizmo::Draw(FRenderOptions /*Options*/, int ComponentIndex, ERenderCommand /*Command*/, const SViewInfo& /*rkViewInfo*/)
|
||||||
{
|
{
|
||||||
// Determine which SModelPart array to use
|
// Determine which SModelPart array to use
|
||||||
if (ComponentIndex >= (int) mNumCurrentParts) return;
|
if (ComponentIndex >= (int) mNumCurrentParts) return;
|
||||||
|
@ -128,7 +128,7 @@ public:
|
|||||||
~CGizmo();
|
~CGizmo();
|
||||||
|
|
||||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||||
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& rkViewInfo);
|
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||||
|
|
||||||
void IncrementSize();
|
void IncrementSize();
|
||||||
void DecrementSize();
|
void DecrementSize();
|
||||||
|
@ -13,7 +13,7 @@ public:
|
|||||||
pRenderer->AddMesh(this, 0, CAABox::skOne, false, eDrawMesh);
|
pRenderer->AddMesh(this, 0, CAABox::skOne, false, eDrawMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw(FRenderOptions, int, const SViewInfo&)
|
void Draw(FRenderOptions, int, ERenderCommand, const SViewInfo&)
|
||||||
{
|
{
|
||||||
CDrawUtil::DrawGrid();
|
CDrawUtil::DrawGrid();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user