Skip to content

Commit f3f76d2

Browse files
committed
Type safe parameters for math functions.
1 parent 3811178 commit f3f76d2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

common/lc_math.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ inline lcVector3 lcQuaternionMul(const lcVector3& a, const lcVector4& b)
15891589
}
15901590

15911591
// Convert world coordinates to screen coordinates.
1592-
inline lcVector3 lcProjectPoint(const lcVector3& Point, const lcMatrix44& ModelView, const lcMatrix44& Projection, const int Viewport[4])
1592+
inline lcVector3 lcProjectPoint(const lcVector3& Point, const lcMatrix44& ModelView, const lcMatrix44& Projection, const int (&Viewport)[4])
15931593
{
15941594
lcVector4 Tmp;
15951595

@@ -1603,7 +1603,7 @@ inline lcVector3 lcProjectPoint(const lcVector3& Point, const lcMatrix44& ModelV
16031603
return lcVector3(Viewport[0] + (1 + Tmp[0]) * Viewport[2] / 2, Viewport[1] + (1 + Tmp[1]) * Viewport[3] / 2, (1 + Tmp[2]) / 2);
16041604
}
16051605

1606-
inline lcVector3 lcUnprojectPoint(const lcVector3& Point, const lcMatrix44& ModelView, const lcMatrix44& Projection, const int Viewport[4])
1606+
inline lcVector3 lcUnprojectPoint(const lcVector3& Point, const lcMatrix44& ModelView, const lcMatrix44& Projection, const int (&Viewport)[4])
16071607
{
16081608
// Calculate the screen to model transform.
16091609
const lcMatrix44 Transform = lcMatrix44Inverse(lcMul(ModelView, Projection));
@@ -1624,7 +1624,7 @@ inline lcVector3 lcUnprojectPoint(const lcVector3& Point, const lcMatrix44& Mode
16241624
return lcVector3(Tmp[0], Tmp[1], Tmp[2]);
16251625
}
16261626

1627-
inline void lcUnprojectPoints(lcVector3* Points, int NumPoints, const lcMatrix44& ModelView, const lcMatrix44& Projection, const int Viewport[4])
1627+
inline void lcUnprojectPoints(lcVector3* Points, int NumPoints, const lcMatrix44& ModelView, const lcMatrix44& Projection, const int (&Viewport)[4])
16281628
{
16291629
// Calculate the screen to model transform.
16301630
const lcMatrix44 Transform = lcMatrix44Inverse(lcMul(ModelView, Projection));
@@ -1648,7 +1648,7 @@ inline void lcUnprojectPoints(lcVector3* Points, int NumPoints, const lcMatrix44
16481648
}
16491649
}
16501650

1651-
inline void lcGetFrustumPlanes(const lcMatrix44& WorldView, const lcMatrix44& Projection, lcVector4 Planes[6])
1651+
inline void lcGetFrustumPlanes(const lcMatrix44& WorldView, const lcMatrix44& Projection, lcVector4 (&Planes)[6])
16521652
{
16531653
lcMatrix44 WorldProj = lcMul(WorldView, Projection);
16541654

@@ -1878,7 +1878,7 @@ inline void lcPolygonPlaneClip(lcVector3* InPoints, int NumInPoints, lcVector3*
18781878
}
18791879

18801880
// Return true if a polygon intersects a set of planes.
1881-
inline bool lcTriangleIntersectsPlanes(const lcVector3& p1, const lcVector3& p2, const lcVector3& p3, const lcVector4 Planes[6])
1881+
inline bool lcTriangleIntersectsPlanes(const lcVector3& p1, const lcVector3& p2, const lcVector3& p3, const lcVector4 (&Planes)[6])
18821882
{
18831883
constexpr int NumPlanes = 6;
18841884
const lcVector3 Points[3] = { p1, p2, p3 };
@@ -2212,7 +2212,7 @@ inline float lcRayPointDistance(const lcVector3& Point, const lcVector3& Start,
22122212
}
22132213

22142214
// Returns true if the axis aligned box intersects the volume defined by planes.
2215-
inline bool lcBoundingBoxIntersectsVolume(const lcVector3& Min, const lcVector3& Max, const lcVector4 Planes[6])
2215+
inline bool lcBoundingBoxIntersectsVolume(const lcVector3& Min, const lcVector3& Max, const lcVector4 (&Planes)[6])
22162216
{
22172217
constexpr int NumPlanes = 6;
22182218
lcVector3 Points[8] =
@@ -2287,7 +2287,7 @@ struct lcBoundingBox
22872287
lcVector3 Max;
22882288
};
22892289

2290-
inline void lcGetBoxCorners(const lcVector3& Min, const lcVector3& Max, lcVector3 Points[8])
2290+
inline void lcGetBoxCorners(const lcVector3& Min, const lcVector3& Max, lcVector3 (&Points)[8])
22912291
{
22922292
Points[0] = lcVector3(Max.x, Max.y, Min.z);
22932293
Points[1] = lcVector3(Min.x, Max.y, Min.z);
@@ -2299,7 +2299,7 @@ inline void lcGetBoxCorners(const lcVector3& Min, const lcVector3& Max, lcVector
22992299
Points[7] = lcVector3(Min.x, Max.y, Max.z);
23002300
}
23012301

2302-
inline void lcGetBoxCorners(const lcBoundingBox& BoundingBox, lcVector3 Points[8])
2302+
inline void lcGetBoxCorners(const lcBoundingBox& BoundingBox, lcVector3 (&Points)[8])
23032303
{
23042304
lcGetBoxCorners(BoundingBox.Min, BoundingBox.Max, Points);
23052305
}

0 commit comments

Comments
 (0)