mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 08:49:30 +00:00
Updated Lua and citro3D, Added a type check in ctr.thread.pool
This commit is contained in:
parent
d3ea68f3d7
commit
2725dce383
81 changed files with 1467 additions and 801 deletions
|
|
@ -283,12 +283,6 @@ static inline void Mtx_Copy(C3D_Mtx* out, const C3D_Mtx* in)
|
|||
*out = *in;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Identity matrix
|
||||
* @param[out] out Matrix to fill
|
||||
*/
|
||||
void Mtx_Identity(C3D_Mtx* out);
|
||||
|
||||
/**
|
||||
* @brief Multiply two matrices
|
||||
* @param[out] out Output matrix
|
||||
|
|
@ -489,6 +483,62 @@ void Mtx_PerspStereoTilt(C3D_Mtx* mtx, float fovy, float aspect, float near, flo
|
|||
* @param[in] isLeftHanded If true, output matrix is left-handed. If false, output matrix is right-handed.
|
||||
*/
|
||||
void Mtx_LookAt(C3D_Mtx* out, C3D_FVec cameraPosition, C3D_FVec cameraTarget, C3D_FVec cameraUpVector, bool isLeftHanded);
|
||||
|
||||
/**
|
||||
*@brief Transposes the matrix. Row => Column, and vice versa.
|
||||
*@param[in,out] out Output matrix.
|
||||
*/
|
||||
void Mtx_Transpose(C3D_Mtx* out);
|
||||
|
||||
/**
|
||||
* @brief Creates a matrix with the diagonal using the given parameters.
|
||||
* @param[out] out Output matrix.
|
||||
* @param[in] x The X component.
|
||||
* @param[in] y The Y component.
|
||||
* @param[in] z The Z component.
|
||||
* @param[in] w The W component.
|
||||
*/
|
||||
static inline void Mtx_Diagonal(C3D_Mtx* out, float x, float y, float z, float w)
|
||||
{
|
||||
Mtx_Zeros(out);
|
||||
out->r[0].x = x;
|
||||
out->r[1].y = y;
|
||||
out->r[2].z = z;
|
||||
out->r[3].w = w;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Identity matrix
|
||||
* @param[out] out Matrix to fill
|
||||
*/
|
||||
static inline void Mtx_Identity(C3D_Mtx* out)
|
||||
{
|
||||
Mtx_Diagonal(out, 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix addition
|
||||
* @param[out] out Output matrix.
|
||||
* @param[in] lhs Left matrix.
|
||||
* @param[in] rhs Right matrix.
|
||||
*/
|
||||
static inline void Mtx_Add(C3D_Mtx* out, const C3D_Mtx* lhs, const C3D_Mtx* rhs)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
out->m[i] = lhs->m[i] + rhs->m[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix subtraction
|
||||
* @param[out] out Output matrix.
|
||||
* @param[in] lhs Left matrix.
|
||||
* @param[in] rhs Right matrix.
|
||||
*/
|
||||
static inline void Mtx_Subtract(C3D_Mtx* out, const C3D_Mtx* lhs, const C3D_Mtx* rhs)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
out->m[i] = lhs->m[i] - rhs->m[i];
|
||||
}
|
||||
///@}
|
||||
|
||||
///@name Quaternion Math
|
||||
|
|
@ -621,6 +671,14 @@ C3D_FQuat Quat_RotateZ(C3D_FQuat q, float r, bool bRightSide);
|
|||
*/
|
||||
void Mtx_FromQuat(C3D_Mtx* m, C3D_FQuat q);
|
||||
|
||||
/**
|
||||
* @brief Get Quaternion equivalent to 4x4 matrix
|
||||
* @note If the matrix is orthogonal or special orthogonal, where determinant(matrix) = +1.0f, then the matrix can be converted.
|
||||
* @param[in] m Input Matrix
|
||||
* @return Generated Quaternion
|
||||
*/
|
||||
C3D_FQuat Quat_FromMtx(const C3D_Mtx* m);
|
||||
|
||||
/**
|
||||
* @brief Identity Quaternion
|
||||
* @return Identity Quaternion
|
||||
|
|
@ -668,4 +726,31 @@ static inline C3D_FVec FVec3_CrossQuat(C3D_FVec v, C3D_FQuat q)
|
|||
// v×q = q^-1×v
|
||||
return Quat_CrossFVec3(Quat_Inverse(q), v);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converting Pitch, Yaw, and Roll to Quaternion equivalent
|
||||
* @param[in] pitch The pitch angle in radians.
|
||||
* @param[in] yaw The yaw angle in radians.
|
||||
* @param[in] roll The roll angle in radians.
|
||||
* @return C3D_FQuat The Quaternion equivalent with the pitch, yaw, and roll orientations applied.
|
||||
*/
|
||||
C3D_FQuat Quat_FromPitchYawRoll(float pitch, float yaw, float roll, bool bRightSide);
|
||||
|
||||
/**
|
||||
* @brief Quaternion Look At
|
||||
* @param[in] source C3D_FVec Starting position. Origin of rotation.
|
||||
* @param[in] target C3D_FVec Target position to orient towards.
|
||||
* @param[in] forwardVector C3D_FVec The Up vector.
|
||||
* @param[in] upVector C3D_FVec The Up vector.
|
||||
* @return Quaternion rotation.
|
||||
*/
|
||||
C3D_FQuat Quat_LookAt(C3D_FVec source, C3D_FVec target, C3D_FVec forwardVector, C3D_FVec upVector);
|
||||
|
||||
/**
|
||||
* @brief Quaternion, created from a given axis and angle in radians.
|
||||
* @param[in] axis C3D_FVec The axis to rotate around at.
|
||||
* @param[in] angle float The angle to rotate. Unit: Radians
|
||||
* @return Quaternion rotation based on the axis and angle. Axis doesn't have to be orthogonal.
|
||||
*/
|
||||
C3D_FQuat Quat_FromAxisAngle(C3D_FVec axis, float angle);
|
||||
///@}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue