mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
random constexpr
This commit is contained in:
parent
82115849b1
commit
d40fff0b05
2 changed files with 13 additions and 13 deletions
|
@ -17,27 +17,27 @@ public:
|
|||
|
||||
inline CRGBA() {}
|
||||
|
||||
inline CRGBA(const CRGBA& in)
|
||||
inline constexpr CRGBA(const CRGBA& in)
|
||||
: r(in.r), g(in.g), b(in.b), a(in.a)
|
||||
{}
|
||||
|
||||
inline CRGBA(const CRGBA& in, uint8_t alpha)
|
||||
inline constexpr CRGBA(const CRGBA& in, uint8_t alpha)
|
||||
: r(in.r), g(in.g), b(in.b), a(alpha)
|
||||
{}
|
||||
|
||||
|
||||
inline CRGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 255)
|
||||
inline constexpr CRGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 255)
|
||||
: r(red), g(green), b(blue), a(alpha)
|
||||
{}
|
||||
|
||||
friend CRGBA Blend(const CRGBA& From, const CRGBA& To, double BlendVal)
|
||||
friend constexpr CRGBA Blend(const CRGBA& From, const CRGBA& To, double BlendVal)
|
||||
{ double InvBlendVal = 1.0 - BlendVal;
|
||||
return CRGBA( To.r * BlendVal + From.r * InvBlendVal,
|
||||
To.g * BlendVal + From.g * InvBlendVal,
|
||||
To.b * BlendVal + From.b * InvBlendVal,
|
||||
To.a * BlendVal + From.a * InvBlendVal); }
|
||||
|
||||
friend CRGBA BlendSqr(const CRGBA& From, const CRGBA& To, double BlendVal)
|
||||
friend constexpr CRGBA BlendSqr(const CRGBA& From, const CRGBA& To, double BlendVal)
|
||||
{ double InvBlendVal = 1.0 - BlendVal;
|
||||
return CRGBA( sqrt((To.r * To.r) * BlendVal + (From.r * From.r) * InvBlendVal),
|
||||
sqrt((To.g * To.g) * BlendVal + (From.g * From.g) * InvBlendVal),
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
float x2, y2;
|
||||
|
||||
inline CRect() {}
|
||||
inline CRect(float a, float b, float c, float d)
|
||||
inline constexpr CRect(float a, float b, float c, float d)
|
||||
: x1(a), y1(b), x2(c), y2(d)
|
||||
{}
|
||||
};
|
||||
|
|
|
@ -12,11 +12,11 @@ public:
|
|||
CVector()
|
||||
{}
|
||||
|
||||
CVector(float fX, float fY, float fZ=0.0f)
|
||||
constexpr CVector(float fX, float fY, float fZ=0.0f)
|
||||
: x(fX), y(fY), z(fZ)
|
||||
{}
|
||||
|
||||
CVector(const RwV3d& rwVec)
|
||||
constexpr CVector(const RwV3d& rwVec)
|
||||
: x(rwVec.x), y(rwVec.y), z(rwVec.z)
|
||||
{}
|
||||
|
||||
|
@ -33,9 +33,9 @@ public:
|
|||
{ x -= vec.x; y -= vec.y; z -= vec.z;
|
||||
return *this; }
|
||||
|
||||
inline float Magnitude()
|
||||
inline float Magnitude() const
|
||||
{ return sqrt(x * x + y * y + z * z); }
|
||||
inline float MagnitudeSqr()
|
||||
inline constexpr float MagnitudeSqr() const
|
||||
{ return x * x + y * y + z * z; }
|
||||
inline CVector& Normalize()
|
||||
{ float fInvLen = 1.0f / Magnitude(); x *= fInvLen; y *= fInvLen; z *= fInvLen; return *this; }
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
CVector2D()
|
||||
{}
|
||||
|
||||
CVector2D(float fX, float fY)
|
||||
constexpr CVector2D(float fX, float fY)
|
||||
: x(fX), y(fY)
|
||||
{}
|
||||
|
||||
|
@ -80,9 +80,9 @@ public:
|
|||
{ x -= vec.x; y -= vec.y;
|
||||
return *this; }
|
||||
|
||||
inline float Magnitude()
|
||||
inline float Magnitude() const
|
||||
{ return sqrt(x * x + y * y); }
|
||||
inline float MagnitudeSqr()
|
||||
inline constexpr float MagnitudeSqr() const
|
||||
{ return x * x + y * y; }
|
||||
inline CVector2D& Normalize()
|
||||
{ float fInvLen = 1.0f / Magnitude(); x *= fInvLen; y *= fInvLen; return *this; }
|
||||
|
|
Loading…
Reference in a new issue