mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 01:15:26 +00:00
General: Migrate off non-constexpr constants
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -110,7 +110,7 @@ void CGameArea::ClearTerrain()
|
||||
mVertexCount = 0;
|
||||
mTriangleCount = 0;
|
||||
mTerrainMerged = false;
|
||||
mAABox = CAABox::skInfinite;
|
||||
mAABox = CAABox::Infinite();
|
||||
}
|
||||
|
||||
void CGameArea::ClearScriptLayers()
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ?
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)]; }
|
||||
};
|
||||
|
||||
|
||||
@@ -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++)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user