mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2024-12-22 17:47:38 +08:00
Fix conflicts with std::min/max.
This commit is contained in:
parent
46713a22a0
commit
c33f7155e9
@ -350,12 +350,12 @@ FORCEINLINE void VectorClear(vec_t *a)
|
|||||||
|
|
||||||
FORCEINLINE float VectorMaximum(const vec_t *v)
|
FORCEINLINE float VectorMaximum(const vec_t *v)
|
||||||
{
|
{
|
||||||
return max( v[0], max( v[1], v[2] ) );
|
return V_max( v[0], V_max( v[1], v[2] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCEINLINE float VectorMaximum(const Vector& v)
|
FORCEINLINE float VectorMaximum(const Vector& v)
|
||||||
{
|
{
|
||||||
return max( v.x, max( v.y, v.z ) );
|
return V_max( v.x, V_max( v.y, v.z ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCEINLINE void VectorScale (const float* in, vec_t scale, float* out)
|
FORCEINLINE void VectorScale (const float* in, vec_t scale, float* out)
|
||||||
@ -380,7 +380,7 @@ inline void VectorNegate(vec_t *a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//#define VectorMaximum(a) ( max( (a)[0], max( (a)[1], (a)[2] ) ) )
|
//#define VectorMaximum(a) ( V_max( (a)[0], V_max( (a)[1], (a)[2] ) ) )
|
||||||
#define Vector2Clear(x) {(x)[0]=(x)[1]=0;}
|
#define Vector2Clear(x) {(x)[0]=(x)[1]=0;}
|
||||||
#define Vector2Negate(x) {(x)[0]=-((x)[0]);(x)[1]=-((x)[1]);}
|
#define Vector2Negate(x) {(x)[0]=-((x)[0]);(x)[1]=-((x)[1]);}
|
||||||
#define Vector2Copy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];}
|
#define Vector2Copy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];}
|
||||||
@ -1491,7 +1491,7 @@ FORCEINLINE unsigned char LinearToLightmap( float f )
|
|||||||
|
|
||||||
FORCEINLINE void ColorClamp( Vector& color )
|
FORCEINLINE void ColorClamp( Vector& color )
|
||||||
{
|
{
|
||||||
float maxc = max( color.x, max( color.y, color.z ) );
|
float maxc = V_max( color.x, V_max( color.y, color.z ) );
|
||||||
if ( maxc > 1.0f )
|
if ( maxc > 1.0f )
|
||||||
{
|
{
|
||||||
float ooMax = 1.0f / maxc;
|
float ooMax = 1.0f / maxc;
|
||||||
@ -1987,10 +1987,10 @@ FORCEINLINE unsigned int * PackNormal_SHORT2( float nx, float ny, float nz, unsi
|
|||||||
ny *= 16384.0f;
|
ny *= 16384.0f;
|
||||||
|
|
||||||
// '0' and '32768' values are invalid encodings
|
// '0' and '32768' values are invalid encodings
|
||||||
nx = max( nx, 1.0f ); // Make sure there are no zero values
|
nx = V_max( nx, 1.0f ); // Make sure there are no zero values
|
||||||
ny = max( ny, 1.0f );
|
ny = V_max( ny, 1.0f );
|
||||||
nx = min( nx, 32767.0f ); // Make sure there are no 32768 values
|
nx = V_min( nx, 32767.0f ); // Make sure there are no 32768 values
|
||||||
ny = min( ny, 32767.0f );
|
ny = V_min( ny, 32767.0f );
|
||||||
|
|
||||||
if ( nz < 0.0f )
|
if ( nz < 0.0f )
|
||||||
nx = -nx; // Set the sign bit for z
|
nx = -nx; // Set the sign bit for z
|
||||||
@ -2181,6 +2181,5 @@ inline bool AlmostEqual( const Vector &a, const Vector &b, int maxUlps = 10)
|
|||||||
AlmostEqual( a.z, b.z, maxUlps );
|
AlmostEqual( a.z, b.z, maxUlps );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // MATH_BASE_H
|
#endif // MATH_BASE_H
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
#ifndef MINMAX_H
|
#ifndef MINMAX_H
|
||||||
#define MINMAX_H
|
#define MINMAX_H
|
||||||
|
|
||||||
#ifndef min
|
#ifndef V_min
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define V_min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
#ifndef max
|
#ifndef V_max
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
#define V_max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // MINMAX_H
|
#endif // MINMAX_H
|
||||||
|
@ -1771,7 +1771,7 @@ struct thinModelVertices_t
|
|||||||
{
|
{
|
||||||
Assert( ( m_numBoneInfluences >= 1 ) && ( m_numBoneInfluences <= 3 ) );
|
Assert( ( m_numBoneInfluences >= 1 ) && ( m_numBoneInfluences <= 3 ) );
|
||||||
Assert( ( boneWeights.numbones >= 1 ) && ( boneWeights.numbones <= m_numBoneInfluences ) );
|
Assert( ( boneWeights.numbones >= 1 ) && ( boneWeights.numbones <= m_numBoneInfluences ) );
|
||||||
int numStoredWeights = max( 0, ( m_numBoneInfluences - 1 ) );
|
int numStoredWeights = V_max( 0, ( m_numBoneInfluences - 1 ) );
|
||||||
float *pBaseWeight = m_boneWeights + vertIndex*numStoredWeights;
|
float *pBaseWeight = m_boneWeights + vertIndex*numStoredWeights;
|
||||||
char *pBaseIndex = m_boneIndices + vertIndex*m_numBoneInfluences;
|
char *pBaseIndex = m_boneIndices + vertIndex*m_numBoneInfluences;
|
||||||
for ( int i = 0; i < m_numBoneInfluences; i++ )
|
for ( int i = 0; i < m_numBoneInfluences; i++ )
|
||||||
@ -1841,7 +1841,7 @@ private:
|
|||||||
Assert( pBoneWeights );
|
Assert( pBoneWeights );
|
||||||
Assert( ( m_numBoneInfluences <= 1 ) || ( m_boneWeights != NULL ) );
|
Assert( ( m_numBoneInfluences <= 1 ) || ( m_boneWeights != NULL ) );
|
||||||
Assert( ( m_numBoneInfluences <= 0 ) || ( m_boneIndices != NULL ) );
|
Assert( ( m_numBoneInfluences <= 0 ) || ( m_boneIndices != NULL ) );
|
||||||
int numStoredWeights = max( 0, ( m_numBoneInfluences - 1 ) );
|
int numStoredWeights = V_max( 0, ( m_numBoneInfluences - 1 ) );
|
||||||
float *pBaseWeight = m_boneWeights + vertIndex*numStoredWeights;
|
float *pBaseWeight = m_boneWeights + vertIndex*numStoredWeights;
|
||||||
char *pBaseIndex = m_boneIndices + vertIndex*m_numBoneInfluences;
|
char *pBaseIndex = m_boneIndices + vertIndex*m_numBoneInfluences;
|
||||||
float sum = 0.0f;
|
float sum = 0.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user