Add more vector functions and try to get a common order into them
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5269 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
bdf986c0e5
commit
a128c9df88
|
@ -253,6 +253,19 @@ static inline WZ_DECL_CONST Vector2f Vector2f_Normalise(const Vector2f v)
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Set the vector field by field, same as v = (Vector3f){x, y, z};
|
||||
* Needed for MSVC which doesn't support C99 struct assignments.
|
||||
* \param x,y,z Values to set to
|
||||
* \return New vector
|
||||
*/
|
||||
static inline WZ_DECL_CONST Vector3f Vector3f_New(const float x, const float y, const float z)
|
||||
{
|
||||
Vector3f dest = { x, y, z };
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Convert a float vector to integer
|
||||
* \param v Vector to convert
|
||||
|
@ -274,19 +287,6 @@ static inline WZ_DECL_CONST bool Vector3f_Compare(const Vector3f a, const Vector
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Set the vector field by field, same as v = (Vector3f){x, y, z};
|
||||
* Needed for MSVC which doesn't support C99 struct assignments.
|
||||
* \param x,y,z Values to set to
|
||||
* \return New vector
|
||||
*/
|
||||
static inline WZ_DECL_CONST Vector3f Vector3f_New(const float x, const float y, const float z)
|
||||
{
|
||||
Vector3f dest = { x, y, z };
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Add op2 to op1.
|
||||
* \param op1,op2 Operands
|
||||
|
@ -392,6 +392,19 @@ static inline WZ_DECL_CONST Vector3f Vector3f_Normalise(const Vector3f v)
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Set the vector field by field, same as v = (Vector3i){x, y, z};
|
||||
* Needed for MSVC which doesn't support C99 struct assignments.
|
||||
* \param x,y,z Coordinates
|
||||
* \return New Vector
|
||||
*/
|
||||
static inline WZ_DECL_CONST Vector3i Vector3i_New(const int x, const int y, const int z)
|
||||
{
|
||||
Vector3i dest = { x, y, z };
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Convert an integer vector to float
|
||||
* \param v Vector to convert
|
||||
|
@ -537,19 +550,6 @@ static inline WZ_DECL_CONST bool Vector3i_InSphere (const Vector3i v, const Vect
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Set the vector field by field, same as v = (Vector3i){x, y, z};
|
||||
* Needed for MSVC which doesn't support C99 struct assignments.
|
||||
* \param x,y,z Coordinates
|
||||
* \return New Vector
|
||||
*/
|
||||
static inline WZ_DECL_CONST Vector3i Vector3i_New(const int x, const int y, const int z)
|
||||
{
|
||||
Vector3i dest = { x, y, z };
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Set the vector field by field, same as v = (Vector3uw){x, y, z};
|
||||
* Needed for MSVC which doesn't support C99 struct assignments.
|
||||
|
@ -562,4 +562,17 @@ static inline WZ_DECL_CONST Vector3uw Vector3uw_New(const unsigned int x, const
|
|||
return dest;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Convert an short vector to int
|
||||
* \param v Vector to convert
|
||||
* \return Short vector
|
||||
*/
|
||||
static inline WZ_DECL_CONST Vector3i Vector3uw_To3i(const Vector3uw v)
|
||||
{
|
||||
Vector3i dest = { (int)v.x, (int)v.y, (int)v.z };
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
#endif // __INCLUDED_LIB_IVIS_PIEVECTOR_H__
|
||||
|
|
Loading…
Reference in New Issue