mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-11 14:42:05 +08:00
ref: soft: as an experiment, reformat ref_soft as it's easier to notice config inaccuracies
This commit is contained in:
+26
-25
@@ -67,17 +67,17 @@ void Matrix4x4_CreateProjection( matrix4x4 out, float xMax, float xMin, float yM
|
||||
|
||||
void Matrix4x4_CreateOrtho( matrix4x4 out, float xLeft, float xRight, float yBottom, float yTop, float zNear, float zFar )
|
||||
{
|
||||
out[0][0] = 2.0f / (xRight - xLeft);
|
||||
out[1][1] = 2.0f / (yTop - yBottom);
|
||||
out[2][2] = -2.0f / (zFar - zNear);
|
||||
out[0][0] = 2.0f / ( xRight - xLeft );
|
||||
out[1][1] = 2.0f / ( yTop - yBottom );
|
||||
out[2][2] = -2.0f / ( zFar - zNear );
|
||||
out[3][3] = 1.0f;
|
||||
out[0][1] = out[0][2] = out[1][0] = out[1][2] = out[3][0] = out[3][1] = out[3][2] = 0.0f;
|
||||
|
||||
out[2][0] = 0.0f;
|
||||
out[2][1] = 0.0f;
|
||||
out[0][3] = -(xRight + xLeft) / (xRight - xLeft);
|
||||
out[1][3] = -(yTop + yBottom) / (yTop - yBottom);
|
||||
out[2][3] = -(zFar + zNear) / (zFar - zNear);
|
||||
out[0][3] = -( xRight + xLeft ) / ( xRight - xLeft );
|
||||
out[1][3] = -( yTop + yBottom ) / ( yTop - yBottom );
|
||||
out[2][3] = -( zFar + zNear ) / ( zFar - zNear );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -121,33 +121,34 @@ void Matrix4x4_CreateTranslate( matrix4x4 out, float x, float y, float z )
|
||||
|
||||
void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float y, float z )
|
||||
{
|
||||
float len, c, s;
|
||||
float len, c, s;
|
||||
|
||||
len = x * x + y * y + z * z;
|
||||
if( len != 0.0f ) len = 1.0f / sqrt( len );
|
||||
if( len != 0.0f )
|
||||
len = 1.0f / sqrt( len );
|
||||
x *= len;
|
||||
y *= len;
|
||||
z *= len;
|
||||
|
||||
angle *= (-M_PI_F / 180.0f);
|
||||
angle *= ( -M_PI_F / 180.0f );
|
||||
SinCos( angle, &s, &c );
|
||||
|
||||
out[0][0]=x * x + c * (1 - x * x);
|
||||
out[0][1]=x * y * (1 - c) + z * s;
|
||||
out[0][2]=z * x * (1 - c) - y * s;
|
||||
out[0][3]=0.0f;
|
||||
out[1][0]=x * y * (1 - c) - z * s;
|
||||
out[1][1]=y * y + c * (1 - y * y);
|
||||
out[1][2]=y * z * (1 - c) + x * s;
|
||||
out[1][3]=0.0f;
|
||||
out[2][0]=z * x * (1 - c) + y * s;
|
||||
out[2][1]=y * z * (1 - c) - x * s;
|
||||
out[2][2]=z * z + c * (1 - z * z);
|
||||
out[2][3]=0.0f;
|
||||
out[3][0]=0.0f;
|
||||
out[3][1]=0.0f;
|
||||
out[3][2]=0.0f;
|
||||
out[3][3]=1.0f;
|
||||
out[0][0] = x * x + c * ( 1 - x * x );
|
||||
out[0][1] = x * y * ( 1 - c ) + z * s;
|
||||
out[0][2] = z * x * ( 1 - c ) - y * s;
|
||||
out[0][3] = 0.0f;
|
||||
out[1][0] = x * y * ( 1 - c ) - z * s;
|
||||
out[1][1] = y * y + c * ( 1 - y * y );
|
||||
out[1][2] = y * z * ( 1 - c ) + x * s;
|
||||
out[1][3] = 0.0f;
|
||||
out[2][0] = z * x * ( 1 - c ) + y * s;
|
||||
out[2][1] = y * z * ( 1 - c ) - x * s;
|
||||
out[2][2] = z * z + c * ( 1 - z * z );
|
||||
out[2][3] = 0.0f;
|
||||
out[3][0] = 0.0f;
|
||||
out[3][1] = 0.0f;
|
||||
out[3][2] = 0.0f;
|
||||
out[3][3] = 1.0f;
|
||||
}
|
||||
|
||||
static void Matrix4x4_CreateScale( matrix4x4 out, float x )
|
||||
|
||||
Reference in New Issue
Block a user