Add array sizes to math functions
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
#include <math.h>
|
||||
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user