ref: soft: as an experiment, reformat ref_soft as it's easier to notice config inaccuracies

This commit is contained in:
Alibek Omarov
2024-11-06 02:41:38 +03:00
parent fbbafb45a3
commit a52c8aa291
23 changed files with 5299 additions and 5018 deletions
+26 -25
View File
@@ -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 )