Add utility ctors to Half vectors
This commit is contained in:
@@ -12,9 +12,9 @@ static_assert(sizeof(Half2) == 4, "Invalid Half2 type size.");
|
||||
static_assert(sizeof(Half3) == 6, "Invalid Half3 type size.");
|
||||
static_assert(sizeof(Half4) == 8, "Invalid Half4 type size.");
|
||||
|
||||
Half2 Half2::Zero(0, 0);
|
||||
Half3 Half3::Zero(0, 0, 0);
|
||||
Half4 Half4::Zero(0, 0, 0, 0);
|
||||
Half2 Half2::Zero(0.0f, 0.0f);
|
||||
Half3 Half3::Zero(0.0f, 0.0f, 0.0f);
|
||||
Half4 Half4::Zero(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
Half2::Half2(const Vector2& v)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,6 @@ class FLAXENGINE_API Float16Compressor
|
||||
static const int32 minD = minC - subC - 1;
|
||||
|
||||
public:
|
||||
|
||||
static Half Compress(const float value)
|
||||
{
|
||||
#if USE_SSE_HALF_CONVERSION
|
||||
@@ -102,14 +101,12 @@ public:
|
||||
struct FLAXENGINE_API Half2
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Zero vector
|
||||
/// </summary>
|
||||
static Half2 Zero;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the X component of the vector.
|
||||
/// </summary>
|
||||
@@ -121,7 +118,6 @@ public:
|
||||
Half Y;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
@@ -129,6 +125,17 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
/// <param name="x">X component</param>
|
||||
/// <param name="y">Y component</param>
|
||||
Half2(Half x, Half y)
|
||||
: X(x)
|
||||
, Y(y)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -147,7 +154,6 @@ public:
|
||||
Half2(const Vector2& v);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Convert to Vector2
|
||||
/// </summary>
|
||||
@@ -161,14 +167,12 @@ public:
|
||||
struct FLAXENGINE_API Half3
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Zero vector
|
||||
/// </summary>
|
||||
static Half3 Zero;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the X component of the vector.
|
||||
/// </summary>
|
||||
@@ -185,11 +189,17 @@ public:
|
||||
Half Z;
|
||||
|
||||
public:
|
||||
|
||||
Half3()
|
||||
{
|
||||
}
|
||||
|
||||
Half3(Half x, Half y, Half z)
|
||||
: X(x)
|
||||
, Y(y)
|
||||
, Z(z)
|
||||
{
|
||||
}
|
||||
|
||||
Half3(const float x, const float y, const float z)
|
||||
{
|
||||
X = Float16Compressor::Compress(x);
|
||||
@@ -200,7 +210,6 @@ public:
|
||||
Half3(const Vector3& v);
|
||||
|
||||
public:
|
||||
|
||||
Vector3 ToVector3() const;
|
||||
};
|
||||
|
||||
@@ -210,14 +219,12 @@ public:
|
||||
struct FLAXENGINE_API Half4
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Zero vector
|
||||
/// </summary>
|
||||
static Half4 Zero;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the X component of the vector.
|
||||
/// </summary>
|
||||
@@ -239,11 +246,18 @@ public:
|
||||
Half W;
|
||||
|
||||
public:
|
||||
|
||||
Half4()
|
||||
{
|
||||
}
|
||||
|
||||
Half4(Half x, Half y, Half z, Half w)
|
||||
: X(x)
|
||||
, Y(y)
|
||||
, Z(z)
|
||||
, W(w)
|
||||
{
|
||||
}
|
||||
|
||||
Half4(const float x, const float y, const float z)
|
||||
{
|
||||
X = Float16Compressor::Compress(x);
|
||||
@@ -265,7 +279,6 @@ public:
|
||||
explicit Half4(const Rectangle& rect);
|
||||
|
||||
public:
|
||||
|
||||
Vector2 ToVector2() const;
|
||||
Vector3 ToVector3() const;
|
||||
Vector4 ToVector4() const;
|
||||
|
||||
Reference in New Issue
Block a user