Leviathan  0.8.0.0
Leviathan game engine
Leviathan::Float4 Struct Reference

#include <Types.h>

+ Inheritance diagram for Leviathan::Float4:

Public Member Functions

DLLEXPORT constexpr Float4 () noexcept=default
 
DLLEXPORT constexpr Float4 (float f1, float f2, float f3, float f4)
 
DLLEXPORT constexpr Float4 (Float2 floats, float f3, float f4)
 
DLLEXPORT constexpr Float4 (Float3 floats, float f4)
 
DLLEXPORT constexpr Float4 (float data)
 
DLLEXPORT bool HasInvalidValues () const noexcept
 
DLLEXPORT void CheckForNans () const
 
DLLEXPORT float & operator[] (unsigned nindex)
 
DLLEXPORT float operator[] (unsigned nindex) const
 
DLLEXPORT operator float * () noexcept
 return first value of {X, Y, Z, W} as a pointer More...
 
DLLEXPORT Float4 operator+ (const Float4 &other) const noexcept
 
DLLEXPORT Float4operator+= (const Float4 &other) noexcept
 
DLLEXPORT Float4 operator- (const Float4 &other) const noexcept
 
DLLEXPORT Float4operator-= (const Float4 &other) noexcept
 
DLLEXPORT Float4 operator- () const noexcept
 
DLLEXPORT Float4 operator+ () const noexcept
 
DLLEXPORT Float4 operator* (const Float4 &other) const noexcept
 
DLLEXPORT Float4operator*= (const Float4 &other) noexcept
 
DLLEXPORT Float4 operator/ (float val) const
 
DLLEXPORT Float4operator/= (float val)
 
DLLEXPORT Float4 operator* (float val) const noexcept
 
DLLEXPORT Float4operator*= (float val) noexcept
 
DLLEXPORT Float4 operator/ (const Float4 &other) const
 
DLLEXPORT Float4operator/= (const Float4 &other)
 
DLLEXPORT bool operator< (const Float4 &other) const noexcept
 
DLLEXPORT bool operator<= (const Float4 &other) const noexcept
 
DLLEXPORT bool operator> (const Float4 &other) const noexcept
 
DLLEXPORT bool operator>= (const Float4 &other) const noexcept
 
DLLEXPORT bool operator== (const Float4 &other) const noexcept
 
DLLEXPORT bool operator!= (const Float4 &other) const noexcept
 
DLLEXPORT float GetX () const noexcept
 
DLLEXPORT float GetY () const noexcept
 
DLLEXPORT float GetZ () const noexcept
 
DLLEXPORT float GetW () const noexcept
 
DLLEXPORT void SetX (float val)
 
DLLEXPORT void SetY (float val)
 
DLLEXPORT void SetZ (float val)
 
DLLEXPORT void SetW (float val)
 
DLLEXPORT float HAdd () const noexcept
 
DLLEXPORT float HAddAbs () const noexcept
 
DLLEXPORT Float4 MinElements (const Float4 &other) const noexcept
 
DLLEXPORT Float4 MaxElements (const Float4 &other) const noexcept
 
DLLEXPORT Float4 Clamp (const Float4 &min, const Float4 &max) const noexcept
 
DLLEXPORT float Dot (const Float4 &val) const noexcept
 
DLLEXPORT float Length () const noexcept
 
DLLEXPORT float LengthSquared () const noexcept
 
DLLEXPORT Float4 Normalize () const
 
DLLEXPORT Float4 NormalizeSafe (const Float4 &safer=Float4(1, 0, 0, 0)) const noexcept
 
DLLEXPORT bool IsNormalized () const noexcept
 
DLLEXPORT Float4 Lerp (const Float4 &other, float f) const noexcept
 
DLLEXPORT bool Compare (const Float4 &other, float tolerance) const noexcept
 
DLLEXPORT void ConvertToHSB (float &hue, float &saturation, float &brightness) const
 
DLLEXPORT Float4 (const bs::Quaternion &quat)
 
DLLEXPORT Float4 (const bs::Color &colour)
 
DLLEXPORT operator bs::Quaternion () const
 
DLLEXPORT operator bs::Color () const
 
DLLEXPORT operator bs::Vector4 () const
 
DLLEXPORT Float4 (const btQuaternion &quat)
 
DLLEXPORT operator btQuaternion () const
 
 VALUE_TYPE (Float4)
 

Static Public Member Functions

