From 7ee69fc3979a11d6ded9db33c58913d602360a61 Mon Sep 17 00:00:00 2001 From: Mikhail Romanko Date: Tue, 29 Apr 2025 18:17:00 +0300 Subject: Add array sizes to math functions --- include/BH/Math.h | 808 +++++++++++++++++++++++++++--------------------------- src/Math/Box2f.c | 34 +-- src/Math/Box3f.c | 34 +-- src/Math/Line.c | 16 +- src/Math/Mat3f.c | 54 ++-- src/Math/Mat4f.c | 80 +++--- src/Math/Misc.c | 10 +- src/Math/Plane.c | 18 +- src/Math/Quat4f.c | 38 +-- src/Math/Ray2f.c | 74 ++--- src/Math/Ray3f.c | 60 ++-- src/Math/Vec2f.c | 86 +++--- src/Math/Vec2i.c | 46 ++-- src/Math/Vec3f.c | 88 +++--- src/Math/Vec3i.c | 46 ++-- src/Math/Vec4f.c | 82 +++--- src/Math/Vec4i.c | 46 ++-- 17 files changed, 810 insertions(+), 810 deletions(-) diff --git a/include/BH/Math.h b/include/BH/Math.h index 7f96e3c..ef1aa40 100644 --- a/include/BH/Math.h +++ b/include/BH/Math.h @@ -12,9 +12,9 @@ * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4fAdd(const float *a, - const float *b, - float *out); +void BH_Vec4fAdd(const float a[4], + const float b[4], + float out[4]); /** @@ -24,9 +24,9 @@ void BH_Vec4fAdd(const float *a, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4fSub(const float *a, - const float *b, - float *out); +void BH_Vec4fSub(const float a[4], + const float b[4], + float out[4]); /** @@ -37,9 +37,9 @@ void BH_Vec4fSub(const float *a, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4fMul(const float *a, - const float *b, - float *out); +void BH_Vec4fMul(const float a[4], + const float b[4], + float out[4]); /** @@ -49,9 +49,9 @@ void BH_Vec4fMul(const float *a, * \param b B value * \param out Output vector */ -void BH_Vec4fScale(const float *a, +void BH_Vec4fScale(const float a[4], float b, - float *out); + float out[4]); /** @@ -62,10 +62,10 @@ void BH_Vec4fScale(const float *a, * \param c C 4D vector * \param out Output 4D vector */ -void BH_Vec4fMulAdd(const float *a, - const float *b, - const float *c, - float *out); +void BH_Vec4fMulAdd(const float a[4], + const float b[4], + const float c[4], + float out[4]); /** @@ -74,8 +74,8 @@ void BH_Vec4fMulAdd(const float *a, * \param in Input 4D vector * \param out Output 4D vector */ -void BH_Vec4fNegate(const float *in, - float *out); +void BH_Vec4fNegate(const float in[4], + float out[4]); /** @@ -84,8 +84,8 @@ void BH_Vec4fNegate(const float *in, * \param a A 4D vector * \param b B 4D vector */ -float BH_Vec4fDot(const float *a, - const float *b); +float BH_Vec4fDot(const float a[4], + const float b[4]); /** @@ -93,7 +93,7 @@ float BH_Vec4fDot(const float *a, * * \param in Input 4D vector */ -float BH_Vec4fLength(const float *in); +float BH_Vec4fLength(const float in[4]); /** @@ -102,8 +102,8 @@ float BH_Vec4fLength(const float *in); * \param in Input 4D vector * \param out Output 4D vector */ -void BH_Vec4fNormal(const float *in, - float *out); +void BH_Vec4fNormal(const float in[4], + float out[4]); /** @@ -115,8 +115,8 @@ void BH_Vec4fNormal(const float *in, * * \return Returns length prior to normalization */ -float BH_Vec4fNormalEx(const float *in, - float *out); +float BH_Vec4fNormalEx(const float in[4], + float out[4]); /** @@ -127,9 +127,9 @@ float BH_Vec4fNormalEx(const float *in, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4fMin(const float *a, - const float *b, - float *out); +void BH_Vec4fMin(const float a[4], + const float b[4], + float out[4]); /** @@ -140,9 +140,9 @@ void BH_Vec4fMin(const float *a, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4fMax(const float *a, - const float *b, - float *out); +void BH_Vec4fMax(const float a[4], + const float b[4], + float out[4]); /** @@ -154,10 +154,10 @@ void BH_Vec4fMax(const float *a, * \param t Amount * \param out Output 4D vector */ -void BH_Vec4fLerp(const float *a, - const float *b, +void BH_Vec4fLerp(const float a[4], + const float b[4], float t, - float *out); + float out[4]); /** @@ -167,9 +167,9 @@ void BH_Vec4fLerp(const float *a, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4fProject(const float *a, - const float *b, - float *out); +void BH_Vec4fProject(const float a[4], + const float b[4], + float out[4]); /** @@ -185,12 +185,12 @@ void BH_Vec4fProject(const float *a, * \param w W barycentric coordinate * \param out Output 4D vector */ -void BH_Vec4fBarycentric(const float *a, - const float *b, - const float *c, +void BH_Vec4fBarycentric(const float a[4], + const float b[4], + const float c[4], float v, float w, - float *out); + float out[4]); /** @@ -200,9 +200,9 @@ void BH_Vec4fBarycentric(const float *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3fAdd(const float *a, - const float *b, - float *out); +void BH_Vec3fAdd(const float a[3], + const float b[3], + float out[3]); /** @@ -212,9 +212,9 @@ void BH_Vec3fAdd(const float *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3fSub(const float *a, - const float *b, - float *out); +void BH_Vec3fSub(const float a[3], + const float b[3], + float out[3]); /** @@ -225,9 +225,9 @@ void BH_Vec3fSub(const float *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3fMul(const float *a, - const float *b, - float *out); +void BH_Vec3fMul(const float a[3], + const float b[3], + float out[3]); /** @@ -237,9 +237,9 @@ void BH_Vec3fMul(const float *a, * \param b B value * \param out Output 3D vector */ -void BH_Vec3fScale(const float *a, +void BH_Vec3fScale(const float a[3], float b, - float *out); + float out[3]); /** @@ -250,10 +250,10 @@ void BH_Vec3fScale(const float *a, * \param c C 3D vector * \param out Output 3D vector */ -void BH_Vec3fMulAdd(const float *a, - const float *b, - const float *c, - float *out); +void BH_Vec3fMulAdd(const float a[3], + const float b[3], + const float c[3], + float out[3]); /** @@ -263,8 +263,8 @@ void BH_Vec3fMulAdd(const float *a, * \param out Output 3D vector * */ -void BH_Vec3fNegate(const float *in, - float *out); +void BH_Vec3fNegate(const float in[3], + float out[3]); /** @@ -273,8 +273,8 @@ void BH_Vec3fNegate(const float *in, * \param a A 3D vector * \param b B 3D vector */ -float BH_Vec3fDot(const float *a, - const float *b); +float BH_Vec3fDot(const float a[3], + const float b[3]); /** @@ -285,9 +285,9 @@ float BH_Vec3fDot(const float *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3fCross(const float *a, - const float *b, - float *out); +void BH_Vec3fCross(const float a[3], + const float b[3], + float out[3]); /** @@ -295,7 +295,7 @@ void BH_Vec3fCross(const float *a, * * \param in Input 3D vector */ -float BH_Vec3fLength(const float *in); +float BH_Vec3fLength(const float in[3]); /** @@ -304,8 +304,8 @@ float BH_Vec3fLength(const float *in); * \param in Input 3D vector * \param out Output 3D vector */ -void BH_Vec3fNormal(const float *in, - float *out); +void BH_Vec3fNormal(const float in[3], + float out[3]); /** @@ -317,8 +317,8 @@ void BH_Vec3fNormal(const float *in, * * \return Returns length prior to normalization */ -float BH_Vec3fNormalEx(const float *in, - float *out); +float BH_Vec3fNormalEx(const float in[3], + float out[3]); /** @@ -329,9 +329,9 @@ float BH_Vec3fNormalEx(const float *in, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3fMin(const float *a, - const float *b, - float *out); +void BH_Vec3fMin(const float a[3], + const float b[3], + float out[3]); /** @@ -342,9 +342,9 @@ void BH_Vec3fMin(const float *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3fMax(const float *a, - const float *b, - float *out); +void BH_Vec3fMax(const float a[3], + const float b[3], + float out[3]); /** @@ -356,10 +356,10 @@ void BH_Vec3fMax(const float *a, * \param t Amount * \param out Output 3D vector */ -void BH_Vec3fLerp(const float *a, - const float *b, +void BH_Vec3fLerp(const float a[3], + const float b[3], float t, - float *out); + float out[3]); /** @@ -369,9 +369,9 @@ void BH_Vec3fLerp(const float *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3fProject(const float *a, - const float *b, - float *out); +void BH_Vec3fProject(const float a[3], + const float b[3], + float out[3]); /** @@ -387,12 +387,12 @@ void BH_Vec3fProject(const float *a, * \param w W barycentric coordinate * \param out Output 3D vector */ -void BH_Vec3fBarycentric(const float *a, - const float *b, - const float *c, +void BH_Vec3fBarycentric(const float a[3], + const float b[3], + const float c[3], float v, float w, - float *out); + float out[3]); /** @@ -402,9 +402,9 @@ void BH_Vec3fBarycentric(const float *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2fAdd(const float *a, - const float *b, - float *out); +void BH_Vec2fAdd(const float a[2], + const float b[2], + float out[2]); /** @@ -414,9 +414,9 @@ void BH_Vec2fAdd(const float *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2fSub(const float *a, - const float *b, - float *out); +void BH_Vec2fSub(const float a[2], + const float b[2], + float out[2]); /** @@ -427,9 +427,9 @@ void BH_Vec2fSub(const float *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2fMul(const float *a, - const float *b, - float *out); +void BH_Vec2fMul(const float a[2], + const float b[2], + float out[2]); /** @@ -439,9 +439,9 @@ void BH_Vec2fMul(const float *a, * \param b B value * \param out Output 2D vector */ -void BH_Vec2fScale(const float *a, +void BH_Vec2fScale(const float a[2], float b, - float *out); + float out[2]); /** @@ -452,10 +452,10 @@ void BH_Vec2fScale(const float *a, * \param c C 2D vector * \param out Output 2D vector */ -void BH_Vec2fMulAdd(const float *a, - const float *b, - const float *c, - float *out); +void BH_Vec2fMulAdd(const float a[2], + const float b[2], + const float c[2], + float out[2]); /** @@ -465,8 +465,8 @@ void BH_Vec2fMulAdd(const float *a, * \param out Output 2D vector * */ -void BH_Vec2fNegate(const float *in, - float *out); +void BH_Vec2fNegate(const float in[2], + float out[2]); /** @@ -475,8 +475,8 @@ void BH_Vec2fNegate(const float *in, * \param a A 2D vector * \param b B 2D vector */ -float BH_Vec2fDot(const float *a, - const float *b); +float BH_Vec2fDot(const float a[2], + const float b[2]); /** @@ -485,8 +485,8 @@ float BH_Vec2fDot(const float *a, * \param a A 2D vector * \param b B 2D vector */ -float BH_Vec2fCross(const float *a, - const float *b); +float BH_Vec2fCross(const float a[2], + const float b[2]); /** @@ -494,7 +494,7 @@ float BH_Vec2fCross(const float *a, * * \param in Input 2D vector */ -float BH_Vec2fLength(const float *in); +float BH_Vec2fLength(const float in[2]); /** @@ -504,8 +504,8 @@ float BH_Vec2fLength(const float *in); * \param in Input 2D vector * \param out Output 2D vector */ -void BH_Vec2fNormal(const float *in, - float *out); +void BH_Vec2fNormal(const float in[2], + float out[2]); /** @@ -517,8 +517,8 @@ void BH_Vec2fNormal(const float *in, * * \return Returns length prior to normalization */ -float BH_Vec2fNormalEx(const float *in, - float *out); +float BH_Vec2fNormalEx(const float in[2], + float out[2]); /** @@ -529,9 +529,9 @@ float BH_Vec2fNormalEx(const float *in, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2fMin(const float *a, - const float *b, - float *out); +void BH_Vec2fMin(const float a[2], + const float b[2], + float out[2]); /** @@ -542,9 +542,9 @@ void BH_Vec2fMin(const float *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2fMax(const float *a, - const float *b, - float *out); +void BH_Vec2fMax(const float a[2], + const float b[2], + float out[2]); /** @@ -556,10 +556,10 @@ void BH_Vec2fMax(const float *a, * \param t Amount * \param out Output 2D vector */ -void BH_Vec2fLerp(const float *a, - const float *b, +void BH_Vec2fLerp(const float a[2], + const float b[2], float t, - float *out); + float out[2]); /** @@ -569,9 +569,9 @@ void BH_Vec2fLerp(const float *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2fProject(const float *a, - const float *b, - float *out); +void BH_Vec2fProject(const float a[2], + const float b[2], + float out[2]); /** @@ -587,12 +587,12 @@ void BH_Vec2fProject(const float *a, * \param w W barycentric coordinate * \param out Output 2D vector */ -void BH_Vec2fBarycentric(const float *a, - const float *b, - const float *c, - float u, +void BH_Vec2fBarycentric(const float a[2], + const float b[2], + const float c[2], float v, - float *out); + float w, + float out[2]); /** @@ -614,9 +614,9 @@ float BH_Lerpf(float a, float b, float t); * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4iAdd(const int *a, - const int *b, - int *out); +void BH_Vec4iAdd(const int a[4], + const int b[4], + int out[4]); /** @@ -626,9 +626,9 @@ void BH_Vec4iAdd(const int *a, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4iSub(const int *a, - const int *b, - int *out); +void BH_Vec4iSub(const int a[4], + const int b[4], + int out[4]); /** @@ -638,9 +638,9 @@ void BH_Vec4iSub(const int *a, * \param b B 4D vector * \param out Output vector */ -void BH_Vec4iMul(const int *a, - const int *b, - int *out); +void BH_Vec4iMul(const int a[4], + const int b[4], + int out[4]); /** @@ -650,9 +650,9 @@ void BH_Vec4iMul(const int *a, * \param b B value * \param out Output 4D vector */ -void BH_Vec4iScale(const int *a, +void BH_Vec4iScale(const int a[4], int b, - int *out); + int out[4]); /** @@ -663,10 +663,10 @@ void BH_Vec4iScale(const int *a, * \param c C 4D vector * \param out Output 4D vector */ -void BH_Vec4iMulAdd(const int *a, - const int *b, - const int *c, - int *out); +void BH_Vec4iMulAdd(const int a[4], + const int b[4], + const int c[4], + int out[4]); /** @@ -675,8 +675,8 @@ void BH_Vec4iMulAdd(const int *a, * \param in Input 4D vector * \param out Output 4D vector */ -void BH_Vec4iNegate(const int *in, - int *out); +void BH_Vec4iNegate(const int in[4], + int out[4]); /** @@ -687,9 +687,9 @@ void BH_Vec4iNegate(const int *in, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4iMin(const int *a, - const int *b, - int *out); +void BH_Vec4iMin(const int a[4], + const int b[4], + int out[4]); /** @@ -700,9 +700,9 @@ void BH_Vec4iMin(const int *a, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Vec4iMax(const int *a, - const int *b, - int *out); +void BH_Vec4iMax(const int a[4], + const int b[4], + int out[4]); /** @@ -712,9 +712,9 @@ void BH_Vec4iMax(const int *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3iAdd(const int *a, - const int *b, - int *out); +void BH_Vec3iAdd(const int a[3], + const int b[3], + int out[3]); /** @@ -724,9 +724,9 @@ void BH_Vec3iAdd(const int *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3iSub(const int *a, - const int *b, - int *out); +void BH_Vec3iSub(const int a[3], + const int b[3], + int out[3]); /** @@ -736,9 +736,9 @@ void BH_Vec3iSub(const int *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3iMul(const int *a, - const int *b, - int *out); +void BH_Vec3iMul(const int a[3], + const int b[3], + int out[3]); /** @@ -748,9 +748,9 @@ void BH_Vec3iMul(const int *a, * \param b B value * \param out Output 3D vector */ -void BH_Vec3iScale(const int *a, +void BH_Vec3iScale(const int a[3], int b, - int *out); + int out[3]); /** @@ -761,10 +761,10 @@ void BH_Vec3iScale(const int *a, * \param c C 3D vector * \param out Output 3D vector */ -void BH_Vec3iMulAdd(const int *a, - const int *b, - const int *c, - int *out); +void BH_Vec3iMulAdd(const int a[3], + const int b[3], + const int c[3], + int out[3]); /** @@ -774,8 +774,8 @@ void BH_Vec3iMulAdd(const int *a, * \param out Output 3D vector * */ -void BH_Vec3iNegate(const int *in, - int *out); +void BH_Vec3iNegate(const int in[3], + int out[3]); /** @@ -786,9 +786,9 @@ void BH_Vec3iNegate(const int *in, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3iMin(const int *a, - const int *b, - int *out); +void BH_Vec3iMin(const int a[3], + const int b[3], + int out[3]); /** @@ -799,9 +799,9 @@ void BH_Vec3iMin(const int *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Vec3iMax(const int *a, - const int *b, - int *out); +void BH_Vec3iMax(const int a[3], + const int b[3], + int out[3]); /** @@ -811,9 +811,9 @@ void BH_Vec3iMax(const int *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2iAdd(const int *a, - const int *b, - int *out); +void BH_Vec2iAdd(const int a[2], + const int b[2], + int out[2]); /** @@ -823,9 +823,9 @@ void BH_Vec2iAdd(const int *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2iSub(const int *a, - const int *b, - int *out); +void BH_Vec2iSub(const int a[2], + const int b[2], + int out[2]); /** @@ -835,9 +835,9 @@ void BH_Vec2iSub(const int *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2iMul(const int *a, - const int *b, - int *out); +void BH_Vec2iMul(const int a[2], + const int b[2], + int out[2]); /** @@ -847,9 +847,9 @@ void BH_Vec2iMul(const int *a, * \param b B 2D value * \param out Output 2D vector */ -void BH_Vec2iScale(const int *a, +void BH_Vec2iScale(const int a[2], int b, - int *out); + int out[2]); /** @@ -860,10 +860,10 @@ void BH_Vec2iScale(const int *a, * \param c C 2D vector * \param out Output 2D vector */ -void BH_Vec2iMulAdd(const int *a, - const int *b, - const int *c, - int *out); +void BH_Vec2iMulAdd(const int a[2], + const int b[2], + const int c[2], + int out[2]); /** @@ -873,8 +873,8 @@ void BH_Vec2iMulAdd(const int *a, * \param out Output 2D vector * */ -void BH_Vec2iNegate(const int *in, - int *out); +void BH_Vec2iNegate(const int in[2], + int out[2]); /** @@ -885,9 +885,9 @@ void BH_Vec2iNegate(const int *in, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2iMin(const int *a, - const int *b, - int *out); +void BH_Vec2iMin(const int a[2], + const int b[2], + int out[2]); /** @@ -898,9 +898,9 @@ void BH_Vec2iMin(const int *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Vec2iMax(const int *a, - const int *b, - int *out); +void BH_Vec2iMax(const int a[2], + const int b[2], + int out[2]); /** @@ -994,7 +994,7 @@ void BH_Vec2iMax(const int *a, * * \param out Output quaternion. */ -void BH_Quat4fIdentity(float *out); +void BH_Quat4fIdentity(float out[4]); /** @@ -1003,8 +1003,8 @@ void BH_Quat4fIdentity(float *out); * \param in Input quaternion * \param out Output quaternion */ -void BH_Quat4fConjugate(const float *in, - float *out); +void BH_Quat4fConjugate(const float in[4], + float out[4]); /** @@ -1013,8 +1013,8 @@ void BH_Quat4fConjugate(const float *in, * \param in Input quaternion * \param out Output quaternion */ -void BH_Quat4fInverse(const float *in, - float *out); +void BH_Quat4fInverse(const float in[4], + float out[4]); /** @@ -1024,9 +1024,9 @@ void BH_Quat4fInverse(const float *in, * \param b B quaternion * \param out Output quaternion */ -void BH_Quat4fMul(const float *a, - const float *b, - float *out); +void BH_Quat4fMul(const float a[4], + const float b[4], + float out[4]); /** @@ -1038,10 +1038,10 @@ void BH_Quat4fMul(const float *a, * \param t Amount * \param out Output quaternion */ -void BH_Quat4fSlerp(const float *a, - const float *b, +void BH_Quat4fSlerp(const float a[4], + const float b[4], float t, - float *out); + float out[4]); /** @@ -1058,7 +1058,7 @@ void BH_Quat4fSlerp(const float *a, void BH_Quat4fFromEuler(float roll, float pitch, float yaw, - float *out); + float out[4]); /** @@ -1069,9 +1069,9 @@ void BH_Quat4fFromEuler(float roll, * \param angle Angle * \param out Output quaternion */ -void BH_Quat4fFromAxis(const float *axis, +void BH_Quat4fFromAxis(const float axis[3], float angle, - float *out); + float out[4]); /** @@ -1085,7 +1085,7 @@ void BH_Quat4fFromAxis(const float *axis, * \param pitch Output pitch * \param yaw Output yaw */ -void BH_Quat4fToEuler(const float *in, +void BH_Quat4fToEuler(const float in[4], float *roll, float *pitch, float *yaw); @@ -1099,8 +1099,8 @@ void BH_Quat4fToEuler(const float *in, * \param axis Output axis 3D vector * \param angle Output angle */ -void BH_Quat4fToAxis(const float *in, - float *axis, +void BH_Quat4fToAxis(const float in[4], + float axis[3], float *angle); @@ -1111,8 +1111,8 @@ void BH_Quat4fToAxis(const float *in, * \param in Input quaternion * \param out Output 4x4 matrix */ -void BH_Quat4fToMat4f(const float *in, - float *out); +void BH_Quat4fToMat4f(const float in[4], + float out[16]); /** @@ -1120,7 +1120,7 @@ void BH_Quat4fToMat4f(const float *in, * * \param out Output 4x4 matrix. */ -void BH_Mat4fIdentity(float *out); +void BH_Mat4fIdentity(float out[16]); /** @@ -1130,9 +1130,9 @@ void BH_Mat4fIdentity(float *out); * \param b B 4x4 matrix * \param out Output 4x4 matrix */ -void BH_Mat4fAdd(const float *a, - const float *b, - float *out); +void BH_Mat4fAdd(const float a[16], + const float b[16], + float out[16]); /** @@ -1143,9 +1143,9 @@ void BH_Mat4fAdd(const float *a, * \param b B 4x4 matrix * \param out Output 4x4 matrix */ -void BH_Mat4fSub(const float *a, - const float *b, - float *out); +void BH_Mat4fSub(const float a[16], + const float b[16], + float out[16]); /** @@ -1156,9 +1156,9 @@ void BH_Mat4fSub(const float *a, * \param b B 4x4 matrix * \param out Output 4x4 matrix */ -void BH_Mat4fMul(const float *a, - const float *b, - float *out); +void BH_Mat4fMul(const float a[16], + const float b[16], + float out[16]); /** @@ -1168,9 +1168,9 @@ void BH_Mat4fMul(const float *a, * \param b B value * \param out Output 4x4 matrix */ -void BH_Mat4fScale(const float *a, +void BH_Mat4fScale(const float a[16], float b, - float *out); + float out[16]); /** @@ -1179,8 +1179,8 @@ void BH_Mat4fScale(const float *a, * \param in Input 4x4 matrix * \param out Output 4x4 matrix */ -void BH_Mat4fTranspose(const float *in, - float *out); +void BH_Mat4fTranspose(const float in[16], + float out[16]); /** @@ -1188,7 +1188,7 @@ void BH_Mat4fTranspose(const float *in, * * \param in Input 4x4 matrix */ -float BH_Mat4fTrace(const float *in); +float BH_Mat4fTrace(const float in[16]); /** @@ -1196,7 +1196,7 @@ float BH_Mat4fTrace(const float *in); * * \param in Input 4x4 matrix */ -float BH_Mat4fDet(const float *in); +float BH_Mat4fDet(const float in[16]); /** @@ -1208,8 +1208,8 @@ float BH_Mat4fDet(const float *in); * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Mat4fInverse(const float *in, - float *out); +int BH_Mat4fInverse(const float in[16], + float out[16]); /** @@ -1224,7 +1224,7 @@ int BH_Mat4fInverse(const float *in, void BH_Mat4fFromScale(float x, float y, float z, - float *out); + float out[16]); /** @@ -1239,7 +1239,7 @@ void BH_Mat4fFromScale(float x, void BH_Mat4fFromTranslation(float x, float y, float z, - float *out); + float out[16]); /** @@ -1250,7 +1250,7 @@ void BH_Mat4fFromTranslation(float x, * \param out Output 4x4 matrix */ void BH_Mat4fFromRotationX(float angle, - float *out); + float out[16]); /** @@ -1261,7 +1261,7 @@ void BH_Mat4fFromRotationX(float angle, * \param out Output 4x4 matrix */ void BH_Mat4fFromRotationY(float angle, - float *out); + float out[16]); /** @@ -1272,7 +1272,7 @@ void BH_Mat4fFromRotationY(float angle, * \param out Output 4x4 matrix */ void BH_Mat4fFromRotationZ(float angle, - float *out); + float out[16]); /** @@ -1283,9 +1283,9 @@ void BH_Mat4fFromRotationZ(float angle, * \param angle Angle * \param out Output 4x4 matrix */ -void BH_Mat4fFromAxis(const float *axis, +void BH_Mat4fFromAxis(const float axis[3], float angle, - float *out); + float out[16]); /** @@ -1302,7 +1302,7 @@ void BH_Mat4fFromAxis(const float *axis, void BH_Mat4fFromEuler(float roll, float pitch, float yaw, - float *out); + float out[16]); /** @@ -1312,8 +1312,8 @@ void BH_Mat4fFromEuler(float roll, * \param in Input quaternion * \param out Output 4x4 matrix */ -void BH_Mat4fFromQuat4f(const float *in, - float *out); +void BH_Mat4fFromQuat4f(const float in[4], + float out[16]); /** @@ -1333,7 +1333,7 @@ void BH_Mat4fFromOrtho(float xMin, float yMax, float zMin, float zMax, - float *out); + float out[16]); /** @@ -1349,7 +1349,7 @@ void BH_Mat4fFromFrustum(float fov, float aspect, float zMin, float zMax, - float *out); + float out[16]); /** @@ -1360,10 +1360,10 @@ void BH_Mat4fFromFrustum(float fov, * \param up Up vector * \param out Output 4x4 matrix */ -void BH_Mat4fFromLookAt(const float *position, - const float *at, - const float *up, - float *out); +void BH_Mat4fFromLookAt(const float position[3], + const float at[3], + const float up[3], + float out[16]); /** @@ -1373,9 +1373,9 @@ void BH_Mat4fFromLookAt(const float *position, * \param b B 4D vector * \param out Output 4D vector */ -void BH_Mat4fApplyVec4f(const float *a, - const float *b, - float *out); +void BH_Mat4fApplyVec4f(const float a[16], + const float b[4], + float out[4]); /** @@ -1385,9 +1385,9 @@ void BH_Mat4fApplyVec4f(const float *a, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Mat4fApplyVec3f(const float *a, - const float *b, - float *out); +void BH_Mat4fApplyVec3f(const float a[16], + const float b[3], + float out[3]); /** @@ -1395,7 +1395,7 @@ void BH_Mat4fApplyVec3f(const float *a, * * \param out Output 3x3 matrix. */ -void BH_Mat3fIdentity(float *out); +void BH_Mat3fIdentity(float out[9]); /** @@ -1405,9 +1405,9 @@ void BH_Mat3fIdentity(float *out); * \param b B 3x3 matrix * \param out Output 3x3 matrix */ -void BH_Mat3fAdd(const float *a, - const float *b, - float *out); +void BH_Mat3fAdd(const float a[9], + const float b[9], + float out[9]); /** @@ -1418,9 +1418,9 @@ void BH_Mat3fAdd(const float *a, * \param b B 3x3 matrix * \param out Output 3x3 matrix */ -void BH_Mat3fSub(const float *a, - const float *b, - float *out); +void BH_Mat3fSub(const float a[9], + const float b[9], + float out[9]); /** @@ -1431,9 +1431,9 @@ void BH_Mat3fSub(const float *a, * \param b B 3x3 matrix * \param out Output 3x3 matrix */ -void BH_Mat3fMul(const float *a, - const float *b, - float *out); +void BH_Mat3fMul(const float a[9], + const float b[9], + float out[9]); /** @@ -1443,9 +1443,9 @@ void BH_Mat3fMul(const float *a, * \param b B value * \param out Output 3x3 matrix */ -void BH_Mat3fScale(const float *a, +void BH_Mat3fScale(const float a[9], float b, - float *out); + float out[9]); /** @@ -1454,8 +1454,8 @@ void BH_Mat3fScale(const float *a, * \param in Input 3x3 matrix * \param out Output 3x3 matrix */ -void BH_Mat3fTranspose(const float *in, - float *out); +void BH_Mat3fTranspose(const float in[9], + float out[9]); /** @@ -1463,7 +1463,7 @@ void BH_Mat3fTranspose(const float *in, * * \param in Input 3x3 matrix */ -float BH_Mat3fTrace(const float *in); +float BH_Mat3fTrace(const float in[9]); /** @@ -1471,7 +1471,7 @@ float BH_Mat3fTrace(const float *in); * * \param in Input 3x3 matrix */ -float BH_Mat3fDet(const float *in); +float BH_Mat3fDet(const float in[9]); /** @@ -1483,8 +1483,8 @@ float BH_Mat3fDet(const float *in); * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Mat3fInverse(const float *in, - float *out); +int BH_Mat3fInverse(const float in[9], + float out[9]); /** @@ -1497,7 +1497,7 @@ int BH_Mat3fInverse(const float *in, */ void BH_Mat3fFromScale(float x, float y, - float *out); + float out[9]); /** @@ -1510,7 +1510,7 @@ void BH_Mat3fFromScale(float x, */ void BH_Mat3fFromTranslation(float x, float y, - float *out); + float out[9]); /** @@ -1520,7 +1520,7 @@ void BH_Mat3fFromTranslation(float x, * \param out Output 3x3 matrix */ void BH_Mat3fFromRotation(float angle, - float *out); + float out[9]); /** @@ -1530,9 +1530,9 @@ void BH_Mat3fFromRotation(float angle, * \param b B 3D vector * \param out Output 3D vector */ -void BH_Mat3fApplyVec3f(float *a, - float *b, - float *out); +void BH_Mat3fApplyVec3f(float a[9], + float b[3], + float out[3]); /** @@ -1542,9 +1542,9 @@ void BH_Mat3fApplyVec3f(float *a, * \param b B 2D vector * \param out Output 2D vector */ -void BH_Mat3fApplyVec2f(float *a, - float *b, - float *out); +void BH_Mat3fApplyVec2f(float a[9], + float b[2], + float out[2]); /** @@ -1565,10 +1565,10 @@ void BH_Mat3fApplyVec2f(float *a, * \return On success, returns zero. * \return On failure, returns error-code. */ -int BH_PlaneFromPoints(const float *a, - const float *b, - const float *c, - float *out); +int BH_PlaneFromPoints(const float a[3], + const float b[3], + const float c[3], + float out[4]); /** @@ -1579,8 +1579,8 @@ int BH_PlaneFromPoints(const float *a, * * \return Returns distance from plane to point. */ -float BH_PlaneDistance(const float *plane, - const float *point); +float BH_PlaneDistance(const float plane[4], + const float point[3]); /** @@ -1591,9 +1591,9 @@ float BH_PlaneDistance(const float *plane, * \param point Point 3D vector * \param out Output 3D vector */ -void BH_PlaneClosestPoint(const float *plane, - const float *point, - float *out); +void BH_PlaneClosestPoint(const float plane[4], + const float point[3], + float out[3]); /** @@ -1611,11 +1611,11 @@ void BH_PlaneClosestPoint(const float *plane, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Ray3fIntersectPlane(const float *start, - const float *direction, - const float *plane, +int BH_Ray3fIntersectPlane(const float start[3], + const float direction[3], + const float plane[4], float *t, - float *out); + float out[3]); /** @@ -1636,13 +1636,13 @@ int BH_Ray3fIntersectPlane(const float *start, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Ray3fIntersectTriangle(const float *start, - const float *direction, - const float *a, - const float *b, - const float *c, +int BH_Ray3fIntersectTriangle(const float start[3], + const float direction[3], + const float a[3], + const float b[3], + const float c[3], float *t, - float *out); + float out[3]); /** @@ -1660,11 +1660,11 @@ int BH_Ray3fIntersectTriangle(const float *start, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Segment3fIntersectPlane(const float *start, - const float *end, - const float *plane, +int BH_Segment3fIntersectPlane(const float start[3], + const float end[3], + const float plane[4], float *t, - float *out); + float out[3]); /** @@ -1685,13 +1685,13 @@ int BH_Segment3fIntersectPlane(const float *start, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Segment3fIntersectTriangle(const float *start, - const float *end, - const float *a, - const float *b, - const float *c, +int BH_Segment3fIntersectTriangle(const float start[3], + const float end[3], + const float a[3], + const float b[3], + const float c[3], float *t, - float *out); + float out[3]); /** @@ -1704,11 +1704,11 @@ int BH_Segment3fIntersectTriangle(const float *start, * \param point Point 3D vector * \param out Output 3D vector */ -void BH_Triangle3fBarycentric(const float *a, - const float *b, - const float *c, - const float *point, - float *out); +void BH_Triangle3fBarycentric(const float a[3], + const float b[3], + const float c[3], + const float point[3], + float out[3]); /** @@ -1721,9 +1721,9 @@ void BH_Triangle3fBarycentric(const float *a, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_LineFromPoints(const float *a, - const float *b, - float *out); +int BH_LineFromPoints(const float a[2], + const float b[2], + float out[3]); /** @@ -1734,8 +1734,8 @@ int BH_LineFromPoints(const float *a, * * \return Returns distance from plane to point. */ -float BH_LineDistance(const float *line, - const float *point); +float BH_LineDistance(const float line[3], + const float point[2]); /** @@ -1746,9 +1746,9 @@ float BH_LineDistance(const float *line, * \param point Point 2D vector * \param out Output 2D vector */ -void BH_LineClosestPoint(const float *line, - const float *point, - float *out); +void BH_LineClosestPoint(const float line[3], + const float point[2], + float out[2]); /** @@ -1766,11 +1766,11 @@ void BH_LineClosestPoint(const float *line, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Ray2fIntersectLine(const float *start, - const float *direction, - const float *line, +int BH_Ray2fIntersectLine(const float start[2], + const float direction[2], + const float line[3], float *t, - float *out); + float out[2]); /** @@ -1788,10 +1788,10 @@ int BH_Ray2fIntersectLine(const float *start, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Ray2fIntersectTime(const float *aStart, - const float *aDirection, - const float *bStart, - const float *bDirection, +int BH_Ray2fIntersectTime(const float aStart[2], + const float aDirection[2], + const float bStart[2], + const float bDirection[2], float *time1, float *time2); @@ -1813,12 +1813,12 @@ int BH_Ray2fIntersectTime(const float *aStart, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Ray2fIntersectRay(const float *aStart, - const float *aDirection, - const float *bStart, - const float *bDirection, +int BH_Ray2fIntersectRay(const float aStart[2], + const float aDirection[2], + const float bStart[2], + const float bDirection[2], float *t, - float *out); + float out[2]); /** @@ -1838,12 +1838,12 @@ int BH_Ray2fIntersectRay(const float *aStart, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Ray2fIntersectSegment(const float *aStart, - const float *aDirection, - const float *bStart, - const float *bEnd, +int BH_Ray2fIntersectSegment(const float aStart[2], + const float aDirection[2], + const float bStart[2], + const float bEnd[2], float *t, - float *out); + float out[2]); /** @@ -1861,11 +1861,11 @@ int BH_Ray2fIntersectSegment(const float *aStart, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Segment2fIntersectLine(const float *start, - const float *end, - const float *line, +int BH_Segment2fIntersectLine(const float start[2], + const float end[2], + const float line[3], float *t, - float *out); + float out[2]); /** @@ -1885,12 +1885,12 @@ int BH_Segment2fIntersectLine(const float *start, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Segment2fIntersectSegment(const float *aStart, - const float *aEnd, - const float *bStart, - const float *bEnd, +int BH_Segment2fIntersectSegment(const float aStart[2], + const float aEnd[2], + const float bStart[2], + const float bEnd[2], float *t, - float *out); + float out[2]); /** @@ -1904,12 +1904,12 @@ int BH_Segment2fIntersectSegment(const float *aStart, * \param outMin Output minimal 3D vector * \param outMax Output maximal 3D vector */ -void BH_Box3fUnion(const float *aMin, - const float *aMax, - const float *bMin, - const float *bMax, - float *outMin, - float *outMax); +void BH_Box3fUnion(const float aMin[3], + const float aMax[3], + const float bMin[3], + const float bMax[3], + float outMin[3], + float outMax[3]); /** @@ -1927,12 +1927,12 @@ void BH_Box3fUnion(const float *aMin, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Box3fIntersect(const float *aMin, - const float *aMax, - const float *bMin, - const float *bMax, - float *outMin, - float *outMax); +int BH_Box3fIntersect(const float aMin[3], + const float aMax[3], + const float bMin[3], + const float bMax[3], + float outMin[3], + float outMax[3]); /** @@ -1946,9 +1946,9 @@ int BH_Box3fIntersect(const float *aMin, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Box3fContains(const float *aMin, - const float *aMax, - const float *point); +int BH_Box3fContains(const float aMin[3], + const float aMax[3], + const float point[3]); /** @@ -1965,8 +1965,8 @@ int BH_Box3fContains(const float *aMin, */ int BH_Box3fEnclose(const float *points, size_t size, - float *outMin, - float *outMax); + float outMin[3], + float outMax[3]); /** @@ -1980,12 +1980,12 @@ int BH_Box3fEnclose(const float *points, * \param outMin Output minimal 2D vector * \param outMax Output maximal 2D vector */ -void BH_Box2fUnion(const float *aMin, - const float *aMax, - const float *bMin, - const float *bMax, - float *outMin, - float *outMax); +void BH_Box2fUnion(const float aMin[2], + const float aMax[2], + const float bMin[2], + const float bMax[2], + float outMin[2], + float outMax[2]); /** @@ -2003,12 +2003,12 @@ void BH_Box2fUnion(const float *aMin, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Box2fIntersect(const float *aMin, - const float *aMax, - const float *bMin, - const float *bMax, - float *outMin, - float *outMax); +int BH_Box2fIntersect(const float aMin[2], + const float aMax[2], + const float bMin[2], + const float bMax[2], + float outMin[2], + float outMax[2]); /** @@ -2022,9 +2022,9 @@ int BH_Box2fIntersect(const float *aMin, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Box2fContains(const float *aMin, - const float *aMax, - const float *point); +int BH_Box2fContains(const float aMin[2], + const float aMax[2], + const float point[2]); /** @@ -2041,8 +2041,8 @@ int BH_Box2fContains(const float *aMin, */ int BH_Box2fEnclose(const float *points, size_t size, - float *outMin, - float *outMax); + float outMin[2], + float outMax[2]); /** @@ -2062,12 +2062,12 @@ int BH_Box2fEnclose(const float *points, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Ray3fIntersectBox3f(const float *aStart, - const float *aDirection, - const float *bMin, - const float *bMax, +int BH_Ray3fIntersectBox3f(const float aStart[3], + const float aDirection[3], + const float bMin[3], + const float bMax[3], float *t, - float *out); + float out[3]); /** @@ -2087,12 +2087,12 @@ int BH_Ray3fIntersectBox3f(const float *aStart, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Segment3fIntersectBox3f(const float *aStart, - const float *aEnd, - const float *bMin, - const float *bMax, +int BH_Segment3fIntersectBox3f(const float aStart[3], + const float aEnd[3], + const float bMin[3], + const float bMax[3], float *t, - float *out); + float out[3]); /** @@ -2112,12 +2112,12 @@ int BH_Segment3fIntersectBox3f(const float *aStart, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Ray2fIntersectBox2f(const float *aStart, - const float *aDirection, - const float *bMin, - const float *bMax, +int BH_Ray2fIntersectBox2f(const float aStart[2], + const float aDirection[2], + const float bMin[2], + const float bMax[2], float *t, - float *out); + float out[2]); /** @@ -2137,12 +2137,12 @@ int BH_Ray2fIntersectBox2f(const float *aStart, * \return On success, returns zero. * \return On failure, returns error code. */ -int BH_Segment2fIntersectBox2f(const float *aStart, - const float *aEnd, - const float *bMin, - const float *bMax, +int BH_Segment2fIntersectBox2f(const float aStart[2], + const float aEnd[2], + const float bMin[2], + const float bMax[2], float *t, - float *out); + float out[2]); #endif /* BH_MATH_H */ diff --git a/src/Math/Box2f.c b/src/Math/Box2f.c index bd6eb73..34adac0 100644 --- a/src/Math/Box2f.c +++ b/src/Math/Box2f.c @@ -6,24 +6,24 @@ #define PI 3.14159265358979323846f -void BH_Box2fUnion(const float *aMin, - const float *aMax, - const float *bMin, - const float *bMax, - float *outMin, - float *outMax) +void BH_Box2fUnion(const float aMin[2], + const float aMax[2], + const float bMin[2], + const float bMax[2], + float outMin[2], + float outMax[2]) { BH_Vec2fMin(aMin, bMin, outMin); BH_Vec2fMax(aMax, bMax, outMax); } -int BH_Box2fIntersect(const float *aMin, - const float *aMax, - const float *bMin, - const float *bMax, - float *outMin, - float *outMax) +int BH_Box2fIntersect(const float aMin[2], + const float aMax[2], + const float bMin[2], + const float bMax[2], + float outMin[2], + float outMax[2]) { BH_Vec2fMax(aMin, bMin, outMin); BH_Vec2fMin(aMax, bMax, outMax); @@ -35,9 +35,9 @@ int BH_Box2fIntersect(const float *aMin, } -int BH_Box2fContains(const float *aMin, - const float *aMax, - const float *point) +int BH_Box2fContains(const float aMin[2], + const float aMax[2], + const float point[2]) { if (point[0] < aMin[0] || point[1] < aMin[1]) return BH_ERROR; @@ -51,8 +51,8 @@ int BH_Box2fContains(const float *aMin, int BH_Box2fEnclose(const float *points, size_t size, - float *outMin, - float *outMax) + float outMin[2], + float outMax[2]) { float tmp1[2], tmp2[2]; size_t i; diff --git a/src/Math/Box3f.c b/src/Math/Box3f.c index ee09dad..b4a1eaf 100644 --- a/src/Math/Box3f.c +++ b/src/Math/Box3f.c @@ -6,24 +6,24 @@ #define PI 3.14159265358979323846f -void BH_Box3fUnion(const float *aMin, - const float *aMax, - const float *bMin, - const float *bMax, - float *outMin, - float *outMax) +void BH_Box3fUnion(const float aMin[3], + const float aMax[3], + const float bMin[3], + const float bMax[3], + float outMin[3], + float outMax[3]) { BH_Vec3fMin(aMin, bMin, outMin); BH_Vec3fMax(aMax, bMax, outMax); } -int BH_Box3fIntersect(const float *aMin, - const float *aMax, - const float *bMin, - const float *bMax, - float *outMin, - float *outMax) +int BH_Box3fIntersect(const float aMin[3], + const float aMax[3], + const float bMin[3], + const float bMax[3], + float outMin[3], + float outMax[3]) { BH_Vec3fMax(aMin, bMin, outMin); BH_Vec3fMin(aMax, bMax, outMax); @@ -35,9 +35,9 @@ int BH_Box3fIntersect(const float *aMin, } -int BH_Box3fContains(const float *aMin, - const float *aMax, - const float *point) +int BH_Box3fContains(const float aMin[3], + const float aMax[3], + const float point[3]) { if (point[0] < aMin[0] || point[1] < aMin[1] || point[2] < aMin[2]) return BH_ERROR; @@ -51,8 +51,8 @@ int BH_Box3fContains(const float *aMin, int BH_Box3fEnclose(const float *points, size_t size, - float *outMin, - float *outMax) + float outMin[3], + float outMax[3]) { float tmp1[3], tmp2[3]; size_t i; diff --git a/src/Math/Line.c b/src/Math/Line.c index 938775f..5dcc3b2 100644 --- a/src/Math/Line.c +++ b/src/Math/Line.c @@ -6,9 +6,9 @@ #define PI 3.14159265358979323846f -int BH_LineFromPoints(const float *a, - const float *b, - float *out) +int BH_LineFromPoints(const float a[2], + const float b[2], + float out[3]) { float tmp[2]; @@ -23,16 +23,16 @@ int BH_LineFromPoints(const float *a, } -float BH_LineDistance(const float *line, - const float *point) +float BH_LineDistance(const float line[3], + const float point[2]) { return BH_Vec2fDot(line, point) - line[2]; } -void BH_LineClosestPoint(const float *line, - const float *point, - float *out) +void BH_LineClosestPoint(const float line[3], + const float point[2], + float out[2]) { float tmp[2]; diff --git a/src/Math/Mat3f.c b/src/Math/Mat3f.c index e78b646..5e7fdff 100644 --- a/src/Math/Mat3f.c +++ b/src/Math/Mat3f.c @@ -7,7 +7,7 @@ #define PI 3.14159265358979323846f -void BH_Mat3fIdentity(float *out) +void BH_Mat3fIdentity(float out[9]) { static const float ident[9] = { @@ -20,9 +20,9 @@ void BH_Mat3fIdentity(float *out) } -void BH_Mat3fAdd(const float *a, - const float *b, - float *out) +void BH_Mat3fAdd(const float a[9], + const float b[9], + float out[9]) { BH_Vec3fAdd(&a[0], &b[0], &out[0]); BH_Vec3fAdd(&a[3], &b[3], &out[3]); @@ -30,9 +30,9 @@ void BH_Mat3fAdd(const float *a, } -void BH_Mat3fSub(const float *a, - const float *b, - float *out) +void BH_Mat3fSub(const float a[9], + const float b[9], + float out[9]) { BH_Vec3fSub(&a[0], &b[0], &out[0]); BH_Vec3fSub(&a[3], &b[3], &out[3]); @@ -40,9 +40,9 @@ void BH_Mat3fSub(const float *a, } -void BH_Mat3fMul(const float *a, - const float *b, - float *out) +void BH_Mat3fMul(const float a[9], + const float b[9], + float out[9]) { float tmp[9], row[3]; @@ -62,9 +62,9 @@ void BH_Mat3fMul(const float *a, } -void BH_Mat3fScale(const float *a, +void BH_Mat3fScale(const float a[9], float b, - float *out) + float out[9]) { BH_Vec3fScale(&a[0], b, &out[0]); BH_Vec3fScale(&a[3], b, &out[3]); @@ -72,8 +72,8 @@ void BH_Mat3fScale(const float *a, } -void BH_Mat3fTranspose(const float *in, - float *out) +void BH_Mat3fTranspose(const float in[9], + float out[9]) { float tmp[9]; @@ -85,13 +85,13 @@ void BH_Mat3fTranspose(const float *in, } -float BH_Mat3fTrace(const float *in) +float BH_Mat3fTrace(const float in[9]) { return in[0] + in[4] + in[8]; } -float BH_Mat3fDet(const float *in) +float BH_Mat3fDet(const float in[9]) { float a, b, c, result; @@ -108,8 +108,8 @@ float BH_Mat3fDet(const float *in) } -int BH_Mat3fInverse(const float *in, - float *out) +int BH_Mat3fInverse(const float in[9], + float out[9]) { float a, b, c, det; float tmp[16]; @@ -153,7 +153,7 @@ int BH_Mat3fInverse(const float *in, void BH_Mat3fFromScale(float x, float y, - float *out) + float out[9]) { BH_Mat3fIdentity(out); out[0] = x; @@ -163,7 +163,7 @@ void BH_Mat3fFromScale(float x, void BH_Mat3fFromTranslation(float x, float y, - float *out) + float out[9]) { BH_Mat3fIdentity(out); out[6] = x; @@ -172,7 +172,7 @@ void BH_Mat3fFromTranslation(float x, void BH_Mat3fFromRotation(float angle, - float *out) + float out[9]) { float c, s; @@ -187,9 +187,9 @@ void BH_Mat3fFromRotation(float angle, } -void BH_Mat3fApplyVec3f(float *a, - float *b, - float *out) +void BH_Mat3fApplyVec3f(float a[9], + float b[3], + float out[3]) { float tmp[3], row[3]; @@ -201,9 +201,9 @@ void BH_Mat3fApplyVec3f(float *a, } -void BH_Mat3fApplyVec2f(float *a, - float *b, - float *out) +void BH_Mat3fApplyVec2f(float a[9], + float b[2], + float out[2]) { float tmp[3], row[3]; diff --git a/src/Math/Mat4f.c b/src/Math/Mat4f.c index c7f6d14..2e675e6 100644 --- a/src/Math/Mat4f.c +++ b/src/Math/Mat4f.c @@ -7,7 +7,7 @@ #define PI 3.14159265358979323846f -void BH_Mat4fIdentity(float *out) +void BH_Mat4fIdentity(float out[16]) { const float ident[16] = { @@ -21,9 +21,9 @@ void BH_Mat4fIdentity(float *out) } -void BH_Mat4fAdd(const float *a, - const float *b, - float *out) +void BH_Mat4fAdd(const float a[16], + const float b[16], + float out[16]) { BH_Vec4fAdd(&a[0], &b[0], &out[0]); BH_Vec4fAdd(&a[4], &b[4], &out[4]); @@ -32,9 +32,9 @@ void BH_Mat4fAdd(const float *a, } -void BH_Mat4fSub(const float *a, - const float *b, - float *out) +void BH_Mat4fSub(const float a[16], + const float b[16], + float out[16]) { BH_Vec4fSub(&a[0], &b[0], &out[0]); BH_Vec4fSub(&a[4], &b[4], &out[4]); @@ -43,9 +43,9 @@ void BH_Mat4fSub(const float *a, } -void BH_Mat4fMul(const float *a, - const float *b, - float *out) +void BH_Mat4fMul(const float a[16], + const float b[16], + float out[16]) { float tmp[16], row[4]; @@ -73,9 +73,9 @@ void BH_Mat4fMul(const float *a, } -void BH_Mat4fScale(const float *a, +void BH_Mat4fScale(const float a[16], float b, - float *out) + float out[16]) { BH_Vec4fScale(&a[0], b, &out[0]); BH_Vec4fScale(&a[4], b, &out[4]); @@ -84,8 +84,8 @@ void BH_Mat4fScale(const float *a, } -void BH_Mat4fTranspose(const float *in, - float *out) +void BH_Mat4fTranspose(const float in[16], + float out[16]) { float tmp[16]; @@ -98,13 +98,13 @@ void BH_Mat4fTranspose(const float *in, } -float BH_Mat4fTrace(const float *in) +float BH_Mat4fTrace(const float in[16]) { return in[0] + in[5] + in[10] + in[15]; } -float BH_Mat4fDet(const float *in) +float BH_Mat4fDet(const float in[16]) { float a, b, c, d, e, f, result; @@ -125,8 +125,8 @@ float BH_Mat4fDet(const float *in) } -int BH_Mat4fInverse(const float *in, - float *out) +int BH_Mat4fInverse(const float in[16], + float out[16]) { float a, b, c, d, e, f, det; float tmp[16]; @@ -189,7 +189,7 @@ int BH_Mat4fInverse(const float *in, void BH_Mat4fFromScale(float x, float y, float z, - float *out) + float out[16]) { BH_Mat4fIdentity(out); out[0] = x; @@ -201,7 +201,7 @@ void BH_Mat4fFromScale(float x, void BH_Mat4fFromTranslation(float x, float y, float z, - float *out) + float out[16]) { BH_Mat4fIdentity(out); out[12] = x; @@ -211,7 +211,7 @@ void BH_Mat4fFromTranslation(float x, void BH_Mat4fFromRotationX(float angle, - float *out) + float out[16]) { float c, s; @@ -227,7 +227,7 @@ void BH_Mat4fFromRotationX(float angle, void BH_Mat4fFromRotationY(float angle, - float *out) + float out[16]) { float c, s; @@ -243,7 +243,7 @@ void BH_Mat4fFromRotationY(float angle, void BH_Mat4fFromRotationZ(float angle, - float *out) + float out[16]) { float c, s; @@ -258,9 +258,9 @@ void BH_Mat4fFromRotationZ(float angle, } -void BH_Mat4fFromAxis(const float *axis, +void BH_Mat4fFromAxis(const float axis[3], float angle, - float *out) + float out[16]) { float x, y, z, length; float c, s, moc, xx, xy, xz, yy, yz, zz; @@ -303,7 +303,7 @@ void BH_Mat4fFromAxis(const float *axis, void BH_Mat4fFromEuler(float roll, float pitch, float yaw, - float *out) + float out[16]) { float rs, rc, ys, yc, ps, pc; @@ -327,8 +327,8 @@ void BH_Mat4fFromEuler(float roll, } -void BH_Mat4fFromQuat4f(const float *in, - float *out) +void BH_Mat4fFromQuat4f(const float in[4], + float out[16]) { BH_Quat4fToMat4f(in, out); } @@ -340,7 +340,7 @@ void BH_Mat4fFromOrtho(float xMin, float yMax, float zMin, float zMax, - float *out) + float out[16]) { float dx, dy, dz; @@ -363,7 +363,7 @@ void BH_Mat4fFromFrustum(float fov, float aspect, float zMin, float zMax, - float *out) + float out[16]) { float t, dz; @@ -381,10 +381,10 @@ void BH_Mat4fFromFrustum(float fov, } -void BH_Mat4fFromLookAt(const float *position, - const float *at, - const float *up, - float *out) +void BH_Mat4fFromLookAt(const float position[3], + const float at[3], + const float up[3], + float out[16]) { float cameraDir[3], cameraRight[3], cameraUp[3]; @@ -416,9 +416,9 @@ void BH_Mat4fFromLookAt(const float *position, } -void BH_Mat4fApplyVec4f(const float *a, - const float *b, - float *out) +void BH_Mat4fApplyVec4f(const float a[16], + const float b[4], + float out[4]) { float tmp[4], row[4]; @@ -431,9 +431,9 @@ void BH_Mat4fApplyVec4f(const float *a, } -void BH_Mat4fApplyVec3f(const float *a, - const float *b, - float *out) +void BH_Mat4fApplyVec3f(const float a[16], + const float b[3], + float out[3]) { float tmp[4], row[4]; diff --git a/src/Math/Misc.c b/src/Math/Misc.c index 3d09c2f..1acb2fa 100644 --- a/src/Math/Misc.c +++ b/src/Math/Misc.c @@ -7,11 +7,11 @@ float BH_Lerpf(float a, float b, float t) } -void BH_Triangle3fBarycentric(const float *a, - const float *b, - const float *c, - const float *point, - float *out) +void BH_Triangle3fBarycentric(const float a[3], + const float b[3], + const float c[3], + const float point[3], + float out[3]) { float tmp1[3], tmp2[3], tmp3[3]; float t11, t12, t22, t31, t32, denom; diff --git a/src/Math/Plane.c b/src/Math/Plane.c index 23711c5..d2dbe76 100644 --- a/src/Math/Plane.c +++ b/src/Math/Plane.c @@ -6,10 +6,10 @@ #define PI 3.14159265358979323846f -int BH_PlaneFromPoints(const float *a, - const float *b, - const float *c, - float *out) +int BH_PlaneFromPoints(const float a[3], + const float b[3], + const float c[3], + float out[4]) { float tmp1[3], tmp2[3]; @@ -25,16 +25,16 @@ int BH_PlaneFromPoints(const float *a, } -float BH_PlaneDistance(const float *plane, - const float *point) +float BH_PlaneDistance(const float plane[4], + const float point[3]) { return BH_Vec3fDot(plane, point) - plane[3]; } -void BH_PlaneClosestPoint(const float *plane, - const float *point, - float *out) +void BH_PlaneClosestPoint(const float plane[4], + const float point[3], + float out[3]) { float tmp[3]; diff --git a/src/Math/Quat4f.c b/src/Math/Quat4f.c index 45e9b32..be69bc5 100644 --- a/src/Math/Quat4f.c +++ b/src/Math/Quat4f.c @@ -7,15 +7,15 @@ #define PI 3.14159265358979323846f -void BH_Quat4fIdentity(float *out) +void BH_Quat4fIdentity(float out[4]) { static const float ident[4] = {0.0f, 0.0f, 0.0f, 1.0f}; memcpy(out, ident, sizeof(ident)); } -void BH_Quat4fConjugate(const float *in, - float *out) +void BH_Quat4fConjugate(const float in[4], + float out[4]) { out[0] = -in[0]; out[1] = -in[1]; @@ -24,8 +24,8 @@ void BH_Quat4fConjugate(const float *in, } -void BH_Quat4fInverse(const float *in, - float *out) +void BH_Quat4fInverse(const float in[4], + float out[4]) { float dot; @@ -35,9 +35,9 @@ void BH_Quat4fInverse(const float *in, } -void BH_Quat4fMul(const float *a, - const float *b, - float *out) +void BH_Quat4fMul(const float a[4], + const float b[4], + float out[4]) { float tmp1[4], tmp2[4], tmp3[4]; float w; @@ -52,10 +52,10 @@ void BH_Quat4fMul(const float *a, } -void BH_Quat4fSlerp(const float *a, - const float *b, +void BH_Quat4fSlerp(const float a[4], + const float b[4], float t, - float *out) + float out[4]) { float angle, denom; float from[4], to[4]; @@ -77,7 +77,7 @@ void BH_Quat4fSlerp(const float *a, void BH_Quat4fFromEuler(float roll, float pitch, float yaw, - float *out) + float out[4]) { float cr, cp, cy, sr, sp, sy; @@ -95,9 +95,9 @@ void BH_Quat4fFromEuler(float roll, } -void BH_Quat4fFromAxis(const float *axis, +void BH_Quat4fFromAxis(const float axis[3], float angle, - float *out) + float out[4]) { float c, s; @@ -111,7 +111,7 @@ void BH_Quat4fFromAxis(const float *axis, } -void BH_Quat4fToEuler(const float *in, +void BH_Quat4fToEuler(const float in[4], float *roll, float *pitch, float *yaw) @@ -155,8 +155,8 @@ void BH_Quat4fToEuler(const float *in, } -void BH_Quat4fToAxis(const float *in, - float *axis, +void BH_Quat4fToAxis(const float in[4], + float axis[3], float *angle) { *angle = 2.0f * acosf(in[3]); @@ -179,8 +179,8 @@ void BH_Quat4fToAxis(const float *in, } -void BH_Quat4fToMat4f(const float *in, - float *out) +void BH_Quat4fToMat4f(const float in[4], + float out[16]) { float xx, xy, xz, xw, yy, yz, yw, zz, zw; diff --git a/src/Math/Ray2f.c b/src/Math/Ray2f.c index 7e217ea..db62b5f 100644 --- a/src/Math/Ray2f.c +++ b/src/Math/Ray2f.c @@ -6,11 +6,11 @@ #define PI 3.14159265358979323846f -int BH_Ray2fIntersectLine(const float *start, - const float *direction, - const float *line, +int BH_Ray2fIntersectLine(const float start[2], + const float direction[2], + const float line[3], float *t, - float *out) + float out[2]) { float tmp1[2]; float denom, time; @@ -31,10 +31,10 @@ int BH_Ray2fIntersectLine(const float *start, } -int BH_Ray2fIntersectTime(const float *aStart, - const float *aDirection, - const float *bStart, - const float *bDirection, +int BH_Ray2fIntersectTime(const float aStart[2], + const float aDirection[2], + const float bStart[2], + const float bDirection[2], float *time1, float *time2) { @@ -58,12 +58,12 @@ int BH_Ray2fIntersectTime(const float *aStart, } -int BH_Ray2fIntersectRay(const float *aStart, - const float *aDirection, - const float *bStart, - const float *bDirection, +int BH_Ray2fIntersectRay(const float aStart[2], + const float aDirection[2], + const float bStart[2], + const float bDirection[2], float *t, - float *out) + float out[2]) { float tmp[2]; float time1, time2; @@ -81,12 +81,12 @@ int BH_Ray2fIntersectRay(const float *aStart, } -int BH_Ray2fIntersectSegment(const float *aStart, - const float *aDirection, - const float *bStart, - const float *bEnd, +int BH_Ray2fIntersectSegment(const float aStart[2], + const float aDirection[2], + const float bStart[2], + const float bEnd[2], float *t, - float *out) + float out[2]) { float tmp[2]; float time1, time2; @@ -105,11 +105,11 @@ int BH_Ray2fIntersectSegment(const float *aStart, } -int BH_Segment2fIntersectLine(const float *start, - const float *end, - const float *line, +int BH_Segment2fIntersectLine(const float start[2], + const float end[2], + const float line[3], float *t, - float *out) + float out[2]) { float tmp[2]; float denom, time; @@ -131,12 +131,12 @@ int BH_Segment2fIntersectLine(const float *start, } -int BH_Segment2fIntersectSegment(const float *aStart, - const float *aEnd, - const float *bStart, - const float *bEnd, +int BH_Segment2fIntersectSegment(const float aStart[2], + const float aEnd[2], + const float bStart[2], + const float bEnd[2], float *t, - float *out) + float out[2]) { float tmp1[2], tmp2[2]; float time1, time2; @@ -156,12 +156,12 @@ int BH_Segment2fIntersectSegment(const float *aStart, } -int BH_Ray2fIntersectBox2f(const float *aStart, - const float *aDirection, - const float *bMin, - const float *bMax, +int BH_Ray2fIntersectBox2f(const float aStart[2], + const float aDirection[2], + const float bMin[2], + const float bMax[2], float *t, - float *out) + float out[2]) { float timeNear, timeFar, hitNear, hitFar, denom, tmp; int i; @@ -215,12 +215,12 @@ int BH_Ray2fIntersectBox2f(const float *aStart, } -int BH_Segment2fIntersectBox2f(const float *aStart, - const float *aEnd, - const float *bMin, - const float *bMax, +int BH_Segment2fIntersectBox2f(const float aStart[2], + const float aEnd[2], + const float bMin[2], + const float bMax[2], float *t, - float *out) + float out[2]) { float tmp[3]; float time; diff --git a/src/Math/Ray3f.c b/src/Math/Ray3f.c index e265071..2393330 100644 --- a/src/Math/Ray3f.c +++ b/src/Math/Ray3f.c @@ -7,11 +7,11 @@ #define PI 3.14159265358979323846f -int BH_Ray3fIntersectPlane(const float *start, - const float *direction, - const float *plane, +int BH_Ray3fIntersectPlane(const float start[3], + const float direction[3], + const float plane[4], float *t, - float *out) + float out[3]) { float tmp1[3]; float denom, time; @@ -32,13 +32,13 @@ int BH_Ray3fIntersectPlane(const float *start, } -int BH_Ray3fIntersectTriangle(const float *start, - const float *direction, - const float *a, - const float *b, - const float *c, +int BH_Ray3fIntersectTriangle(const float start[3], + const float direction[3], + const float a[3], + const float b[3], + const float c[3], float *t, - float *out) + float out[3]) { float plane[4]; float tmp1[3], tmp2[3], tmp3[3]; @@ -78,11 +78,11 @@ int BH_Ray3fIntersectTriangle(const float *start, } -int BH_Segment3fIntersectPlane(const float *start, - const float *end, - const float *plane, +int BH_Segment3fIntersectPlane(const float start[3], + const float end[3], + const float plane[4], float *t, - float *out) + float out[3]) { float tmp[3]; float denom, time; @@ -104,13 +104,13 @@ int BH_Segment3fIntersectPlane(const float *start, } -int BH_Segment3fIntersectTriangle(const float *start, - const float *end, - const float *a, - const float *b, - const float *c, +int BH_Segment3fIntersectTriangle(const float start[3], + const float end[3], + const float a[3], + const float b[3], + const float c[3], float *t, - float *out) + float out[3]) { float plane[4]; float tmp1[3], tmp2[3], tmp3[3]; @@ -150,12 +150,12 @@ int BH_Segment3fIntersectTriangle(const float *start, } -int BH_Ray3fIntersectBox3f(const float *aStart, - const float *aDirection, - const float *bMin, - const float *bMax, +int BH_Ray3fIntersectBox3f(const float aStart[3], + const float aDirection[3], + const float bMin[3], + const float bMax[3], float *t, - float *out) + float out[3]) { float timeNear, timeFar, hitNear, hitFar, denom, tmp; int i; @@ -210,12 +210,12 @@ int BH_Ray3fIntersectBox3f(const float *aStart, } -int BH_Segment3fIntersectBox3f(const float *aStart, - const float *aEnd, - const float *bMin, - const float *bMax, +int BH_Segment3fIntersectBox3f(const float aStart[3], + const float aEnd[3], + const float bMin[3], + const float bMax[3], float *t, - float *out) + float out[3]) { float tmp[3]; float time; diff --git a/src/Math/Vec2f.c b/src/Math/Vec2f.c index 351415b..bd6c0a8 100644 --- a/src/Math/Vec2f.c +++ b/src/Math/Vec2f.c @@ -2,89 +2,89 @@ #include -void BH_Vec2fAdd(const float *a, - const float *b, - float *out) +void BH_Vec2fAdd(const float a[2], + const float b[2], + float out[2]) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; } -void BH_Vec2fSub(const float *a, - const float *b, - float *out) +void BH_Vec2fSub(const float a[2], + const float b[2], + float out[2]) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; } -void BH_Vec2fMul(const float *a, - const float *b, - float *out) +void BH_Vec2fMul(const float a[2], + const float b[2], + float out[2]) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; } -void BH_Vec2fScale(const float *a, - const float b, - float *out) +void BH_Vec2fScale(const float a[2], + float b, + float out[2]) { out[0] = a[0] * b; out[1] = a[1] * b; } -void BH_Vec2fMulAdd(const float *a, - const float *b, - const float *c, - float *out) +void BH_Vec2fMulAdd(const float a[2], + const float b[2], + const float c[2], + float out[2]) { out[0] = a[0] * b[0] + c[0]; out[1] = a[1] * b[1] + c[1]; } -void BH_Vec2fNegate(const float *in, - float *out) +void BH_Vec2fNegate(const float in[2], + float out[2]) { out[0] = -in[0]; out[1] = -in[1]; } -float BH_Vec2fDot(const float *a, - const float *b) +float BH_Vec2fDot(const float a[2], + const float b[2]) { return a[0] * b[0] + a[1] * b[1]; } -float BH_Vec2fCross(const float *a, - const float *b) +float BH_Vec2fCross(const float a[2], + const float b[2]) { return a[0] * b[1] - a[1] * b[0]; } -float BH_Vec2fLength(const float *in) +float BH_Vec2fLength(const float in[2]) { return sqrtf(BH_Vec2fDot(in, in)); } -void BH_Vec2fNormal(const float *in, - float *out) +void BH_Vec2fNormal(const float in[2], + float out[2]) { BH_Vec2fScale(in, 1.0f / BH_Vec2fLength(in), out); } -float BH_Vec2fNormalEx(const float *in, - float *out) +float BH_Vec2fNormalEx(const float in[2], + float out[2]) { float length; @@ -94,28 +94,28 @@ float BH_Vec2fNormalEx(const float *in, } -void BH_Vec2fMin(const float *a, - const float *b, - float *out) +void BH_Vec2fMin(const float a[2], + const float b[2], + float out[2]) { if (a[0] < b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] < b[1]) out[1] = a[1]; else out[1] = b[1]; } -void BH_Vec2fMax(const float *a, - const float *b, - float *out) +void BH_Vec2fMax(const float a[2], + const float b[2], + float out[2]) { if (a[0] > b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1]; } -void BH_Vec2fLerp(const float *a, - const float *b, +void BH_Vec2fLerp(const float a[2], + const float b[2], float t, - float *out) + float out[2]) { float tmp[2]; @@ -125,9 +125,9 @@ void BH_Vec2fLerp(const float *a, } -void BH_Vec2fProject(const float *a, - const float *b, - float *out) +void BH_Vec2fProject(const float a[2], + const float b[2], + float out[2]) { float amount; @@ -136,12 +136,12 @@ void BH_Vec2fProject(const float *a, } -void BH_Vec2fBarycentric(const float *a, - const float *b, - const float *c, +void BH_Vec2fBarycentric(const float a[2], + const float b[2], + const float c[2], float v, float w, - float *out) + float out[2]) { float tmp1[2], tmp2[2]; float u; diff --git a/src/Math/Vec2i.c b/src/Math/Vec2i.c index 94601ec..7f3bc64 100644 --- a/src/Math/Vec2i.c +++ b/src/Math/Vec2i.c @@ -1,72 +1,72 @@ #include -void BH_Vec2iAdd(const int *a, - const int *b, - int *out) +void BH_Vec2iAdd(const int a[2], + const int b[2], + int out[2]) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; } -void BH_Vec2iSub(const int *a, - const int *b, - int *out) +void BH_Vec2iSub(const int a[2], + const int b[2], + int out[2]) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; } -void BH_Vec2iMul(const int *a, - const int *b, - int *out) +void BH_Vec2iMul(const int a[2], + const int b[2], + int out[2]) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; } -void BH_Vec2iScale(const int *a, +void BH_Vec2iScale(const int a[2], int b, - int *out) + int out[2]) { out[0] = a[0] * b; out[1] = a[1] * b; } -void BH_Vec2iMulAdd(const int *a, - const int *b, - const int *c, - int *out) +void BH_Vec2iMulAdd(const int a[2], + const int b[2], + const int c[2], + int out[2]) { out[0] = a[0] * b[0] + c[0]; out[1] = a[1] * b[1] + c[1]; } -void BH_Vec2iNegate(const int *in, - int *out) +void BH_Vec2iNegate(const int in[2], + int out[2]) { out[0] = -in[0]; out[1] = -in[1]; } -void BH_Vec2iMin(const int *a, - const int *b, - int *out) +void BH_Vec2iMin(const int a[2], + const int b[2], + int out[2]) { if (a[0] < b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] < b[1]) out[1] = a[1]; else out[1] = b[1]; } -void BH_Vec2iMax(const int *a, - const int *b, - int *out) +void BH_Vec2iMax(const int a[2], + const int b[2], + int out[2]) { if (a[0] > b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1]; diff --git a/src/Math/Vec3f.c b/src/Math/Vec3f.c index 50a268d..2119431 100644 --- a/src/Math/Vec3f.c +++ b/src/Math/Vec3f.c @@ -3,9 +3,9 @@ #include -void BH_Vec3fAdd(const float *a, - const float *b, - float *out) +void BH_Vec3fAdd(const float a[3], + const float b[3], + float out[3]) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; @@ -13,9 +13,9 @@ void BH_Vec3fAdd(const float *a, } -void BH_Vec3fSub(const float *a, - const float *b, - float *out) +void BH_Vec3fSub(const float a[3], + const float b[3], + float out[3]) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; @@ -23,9 +23,9 @@ void BH_Vec3fSub(const float *a, } -void BH_Vec3fMul(const float *a, - const float *b, - float *out) +void BH_Vec3fMul(const float a[3], + const float b[3], + float out[3]) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; @@ -33,9 +33,9 @@ void BH_Vec3fMul(const float *a, } -void BH_Vec3fScale(const float *a, - const float b, - float *out) +void BH_Vec3fScale(const float a[3], + float b, + float out[3]) { out[0] = a[0] * b; out[1] = a[1] * b; @@ -43,10 +43,10 @@ void BH_Vec3fScale(const float *a, } -void BH_Vec3fMulAdd(const float *a, - const float *b, - const float *c, - float *out) +void BH_Vec3fMulAdd(const float a[3], + const float b[3], + const float c[3], + float out[3]) { out[0] = a[0] * b[0] + c[0]; out[1] = a[1] * b[1] + c[1]; @@ -54,8 +54,8 @@ void BH_Vec3fMulAdd(const float *a, } -void BH_Vec3fNegate(const float *in, - float *out) +void BH_Vec3fNegate(const float in[3], + float out[3]) { out[0] = -in[0]; out[1] = -in[1]; @@ -63,16 +63,16 @@ void BH_Vec3fNegate(const float *in, } -float BH_Vec3fDot(const float *a, - const float *b) +float BH_Vec3fDot(const float a[3], + const float b[3]) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } -void BH_Vec3fCross(const float *a, - const float *b, - float *out) +void BH_Vec3fCross(const float a[3], + const float b[3], + float out[3]) { float tmp[3]; @@ -83,21 +83,21 @@ void BH_Vec3fCross(const float *a, } -float BH_Vec3fLength(const float *in) +float BH_Vec3fLength(const float in[3]) { return sqrtf(BH_Vec3fDot(in, in)); } -void BH_Vec3fNormal(const float *in, - float *out) +void BH_Vec3fNormal(const float in[3], + float out[3]) { BH_Vec3fScale(in, 1.0f / BH_Vec3fLength(in), out); } -float BH_Vec3fNormalEx(const float *in, - float *out) +float BH_Vec3fNormalEx(const float in[3], + float out[3]) { float length; @@ -107,9 +107,9 @@ float BH_Vec3fNormalEx(const float *in, } -void BH_Vec3fMin(const float *a, - const float *b, - float *out) +void BH_Vec3fMin(const float a[3], + const float b[3], + float out[3]) { if (a[0] < b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] < b[1]) out[1] = a[1]; else out[1] = b[1]; @@ -117,9 +117,9 @@ void BH_Vec3fMin(const float *a, } -void BH_Vec3fMax(const float *a, - const float *b, - float *out) +void BH_Vec3fMax(const float a[3], + const float b[3], + float out[3]) { if (a[0] > b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1]; @@ -127,10 +127,10 @@ void BH_Vec3fMax(const float *a, } -void BH_Vec3fLerp(const float *a, - const float *b, +void BH_Vec3fLerp(const float a[3], + const float b[3], float t, - float *out) + float out[3]) { float tmp[3]; @@ -140,9 +140,9 @@ void BH_Vec3fLerp(const float *a, } -void BH_Vec3fProject(const float *a, - const float *b, - float *out) +void BH_Vec3fProject(const float a[3], + const float b[3], + float out[3]) { float amount; @@ -151,12 +151,12 @@ void BH_Vec3fProject(const float *a, } -void BH_Vec3fBarycentric(const float *a, - const float *b, - const float *c, +void BH_Vec3fBarycentric(const float a[3], + const float b[3], + const float c[3], float v, float w, - float *out) + float out[3]) { float tmp1[3], tmp2[3]; float u; diff --git a/src/Math/Vec3i.c b/src/Math/Vec3i.c index c791c09..1b07d7a 100644 --- a/src/Math/Vec3i.c +++ b/src/Math/Vec3i.c @@ -1,9 +1,9 @@ #include -void BH_Vec3iAdd(const int *a, - const int *b, - int *out) +void BH_Vec3iAdd(const int a[3], + const int b[3], + int out[3]) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; @@ -11,9 +11,9 @@ void BH_Vec3iAdd(const int *a, } -void BH_Vec3iSub(const int *a, - const int *b, - int *out) +void BH_Vec3iSub(const int a[3], + const int b[3], + int out[3]) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; @@ -21,9 +21,9 @@ void BH_Vec3iSub(const int *a, } -void BH_Vec3iMul(const int *a, - const int *b, - int *out) +void BH_Vec3iMul(const int a[3], + const int b[3], + int out[3]) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; @@ -31,9 +31,9 @@ void BH_Vec3iMul(const int *a, } -void BH_Vec3iScale(const int *a, +void BH_Vec3iScale(const int a[3], int b, - int *out) + int out[3]) { out[0] = a[0] * b; out[1] = a[1] * b; @@ -41,10 +41,10 @@ void BH_Vec3iScale(const int *a, } -void BH_Vec3iMulAdd(const int *a, - const int *b, - const int *c, - int *out) +void BH_Vec3iMulAdd(const int a[3], + const int b[3], + const int c[3], + int out[3]) { out[0] = a[0] * b[0] + c[0]; out[1] = a[1] * b[1] + c[1]; @@ -52,8 +52,8 @@ void BH_Vec3iMulAdd(const int *a, } -void BH_Vec3iNegate(const int *in, - int *out) +void BH_Vec3iNegate(const int in[3], + int out[3]) { out[0] = -in[0]; out[1] = -in[1]; @@ -61,9 +61,9 @@ void BH_Vec3iNegate(const int *in, } -void BH_Vec3iMin(const int *a, - const int *b, - int *out) +void BH_Vec3iMin(const int a[3], + const int b[3], + int out[3]) { if (a[0] < b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] < b[1]) out[1] = a[1]; else out[1] = b[1]; @@ -71,9 +71,9 @@ void BH_Vec3iMin(const int *a, } -void BH_Vec3iMax(const int *a, - const int *b, - int *out) +void BH_Vec3iMax(const int a[3], + const int b[3], + int out[3]) { if (a[0] > b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1]; diff --git a/src/Math/Vec4f.c b/src/Math/Vec4f.c index 768f84c..5a64055 100644 --- a/src/Math/Vec4f.c +++ b/src/Math/Vec4f.c @@ -2,9 +2,9 @@ #include -void BH_Vec4fAdd(const float *a, - const float *b, - float *out) +void BH_Vec4fAdd(const float a[4], + const float b[4], + float out[4]) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; @@ -13,9 +13,9 @@ void BH_Vec4fAdd(const float *a, } -void BH_Vec4fSub(const float *a, - const float *b, - float *out) +void BH_Vec4fSub(const float a[4], + const float b[4], + float out[4]) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; @@ -24,9 +24,9 @@ void BH_Vec4fSub(const float *a, } -void BH_Vec4fMul(const float *a, - const float *b, - float *out) +void BH_Vec4fMul(const float a[4], + const float b[4], + float out[4]) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; @@ -35,9 +35,9 @@ void BH_Vec4fMul(const float *a, } -void BH_Vec4fScale(const float *a, - const float b, - float *out) +void BH_Vec4fScale(const float a[4], + float b, + float out[4]) { out[0] = a[0] * b; out[1] = a[1] * b; @@ -46,10 +46,10 @@ void BH_Vec4fScale(const float *a, } -void BH_Vec4fMulAdd(const float *a, - const float *b, - const float *c, - float *out) +void BH_Vec4fMulAdd(const float a[4], + const float b[4], + const float c[4], + float out[4]) { out[0] = a[0] * b[0] + c[0]; out[1] = a[1] * b[1] + c[1]; @@ -58,8 +58,8 @@ void BH_Vec4fMulAdd(const float *a, } -void BH_Vec4fNegate(const float *in, - float *out) +void BH_Vec4fNegate(const float in[4], + float out[4]) { out[0] = -in[0]; out[1] = -in[1]; @@ -68,28 +68,28 @@ void BH_Vec4fNegate(const float *in, } -float BH_Vec4fDot(const float *a, - const float *b) +float BH_Vec4fDot(const float a[4], + const float b[4]) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; } -float BH_Vec4fLength(const float *in) +float BH_Vec4fLength(const float in[4]) { return sqrtf(BH_Vec4fDot(in, in)); } -void BH_Vec4fNormal(const float *in, - float *out) +void BH_Vec4fNormal(const float in[4], + float out[4]) { BH_Vec4fScale(in, 1.0f / BH_Vec4fLength(in), out); } -float BH_Vec4fNormalEx(const float *in, - float *out) +float BH_Vec4fNormalEx(const float in[4], + float out[4]) { float length; @@ -99,9 +99,9 @@ float BH_Vec4fNormalEx(const float *in, } -void BH_Vec4fMin(const float *a, - const float *b, - float *out) +void BH_Vec4fMin(const float a[4], + const float b[4], + float out[4]) { if (a[0] < b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] < b[1]) out[1] = a[1]; else out[1] = b[1]; @@ -110,9 +110,9 @@ void BH_Vec4fMin(const float *a, } -void BH_Vec4fMax(const float *a, - const float *b, - float *out) +void BH_Vec4fMax(const float a[4], + const float b[4], + float out[4]) { if (a[0] > b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1]; @@ -121,10 +121,10 @@ void BH_Vec4fMax(const float *a, } -void BH_Vec4fLerp(const float *a, - const float *b, +void BH_Vec4fLerp(const float a[4], + const float b[4], float t, - float *out) + float out[4]) { float tmp[4]; @@ -134,9 +134,9 @@ void BH_Vec4fLerp(const float *a, } -void BH_Vec4fProject(const float *a, - const float *b, - float *out) +void BH_Vec4fProject(const float a[4], + const float b[4], + float out[4]) { float amount; @@ -145,12 +145,12 @@ void BH_Vec4fProject(const float *a, } -void BH_Vec4fBarycentric(const float *a, - const float *b, - const float *c, +void BH_Vec4fBarycentric(const float a[4], + const float b[4], + const float c[4], float v, float w, - float *out) + float out[4]) { float tmp1[4], tmp2[4]; float u; diff --git a/src/Math/Vec4i.c b/src/Math/Vec4i.c index e62ff9e..915d3a2 100644 --- a/src/Math/Vec4i.c +++ b/src/Math/Vec4i.c @@ -1,9 +1,9 @@ #include -void BH_Vec4iAdd(const int *a, - const int *b, - int *out) +void BH_Vec4iAdd(const int a[4], + const int b[4], + int out[4]) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; @@ -12,9 +12,9 @@ void BH_Vec4iAdd(const int *a, } -void BH_Vec4iSub(const int *a, - const int *b, - int *out) +void BH_Vec4iSub(const int a[4], + const int b[4], + int out[4]) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; @@ -23,9 +23,9 @@ void BH_Vec4iSub(const int *a, } -void BH_Vec4iMul(const int *a, - const int *b, - int *out) +void BH_Vec4iMul(const int a[4], + const int b[4], + int out[4]) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; @@ -34,9 +34,9 @@ void BH_Vec4iMul(const int *a, } -void BH_Vec4iScale(const int *a, +void BH_Vec4iScale(const int a[4], int b, - int *out) + int out[4]) { out[0] = a[0] * b; out[1] = a[1] * b; @@ -45,10 +45,10 @@ void BH_Vec4iScale(const int *a, } -void BH_Vec4iMulAdd(const int *a, - const int *b, - const int *c, - int *out) +void BH_Vec4iMulAdd(const int a[4], + const int b[4], + const int c[4], + int out[4]) { out[0] = a[0] * b[0] + c[0]; out[1] = a[1] * b[1] + c[1]; @@ -57,8 +57,8 @@ void BH_Vec4iMulAdd(const int *a, } -void BH_Vec4iNegate(const int *in, - int *out) +void BH_Vec4iNegate(const int in[4], + int out[4]) { out[0] = -in[0]; out[1] = -in[1]; @@ -67,9 +67,9 @@ void BH_Vec4iNegate(const int *in, } -void BH_Vec4iMin(const int *a, - const int *b, - int *out) +void BH_Vec4iMin(const int a[4], + const int b[4], + int out[4]) { if (a[0] < b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] < b[1]) out[1] = a[1]; else out[1] = b[1]; @@ -78,9 +78,9 @@ void BH_Vec4iMin(const int *a, } -void BH_Vec4iMax(const int *a, - const int *b, - int *out) +void BH_Vec4iMax(const int a[4], + const int b[4], + int out[4]) { if (a[0] > b[0]) out[0] = a[0]; else out[0] = b[0]; if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1]; -- cgit v1.2.3