diff --git a/src/Core/Resource/CLight.cpp b/src/Core/Resource/CLight.cpp index e41481e4..2f6b3939 100644 --- a/src/Core/Resource/CLight.cpp +++ b/src/Core/Resource/CLight.cpp @@ -4,17 +4,11 @@ #include #include -#define CLIGHT_NO_RADIUS 0x40 -#define CLIGHT_NO_INTENSITY 0x80 +constexpr uint32_t CLIGHT_NO_RADIUS = 0x40; +constexpr uint32_t CLIGHT_NO_INTENSITY = 0x80; CLight::CLight() - : mPosition(skDefaultLightPos) - , mDirection(skDefaultLightDir) - , mDistAttenCoefficients(0.f, 1.f, 0.f) - , mAngleAttenCoefficients(0.f, 1.f, 0.f) - , mCachedRadius(0.f) - , mCachedIntensity(0.f) - , mDirtyFlags(CLIGHT_NO_RADIUS | CLIGHT_NO_INTENSITY) + : mDirtyFlags(CLIGHT_NO_RADIUS | CLIGHT_NO_INTENSITY) { } @@ -289,7 +283,3 @@ CLight CLight::BuildCustom(const CVector3f& rkPosition, const CVector3f& rkDirec pLight.mAngleAttenCoefficients.Z = AngleAttenC * AngleAttenC; return pLight; } - -// ************ CONSTANTS ************ -const CVector3f CLight::skDefaultLightPos(0.f, 0.f, 0.f); -const CVector3f CLight::skDefaultLightDir(0.f,-1.f, 0.f); diff --git a/src/Core/Resource/CLight.h b/src/Core/Resource/CLight.h index 5db52414..ce1635ce 100644 --- a/src/Core/Resource/CLight.h +++ b/src/Core/Resource/CLight.h @@ -19,17 +19,17 @@ enum class ELightType class CLight { - ELightType mType; - uint32 mLayerIndex; - CVector3f mPosition; - CVector3f mDirection; + ELightType mType{}; + uint32 mLayerIndex = 0; + CVector3f mPosition{skDefaultLightPos}; + CVector3f mDirection{skDefaultLightDir}; CColor mColor; - float mSpotCutoff; - CVector3f mDistAttenCoefficients; - CVector3f mAngleAttenCoefficients; + float mSpotCutoff = 0.0f; + CVector3f mDistAttenCoefficients{0.f, 1.f, 0.f}; + CVector3f mAngleAttenCoefficients{0.f, 1.f, 0.f}; - mutable float mCachedRadius; - mutable float mCachedIntensity; + mutable float mCachedRadius = 0.0f; + mutable float mCachedIntensity = 0.0f; mutable uint8 mDirtyFlags; public: @@ -77,8 +77,8 @@ public: float AngleAttenA, float AngleAttenB, float AngleAttenC); // Constants - static const CVector3f skDefaultLightPos; - static const CVector3f skDefaultLightDir; + static constexpr CVector3f skDefaultLightPos{0.f, 0.f, 0.f}; + static constexpr CVector3f skDefaultLightDir{0.f, -1.f, 0.f}; }; #endif // CLIGHT_H