static DLLEXPORT Float4 FromHSB (float hue, float saturation, float brightness)
 
static DLLEXPORT const Float4GetColourBlack ()
 
static DLLEXPORT const Float4GetColourWhite ()
 
static DLLEXPORT const Float4GetColourTransparent ()
 

Public Attributes

float X = 0
 
float Y = 0
 
float Z = 0
 
float W = 0
 

Static Public Attributes

static DLLEXPORT const Float4 ColourBlack = Float4(0, 0, 0, 1)
 
static DLLEXPORT const Float4 ColourWhite = Float4(1, 1, 1, 1)
 
static DLLEXPORT const Float4 ColourTransparent = Float4(0, 0, 0, 0)
 

Detailed Description

Definition at line 1341 of file Types.h.

Constructor & Destructor Documentation

◆ Float4() [1/8]

DLLEXPORT constexpr Leviathan::Float4::Float4 ( )
inlinedefaultnoexcept

◆ Float4() [2/8]

DLLEXPORT constexpr Leviathan::Float4::Float4 ( float  f1,
float  f2,
float  f3,
float  f4 
)
inline

Definition at line 1345 of file Types.h.

1345  :
1346  X(f1), Y(f2), Z(f3), W(f4)
1347  {
1348  DO_NAN_CHECK;
1349  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ Float4() [3/8]

DLLEXPORT constexpr Leviathan::Float4::Float4 ( Float2  floats,
float  f3,
float  f4 
)
inline

Definition at line 1351 of file Types.h.

1351  :
1352  X(floats.X), Y(floats.Y), Z(f3), W(f4)
1353  {
1354  DO_NAN_CHECK;
1355  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ Float4() [4/8]

DLLEXPORT constexpr Leviathan::Float4::Float4 ( Float3  floats,
float  f4 
)
inline

Definition at line 1357 of file Types.h.

1357  :
1358  X(floats.X), Y(floats.Y), Z(floats.Z), W(f4)
1359  {
1360  DO_NAN_CHECK;
1361  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ Float4() [5/8]

DLLEXPORT constexpr Leviathan::Float4::Float4 ( float  data)
inlineexplicit

Definition at line 1363 of file Types.h.

1363  : X(data), Y(data), Z(data), W(data)
1364  {
1365  DO_NAN_CHECK;
1366  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ Float4() [6/8]

DLLEXPORT Leviathan::Float4::Float4 ( const bs::Quaternion &  quat)
inline

Definition at line 1710 of file Types.h.

1711  {
1712  // copy values //
1713  X = quat.x;
1714  Y = quat.y;
1715  Z = quat.z;
1716  W = quat.w;
1717  DO_NAN_CHECK;
1718  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ Float4() [7/8]

DLLEXPORT Leviathan::Float4::Float4 ( const bs::Color &  colour)
inline

Definition at line 1720 of file Types.h.

1721  {
1722  // copy values //
1723  X = colour.r;
1724  Y = colour.g;
1725  Z = colour.b;
1726  W = colour.a;
1727  DO_NAN_CHECK;
1728  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ Float4() [8/8]

DLLEXPORT Leviathan::Float4::Float4 ( const btQuaternion &  quat)
inline

Definition at line 1746 of file Types.h.

1747  {
1748  // copy values //
1749  X = quat.x();
1750  Y = quat.y();
1751  Z = quat.z();
1752  W = quat.w();
1753  DO_NAN_CHECK;
1754  }
#define DO_NAN_CHECK
Definition: Types.h:20

Member Function Documentation

◆ CheckForNans()

DLLEXPORT void Leviathan::Float4::CheckForNans ( ) const
inline

Definition at line 1374 of file Types.h.

1375  {
1376  if(HasInvalidValues()) {
1377  DEBUG_BREAK;
1378  throw std::runtime_error("Float4 has NaNs (or infinites in it) in it!");
1379  }
1380  }
DLLEXPORT bool HasInvalidValues() const noexcept
Definition: Types.h:1368

◆ Clamp()

DLLEXPORT Float4 Leviathan::Float4::Clamp ( const Float4 min,
const Float4 max 
) const
inlinenoexcept

Definition at line 1630 of file Types.h.

1631  {
1632  const Float4 minval = this->MinElements(max);
1633  return min.MaxElements(minval);
1634  }
DLLEXPORT constexpr Float4() noexcept=default
DLLEXPORT Float4 MinElements(const Float4 &other) const noexcept
Definition: Types.h:1617

◆ Compare()

DLLEXPORT bool Leviathan::Float4::Compare ( const Float4 other,
float  tolerance 
) const
inlinenoexcept

Definition at line 1695 of file Types.h.

1696  {
1697  const Float4 difference = (*this) - other;
1698  return difference.Dot(difference) < tolerance * tolerance;
1699  }
DLLEXPORT constexpr Float4() noexcept=default

◆ ConvertToHSB()

DLLEXPORT void Leviathan::Float4::ConvertToHSB ( float &  hue,
float &  saturation,
float &  brightness 
) const

Definition at line 49 of file Types.cpp.

50 {
51  const float vMin = std::min(X, std::min(Y, Z));
52  const float vMax = std::max(X, std::max(Y, Z));
53  const float delta = vMax - vMin;
54 
55  brightness = vMax;
56 
57  if(std::abs(delta - 0.f) < EPSILON) {
58  // grey
59  hue = 0;
60  saturation = 0;
61  } else {
62  // a colour
63  saturation = delta / vMax;
64 
65  float deltaR = (((vMax - X) / 6.0f) + (delta / 2.0f)) / delta;
66  float deltaG = (((vMax - Y) / 6.0f) + (delta / 2.0f)) / delta;
67  float deltaB = (((vMax - Z) / 6.0f) + (delta / 2.0f)) / delta;
68 
69  if(std::abs(X - vMax) < EPSILON)
70  hue = deltaB - deltaG;
71  else if(std::abs(Y - vMax) < EPSILON)
72  hue = 0.3333333f + deltaR - deltaB;
73  else if(std::abs(Z - vMax) < EPSILON)
74  hue = 0.6666667f + deltaG - deltaR;
75 
76  if(hue < 0.0f)
77  hue += 1.0f;
78  if(hue > 1.0f)
79  hue -= 1.0f;
80  }
81 }
constexpr float EPSILON
Definition: Define.h:70

◆ Dot()

DLLEXPORT float Leviathan::Float4::Dot ( const Float4 val) const
inlinenoexcept

Definition at line 1638 of file Types.h.

1639  {
1640  return X * val.X + Y * val.Y + Z * val.Z + W * val.W;
1641  }

◆ FromHSB()

DLLEXPORT Float4 Leviathan::Float4::FromHSB ( float  hue,
float  saturation,
float  brightness 
)
static

Definition at line 83 of file Types.cpp.

84 {
85  Float4 output;
86  output.W = 1.f;
87 
88  // wrap hue
89  if(hue > 1.0f)
90  hue -= (int)hue;
91  else if(hue < 0.0f)
92  hue += (int)hue + 1;
93 
94  // clamp saturation / brightness
95  saturation = std::min(saturation, (float)1.0);
96  saturation = std::max(saturation, (float)0.0);
97  brightness = std::min(brightness, (float)1.0);
98  brightness = std::max(brightness, (float)0.0);
99 
100  if(brightness == 0.0f) {
101  // early exit, this has to be black
102  output.X = output.Y = output.Z = 0.0f;
103  return output;
104  }
105 
106  if(saturation == 0.0f) {
107  // early exit, this has to be grey
108 
109  output.X = output.Y = output.Z = brightness;
110  return output;
111  }
112 
113  float hueDomain = hue * 6.0f;
114  if(hueDomain >= 6.0f) {
115  // wrap around, and allow mathematical errors
116  hueDomain = 0.0f;
117  }
118 
119  const auto domain = (unsigned short)hueDomain;
120  const float f1 = brightness * (1 - saturation);
121  const float f2 = brightness * (1 - saturation * (hueDomain - domain));
122  const float f3 = brightness * (1 - saturation * (1 - (hueDomain - domain)));
123 
124  switch(domain) {
125  case 0:
126  // red domain; green ascends
127  output.X = brightness;
128  output.Y = f3;
129  output.Z = f1;
130  break;
131  case 1:
132  // yellow domain; red descends
133  output.X = f2;
134  output.Y = brightness;
135  output.Z = f1;
136  break;
137  case 2:
138  // green domain; blue ascends
139  output.X = f1;
140  output.Y = brightness;
141  output.Z = f3;
142  break;
143  case 3:
144  // cyan domain; green descends
145  output.X = f1;
146  output.Y = f2;
147  output.Z = brightness;
148  break;
149  case 4:
150  // blue domain; red ascends
151  output.X = f3;
152  output.Y = f1;
153  output.Z = brightness;
154  break;
155  case 5:
156  // magenta domain; blue descends
157  output.X = brightness;
158  output.Y = f1;
159  output.Z = f2;
160  break;
161  }
162 
163  return output;
164 }
DLLEXPORT constexpr Float4() noexcept=default

◆ GetColourBlack()

DLLEXPORT const Float4 & Leviathan::Float4::GetColourBlack ( )
static

Definition at line 31 of file Types.cpp.

32 {
33  return ColourBlack;
34 }
static DLLEXPORT const Float4 ColourBlack
Definition: Types.h:1771

◆ GetColourTransparent()

DLLEXPORT const Float4 & Leviathan::Float4::GetColourTransparent ( )
static

Definition at line 41 of file Types.cpp.

42 {
43  return ColourTransparent;
44 }
static DLLEXPORT const Float4 ColourTransparent
Definition: Types.h:1773

◆ GetColourWhite()

DLLEXPORT const Float4 & Leviathan::Float4::GetColourWhite ( )
static

Definition at line 36 of file Types.cpp.

37 {
38  return ColourWhite;
39 }
static DLLEXPORT const Float4 ColourWhite
Definition: Types.h:1772

◆ GetW()

DLLEXPORT float Leviathan::Float4::GetW ( ) const
inlinenoexcept

Definition at line 1574 of file Types.h.

1575  {
1576  return W;
1577  }

◆ GetX()

DLLEXPORT float Leviathan::Float4::GetX ( ) const
inlinenoexcept

Definition at line 1559 of file Types.h.

1560  {
1561  return X;
1562  }

◆ GetY()

DLLEXPORT float Leviathan::Float4::GetY ( ) const
inlinenoexcept

Definition at line 1564 of file Types.h.

1565  {
1566  return Y;
1567  }

◆ GetZ()

DLLEXPORT float Leviathan::Float4::GetZ ( ) const
inlinenoexcept

Definition at line 1569 of file Types.h.

1570  {
1571  return Z;
1572  }

◆ HAdd()

DLLEXPORT float Leviathan::Float4::HAdd ( ) const
inlinenoexcept

Definition at line 1605 of file Types.h.

1606  {
1607  return X + Y + Z + W;
1608  }

◆ HAddAbs()

DLLEXPORT float Leviathan::Float4::HAddAbs ( ) const
inlinenoexcept

Definition at line 1611 of file Types.h.

1612  {
1613  return std::abs(X) + std::abs(Y) + std::abs(Z) + std::abs(W);
1614  }

◆ HasInvalidValues()

DLLEXPORT bool Leviathan::Float4::HasInvalidValues ( ) const
inlinenoexcept

Definition at line 1368 of file Types.h.

1369  {
1370  return !std::isfinite(X) || !std::isfinite(Y) || !std::isfinite(Z) ||
1371  !std::isfinite(W);
1372  }
#define isfinite
Definition: jsoncpp.cpp:4247

◆ IsNormalized()

DLLEXPORT bool Leviathan::Float4::IsNormalized ( ) const
inlinenoexcept

Definition at line 1680 of file Types.h.

1681  {
1682  // is absolute -1.f under normalization tolerance //
1683  return fabs(X * X + Y * Y + Z * Z + W * W - 1.0f) < NORMALIZATION_TOLERANCE;
1684  }
constexpr float NORMALIZATION_TOLERANCE
For checking vector normalization.
Definition: Define.h:50

◆ Length()

DLLEXPORT float Leviathan::Float4::Length ( ) const
inlinenoexcept

Definition at line 1644 of file Types.h.

1645  {
1646  return std::sqrt(LengthSquared());
1647  }
DLLEXPORT float LengthSquared() const noexcept
Definition: Types.h:1649

◆ LengthSquared()

DLLEXPORT float Leviathan::Float4::LengthSquared ( ) const
inlinenoexcept

Definition at line 1649 of file Types.h.

1650  {
1651  return X * X + Y * Y + Z * Z + W * W;
1652  }

◆ Lerp()

DLLEXPORT Float4 Leviathan::Float4::Lerp ( const Float4 other,
float  f 
) const
inlinenoexcept

Definition at line 1688 of file Types.h.

1689  {
1690  return Float4((other.X - X) * f + X, (other.Y - Y) * f + Y, (other.Z - Z) * f + Z,
1691  (other.W - W) * f + W);
1692  }
DLLEXPORT constexpr Float4() noexcept=default

◆ MaxElements()

DLLEXPORT Float4 Leviathan::Float4::MaxElements ( const Float4 other) const
inlinenoexcept

Definition at line 1623 of file Types.h.

1624  {
1625  return Float4(X > other.X ? X : other.X, Y > other.Y ? Y : other.Y,
1626  Z > other.Z ? Z : other.Z, W > other.W ? W : other.W);
1627  }
DLLEXPORT constexpr Float4() noexcept=default

◆ MinElements()

DLLEXPORT Float4 Leviathan::Float4::MinElements ( const Float4 other) const
inlinenoexcept

Definition at line 1617 of file Types.h.

1618  {
1619  return Float4(X < other.X ? X : other.X, Y < other.Y ? Y : other.Y,
1620  Z < other.Z ? Z : other.Z, W < other.W ? W : other.W);
1621  }
DLLEXPORT constexpr Float4() noexcept=default

◆ Normalize()

DLLEXPORT Float4 Leviathan::Float4::Normalize ( ) const
inline

Definition at line 1655 of file Types.h.

1656  {
1657  const float length = Length();
1658 
1659  if(length == 0) {
1660  // Returns an identity quaternion
1661  return Float4(0, 0, 0, 1);
1662  }
1663 
1664  return (*this) / length;
1665  }
DLLEXPORT constexpr Float4() noexcept=default
DLLEXPORT float Length() const noexcept
Definition: Types.h:1644

◆ NormalizeSafe()

DLLEXPORT Float4 Leviathan::Float4::NormalizeSafe ( const Float4 safer = Float4(1, 0, 0, 0)) const
inlinenoexcept

Definition at line 1668 of file Types.h.

1670  {
1671  // security //
1672  LEVIATHAN_ASSERT(safer.IsNormalized(), "safer not normalized");
1673  if(LengthSquared() == 0)
1674  return safer;
1675  const float length = Length();
1676  return (*this) / length;
1677  }
DLLEXPORT float Length() const noexcept
Definition: Types.h:1644
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:100
DLLEXPORT float LengthSquared() const noexcept
Definition: Types.h:1649

◆ operator bs::Color()

DLLEXPORT Leviathan::Float4::operator bs::Color ( ) const
inline

Definition at line 1736 of file Types.h.

1737  {
1738  return bs::Color(X, Y, Z, W);
1739  }

◆ operator bs::Quaternion()

DLLEXPORT Leviathan::Float4::operator bs::Quaternion ( ) const
inline

Definition at line 1730 of file Types.h.

1731  {
1732  // bsf has these in different order
1733  return bs::Quaternion(W, X, Y, Z);
1734  }

◆ operator bs::Vector4()

DLLEXPORT Leviathan::Float4::operator bs::Vector4 ( ) const
inline

Definition at line 1741 of file Types.h.

1742  {
1743  return bs::Vector4(X, Y, Z, W);
1744  }

◆ operator btQuaternion()

DLLEXPORT Leviathan::Float4::operator btQuaternion ( ) const
inline

Definition at line 1756 of file Types.h.

1757  {
1758  return btQuaternion(X, Y, Z, W);
1759  }

◆ operator float *()

DLLEXPORT Leviathan::Float4::operator float * ( )
inlinenoexcept

return first value of {X, Y, Z, W} as a pointer

Definition at line 1412 of file Types.h.

1413  {
1414  // this should be always confirmed to work //
1415  return &X;
1416  }

◆ operator!=()

DLLEXPORT bool Leviathan::Float4::operator!= ( const Float4 other) const
inlinenoexcept

Definition at line 1552 of file Types.h.

1553  {
1554  return X != other.X || Y != other.Y || Z != other.Z || W != other.W;
1555  }

◆ operator*() [1/2]

DLLEXPORT Float4 Leviathan::Float4::operator* ( const Float4 other) const
inlinenoexcept

Definition at line 1462 of file Types.h.

1463  {
1464  return Float4(X * other.X, Y * other.Y, Z * other.Z, W * other.W);
1465  }
DLLEXPORT constexpr Float4() noexcept=default

◆ operator*() [2/2]

DLLEXPORT Float4 Leviathan::Float4::operator* ( float  val) const
inlinenoexcept

Definition at line 1494 of file Types.h.

1495  {
1496  return Float4(X * val, Y * val, Z * val, W * val);
1497  }
DLLEXPORT constexpr Float4() noexcept=default

◆ operator*=() [1/2]

DLLEXPORT Float4& Leviathan::Float4::operator*= ( const Float4 other)
inlinenoexcept

Definition at line 1467 of file Types.h.

1468  {
1469  X *= other.X;
1470  Y *= other.Y;
1471  Z *= other.Z;
1472  W *= other.W;
1473  DO_NAN_CHECK;
1474  return *this;
1475  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ operator*=() [2/2]

DLLEXPORT Float4& Leviathan::Float4::operator*= ( float  val)
inlinenoexcept

Definition at line 1499 of file Types.h.

1500  {
1501  X *= val;
1502  Y *= val;
1503  Z *= val;
1504  W *= val;
1505  DO_NAN_CHECK;
1506  return *this;
1507  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ operator+() [1/2]

DLLEXPORT Float4 Leviathan::Float4::operator+ ( const Float4 other) const
inlinenoexcept

Definition at line 1420 of file Types.h.

1421  {
1422  return Float4(X + other.X, Y + other.Y, Z + other.Z, W + other.W);
1423  }
DLLEXPORT constexpr Float4() noexcept=default

◆ operator+() [2/2]

DLLEXPORT Float4 Leviathan::Float4::operator+ ( ) const
inlinenoexcept

Definition at line 1456 of file Types.h.

1457  {
1458  return Float4(*this);
1459  }
DLLEXPORT constexpr Float4() noexcept=default

◆ operator+=()

DLLEXPORT Float4& Leviathan::Float4::operator+= ( const Float4 other)
inlinenoexcept

Definition at line 1425 of file Types.h.

1426  {
1427  X += other.X;
1428  Y += other.Y;
1429  Z += other.Z;
1430  W += other.W;
1431  return *this;
1432  }

◆ operator-() [1/2]

DLLEXPORT Float4 Leviathan::Float4::operator- ( const Float4 other) const
inlinenoexcept

Definition at line 1435 of file Types.h.

1436  {
1437  return Float4(X - other.X, Y - other.Y, Z - other.Z, W - other.W);
1438  }
DLLEXPORT constexpr Float4() noexcept=default

◆ operator-() [2/2]

DLLEXPORT Float4 Leviathan::Float4::operator- ( ) const
inlinenoexcept

Definition at line 1450 of file Types.h.

1451  {
1452  return Float4(-X, -Y, -Z, -W);
1453  }
DLLEXPORT constexpr Float4() noexcept=default

◆ operator-=()

DLLEXPORT Float4& Leviathan::Float4::operator-= ( const Float4 other)
inlinenoexcept

Definition at line 1440 of file Types.h.

1441  {
1442  X -= other.X;
1443  Y -= other.Y;
1444  Z -= other.Z;
1445  W -= other.W;
1446  return *this;
1447  }

◆ operator/() [1/2]

DLLEXPORT Float4 Leviathan::Float4::operator/ ( float  val) const
inline

Definition at line 1478 of file Types.h.

1479  {
1480  return Float4(X / val, Y / val, Z / val, W / val);
1481  }
DLLEXPORT constexpr Float4() noexcept=default

◆ operator/() [2/2]

DLLEXPORT Float4 Leviathan::Float4::operator/ ( const Float4 other) const
inline

Definition at line 1510 of file Types.h.

1511  {
1512  return Float4(X / other.X, Y / other.Y, Z / other.Z, W / other.W);
1513  }
DLLEXPORT constexpr Float4() noexcept=default

◆ operator/=() [1/2]

DLLEXPORT Float4& Leviathan::Float4::operator/= ( float  val)
inline

Definition at line 1483 of file Types.h.

1484  {
1485  X /= val;
1486  Y /= val;
1487  Z /= val;
1488  W /= val;
1489  DO_NAN_CHECK;
1490  return *this;
1491  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ operator/=() [2/2]

DLLEXPORT Float4& Leviathan::Float4::operator/= ( const Float4 other)
inline

Definition at line 1515 of file Types.h.

1516  {
1517  X /= other.X;
1518  Y /= other.Y;
1519  Z /= other.Z;
1520  W /= other.W;
1521  DO_NAN_CHECK;
1522  return *this;
1523  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ operator<()

DLLEXPORT bool Leviathan::Float4::operator< ( const Float4 other) const
inlinenoexcept

Definition at line 1527 of file Types.h.

1528  {
1529  return std::tie(X, Y, Z, W) < std::tie(other.X, other.Y, other.Z, other.W);
1530  }

◆ operator<=()

DLLEXPORT bool Leviathan::Float4::operator<= ( const Float4 other) const
inlinenoexcept

Definition at line 1532 of file Types.h.

1533  {
1534  return std::tie(X, Y, Z, W) <= std::tie(other.X, other.Y, other.Z, other.W);
1535  }

◆ operator==()

DLLEXPORT bool Leviathan::Float4::operator== ( const Float4 other) const
inlinenoexcept

Definition at line 1547 of file Types.h.

1548  {
1549  return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
1550  }

◆ operator>()

DLLEXPORT bool Leviathan::Float4::operator> ( const Float4 other) const
inlinenoexcept

Definition at line 1537 of file Types.h.

1538  {
1539  return std::tie(X, Y, Z, W) > std::tie(other.X, other.Y, other.Z, other.W);
1540  }

◆ operator>=()

DLLEXPORT bool Leviathan::Float4::operator>= ( const Float4 other) const
inlinenoexcept

Definition at line 1542 of file Types.h.

1543  {
1544  return std::tie(X, Y, Z, W) >= std::tie(other.X, other.Y, other.Z, other.W);
1545  }

◆ operator[]() [1/2]

DLLEXPORT float& Leviathan::Float4::operator[] ( unsigned  nindex)
inline

Definition at line 1383 of file Types.h.

1384  {
1385  switch(nindex) {
1386  case 0: return X;
1387  case 1: return Y;
1388  case 2: return Z;
1389  case 3: return W;
1390  default: break;
1391  }
1392 
1393  LEVIATHAN_ASSERT(0, "invalid [] access");
1394  return X;
1395  }
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:100

◆ operator[]() [2/2]

DLLEXPORT float Leviathan::Float4::operator[] ( unsigned  nindex) const
inline

Definition at line 1396 of file Types.h.

1397  {
1398  switch(nindex) {
1399  case 0: return X;
1400  case 1: return Y;
1401  case 2: return Z;
1402  case 3: return W;
1403  default: break;
1404  }
1405 
1406  LEVIATHAN_ASSERT(0, "invalid [] access");
1407  return X;
1408  }
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:100

◆ SetW()

DLLEXPORT void Leviathan::Float4::SetW ( float  val)
inline

Definition at line 1598 of file Types.h.

1599  {
1600  W = val;
1601  DO_NAN_CHECK;
1602  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ SetX()

DLLEXPORT void Leviathan::Float4::SetX ( float  val)
inline

Definition at line 1580 of file Types.h.

1581  {
1582  X = val;
1583  DO_NAN_CHECK;
1584  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ SetY()

DLLEXPORT void Leviathan::Float4::SetY ( float  val)
inline

Definition at line 1586 of file Types.h.

1587  {
1588  Y = val;
1589  DO_NAN_CHECK;
1590  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ SetZ()

DLLEXPORT void Leviathan::Float4::SetZ ( float  val)
inline

Definition at line 1592 of file Types.h.

1593  {
1594  Z = val;
1595  DO_NAN_CHECK;
1596  }
#define DO_NAN_CHECK
Definition: Types.h:20

◆ VALUE_TYPE()

Leviathan::Float4::VALUE_TYPE ( Float4  )

Member Data Documentation

◆ ColourBlack

DLLEXPORT const Float4 Leviathan::Float4::ColourBlack = Float4(0, 0, 0, 1)
static

Definition at line 1771 of file Types.h.

◆ ColourTransparent

DLLEXPORT const Float4 Leviathan::Float4::ColourTransparent = Float4(0, 0, 0, 0)
static

Definition at line 1773 of file Types.h.

◆ ColourWhite

DLLEXPORT const Float4 Leviathan::Float4::ColourWhite = Float4(1, 1, 1, 1)
static

Definition at line 1772 of file Types.h.

◆ W

float Leviathan::Float4::W = 0

Definition at line 1768 of file Types.h.

◆ X

float Leviathan::Float4::X = 0

Definition at line 1765 of file Types.h.

◆ Y

float Leviathan::Float4::Y = 0

Definition at line 1766 of file Types.h.

◆ Z

float Leviathan::Float4::Z = 0

Definition at line 1767 of file Types.h.


The documentation for this struct was generated from the following files: