General: Migrate off non-constexpr constants

This commit is contained in:
Lioncash 2020-06-16 22:22:54 -04:00
parent 31bfca7aac
commit 566a32fd75
50 changed files with 304 additions and 258 deletions

View File

@ -88,7 +88,7 @@ public:
void SetLookSpeed(float LookSpeed) { mLookSpeed = LookSpeed; }
void SetAspectRatio(float AspectRatio) { mAspectRatio = AspectRatio; mProjectionDirty = true; mFrustumPlanesDirty = true; }
void ResetOrbit() { SetOrbit(CVector3f::skZero, 5.f); }
void ResetOrbit() { SetOrbit(CVector3f::Zero(), 5.f); }
// Private
private:

View File

@ -63,13 +63,13 @@ void CDrawUtil::DrawSquare(const float *pTexCoords)
void CDrawUtil::DrawLine(const CVector3f& PointA, const CVector3f& PointB)
{
DrawLine(PointA, PointB, CColor::skWhite);
DrawLine(PointA, PointB, CColor::White());
}
void CDrawUtil::DrawLine(const CVector2f& PointA, const CVector2f& PointB)
{
// Overload for 2D lines
DrawLine(CVector3f(PointA.X, PointA.Y, 0.f), CVector3f(PointB.X, PointB.Y, 0.f), CColor::skWhite);
DrawLine(CVector3f(PointA.X, PointA.Y, 0.f), CVector3f(PointB.X, PointB.Y, 0.f), CColor::White());
}
void CDrawUtil::DrawLine(const CVector3f& PointA, const CVector3f& PointB, const CColor& LineColor)
@ -281,7 +281,7 @@ void CDrawUtil::UseColorShaderLighting(const CColor& kColor)
void CDrawUtil::UseTextureShader()
{
UseTextureShader(CColor::skWhite);
UseTextureShader(CColor::White());
}
void CDrawUtil::UseTextureShader(const CColor& TintColor)

View File

@ -86,17 +86,17 @@ public:
static void DrawSphere(bool DoubleSided = false);
static void DrawSphere(const CColor& Color);
static void DrawWireSphere(const CVector3f& Position, float Radius, const CColor& Color = CColor::skWhite);
static void DrawWireSphere(const CVector3f& Position, float Radius, const CColor& Color = CColor::White());
static void DrawBillboard(CTexture* pTexture, const CVector3f& Position, const CVector2f& Scale = CVector2f::skOne, const CColor& Tint = CColor::skWhite);
static void DrawBillboard(CTexture* pTexture, const CVector3f& Position, const CVector2f& Scale = CVector2f::One(), const CColor& Tint = CColor::White());
static void DrawLightBillboard(ELightType Type, const CColor& LightColor, const CVector3f& Position, const CVector2f& Scale = CVector2f::skOne, const CColor& Tint = CColor::skWhite);
static void DrawLightBillboard(ELightType Type, const CColor& LightColor, const CVector3f& Position, const CVector2f& Scale = CVector2f::One(), const CColor& Tint = CColor::White());
static void UseColorShader(const CColor& Color);
static void UseColorShaderLighting(const CColor& Color);
static void UseTextureShader();
static void UseTextureShader(const CColor& TintColor);
static void UseCollisionShader(bool IsFloor, bool IsUnstandable, const CColor& TintColor = CColor::skWhite);
static void UseCollisionShader(bool IsFloor, bool IsUnstandable, const CColor& TintColor = CColor::White());
static CShader* GetTextShader();
static void LoadCheckerboardTexture(uint32 GLTextureUnit);

View File

@ -22,7 +22,7 @@ CGraphics::SLightBlock CGraphics::sLightBlock;
CGraphics::ELightingMode CGraphics::sLightMode;
uint32 CGraphics::sNumLights;
CColor CGraphics::sAreaAmbientColor = CColor::skTransparentBlack;
CColor CGraphics::sAreaAmbientColor = CColor::TransparentBlack();
float CGraphics::sWorldLightMultiplier;
std::array<CLight, 3> CGraphics::sDefaultDirectionalLights{{
CLight::BuildDirectional(CVector3f(0), CVector3f(0.f, -0.866025f, -0.5f), CColor(0.3f, 0.3f, 0.3f, 0.3f)),
@ -169,8 +169,8 @@ void CGraphics::SetDefaultLighting()
sNumLights = 0;
UpdateLightBlock();
sVertexBlock.COLOR0_Amb = CColor::skGray;
sVertexBlock.COLOR0_Mat = CColor::skWhite;
sVertexBlock.COLOR0_Amb = CColor::Gray();
sVertexBlock.COLOR0_Mat = CColor::White();
UpdateVertexBlock();
}
@ -181,7 +181,7 @@ void CGraphics::SetupAmbientColor()
else if (sLightMode == ELightingMode::Basic)
sVertexBlock.COLOR0_Amb = skDefaultAmbientColor;
else
sVertexBlock.COLOR0_Amb = CColor::skTransparentWhite;
sVertexBlock.COLOR0_Amb = CColor::TransparentWhite();
}
void CGraphics::SetIdentityMVP()

View File

