try
This commit is contained in:
parent
2154d36b41
commit
b0da316441
5 changed files with 106 additions and 177 deletions
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2015-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
@ -99,21 +99,14 @@ inline /* Functions may be inlined or external definition used*/ Vector2 Vector2
|
|||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Normalize(Vector2 v);// Transforms a Vector2 by a given Matrix
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Transform(Vector2 v, Matrix mat);// Calculate linear interpolation between two vectors
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);// Calculate reflected vector to normal
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Reflect(Vector2 v, Vector2 normal);// Get min value for each pair of components
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Min(Vector2 v1, Vector2 v2);// Get max value for each pair of components
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Max(Vector2 v1, Vector2 v2);// Rotate vector by angle
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Reflect(Vector2 v, Vector2 normal);// Rotate vector by angle
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Rotate(Vector2 v, float angle);// Move Vector towards target
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance);// Invert the given vector
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Invert(Vector2 v);// Clamp the components of the vector between
|
||||
// min and max values specified by the given vectors
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max);// Clamp the magnitude of the vector between two min and max values
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2ClampValue(Vector2 v, float min, float max);// Check whether two given vectors are almost equal
|
||||
inline /* Functions may be inlined or external definition used*/ int Vector2Equals(Vector2 p, Vector2 q);// Compute the direction of a refracted ray
|
||||
// v: normalized direction of the incoming ray
|
||||
// n: normalized normal vector of the interface of two optical media
|
||||
// r: ratio of the refractive index of the medium from where the ray comes
|
||||
// to the refractive index of the medium on the other side of the surface
|
||||
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Refract(Vector2 v, Vector2 n, float r);//----------------------------------------------------------------------------------
|
||||
inline /* Functions may be inlined or external definition used*/ int Vector2Equals(Vector2 p, Vector2 q);//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Vector3 math
|
||||
//----------------------------------------------------------------------------------
|
||||
// Vector with components value 0.0f
|
||||
|
@ -143,11 +136,8 @@ inline /* Functions may be inlined or external definition used*/ Vector3 Vector3
|
|||
inline /* Functions may be inlined or external definition used*/ void Vector3OrthoNormalize(Vector3 *v1, Vector3 *v2);// Transforms a Vector3 by a given Matrix
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Transform(Vector3 v, Matrix mat);// Transform a vector by quaternion rotation
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);// Rotates a vector around an axis
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle);// Move Vector towards target
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3MoveTowards(Vector3 v, Vector3 target, float maxDistance);// Calculate linear interpolation between two vectors
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);// Calculate cubic hermite interpolation between two vectors and their tangents
|
||||
// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3CubicHermite(Vector3 v1, Vector3 tangent1, Vector3 v2, Vector3 tangent2, float amount);// Calculate reflected vector to normal
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle);// Calculate linear interpolation between two vectors
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);// Calculate reflected vector to normal
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Reflect(Vector3 v, Vector3 normal);// Get min value for each pair of components
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Min(Vector3 v1, Vector3 v2);// Get max value for each pair of components
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Max(Vector3 v1, Vector3 v2);// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)
|
||||
|
@ -166,21 +156,6 @@ inline /* Functions may be inlined or external definition used*/ int Vector3Equa
|
|||
// r: ratio of the refractive index of the medium from where the ray comes
|
||||
// to the refractive index of the medium on the other side of the surface
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Refract(Vector3 v, Vector3 n, float r);//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Vector4 math
|
||||
//----------------------------------------------------------------------------------
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Zero(void);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4One(void);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Add(Vector4 v1, Vector4 v2);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4AddValue(Vector4 v, float add);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Subtract(Vector4 v1, Vector4 v2);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4SubtractValue(Vector4 v, float add);inline /* Functions may be inlined or external definition used*/ float Vector4Length(Vector4 v);inline /* Functions may be inlined or external definition used*/ float Vector4LengthSqr(Vector4 v);inline /* Functions may be inlined or external definition used*/ float Vector4DotProduct(Vector4 v1, Vector4 v2);// Calculate distance between two vectors
|
||||
inline /* Functions may be inlined or external definition used*/ float Vector4Distance(Vector4 v1, Vector4 v2);// Calculate square distance between two vectors
|
||||
inline /* Functions may be inlined or external definition used*/ float Vector4DistanceSqr(Vector4 v1, Vector4 v2);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Scale(Vector4 v, float scale);// Multiply vector by vector
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Multiply(Vector4 v1, Vector4 v2);// Negate vector
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Negate(Vector4 v);// Divide vector by vector
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Divide(Vector4 v1, Vector4 v2);// Normalize provided vector
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Normalize(Vector4 v);// Get min value for each pair of components
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Min(Vector4 v1, Vector4 v2);// Get max value for each pair of components
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Max(Vector4 v1, Vector4 v2);// Calculate linear interpolation between two vectors
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Lerp(Vector4 v1, Vector4 v2, float amount);// Move Vector towards target
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4MoveTowards(Vector4 v, Vector4 target, float maxDistance);// Invert the given vector
|
||||
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Invert(Vector4 v);// Check whether two given vectors are almost equal
|
||||
inline /* Functions may be inlined or external definition used*/ int Vector4Equals(Vector4 p, Vector4 q);//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Matrix math
|
||||
//----------------------------------------------------------------------------------
|
||||
// Compute matrix determinant
|
||||
|
@ -207,7 +182,7 @@ inline /* Functions may be inlined or external definition used*/ Matrix MatrixRo
|
|||
// NOTE: Angle must be provided in radians
|
||||
inline /* Functions may be inlined or external definition used*/ Matrix MatrixRotateZYX(Vector3 angle);// Get scaling matrix
|
||||
inline /* Functions may be inlined or external definition used*/ Matrix MatrixScale(float x, float y, float z);// Get perspective projection matrix
|
||||
inline /* Functions may be inlined or external definition used*/ Matrix MatrixFrustum(double left, double right, double bottom, double top, double nearPlane, double farPlane);// Get perspective projection matrix
|
||||
inline /* Functions may be inlined or external definition used*/ Matrix MatrixFrustum(double left, double right, double bottom, double top, double near, double far);// Get perspective projection matrix
|
||||
// NOTE: Fovy angle must be provided in radians
|
||||
inline /* Functions may be inlined or external definition used*/ Matrix MatrixPerspective(double fovY, double aspect, double nearPlane, double farPlane);// Get orthographic projection matrix
|
||||
inline /* Functions may be inlined or external definition used*/ Matrix MatrixOrtho(double left, double right, double bottom, double top, double nearPlane, double farPlane);// Get camera look-at matrix (view matrix)
|
||||
|
@ -229,9 +204,7 @@ inline /* Functions may be inlined or external definition used*/ Quaternion Quat
|
|||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionDivide(Quaternion q1, Quaternion q2);// Calculate linear interpolation between two quaternions
|
||||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);// Calculate slerp-optimized interpolation between two quaternions
|
||||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);// Calculates spherical linear interpolation between two quaternions
|
||||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);// Calculate quaternion cubic spline interpolation using Cubic Hermite Spline algorithm
|
||||
// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
|
||||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionCubicHermiteSpline(Quaternion q1, Quaternion outTangent1, Quaternion q2, Quaternion inTangent2, float t);// Calculate quaternion based on the rotation from one vector to another
|
||||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);// Calculate quaternion based on the rotation from one vector to another
|
||||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);// Get a quaternion for a given rotation matrix
|
||||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionFromMatrix(Matrix mat);// Get a matrix for a given quaternion
|
||||
inline /* Functions may be inlined or external definition used*/ Matrix QuaternionToMatrix(Quaternion q);// Get rotation quaternion for an angle and axis
|
||||
|
@ -243,5 +216,4 @@ inline /* Functions may be inlined or external definition used*/ Quaternion Quat
|
|||
// NOTE: Angles are returned in a Vector3 struct in radians
|
||||
inline /* Functions may be inlined or external definition used*/ Vector3 QuaternionToEuler(Quaternion q);// Transform a quaternion given a transformation matrix
|
||||
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionTransform(Quaternion q, Matrix mat);// Check whether two given quaternions are almost equal
|
||||
inline /* Functions may be inlined or external definition used*/ int QuaternionEquals(Quaternion p, Quaternion q);// Decompose a transformation matrix into its rotational, translational and scaling components
|
||||
inline /* Functions may be inlined or external definition used*/ void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale);
|
||||
inline /* Functions may be inlined or external definition used*/ int QuaternionEquals(Quaternion p, Quaternion q);
|
Reference in a new issue