Skip to content

Commit 9b53faf

Browse files
committed
Use better math constants
1 parent 2fe16f3 commit 9b53faf

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/engine/qcommon/q_shared.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,16 @@ void Com_Free_Aligned( void *ptr );
281281
#define M_SQRT2 1.414213562f
282282
#endif
283283

284-
#ifndef M_ROOT3
285-
#define M_ROOT3 1.732050808f
284+
#ifndef M_RSQRT2
285+
#define M_RSQRT2 0.707106781f
286+
#endif
287+
288+
#ifndef M_SQRT3
289+
#define M_SQRT3 1.732050808f
290+
#endif
291+
292+
#ifndef M_RSQRT3
293+
#define M_RSQRT3 0.577350269f
286294
#endif
287295

288296
#ifndef LINE_DISTANCE_EPSILON

src/engine/renderer/tr_shade_calc.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static void AutospriteDeform( uint32_t numVertexes )
495495
VectorCopy( backEnd.viewParms.orientation.axis[ 2 ], upDir );
496496
}
497497

498-
float scale = 1.0 / M_SQRT2;
498+
float scale = M_RSQRT2;
499499

500500
if ( backEnd.currentEntity->e.nonNormalizedAxes )
501501
{

0 commit comments

Comments
 (0)