31 #include "hpl1/engine/math/BoundingVolume.h" 32 #include "hpl1/engine/math/MathTypes.h" 33 #include "hpl1/engine/math/MeshTypes.h" 35 #include "hpl1/engine/graphics/Color.h" 50 static int RandRectl(
int alMin,
int alMax);
58 static float RandRectf(
float alMin,
float alMax);
115 float afNearClipPlane,
const cVector2l &avScreenSize);
117 static bool CheckSphereInPlanes(
const cVector3f &avCenter,
float afRadius,
118 const cPlanef *apPlanes,
int alPlaneCount);
136 static float Modulus(
float afDividend,
float afDivisor);
138 static float ToRad(
float afAngle);
139 static float ToDeg(
float afAngle);
149 static bool IsPow2(
int alX);
156 static float Wrap(
float afX,
float afMin,
float afMax);
161 static float Clamp(
float afX,
float afMin,
float afMax);
163 inline static float Max(
float afX,
float afY) {
168 inline static float Min(
float afX,
float afY) {
174 inline static int Max(
int alX,
int alY) {
179 inline static int Min(
int alX,
int alY) {
185 inline static float Abs(
float afX) {
return afX < 0 ? -afX : afX; }
186 inline static int Abs(
int alX) {
return alX < 0 ? -alX : alX; }
188 static float GetAngleDistance(
float afAngle1,
float afAngle2,
float afMaxAngle);
189 static float GetAngleDistanceRad(
float afAngle1,
float afAngle2);
190 static float GetAngleDistanceDeg(
float afAngle1,
float afAngle2);
192 static float TurnAngle(
float afAngle,
float afFinalAngle,
float afSpeed,
float afMaxAngle);
193 static float TurnAngleRad(
float afAngle,
float afFinalAngle,
float afSpeed);
194 static float TurnAngleDeg(
float afAngle,
float afFinalAngle,
float afSpeed);
196 static float InterpolateFloat(
float afA,
float afB,
float afT);
198 template<
typename Vector>
199 static decltype(Vector::x) & GetVectorX(Vector &v) {
203 template<
typename Vector>
204 static decltype(Vector::y) & GetVectorY(Vector &v) {
207 template<
typename Vector>
208 static decltype(Vector::z) & GetVectorZ(Vector &v) {
250 return cVector3f(ToRad(avVec.x), ToRad(avVec.y), ToRad(avVec.z));
254 return cVector3f(ToDeg(avVec.x), ToDeg(avVec.y), ToDeg(avVec.z));
263 static inline float Vector3DistSqr(
const cVector3f &avStartPos,
const cVector3f &avEndPos) {
264 float fDX = avEndPos.x - avStartPos.x;
265 float fDY = avEndPos.y - avStartPos.y;
266 float fDZ = avEndPos.z - avStartPos.z;
268 return fDX * fDX + fDY * fDY + fDZ * fDZ;
271 static inline float Vector3Dist(
const cVector3f &avStartPos,
const cVector3f &avEndPos) {
272 return sqrt(Vector3DistSqr(avStartPos, avEndPos));
337 const cVector3f &avPoint2,
int alPairNum);
357 bool abShortestPath);
372 bool abShortestPath);
421 const size_t r0,
const size_t r1,
const size_t r2,
422 const size_t c0,
const size_t c1,
const size_t c2);
466 const unsigned int *apIndexArray,
int alIndexNum,
467 const float *apVertexArray,
int alVtxStride,
468 const float *apTexArray,
469 const float *apNormalArray,
int alVertexNum);
481 const unsigned int *apIndexArray,
int alIndexNum,
482 const float *apVertexArray,
int alVtxStride,
int alVertexNum);
494 const unsigned int *apIndexArray,
int alIndexNum,
495 const float *apVertexArray,
int alVtxStride,
int alVertexNum,
496 bool *apIsDoubleSided);
static cMatrixf MatrixQuaternion(const cQuaternion &aqRot)
static bool GetClipRectFromBV(cRect2l &aDestRect, cBoundingVolume &aBV, const cMatrixf &a_mtxView, const cMatrixf &a_mtxProj, float afNearClipPlane, const cVector2l &avScreenSize)
static float RandRectf(float alMin, float alMax)
static float GetAngleFromPoints2D(const cVector2f &aStartPos, const cVector2f &avGoalPos)
static float GetFraction(float afVal)
static cVector3f ProjectVector3D(const cVector3f &avSrcVec, const cVector3f &avDestVec)
static cMatrixf MatrixRotateZ(float afAngle)
static cVector2f GetVectorFromAngle2D(float afAngle, float afLength)
static cMatrixf MatrixRotate(cVector3f avRot, eEulerRotationOrder aOrder)
static void PlaneIntersectionLine(const cPlanef &aPA, const cPlanef &aPB, cVector3f &avDir, cVector3f &avPoint)
static bool CreateTriangleData(tTriangleDataVec &avTriangles, const unsigned int *apIndexArray, int alIndexNum, const float *apVertexArray, int alVtxStride, int alVertexNum)
static float Vector3Dot(const cVector3f &avVecA, const cVector3f &avVecB)
static cVector3f MatrixMulDivideW(const cMatrixf &a_mtxA, const cVector3f &avB)
static bool CheckFrustumLineIntersection(const cPlanef *apPlanePairs, const cVector3f &avPoint1, const cVector3f &avPoint2, int alPairNum)
static cVector2f ProjectVector2D(const cVector2f &avSrcVec, const cVector2f &avDestVec)
static cMatrixf MatrixInverse(const cMatrixf &a_mtxA)
static cVector2f RandRectVector2f(const cVector3f &avMin, const cVector3f &avMax)
Definition: Quaternion.h:36
Definition: BoundingVolume.h:71
static float Wrap(float afX, float afMin, float afMax)
static void Randomize(int alSeed=-1)
static bool IsPow2(int alX)
static int Log2ToInt(int alX)
static cMatrixf MatrixSlerp(float afT, const cMatrixf &a_mtxA, const cMatrixf &a_mtxB, bool abShortestPath)
static cMatrixf MatrixMul(const cMatrixf &a_mtxA, const cMatrixf &a_mtxB)
T Normalise()
Definition: Vector3.h:299
static cVector3f Vector3UnProject(const cVector3f &avVec, const cRect2f &aScreenRect, cMatrixf a_mtxViewProj)
static cColor RandRectColor(const cColor &aMin, const cColor &aMax)
static float Clamp(float afX, float afMin, float afMax)
static cQuaternion QuaternionSlerp(float afT, const cQuaternion &aqA, const cQuaternion &aqB, bool abShortestPath)
static cMatrixf MatrixRotateX(float afAngle)
static void GetAngleFromVector(const cVector2f &avVec, float *apAngle, float *apLength)
static bool CreateTriTangentVectors(float *apDestArray, const unsigned int *apIndexArray, int alIndexNum, const float *apVertexArray, int alVtxStride, const float *apTexArray, const float *apNormalArray, int alVertexNum)
static bool CheckCollisionBV(cBoundingVolume &aBV1, cBoundingVolume &aBV2)
static float Vector3Angle(const cVector3f &avVecA, const cVector3f &avVecB)
static cVector3f Vector3Cross(const cVector3f &avVecA, const cVector3f &avVecB)
static float MatrixMinor(const cMatrixf &a_mtxA, const size_t r0, const size_t r1, const size_t r2, const size_t c0, const size_t c1, const size_t c2)
static float PlaneToPointDist(const cPlanef &aPlane, const cVector3f &avVec)
static cVector3f MatrixToEulerAngles(const cMatrixf &a_mtxA, eEulerRotationOrder aOrder)
static int RandRectl(int alMin, int alMax)
static bool CreateEdges(tTriEdgeVec &avEdges, const unsigned int *apIndexArray, int alIndexNum, const float *apVertexArray, int alVtxStride, int alVertexNum, bool *apIsDoubleSided)
static float Modulus(float afDividend, float afDivisor)
static float MatrixDeterminant(const cMatrixf &a_mtxA)
static cMatrixf MatrixRotateY(float afAngle)
static bool CheckFrustumQuadMeshIntersection(const cPlanef *apPlanePairs, tVector3fVec *apPoints, int alPairNum)
static cMatrixf MatrixAdjoint(const cMatrixf &a_mtxA)
static cMatrixf MatrixMulScalar(const cMatrixf &a_mtxA, float afB)
static const char * MatrixToChar(const cMatrixf &a_mtxA)
static cVector3f RandRectVector3f(const cVector3f &avMin, const cVector3f &avMax)