@ -36,7 +36,7 @@ void CRenderBucket::CSubBucket::Sort(const CCamera* pkCamera, bool DebugVisualiz
{
SRenderablePtr *pPtr = &mRenderables[iPtr];
CVector3f Point = pPtr->AABox.ClosestPointAlongVector(pkCamera->Direction());
CDrawUtil::DrawWireCube(pPtr->AABox, CColor::skWhite);
CDrawUtil::DrawWireCube(pPtr->AABox, CColor::White());
CVector3f Dist = Point - pkCamera->Position();
float Dot = Dist.Dot(pkCamera->Direction());

View File

@ -115,12 +115,16 @@ void CRenderer::SetViewportSize(uint32 Width, uint32 Height)
// ************ RENDER ************
void CRenderer::RenderBuckets(const SViewInfo& rkViewInfo)
{
if (!mInitialized) Init();
if (!mInitialized)
Init();
mSceneFramebuffer.Bind();
// Set backface culling
if (mOptions & ERenderOption::EnableBackfaceCull) glEnable(GL_CULL_FACE);
else glDisable(GL_CULL_FACE);
if (mOptions & ERenderOption::EnableBackfaceCull)
glEnable(GL_CULL_FACE);
else
glDisable(GL_CULL_FACE);
// Render scene to texture
glDepthRange(0.f, 1.f);
@ -146,21 +150,36 @@ void CRenderer::RenderBuckets(const SViewInfo& rkViewInfo)
void CRenderer::RenderBloom()
{
// Check to ensure bloom is enabled. Also don't render bloom in unlit mode.
if (mBloomMode == EBloomMode::NoBloom || CGraphics::sLightMode != CGraphics::ELightingMode::World) return;
if (mBloomMode == EBloomMode::NoBloom || CGraphics::sLightMode != CGraphics::ELightingMode::World)
return;
// Setup
static const float skHOffset[6] = { -0.008595f, -0.005470f, -0.002345f,
0.002345f, 0.005470f, 0.008595f };
static constexpr float skHOffset[6] = {
-0.008595f,
-0.005470f,
-0.002345f,
0.002345f,
0.005470f,
0.008595f,
};
static const float skVOffset[6] = { -0.012275f, -0.007815f, -0.003350f,
0.003350f, 0.007815f, 0.012275f };
static constexpr float skVOffset[6] = {
-0.012275f,
-0.007815f,
-0.003350f,
0.003350f,
0.007815f,
0.012275f,
};
static const CColor skTintColors[6] = { CColor::Integral(17, 17, 17),
CColor::Integral(53, 53, 53),
CColor::Integral(89, 89, 89),
CColor::Integral(89, 89, 89),
CColor::Integral(53, 53, 53),
CColor::Integral(17, 17, 17) };
static constexpr CColor skTintColors[6] = {
CColor::Integral(17, 17, 17),
CColor::Integral(53, 53, 53),
CColor::Integral(89, 89, 89),
CColor::Integral(89, 89, 89),
CColor::Integral(53, 53, 53),
CColor::Integral(17, 17, 17),
};
uint32 BloomWidth = (mBloomMode == EBloomMode::Bloom ? mBloomWidth : mViewportWidth);
uint32 BloomHeight = (mBloomMode == EBloomMode::Bloom ? mBloomHeight : mViewportHeight);
@ -195,7 +214,7 @@ void CRenderer::RenderBloom()
mBloomFramebuffers[1].Resize(BloomWidth, BloomHeight);
mBloomFramebuffers[1].Bind();
CDrawUtil::UseTextureShader(CColor::skGray);
CDrawUtil::UseTextureShader(CColor::Gray());
glBlendFunc(GL_ONE, GL_ZERO);
mBloomFramebuffers[0].Texture()->Bind(0);
CDrawUtil::DrawSquare();
@ -215,7 +234,7 @@ void CRenderer::RenderBloom()
mBloomFramebuffers[2].Bind();
glClear(GL_COLOR_BUFFER_BIT);
CDrawUtil::UseTextureShader(CColor::skGray);
CDrawUtil::UseTextureShader(CColor::Gray());
glBlendFunc(GL_ONE, GL_ZERO);
mBloomFramebuffers[1].Texture()->Bind(0);
CDrawUtil::DrawSquare();
@ -247,7 +266,7 @@ void CRenderer::RenderBloom()
{
// Bloom maps are in the framebuffer alpha channel.
// White * dst alpha = bloom map colors
CDrawUtil::UseColorShader(CColor::skWhite);
CDrawUtil::UseColorShader(CColor::White());
glBlendFunc(GL_DST_ALPHA, GL_ZERO);
CDrawUtil::DrawSquare();
}
@ -269,10 +288,10 @@ void CRenderer::RenderSky(CModel *pSkyboxModel, const SViewInfo& rkViewInfo)
glEnable(GL_CULL_FACE);
CGraphics::sMVPBlock.ModelMatrix = CMatrix4f::skIdentity;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skTransparentWhite;
CGraphics::sPixelBlock.SetAllTevColors(CColor::skWhite);
CGraphics::sPixelBlock.TintColor = CColor::skWhite;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::TransparentWhite();
CGraphics::sVertexBlock.COLOR0_Mat = CColor::TransparentWhite();
CGraphics::sPixelBlock.SetAllTevColors(CColor::White());
CGraphics::sPixelBlock.TintColor = CColor::White();
CGraphics::sNumLights = 0;
CGraphics::UpdateVertexBlock();
CGraphics::UpdatePixelBlock();

View File

@ -24,7 +24,7 @@ void CBone::UpdateTransform(CBoneTransformData& rData, const SBoneTransformInfo&
pAnim->EvaluateTransform(Time, mID, &TransformInfo.Position, &TransformInfo.Rotation, &TransformInfo.Scale);
if (AnchorRoot && IsRoot())
TransformInfo.Position = CVector3f::skZero;
TransformInfo.Position = CVector3f::Zero();
// Apply parent transform
TransformInfo.Position = rkParentTransform.Position + (rkParentTransform.Rotation * (rkParentTransform.Scale * TransformInfo.Position));
@ -125,9 +125,9 @@ void CSkeleton::Draw(FRenderOptions /*Options*/, const CBoneTransformData *pkDat
if (pBone->IsSelected())
{
const CQuaternion BoneRot = pkData ? pBone->TransformedRotation(*pkData) : pBone->Rotation();
CDrawUtil::DrawLine(BonePos, BonePos + BoneRot.XAxis(), CColor::skRed);
CDrawUtil::DrawLine(BonePos, BonePos + BoneRot.YAxis(), CColor::skGreen);
CDrawUtil::DrawLine(BonePos, BonePos + BoneRot.ZAxis(), CColor::skBlue);
CDrawUtil::DrawLine(BonePos, BonePos + BoneRot.XAxis(), CColor::Red());
CDrawUtil::DrawLine(BonePos, BonePos + BoneRot.YAxis(), CColor::Green());
CDrawUtil::DrawLine(BonePos, BonePos + BoneRot.ZAxis(), CColor::Blue());
}
// Draw child links
@ -151,7 +151,7 @@ void CSkeleton::Draw(FRenderOptions /*Options*/, const CBoneTransformData *pkDat
Transform.Translate(BonePos);
CGraphics::sMVPBlock.ModelMatrix = Transform * BaseTransform;
CGraphics::UpdateMVPBlock();
CDrawUtil::DrawSphere(pBone->IsSelected() ? CColor::skRed : CColor::skWhite);
CDrawUtil::DrawSphere(pBone->IsSelected() ? CColor::Red() : CColor::White());
}
}

View File

@ -15,9 +15,9 @@ class CBone;
struct SBoneTransformInfo
{
CVector3f Position{CVector3f::skZero};
CQuaternion Rotation{CQuaternion::skIdentity};
CVector3f Scale{CVector3f::skOne};
CVector3f Position{CVector3f::Zero()};
CQuaternion Rotation{CQuaternion::Identity()};
CVector3f Scale{CVector3f::One()};
SBoneTransformInfo() = default;
};

View File

@ -110,7 +110,7 @@ void CGameArea::ClearTerrain()
mVertexCount = 0;
mTriangleCount = 0;
mTerrainMerged = false;
mAABox = CAABox::skInfinite;
mAABox = CAABox::Infinite();
}
void CGameArea::ClearScriptLayers()

View File

@ -79,9 +79,9 @@ public:
CScriptObject* InstanceByID(uint32 InstanceID);
uint32 FindUnusedInstanceID() const;
CScriptObject* SpawnInstance(CScriptTemplate *pTemplate, CScriptLayer *pLayer,
const CVector3f& rkPosition = CVector3f::skZero,
const CQuaternion& rkRotation = CQuaternion::skIdentity,
const CVector3f& rkScale = CVector3f::skOne,
const CVector3f& rkPosition = CVector3f::Zero(),
const CQuaternion& rkRotation = CQuaternion::Identity(),
const CVector3f& rkScale = CVector3f::One(),
uint32 SuggestedID = -1, uint32 SuggestedLayerIndex = -1);
void AddInstanceToArea(CScriptObject *pInstance);
void DeleteInstance(CScriptObject *pInstance);

View File

@ -66,7 +66,7 @@ public:
std::unique_ptr<CDependencyTree> BuildDependencyTree() const override;
CVector2f RenderString(const TString& rkString, CRenderer *pRenderer, float AspectRatio,
CVector2f Position = CVector2f(0,0),
CColor FillColor = CColor::skWhite, CColor StrokeColor = CColor::skBlack,
CColor FillColor = CColor::White(), CColor StrokeColor = CColor::Black(),
uint32 FontSize = CFONT_DEFAULT_SIZE);
// Accessors

View File

@ -9,7 +9,7 @@
#include <GL/glew.h>
uint64 CMaterial::sCurrentMaterial = 0;
CColor CMaterial::sCurrentTint = CColor::skWhite;
CColor CMaterial::sCurrentTint = CColor::White();
std::map<uint64, CMaterial::SMaterialShader> CMaterial::smShaderMap;
CMaterial::CMaterial()

View File

@ -68,9 +68,9 @@ const std::unordered_map<ECollisionFlag, CColor> gkTypeToColor = {
};
CColor CCollisionMaterial::SurfaceColor(EGame Game) const
{
ECollisionFlag SurfType = SurfaceType(Game);
auto FindColor = gkTypeToColor.find(SurfType);
return (FindColor == gkTypeToColor.end() ? CColor::skWhite : FindColor->second);
const ECollisionFlag SurfType = SurfaceType(Game);
const auto FindColor = gkTypeToColor.find(SurfType);
return (FindColor == gkTypeToColor.end() ? CColor::White() : FindColor->second);
}
bool CCollisionMaterial::IsFloor() const

View File

@ -225,7 +225,7 @@ void CCollisionRenderData::Render(bool Wireframe, int MaterialIndex /*= -1*/)
//@todo get these ugly OpenGL calls outta here
if (Wireframe)
{
CDrawUtil::UseColorShader(CColor::skBlack);
CDrawUtil::UseColorShader(CColor::Black());
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
@ -252,7 +252,7 @@ void CCollisionRenderData::Render(bool Wireframe, int MaterialIndex /*= -1*/)
void CCollisionRenderData::RenderBoundingHierarchy(int MaxDepthLevel /*= -1*/)
{
mBoundingVertexBuffer.Bind();
CDrawUtil::UseColorShader(CColor::skBlue);
CDrawUtil::UseColorShader(CColor::Blue());
glLineWidth(1.f);
uint FirstIndex = mBoundingDepthOffsets[0];
uint LastIndex = (MaxDepthLevel > 0 ?

View File

@ -260,7 +260,7 @@ std::unique_ptr<CCollisionMeshGroup> CCollisionLoader::LoadDCLN(IInputStream& rD
// Build bounding box
if (Loader.mVersion != EGame::DKCReturns)
{
Loader.mpMesh->mAABox = CAABox::skInfinite;
Loader.mpMesh->mAABox = CAABox::Infinite();
for (const auto& vert : Loader.mpMesh->mIndexData.Vertices)
{

View File

@ -103,7 +103,7 @@ struct SMP3IntermediateMaterial
std::array<uint8, 5> mINTs{255, 255, 0, 32, 255};
uint8 GetINT(EINT eint) const { return mINTs[static_cast<size_t>(eint)]; }
std::array<CColor, 2> mCLRs{CColor::skWhite, CColor::skWhite};
std::array<CColor, 2> mCLRs{CColor::White(), CColor::White()};
const CColor& GetCLR(ECLR clr) const { return mCLRs[static_cast<size_t>(clr)]; }
};

View File

@ -117,7 +117,7 @@ SSurface* CModelLoader::LoadSurface(IInputStream& rModel)
else
LoadSurfaceHeaderDKCR(rModel, pSurf);
const bool HasAABB = (pSurf->AABox != CAABox::skInfinite);
const bool HasAABB = pSurf->AABox != CAABox::Infinite();
CMaterial *pMat = mMaterials[0]->MaterialByIndex(pSurf->MaterialID, false);
// Primitive table
@ -250,7 +250,7 @@ void CModelLoader::LoadSurfaceHeaderPrime(IInputStream& rModel, SSurface *pSurf)
}
else
{
pSurf->AABox = CAABox::skInfinite;
pSurf->AABox = CAABox::Infinite();
}
rModel.Seek(ExtraSize, SEEK_CUR);
@ -273,7 +273,7 @@ void CModelLoader::LoadSurfaceHeaderDKCR(IInputStream& rModel, SSurface *pSurf)
}
else
{
pSurf->AABox = CAABox::skInfinite;
pSurf->AABox = CAABox::Infinite();
}
rModel.Seek(ExtraSize, SEEK_CUR);
@ -326,8 +326,8 @@ SSurface* CModelLoader::LoadAssimpMesh(const aiMesh *pkMesh, CMaterialSet *pSet)
rPrim.Type = EPrimitiveType::Triangles;
// Generate bounding box, center point, and reflection projection
pSurf->CenterPoint = CVector3f::skZero;
pSurf->ReflectionDirection = CVector3f::skZero;
pSurf->CenterPoint = CVector3f::Zero();
pSurf->ReflectionDirection = CVector3f::Zero();
for (size_t iVtx = 0; iVtx < pkMesh->mNumVertices; iVtx++)
{

View File

@ -818,7 +818,7 @@ CColor CTextureDecoder::DecodePixelC4(uint8 Byte, uint8 WhichPixel, IInputStream
if (mPaletteFormat == EGXPaletteFormat::RGB5A3)
return DecodePixelIA8(rPaletteStream.ReadShort());
return CColor::skTransparentBlack;
return CColor::TransparentBlack();
}
CColor CTextureDecoder::DecodePixelC8(uint8 Byte, IInputStream& rPaletteStream)
@ -834,7 +834,7 @@ CColor CTextureDecoder::DecodePixelC8(uint8 Byte, IInputStream& rPaletteStream)
if (mPaletteFormat == EGXPaletteFormat::RGB5A3)
return DecodePixelIA8(rPaletteStream.ReadShort());
return CColor::skTransparentBlack;
return CColor::TransparentBlack();
}
CColor CTextureDecoder::DecodePixelRGB565(uint16 Short)
@ -882,7 +882,7 @@ void CTextureDecoder::DecodeSubBlockCMPR(IInputStream& rSrc, IOutputStream& rDst
else
{
Palettes[2] = (Palettes[0] * 0.5f) + (Palettes[1] * 0.5f);
Palettes[3] = CColor::skTransparentBlack;
Palettes[3] = CColor::TransparentBlack();
}
for (uint32 iBlockY = 0; iBlockY < 4; iBlockY++)
@ -921,7 +921,7 @@ void CTextureDecoder::DecodeBlockBC1(IInputStream& rSrc, IOutputStream& rDst, ui
else
{
Palettes[2] = (Palettes[0] * 0.5f) + (Palettes[1] * 0.5f);
Palettes[3] = CColor::skTransparentBlack;
Palettes[3] = CColor::TransparentBlack();
}
for (uint32 iBlockY = 0; iBlockY < 4; iBlockY++)
@ -958,7 +958,7 @@ void CTextureDecoder::DecodeBlockBC2(IInputStream& rSrc, IOutputStream& rDst, ui
else
{
CPalettes[2] = (CPalettes[0] * 0.5f) + (CPalettes[1] * 0.5f);
CPalettes[3] = CColor::skTransparentBlack;
CPalettes[3] = CColor::TransparentBlack();
}
for (uint32 iBlockY = 0; iBlockY < 4; iBlockY++)
@ -995,7 +995,7 @@ void CTextureDecoder::DecodeBlockBC3(IInputStream& rSrc, IOutputStream& rDst, ui
else
{
Palettes[2] = (Palettes[0] * 0.5f) + (Palettes[1] * 0.5f);
Palettes[3] = CColor::skTransparentBlack;
Palettes[3] = CColor::TransparentBlack();
}
for (uint32 iBlockY = 0; iBlockY < 4; iBlockY++)
@ -1016,5 +1016,5 @@ void CTextureDecoder::DecodeBlockBC3(IInputStream& rSrc, IOutputStream& rDst, ui
CColor CTextureDecoder::DecodeDDSPixel(IInputStream& /*rDDS*/)
{
return CColor::skWhite;
return CColor::White();
}

View File

@ -31,7 +31,7 @@ public:
void ClearGLBuffer() override;
void Draw(FRenderOptions Options, size_t MatSet);
void DrawSurface(FRenderOptions Options, size_t Surface, size_t MatSet);
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::skWhite);
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::White());
void SetSkin(CSkin *pSkin);
size_t GetMatSetCount() const;

View File

@ -26,7 +26,7 @@ public:
void ClearGLBuffer();
void Draw(FRenderOptions Options);
void DrawSurface(FRenderOptions Options, uint32 Surface);
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::skWhite);
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::White());
CMaterial* GetMaterial();
void SetMaterial(CMaterial *pMat);

View File

@ -93,9 +93,9 @@ public:
CLink* Link(ELinkType Type, uint32 Index) const { return (Type == ELinkType::Incoming ? mInLinks[Index] : mOutLinks[Index]); }
void* PropertyData() const { return (void*) mPropertyData.data(); }
CVector3f Position() const { return mPosition.IsValid() ? mPosition.Get() : CVector3f::skZero; }
CVector3f Rotation() const { return mRotation.IsValid() ? mRotation.Get() : CVector3f::skZero; }
CVector3f Scale() const { return mScale.IsValid() ? mScale.Get() : CVector3f::skOne; }
CVector3f Position() const { return mPosition.IsValid() ? mPosition.Get() : CVector3f::Zero(); }
CVector3f Rotation() const { return mRotation.IsValid() ? mRotation.Get() : CVector3f::Zero(); }
CVector3f Scale() const { return mScale.IsValid() ? mScale.Get() : CVector3f::One(); }
TString InstanceName() const { return mInstanceName.IsValid() ? mInstanceName.Get() : ""; }
bool IsActive() const { return mActive.IsValid() ? mActive.Get() : false; }
bool HasInGameModel() const { return mHasInGameModel; }

View File

@ -10,7 +10,7 @@ struct SRayIntersection
{
bool Hit = false;
float Distance = 0.0f;
CVector3f HitPoint{CVector3f::skZero};
CVector3f HitPoint{CVector3f::Zero()};
CSceneNode *pNode = nullptr;
uint ComponentIndex = UINT32_MAX;

View File

@ -62,9 +62,9 @@ void CCharacterNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderCom
CGraphics::SetDefaultLighting();
CGraphics::UpdateLightBlock();
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::TransparentWhite();
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
CGraphics::sPixelBlock.SetAllTevColors(CColor::skWhite);
CGraphics::sPixelBlock.SetAllTevColors(CColor::White());
CGraphics::sPixelBlock.TintColor = TintColor(rkViewInfo);
LoadModelMatrix();
@ -126,7 +126,7 @@ void CCharacterNode::SetCharSet(CAnimSet *pChar)
ConditionalSetDirty();
if (!mpCharacter)
mLocalAABox = CAABox::skOne;
mLocalAABox = CAABox::One();
}
void CCharacterNode::SetActiveChar(uint32 CharIndex)
@ -138,7 +138,7 @@ void CCharacterNode::SetActiveChar(uint32 CharIndex)
{
CModel *pModel = mpCharacter->Character(CharIndex)->pModel;
mTransformData.ResizeToSkeleton(mpCharacter->Character(CharIndex)->pSkeleton);
mLocalAABox = pModel ? pModel->AABox() : CAABox::skZero;
mLocalAABox = pModel ? pModel->AABox() : CAABox::Zero();
MarkTransformChanged();
}
}

View File

@ -66,8 +66,7 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
CColor Tint = BaseTint;
if (rkViewInfo.CollisionSettings.HighlightMask != 0 && (kMat.RawFlags() & rkViewInfo.CollisionSettings.HighlightMask) == rkViewInfo.CollisionSettings.HighlightMask)
Tint *= CColor::skRed;
Tint *= CColor::Red();
else if (Game != EGame::DKCReturns && rkViewInfo.CollisionSettings.TintWithSurfaceColor)
Tint *= kMat.SurfaceColor(Game);
@ -103,7 +102,7 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
{
if (Parent() && Parent()->NodeType() == ENodeType::Root && Game != EGame::DKCReturns)
{
CDrawUtil::DrawWireCube( mpCollision->MeshByIndex(0)->Bounds(), CColor::skRed );
CDrawUtil::DrawWireCube(mpCollision->MeshByIndex(0)->Bounds(), CColor::Red());
}
}
}
@ -130,7 +129,7 @@ void CCollisionNode::SetCollision(CCollisionMeshGroup *pCollision)
mpCollision->BuildRenderData();
// Update bounds
mLocalAABox = CAABox::skInfinite;
mLocalAABox = CAABox::Infinite();
for (uint MeshIdx = 0; MeshIdx < pCollision->NumMeshes(); MeshIdx++)
{

View File

@ -8,7 +8,7 @@ CLightNode::CLightNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent, CLigh
: CSceneNode(pScene, NodeID, pParent)
, mpLight(pLight)
{
mLocalAABox = CAABox::skOne;
mLocalAABox = CAABox::One();
mPosition = pLight->Position();
switch (pLight->Type())
@ -34,7 +34,7 @@ void CLightNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo
if (IsSelected() && mpLight->Type() == ELightType::Custom)
{
CAABox RadiusBox = (CAABox::skOne * 2.f * mpLight->GetRadius()) + mPosition;
CAABox RadiusBox = (CAABox::One() * 2.f * mpLight->GetRadius()) + mPosition;
if (rkViewInfo.ViewFrustum.BoxInFrustum(RadiusBox))
pRenderer->AddMesh(this, -1, AABox(), false, ERenderCommand::DrawSelection);

View File

@ -9,9 +9,9 @@ CModelNode::CModelNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent, CMode
, mWorldModel(false)
, mForceAlphaOn(false)
, mEnableScanOverlay(false)
, mTintColor(CColor::skWhite)
, mTintColor(CColor::White())
{
mScale = CVector3f::skOne;
mScale = CVector3f::One();
SetModel(pModel);
}
@ -68,9 +68,9 @@ void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand
CGraphics::SetDefaultLighting();
CGraphics::UpdateLightBlock();
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::TransparentWhite();
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
CGraphics::sPixelBlock.SetAllTevColors(CColor::skWhite);
CGraphics::sPixelBlock.SetAllTevColors(CColor::White());
}
else
{
@ -79,7 +79,7 @@ void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand
if (IsLightingEnabled)
{
CGraphics::sNumLights = 0;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skTransparentBlack;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::TransparentBlack();
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
CGraphics::UpdateLightBlock();
}
@ -87,10 +87,10 @@ void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand
{
LoadLights(rkViewInfo);
if (CGraphics::sLightMode == CGraphics::ELightingMode::None)
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::TransparentWhite();
}
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::TransparentWhite();
const float Mul = CGraphics::sWorldLightMultiplier;
CGraphics::sPixelBlock.SetAllTevColors(CColor(Mul,Mul,Mul));

View File

@ -33,7 +33,7 @@ public:
void SetWorldModel(bool World) { mWorldModel = World; }
void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
void ClearTintColor() { mTintColor = CColor::skWhite; }
void ClearTintColor() { mTintColor = CColor::White(); }
void SetScanOverlayEnabled(bool Enable) { mEnableScanOverlay = Enable; }
void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
CModel* Model() const { return mpModel; }

View File

@ -228,7 +228,7 @@ void CScene::SetActiveArea(CWorld *pWorld, CGameArea *pArea)
}
uint32 NumLightLayers = mpArea->NumLightLayers();
CGraphics::sAreaAmbientColor = CColor::skTransparentBlack;
CGraphics::sAreaAmbientColor = CColor::TransparentBlack();
for (uint32 iLyr = 0; iLyr < NumLightLayers; iLyr++)
{

View File

@ -33,7 +33,7 @@ CSceneNode::~CSceneNode()
void CSceneNode::DrawSelection()
{
// Default implementation for virtual function
CDrawUtil::DrawWireCube(AABox(), CColor::skWhite);
CDrawUtil::DrawWireCube(AABox(), CColor::White());
}
void CSceneNode::RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& /*rkViewInfo*/)
@ -54,13 +54,13 @@ bool CSceneNode::IsVisible() const
CColor CSceneNode::TintColor(const SViewInfo& rkViewInfo) const
{
// Default implementation for virtual function
return (IsSelected() && !rkViewInfo.GameMode ? skSelectionTint : CColor::skWhite);
return (IsSelected() && !rkViewInfo.GameMode ? skSelectionTint : CColor::White());
}
CColor CSceneNode::WireframeColor() const
{
// Default implementation for virtual function
return CColor::skWhite;
return CColor::White();
}
// ************ MAIN FUNCTIONALITY ************
@ -119,7 +119,7 @@ void CSceneNode::LoadModelMatrix()
void CSceneNode::BuildLightList(CGameArea *pArea)
{
mLightCount = 0;
mAmbientColor = CColor::skTransparentBlack;
mAmbientColor = CColor::TransparentBlack();
uint32 Index = mLightLayerIndex;
if ((pArea->NumLightLayers() <= Index) || (pArea->NumLights(Index) == 0)) Index = 0;
@ -139,7 +139,8 @@ void CSceneNode::BuildLightList(CGameArea *pArea)
// Default ambient color to white if there are no lights on the selected layer
uint32 NumLights = pArea->NumLights(Index);
if (NumLights == 0) mAmbientColor = CColor::skTransparentWhite;
if (NumLights == 0)
mAmbientColor = CColor::TransparentWhite();
for (uint32 iLight = 0; iLight < NumLights; iLight++)
{
@ -147,16 +148,16 @@ void CSceneNode::BuildLightList(CGameArea *pArea)
// Ambient lights should only be present one per layer; need to check how the game deals with multiple ambients
if (pLight->Type() == ELightType::LocalAmbient)
mAmbientColor = pLight->Color();
// Other lights will be used depending which are closest to the node
else
{
bool IsInRange = AABox().IntersectsSphere(pLight->Position(), pLight->GetRadius());
mAmbientColor = pLight->Color();
}
else // Other lights will be used depending which are closest to the node
{
const bool IsInRange = AABox().IntersectsSphere(pLight->Position(), pLight->GetRadius());
if (IsInRange)
{
float Dist = mPosition.Distance(pLight->Position());
const float Dist = mPosition.Distance(pLight->Position());
LightEntries.push_back(SLightEntry(pLight, Dist));
}
}
@ -179,7 +180,7 @@ void CSceneNode::LoadLights(const SViewInfo& rkViewInfo)
{
case CGraphics::ELightingMode::None:
// No lighting: full white ambient, no dynamic lights
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::TransparentWhite();
break;
case CGraphics::ELightingMode::Basic:
@ -197,7 +198,7 @@ void CSceneNode::LoadLights(const SViewInfo& rkViewInfo)
break;
}
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::TransparentWhite();
CGraphics::sPixelBlock.LightmapMultiplier = (Mode == CGraphics::ELightingMode::World ? 1.f : 0.f);
CGraphics::UpdateLightBlock();
@ -244,7 +245,7 @@ void CSceneNode::DrawModelParts(CModel *pModel, FRenderOptions Options, size_t M
void CSceneNode::DrawBoundingBox() const
{
CDrawUtil::DrawWireCube(AABox(), CColor::skWhite);
CDrawUtil::DrawWireCube(AABox(), CColor::White());
}
void CSceneNode::DrawRotationArrow() const

View File

@ -86,9 +86,9 @@ protected:
CSceneNode *mpParent;
CScene *mpScene;
CVector3f mPosition{CVector3f::skZero};
CQuaternion mRotation{CQuaternion::skIdentity};
CVector3f mScale{CVector3f::skOne};
CVector3f mPosition{CVector3f::Zero()};
CQuaternion mRotation{CQuaternion::Identity()};
CVector3f mScale{CVector3f::One()};
CAABox mLocalAABox;
bool mMouseHovering = false;

View File

@ -34,7 +34,7 @@ void CScriptAttachNode::AttachPropertyModified()
if (pModel && pModel->Type() == EResourceType::Model)
mLocalAABox = pModel->AABox();
else
mLocalAABox = CAABox::skInfinite;
mLocalAABox = CAABox::Infinite();
MarkTransformChanged();
}
@ -93,7 +93,7 @@ void CScriptAttachNode::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERe
CGraphics::UpdateVertexBlock();
CGraphics::sPixelBlock.TintColor = mpParent->TintColor(rkViewInfo);
CGraphics::sPixelBlock.SetAllTevColors(CColor::skWhite);
CGraphics::sPixelBlock.SetAllTevColors(CColor::White());
CGraphics::UpdatePixelBlock();
DrawModelParts(Model(), Options, 0, Command);
}

View File

@ -176,8 +176,8 @@ void CScriptNode::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCo
if (CGraphics::sLightMode == CGraphics::ELightingMode::World && LightingOptions == EWorldLightingOptions::DisableWorldLighting)
{
CGraphics::sNumLights = 0;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skTransparentBlack;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::TransparentBlack();
CGraphics::sVertexBlock.COLOR0_Mat = CColor::TransparentWhite();
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
CGraphics::UpdateLightBlock();
}
@ -189,7 +189,7 @@ void CScriptNode::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCo
{
CGraphics::SetDefaultLighting();
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::TransparentWhite();
}
else
@ -205,8 +205,10 @@ void CScriptNode::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCo
{
if (pModel->IsSkinned()) CGraphics::LoadIdentityBoneTransforms();
if (mpExtra) CGraphics::sPixelBlock.SetAllTevColors(mpExtra->TevColor());
else CGraphics::sPixelBlock.SetAllTevColors(CColor::skWhite);
if (mpExtra)
CGraphics::sPixelBlock.SetAllTevColors(mpExtra->TevColor());
else
CGraphics::sPixelBlock.SetAllTevColors(CColor::White());
CGraphics::sPixelBlock.TintColor = TintColor(rkViewInfo);
CGraphics::UpdatePixelBlock();
@ -220,7 +222,7 @@ void CScriptNode::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCo
glDepthMask(GL_TRUE);
CGraphics::UpdateVertexBlock();
CGraphics::UpdatePixelBlock();
CDrawUtil::DrawShadedCube(CColor::skTransparentPurple * TintColor(rkViewInfo));
CDrawUtil::DrawShadedCube(CColor::TransparentPurple() * TintColor(rkViewInfo));
}
}
@ -254,7 +256,7 @@ void CScriptNode::DrawSelection()
CGraphics::sMVPBlock.ModelMatrix = Transform;
CGraphics::UpdateMVPBlock();
CGraphics::sPixelBlock.TintColor = CColor::skWhite;
CGraphics::sPixelBlock.TintColor = CColor::White();
CGraphics::UpdatePixelBlock();
DrawRotationArrow();
@ -270,14 +272,16 @@ void CScriptNode::DrawSelection()
// Don't draw in links if the other object is selected.
CLink *pLink = mpInstance->Link(ELinkType::Incoming, iIn);
CScriptNode *pLinkNode = mpScene->NodeForInstanceID(pLink->SenderID());
if (pLinkNode && !pLinkNode->IsSelected()) CDrawUtil::DrawLine(CenterPoint(), pLinkNode->CenterPoint(), CColor::skTransparentRed);
if (pLinkNode && !pLinkNode->IsSelected())
CDrawUtil::DrawLine(CenterPoint(), pLinkNode->CenterPoint(), CColor::TransparentRed());
}
for (uint32 iOut = 0; iOut < mpInstance->NumLinks(ELinkType::Outgoing); iOut++)
{
CLink *pLink = mpInstance->Link(ELinkType::Outgoing, iOut);
CScriptNode *pLinkNode = mpScene->NodeForInstanceID(pLink->ReceiverID());
if (pLinkNode) CDrawUtil::DrawLine(CenterPoint(), pLinkNode->CenterPoint(), CColor::skTransparentGreen);
if (pLinkNode)
CDrawUtil::DrawLine(CenterPoint(), pLinkNode->CenterPoint(), CColor::TransparentGreen());
}
}
}
@ -594,7 +598,7 @@ void CScriptNode::GeneratePosition()
// For two or more links, average out the position of the connected objects.
else if (NumLinks >= 2)
{
CVector3f NewPos = CVector3f::skZero;
CVector3f NewPos = CVector3f::Zero();
for (uint32 iIn = 0; iIn < mpInstance->NumLinks(ELinkType::Incoming); iIn++)
{
@ -631,7 +635,6 @@ void CScriptNode::TestGameModeVisibility()
// Don't render if we don't have an ingame model, or if this is the Prime series and the instance is not active.
if ((Template()->Game() < EGame::DKCReturns && !mpInstance->IsActive()) || !mpInstance->HasInGameModel())
mGameModeVisibility = EGameModeVisibility::NotVisible;
// If this is Returns, only render if the instance is active OR if it has a near visible activation.
else
mGameModeVisibility = (mpInstance->IsActive() || mpInstance->HasNearVisibleActivation()) ? EGameModeVisibility::Visible : EGameModeVisibility::NotVisible;
@ -663,7 +666,7 @@ CModel* CScriptNode::ActiveModel() const
{
if (mpDisplayAsset->Type() == EResourceType::Model)
return static_cast<CModel*>(mpDisplayAsset.RawPointer());
else if (mpDisplayAsset->Type() == EResourceType::AnimSet || mpDisplayAsset->Type() == EResourceType::Character)
if (mpDisplayAsset->Type() == EResourceType::AnimSet || mpDisplayAsset->Type() == EResourceType::Character)
return static_cast<CAnimSet*>(mpDisplayAsset.RawPointer())->Character(mCharIndex)->pModel;
}
@ -674,15 +677,18 @@ CAnimSet* CScriptNode::ActiveAnimSet() const
{
if (mpDisplayAsset && (mpDisplayAsset->Type() == EResourceType::AnimSet || mpDisplayAsset->Type() == EResourceType::Character))
return static_cast<CAnimSet*>(mpDisplayAsset.RawPointer());
else
return nullptr;
return nullptr;
}
CSkeleton* CScriptNode::ActiveSkeleton() const
{
CAnimSet *pSet = ActiveAnimSet();
if (pSet) return pSet->Character(mCharIndex)->pSkeleton;
else return nullptr;
if (pSet)
return pSet->Character(mCharIndex)->pSkeleton;
return nullptr;
}
CAnimation* CScriptNode::ActiveAnimation() const
@ -712,7 +718,7 @@ bool CScriptNode::HasPreviewVolume() const
CAABox CScriptNode::PreviewVolumeAABox() const
{
if (!mHasVolumePreview)
return CAABox::skZero;
return CAABox::Zero();
else
return mpVolumePreviewNode->AABox();
}
@ -752,7 +758,7 @@ void CScriptNode::SetDisplayAsset(CResource *pRes)
mAnimIndex = (IsAnimSet ? mpInstance->ActiveAnimIndex() : -1);
CModel *pModel = ActiveModel();
mLocalAABox = (pModel ? pModel->AABox() : CAABox::skOne);
mLocalAABox = (pModel ? pModel->AABox() : CAABox::One());
MarkTransformChanged();
for (uint32 iAttach = 0; iAttach < mAttachments.size(); iAttach++)
@ -768,7 +774,7 @@ void CScriptNode::CalculateTransform(CTransform4f& rOut) const
if (pTemp->ScaleType() != CScriptTemplate::EScaleType::ScaleDisabled)
{
CVector3f Scale = (HasPreviewVolume() ? CVector3f::skOne : AbsoluteScale());
CVector3f Scale = (HasPreviewVolume() ? CVector3f::One() : AbsoluteScale());
rOut.Scale(Scale * pTemp->PreviewScale());
}

View File

@ -9,7 +9,7 @@ CStaticNode::CStaticNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent, CSt
, mpModel(pModel)
{
mLocalAABox = mpModel->AABox();
mScale = CVector3f::skOne;
mScale = CVector3f::One();
SetName("Static Node");
}
@ -68,8 +68,8 @@ void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderComman
if (IsLightingEnabled)
{
CGraphics::sNumLights = 0;
CGraphics::sVertexBlock.COLOR0_Amb = UseWhiteAmbient ? CColor::skTransparentWhite : CColor::skTransparentBlack;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skBlack;
CGraphics::sVertexBlock.COLOR0_Amb = UseWhiteAmbient ? CColor::TransparentWhite() : CColor::TransparentBlack();
CGraphics::sVertexBlock.COLOR0_Mat = CColor::Black();
CGraphics::sPixelBlock.LightmapMultiplier = 1.0f;
CGraphics::UpdateLightBlock();
}
@ -78,8 +78,8 @@ void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderComman
{
LoadLights(rkViewInfo);
if (CGraphics::sLightMode == CGraphics::ELightingMode::None || UseWhiteAmbient)
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skTransparentWhite;
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skWhite;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::TransparentWhite();
CGraphics::sVertexBlock.COLOR0_Mat = CColor::White();
}
float Mul = CGraphics::sWorldLightMultiplier;

View File

@ -123,7 +123,7 @@ void CDamageableTriggerExtra::UpdatePlaneTransform()
}
if (mRenderSide == ERenderSide::NoRender)
mLocalAABox = CAABox::skZero;
mLocalAABox = CAABox::Zero();
else
mLocalAABox = CAABox(CVector3f(-1.f, -1.f, 0.f), CVector3f(1.f, 1.f, 0.f));

View File

@ -30,9 +30,8 @@ void CDoorExtra::PropertyModified(IProperty* pProperty)
if (mpShieldModel)
mLocalAABox = mpShieldModel->AABox();
else
mLocalAABox = CAABox::skInfinite;
mLocalAABox = CAABox::Infinite();
MarkTransformChanged();
}
@ -46,10 +45,10 @@ void CDoorExtra::PropertyModified(IProperty* pProperty)
{
// The Echoes demo doesn't have the shield color property. The color is
// always cyan if the door is unlocked and always white if the door is locked.
mShieldColor = CColor::skWhite;
mShieldColor = CColor::White();
if (!mDisabledProp)
mShieldColor = CColor::skCyan;
mShieldColor = CColor::Cyan();
}
}
@ -79,7 +78,7 @@ void CDoorExtra::Draw(FRenderOptions Options, int /*ComponentIndex*/, ERenderCom
CColor Tint = mpParent->TintColor(rkViewInfo) * mShieldColor;
CGraphics::sPixelBlock.TintColor = Tint;
CGraphics::sPixelBlock.SetAllTevColors(CColor::skWhite);
CGraphics::sPixelBlock.SetAllTevColors(CColor::White());
CGraphics::UpdatePixelBlock();
DrawModelParts(mpShieldModel, Options, 0, Command);
}

View File

@ -52,21 +52,21 @@ CColor CRadiusSphereExtra::Color() const
// Repulsor
case 0x63:
case FOURCC('REPL'):
return CColor::skGreen;
return CColor::Green();
// RadialDamage
case 0x68:
case FOURCC('RADD'):
return CColor::skRed;
return CColor::Red();
default:
return CColor::skWhite;
return CColor::White();
}
}
CAABox CRadiusSphereExtra::Bounds() const
{
CAABox Bounds = CAABox::skOne * 2.f * mRadius;
CAABox Bounds = CAABox::One() * 2.f * mRadius;
Bounds += mpParent->AbsolutePosition();
return Bounds;
}

View File

@ -56,7 +56,7 @@ public:
virtual void LinksModified() {}
virtual bool ShouldDrawNormalAssets() { return true; }
virtual bool ShouldDrawVolume() { return true; }
virtual CColor TevColor() { return CColor::skWhite; }
virtual CColor TevColor() { return CColor::White(); }
virtual void ModifyTintColor(CColor& /*Color*/) {}
// Create Script Extra

View File

@ -19,16 +19,16 @@ CColor CSpacePirateExtra::TevColor()
{
// Priority: Plasma -> Ice -> Power -> Wave
if (mPlasmaVulnerability.IsValid() && mPlasmaVulnerability.Get() == EVulnerabilityTypeMP1::Normal)
return CColor::skRed;
return CColor::Red();
if (mIceVulnerability.IsValid() && mIceVulnerability.Get() == EVulnerabilityTypeMP1::Normal)
return CColor::skWhite;
return CColor::White();
if (mPowerVulnerability.IsValid() && mPowerVulnerability.Get() == EVulnerabilityTypeMP1::Normal)
return CColor::skYellow;
return CColor::Yellow();
if (mWaveVulnerability.IsValid() && mWaveVulnerability.Get() == EVulnerabilityTypeMP1::Normal)
return CColor::skPurple;
return CColor::Purple();
return CColor::skWhite;
return CColor::White();
}

View File

@ -17,7 +17,7 @@ class CSplinePathExtra : public CScriptExtra
public:
explicit CSplinePathExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = nullptr);
~CSplinePathExtra() override { ClearWaypoints(); }
CColor PathColor() const { return mPathColor.IsValid() ? mPathColor.Get() : CColor::skBlack; }
CColor PathColor() const { return mPathColor.IsValid() ? mPathColor.Get() : CColor::Black(); }
void PostLoad() override;
void PropertyModified(IProperty* pProperty) override;

View File

@ -37,11 +37,9 @@ void CWaypointExtra::CheckColor()
mColor = pMat->Konst(0);
}
}
// Use preset color (DKCR)
else
else // Use preset color (DKCR)
{
mColor = CColor::skCyan;
mColor = CColor::Cyan();
}
mColor.A = 0;
@ -141,7 +139,7 @@ void CWaypointExtra::OnTransformed()
for (uint32 iLink = 0; iLink < mLinks.size(); iLink++)
{
SWaypointLink& rLink = mLinks[iLink];
rLink.LineAABB = CAABox::skInfinite;
rLink.LineAABB = CAABox::Infinite();
rLink.LineAABB.ExpandBounds(AbsolutePosition());
rLink.LineAABB.ExpandBounds(rLink.pWaypoint->AbsolutePosition());
}
@ -183,5 +181,5 @@ void CWaypointExtra::Draw(FRenderOptions /*Options*/, int ComponentIndex, ERende
CColor CWaypointExtra::TevColor()
{
return (mGame < EGame::DKCReturns ? CColor::skWhite : mColor);
return (mGame < EGame::DKCReturns ? CColor::White() : mColor);
}

View File

@ -8,7 +8,7 @@
class CWaypointExtra : public CScriptExtra
{
// Draw waypoint paths formed by script connections
CColor mColor{CColor::skBlack};
CColor mColor{CColor::Black()};
bool mLinksBuilt = false;
std::list<CSplinePathExtra*> mPaths;

View File

@ -341,7 +341,7 @@ void CBasicViewport::DrawAxes()
CGraphics::UpdateMVPBlock();
glLineWidth(1.f);
CDrawUtil::DrawLine(CVector3f(0,0,0), CVector3f(1,0,0), CColor::skRed); // X
CDrawUtil::DrawLine(CVector3f(0,0,0), CVector3f(0,1,0), CColor::skGreen); // Y
CDrawUtil::DrawLine(CVector3f(0,0,0), CVector3f(0,0,1), CColor::skBlue); // Z
CDrawUtil::DrawLine(CVector3f::Zero(), CVector3f(1,0,0), CColor::Red()); // X
CDrawUtil::DrawLine(CVector3f::Zero(), CVector3f(0,1,0), CColor::Green()); // Y
CDrawUtil::DrawLine(CVector3f::Zero(), CVector3f(0,0,1), CColor::Blue()); // Z
}

View File

@ -19,17 +19,17 @@ CGizmo::CGizmo()
, mHasTransformed(false)
, mWrapOffset(0.f)
, mEnableCursorWrap(true)
, mPosition(CVector3f::skZero)
, mRotation(CQuaternion::skIdentity)
, mLocalRotation(CQuaternion::skIdentity)
, mScale(CVector3f::skOne)
, mPosition(CVector3f::Zero())
, mRotation(CQuaternion::Identity())
, mLocalRotation(CQuaternion::Identity())
, mScale(CVector3f::One())
, mFlipScaleX(false)
, mFlipScaleY(false)
, mFlipScaleZ(false)
, mDeltaTranslation(CVector3f::skZero)
, mDeltaRotation(CQuaternion::skIdentity)
, mDeltaScale(CVector3f::skOne)
, mTotalScale(CVector3f::skOne)
, mDeltaTranslation(CVector3f::Zero())
, mDeltaRotation(CQuaternion::Identity())
, mDeltaScale(CVector3f::One())
, mTotalScale(CVector3f::One())
, mSetOffset(false)
{
LoadModels();
@ -80,7 +80,7 @@ void CGizmo::Draw(FRenderOptions /*Options*/, int ComponentIndex, ERenderCommand
CGraphics::UpdateMVPBlock();
// Clear tint color
CGraphics::sPixelBlock.TintColor = CColor::skWhite;
CGraphics::sPixelBlock.TintColor = CColor::White();
CGraphics::UpdatePixelBlock();
// Choose material set
@ -98,7 +98,8 @@ void CGizmo::IncrementSize()
static const float skMaxSize = powf(skIncAmount, 4);
mGizmoSize *= skIncAmount;
if (mGizmoSize > skMaxSize) mGizmoSize = skMaxSize;
if (mGizmoSize > skMaxSize)
mGizmoSize = skMaxSize;
}
void CGizmo::DecrementSize()
@ -107,7 +108,8 @@ void CGizmo::DecrementSize()
static const float skMinSize = powf(skDecAmount, 4);
mGizmoSize *= skDecAmount;
if (mGizmoSize < skMinSize) mGizmoSize = skMinSize;
if (mGizmoSize < skMinSize)
mGizmoSize = skMinSize;
}
void CGizmo::UpdateForCamera(const CCamera& rkCamera)
@ -118,13 +120,13 @@ void CGizmo::UpdateForCamera(const CCamera& rkCamera)
mFlipScaleY = (mRotation.YAxis().Dot(CameraToGizmo) >= 0.f);
mFlipScaleZ = (mRotation.ZAxis().Dot(CameraToGizmo) >= 0.f);
if ((!mIsTransforming) || (mMode != EGizmoMode::Translate))
if (!mIsTransforming || mMode != EGizmoMode::Translate)
mCameraDist = mPosition.Distance(CamPos);
// todo: make this cleaner...
CVector3f BillDir = (CamPos - mPosition).Normalized();
CVector3f Axis = CVector3f::skForward.Cross(BillDir);
float Angle = acosf(CVector3f::skForward.Dot(BillDir));
CVector3f Axis = CVector3f::Forward().Cross(BillDir);
float Angle = acosf(CVector3f::Forward().Dot(BillDir));
mBillboardRotation = CQuaternion::FromAxisAngle(Angle, Axis);
}
@ -155,8 +157,8 @@ bool CGizmo::CheckSelectedAxes(const CRay& rkRay)
// Ray/Model AABox test - allow buffer room because lines are small
CAABox AABox = pModel->AABox();
AABox.ExpandBy(CVector3f::skOne);
bool ModelBoxCheck = Math::RayBoxIntersection(rPartRay, AABox).first;
AABox.ExpandBy(CVector3f::One());
const bool ModelBoxCheck = Math::RayBoxIntersection(rPartRay, AABox).first;
if (ModelBoxCheck)
{
@ -198,16 +200,15 @@ bool CGizmo::CheckSelectedAxes(const CRay& rkRay)
}
// Otherwise, we have at least one hit - sort results and set selected axes
Results.sort([](const SResult& rkLeft, SResult& rkRight) -> bool
{
return (rkLeft.Dist < rkRight.Dist);
});
Results.sort([](const SResult& rkLeft, SResult& rkRight) {
return rkLeft.Dist < rkRight.Dist;
});
CRay& rPartRay = (pPart->IsBillboard ? BillRay : LocalRay);
mSelectedAxes = Results.front().pPart->ModelAxes;
mHitPoint = mTransform * rPartRay.PointOnRay(Results.front().Dist);
return (mSelectedAxes != EAxis::None);
return mSelectedAxes != EAxis::None;
}
uint32 CGizmo::NumSelectedAxes()
@ -229,25 +230,27 @@ void CGizmo::StartTransform()
{
mIsTransforming = true;
mHasTransformed = false;
mWrapOffset = CVector2f::skZero;
mWrapOffset = CVector2f::Zero();
mSetOffset = false;
mTotalTranslation = CVector3f::skZero;
mTotalRotation = CVector3f::skZero;
mCurrentRotation = CQuaternion::skIdentity;
mTotalScale = CVector3f::skOne;
mTotalTranslation = CVector3f::Zero();
mTotalRotation = CVector3f::Zero();
mCurrentRotation = CQuaternion::Identity();
mTotalScale = CVector3f::One();
// Set rotation direction
if (mMode == EGizmoMode::Rotate)
{
CVector3f Axis;
if (mSelectedAxes & EAxis::X) Axis = mRotation.XAxis();
else if (mSelectedAxes & EAxis::Y) Axis = mRotation.YAxis();
else Axis = mRotation.ZAxis();
if (mSelectedAxes & EAxis::X)
Axis = mRotation.XAxis();
else if (mSelectedAxes & EAxis::Y)
Axis = mRotation.YAxis();
else
Axis = mRotation.ZAxis();
CVector3f GizmoToHit = (mHitPoint - mPosition).Normalized();
const CVector3f GizmoToHit = (mHitPoint - mPosition).Normalized();
mMoveDir = Axis.Cross(GizmoToHit);
}
// Set scale direction
else if (mMode == EGizmoMode::Scale)
{
@ -257,16 +260,18 @@ void CGizmo::StartTransform()
// One axis; direction = selected axis
if (NumSelectedAxes() == 1)
{
if (mSelectedAxes & EAxis::X) mMoveDir = mRotation.XAxis();
else if (mSelectedAxes & EAxis::Y) mMoveDir = mRotation.YAxis();
else mMoveDir = mRotation.ZAxis();
if (mSelectedAxes & EAxis::X)
mMoveDir = mRotation.XAxis();
else if (mSelectedAxes & EAxis::Y)
mMoveDir = mRotation.YAxis();
else
mMoveDir = mRotation.ZAxis();
}
// Two axes; interpolate between the two selected axes
else if (NumSelectedAxes() == 2)
{
CVector3f AxisA = (mSelectedAxes & EAxis::X ? mRotation.XAxis() : mRotation.YAxis());
CVector3f AxisB = (mSelectedAxes & EAxis::Z ? mRotation.ZAxis() : mRotation.YAxis());
const CVector3f AxisA = (mSelectedAxes & EAxis::X ? mRotation.XAxis() : mRotation.YAxis());
const CVector3f AxisB = (mSelectedAxes & EAxis::Z ? mRotation.ZAxis() : mRotation.YAxis());
mMoveDir = (AxisA + AxisB) / 2.f;
}
}
@ -296,18 +301,20 @@ bool CGizmo::TransformFromInput(const CRay& rkRay, CCamera& rCamera)
if (NumAxes == 1)
{
if (mSelectedAxes & EAxis::X) AxisB = mRotation.XAxis();
else if (mSelectedAxes & EAxis::Y) AxisB = mRotation.YAxis();
else AxisB = mRotation.ZAxis();
if (mSelectedAxes & EAxis::X)
AxisB = mRotation.XAxis();
else if (mSelectedAxes & EAxis::Y)
AxisB = mRotation.YAxis();
else
AxisB = mRotation.ZAxis();
CVector3f GizmoToCamera = (mPosition - rCamera.Position()).Normalized();
AxisA = AxisB.Cross(GizmoToCamera);
}
else if (NumAxes == 2)
{
AxisA = (mSelectedAxes & EAxis::X ? mRotation.XAxis() : mRotation.YAxis());
AxisB = (mSelectedAxes & EAxis::Z ? mRotation.ZAxis() : mRotation.YAxis());
AxisA = mSelectedAxes & EAxis::X ? mRotation.XAxis() : mRotation.YAxis();
AxisB = mSelectedAxes & EAxis::Z ? mRotation.ZAxis() : mRotation.YAxis();
}
CVector3f PlaneNormal = AxisA.Cross(AxisB);
@ -323,58 +330,65 @@ bool CGizmo::TransformFromInput(const CRay& rkRay, CCamera& rCamera)
// Calculate new position
CVector3f NewPos = mPosition;
if (mSelectedAxes & EAxis::X) NewPos += mRotation.XAxis() * LocalDelta.X;
if (mSelectedAxes & EAxis::Y) NewPos += mRotation.YAxis() * LocalDelta.Y;
if (mSelectedAxes & EAxis::Z) NewPos += mRotation.ZAxis() * LocalDelta.Z;
if (mSelectedAxes & EAxis::X)
NewPos += mRotation.XAxis() * LocalDelta.X;
if (mSelectedAxes & EAxis::Y)
NewPos += mRotation.YAxis() * LocalDelta.Y;
if (mSelectedAxes & EAxis::Z)
NewPos += mRotation.ZAxis() * LocalDelta.Z;
// Check relativity of new pos to camera to reduce issue where the gizmo might
// go flying off into the distance if newPosToCamera is parallel to the plane
CVector3f NewPosToCamera = (NewPos - rCamera.Position()).Normalized();
float Dot = Math::Abs(PlaneNormal.Dot(NewPosToCamera));
if (Dot < 0.02f) return false;
if (Dot < 0.02f)
return false;
// Set offset
if (!mSetOffset)
{
mTranslateOffset = mPosition - NewPos;
mDeltaTranslation = CVector3f::skZero;
mDeltaTranslation = CVector3f::Zero();
mSetOffset = true;
return false;
}
// Apply translation
else
else // Apply translation
{
mDeltaTranslation = mRotation.Inverse() * (NewPos - mPosition + mTranslateOffset);
if (!(mSelectedAxes & EAxis::X)) mDeltaTranslation.X = 0.f;
if (!(mSelectedAxes & EAxis::Y)) mDeltaTranslation.Y = 0.f;
if (!(mSelectedAxes & EAxis::Z)) mDeltaTranslation.Z = 0.f;
if (!(mSelectedAxes & EAxis::X))
mDeltaTranslation.X = 0.f;
if (!(mSelectedAxes & EAxis::Y))
mDeltaTranslation.Y = 0.f;
if (!(mSelectedAxes & EAxis::Z))
mDeltaTranslation.Z = 0.f;
mTotalTranslation += mDeltaTranslation;
mPosition += mRotation * mDeltaTranslation;
if (!mHasTransformed && (mDeltaTranslation != CVector3f::skZero))
if (!mHasTransformed && (mDeltaTranslation != CVector3f::Zero()))
mHasTransformed = true;
return mHasTransformed;
}
}
else
{
mDeltaTranslation = CVector3f::skZero;
mDeltaTranslation = CVector3f::Zero();
return false;
}
}
// Rotate
else if (mMode == EGizmoMode::Rotate)
if (mMode == EGizmoMode::Rotate)
{
// Choose rotation axis
CVector3f Axis;
if (mSelectedAxes & EAxis::X) Axis = CVector3f::skUnitX;
else if (mSelectedAxes & EAxis::Y) Axis = CVector3f::skUnitY;
else Axis = CVector3f::skUnitZ;
if (mSelectedAxes & EAxis::X)
Axis = CVector3f::UnitX();
else if (mSelectedAxes & EAxis::Y)
Axis = CVector3f::UnitY();
else
Axis = CVector3f::UnitZ();
// Convert hit point + move direction into a line in screen space
// Clockwise direction is set in StartTransform(). Is there a cleaner way to calculate the direction?
@ -387,7 +401,7 @@ bool CGizmo::TransformFromInput(const CRay& rkRay, CCamera& rCamera)
if (!mSetOffset)
{
mRotateOffset = -RotAmount;
mDeltaRotation = CQuaternion::skIdentity;
mDeltaRotation = CQuaternion::Identity();
mSetOffset = true;
return false;
}
@ -402,18 +416,21 @@ bool CGizmo::TransformFromInput(const CRay& rkRay, CCamera& rCamera)
mRotation *= mDeltaRotation;
// Add to total
if (mSelectedAxes & EAxis::X) mTotalRotation.X = RotAmount;
else if (mSelectedAxes & EAxis::Y) mTotalRotation.Y = RotAmount;
else mTotalRotation.Z = RotAmount;
if (mSelectedAxes & EAxis::X)
mTotalRotation.X = RotAmount;
else if (mSelectedAxes & EAxis::Y)
mTotalRotation.Y = RotAmount;
else
mTotalRotation.Z = RotAmount;
if (!mHasTransformed && (RotAmount != 0.f))
if (!mHasTransformed && RotAmount != 0.f)
mHasTransformed = true;
return mHasTransformed;
}
// Scale
else if (mMode == EGizmoMode::Scale)
if (mMode == EGizmoMode::Scale)
{
// Create a line in screen space. First step: line origin
CMatrix4f VP = rCamera.ViewMatrix().Transpose() * rCamera.ProjectionMatrix().Transpose();
@ -431,9 +448,12 @@ bool CGizmo::TransformFromInput(const CRay& rkRay, CCamera& rCamera)
if (NumSelectedAxes() == 1)
{
CVector3f WorldDir;
if (mSelectedAxes & EAxis::X) WorldDir = DirX;
else if (mSelectedAxes & EAxis::Y) WorldDir = DirY;
else WorldDir = DirZ;
if (mSelectedAxes & EAxis::X)
WorldDir = DirX;
else if (mSelectedAxes & EAxis::Y)
WorldDir = DirY;
else
WorldDir = DirZ;
LineDir = (((mPosition + WorldDir) * VP).XY() - LineOrigin).Normalized();
}
// Two axes - take the two selected axes and convert them to world space, then average them for the line direction
@ -445,16 +465,17 @@ bool CGizmo::TransformFromInput(const CRay& rkRay, CCamera& rCamera)
CVector2f ScreenB = (((mPosition + AxisB) * VP).XY() - LineOrigin).Normalized();
LineDir = ((ScreenA + ScreenB) / 2.f).Normalized();
}
// Three axes - use straight up
else LineDir = CVector2f::skUp;
else // Three axes - use straight up
{
LineDir = CVector2f::Up();
}
float ScaleAmount = LineDir.Dot(MouseCoords + mWrapOffset - LineOrigin) * 5.f;
// Set offset
if (!mSetOffset)
{
mScaleOffset = -ScaleAmount;
mDeltaScale = CVector3f::skOne;
mDeltaScale = CVector3f::One();
mSetOffset = true;
return false;
}
@ -468,10 +489,13 @@ bool CGizmo::TransformFromInput(const CRay& rkRay, CCamera& rCamera)
CVector3f OldScale = mTotalScale;
mTotalScale = CVector3f::skOne;
if (mSelectedAxes & EAxis::X) mTotalScale.X = ScaleAmount;
if (mSelectedAxes & EAxis::Y) mTotalScale.Y = ScaleAmount;
if (mSelectedAxes & EAxis::Z) mTotalScale.Z = ScaleAmount;
mTotalScale = CVector3f::One();
if (mSelectedAxes & EAxis::X)
mTotalScale.X = ScaleAmount;
if (mSelectedAxes & EAxis::Y)
mTotalScale.Y = ScaleAmount;
if (mSelectedAxes & EAxis::Z)
mTotalScale.Z = ScaleAmount;
mDeltaScale = mTotalScale / OldScale;
@ -486,7 +510,7 @@ bool CGizmo::TransformFromInput(const CRay& rkRay, CCamera& rCamera)
void CGizmo::EndTransform()
{
mTotalScale = CVector3f::skOne;
mTotalScale = CVector3f::One();
mIsTransforming = false;
}
@ -499,22 +523,22 @@ void CGizmo::SetMode(EGizmoMode Mode)
case EGizmoMode::Translate:
mpCurrentParts = smTranslateModels;
mNumCurrentParts = CGIZMO_TRANSLATE_NUM;
mDeltaRotation = CQuaternion::skIdentity;
mDeltaScale = CVector3f::skOne;
mDeltaRotation = CQuaternion::Identity();
mDeltaScale = CVector3f::One();
break;
case EGizmoMode::Rotate:
mpCurrentParts = smRotateModels;
mNumCurrentParts = CGIZMO_ROTATE_NUM;
mDeltaTranslation = CVector3f::skZero;
mDeltaScale = CVector3f::skOne;
mDeltaTranslation = CVector3f::Zero();
mDeltaScale = CVector3f::One();
break;
case EGizmoMode::Scale:
mpCurrentParts = smScaleModels;
mNumCurrentParts = CGIZMO_SCALE_NUM;
mDeltaTranslation = CVector3f::skZero;
mDeltaRotation = CQuaternion::skIdentity;
mDeltaTranslation = CVector3f::Zero();
mDeltaRotation = CQuaternion::Identity();
break;
default: break;
}
@ -525,7 +549,7 @@ void CGizmo::SetTransformSpace(ETransformSpace Space)
mTransformSpace = Space;
if (Space == ETransformSpace::World)
mRotation = CQuaternion::skIdentity;
mRotation = CQuaternion::Identity();
else
mRotation = mLocalRotation;
}

