1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-22 17:47:38 +08:00

Fix even more build errors caused by c33f715: mathlib (#107)

This fixes the mathlib build, at least for me.

I didn't bother to fix code in e.g. raytrace or vgui_controls, so things
are almost certainly still broken in there.
This commit is contained in:
sigsegv 2022-10-15 06:52:44 -07:00 committed by GitHub
parent 96df7cdd53
commit d37768fc19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -46,7 +46,7 @@ void ColorQuantize(uint8 const *Image,
val1+=PIXEL(x,y,c)*ExtraValueXForms[i*3+c]; val1+=PIXEL(x,y,c)*ExtraValueXForms[i*3+c];
val1>>=8; val1>>=8;
NthSample(s,y*Width+x,N_DIMENSIONS)->Value[c]=(uint8) NthSample(s,y*Width+x,N_DIMENSIONS)->Value[c]=(uint8)
(min(255,max(0,val1))); (V_min(255,V_max(0,val1)));
} }
} }
struct QuantizedValue *q=Quantize(s,Width*Height,N_DIMENSIONS, struct QuantizedValue *q=Quantize(s,Width*Height,N_DIMENSIONS,
@ -76,7 +76,7 @@ void ColorQuantize(uint8 const *Image,
tryc+=Error[x][c][ErrorUse]; tryc+=Error[x][c][ErrorUse];
Error[x][c][ErrorUse]=0; Error[x][c][ErrorUse]=0;
} }
samp[c]=(uint8) min(255,max(0,tryc)); samp[c]=(uint8) V_min(255,V_max(0,tryc));
} }
struct QuantizedValue *f=FindMatch(samp,3,Weights,q); struct QuantizedValue *f=FindMatch(samp,3,Weights,q);
out_pixels[Width*y+x]=(uint8) (f->value); out_pixels[Width*y+x]=(uint8) (f->value);

View File

@ -1777,7 +1777,7 @@ void QuaternionScale( const Quaternion &p, float t, Quaternion &q )
// FIXME: nick, this isn't overly sensitive to accuracy, and it may be faster to // FIXME: nick, this isn't overly sensitive to accuracy, and it may be faster to
// use the cos part (w) of the quaternion (sin(omega)*N,cos(omega)) to figure the new scale. // use the cos part (w) of the quaternion (sin(omega)*N,cos(omega)) to figure the new scale.
float sinom = sqrt( DotProduct( &p.x, &p.x ) ); float sinom = sqrt( DotProduct( &p.x, &p.x ) );
sinom = min( sinom, 1.f ); sinom = V_min( sinom, 1.f );
float sinsom = sin( asin( sinom ) * t ); float sinsom = sin( asin( sinom ) * t );
@ -4057,10 +4057,10 @@ void CalcTriangleTangentSpace( const Vector &p0, const Vector &p1, const Vector
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void RGBtoHSV( const Vector &rgb, Vector &hsv ) void RGBtoHSV( const Vector &rgb, Vector &hsv )
{ {
float flMax = max( rgb.x, rgb.y ); float flMax = V_max( rgb.x, rgb.y );
flMax = max( flMax, rgb.z ); flMax = V_max( flMax, rgb.z );
float flMin = min( rgb.x, rgb.y ); float flMin = V_min( rgb.x, rgb.y );
flMin = min( flMin, rgb.z ); flMin = V_min( flMin, rgb.z );
// hsv.z is the value // hsv.z is the value
hsv.z = flMax; hsv.z = flMax;

View File

@ -411,8 +411,8 @@ static void Label(struct QuantizedValue *q, int updatecolor)
else else
for(int i=0;i<current_ndims;i++) for(int i=0;i<current_ndims;i++)
{ {
q->Mins[i]=min(q->Children[0]->Mins[i],q->Children[1]->Mins[i]); q->Mins[i]=V_min(q->Children[0]->Mins[i],q->Children[1]->Mins[i]);
q->Maxs[i]=max(q->Children[0]->Maxs[i],q->Children[1]->Maxs[i]); q->Maxs[i]=V_max(q->Children[0]->Maxs[i],q->Children[1]->Maxs[i]);
} }
} }
} }

View File

@ -48,7 +48,7 @@ void CSIMDVectorMatrix::CreateFromRGBA_FloatImageData(int srcwidth, int srcheigh
{ {
for(int cp=0;cp<4; cp++) for(int cp=0;cp<4; cp++)
{ {
int real_cp=min( cp, ntrailing_pixels_per_source_line-1 ); int real_cp=V_min( cp, ntrailing_pixels_per_source_line-1 );
data_out[4*c+cp]= data_in[c+4*real_cp]; data_out[4*c+cp]= data_in[c+4*real_cp];
} }
} }