View File

@ -24,7 +24,7 @@ public:
void AddToRenderer(CRenderer *pRenderer, const SViewInfo&)
{
pRenderer->AddMesh(this, 0, CAABox::skOne, false, ERenderCommand::DrawMesh);
pRenderer->AddMesh(this, 0, CAABox::One(), false, ERenderCommand::DrawMesh);
}
void Draw(FRenderOptions, int, ERenderCommand, const SViewInfo&)

View File

@ -28,7 +28,7 @@ public:
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& /*rkViewInfo*/)
{
pRenderer->AddMesh(this, -1, CAABox::skInfinite, false, ERenderCommand::DrawMesh);
pRenderer->AddMesh(this, -1, CAABox::Infinite(), false, ERenderCommand::DrawMesh);
}
void Draw(FRenderOptions, int, ERenderCommand, const SViewInfo&)

View File

@ -86,7 +86,7 @@ public:
{
if (mBoundsDirty)
{
mCachedBounds = CAABox::skInfinite;
mCachedBounds = CAABox::Infinite();
foreach (CSceneNode *pNode, mSelectedNodes)
{

View File

@ -16,15 +16,15 @@ CSceneViewport::CSceneViewport(QWidget *pParent)
, mRenderingMergedWorld(true)
, mGizmoTransforming(false)
, mpHoverNode(nullptr)
, mHoverPoint(CVector3f::skZero)
, mHoverPoint(CVector3f::Zero())
, mpContextMenu(nullptr)
, mpMenuNode(nullptr)
{
mGrid.SetColor(CColor(0.f, 0.f, 0.6f, 0.f), CColor(0.f, 0.f, 1.f, 0.f));
mLinkLine.SetColor(CColor::skYellow);
mLinkLine.SetColor(CColor::Yellow());
mpRenderer = new CRenderer();
mpRenderer->SetClearColor(CColor::skBlack);
mpRenderer->SetClearColor(CColor::Black());
qreal pixelRatio = devicePixelRatioF();
mpRenderer->SetViewportSize(width() * pixelRatio, height() * pixelRatio);
@ -306,7 +306,7 @@ void CSceneViewport::Paint()
{
if (!mpScene) return;
mpRenderer->SetClearColor(CColor::skBlack);
mpRenderer->SetClearColor(CColor::Black());
mpRenderer->BeginFrame();
// todo: The sky should really just be a regular node in the background depth group instead of having special rendering code here

View File

@ -11,7 +11,7 @@ CModelEditorViewport::CModelEditorViewport(QWidget *pParent)
mpRenderer = new CRenderer();
qreal pixelRatio = devicePixelRatioF();
mpRenderer->SetViewportSize(width() * pixelRatio, height() * pixelRatio);
mpRenderer->SetClearColor(CColor::skBlack);
mpRenderer->SetClearColor(CColor::Black());
mpRenderer->ToggleGrid(true);
mViewInfo.pRenderer = mpRenderer;

View File

@ -2,7 +2,7 @@
WVectorEditor::WVectorEditor(QWidget *pParent)
: QWidget(pParent)
, mValue(CVector3f::skZero)
, mValue(CVector3f::Zero())
, mEditing(false)
{
SetupUI();

View File

@ -812,7 +812,7 @@ void CWorldEditor::UpdateGizmoUI()
// Update transform XYZ spin boxes
if (!ui->TransformSpinBox->IsBeingEdited())
{
CVector3f SpinBoxValue = CVector3f::skZero;
CVector3f SpinBoxValue = CVector3f::Zero();
// If the gizmo is transforming, use the total transform amount
// Otherwise, use the first selected node transform, or 0 if no selection