mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 11:50:49 +00:00
- scale the vertex coordinates that get output to the hardware by 1024.
This is needed to get a coordinate system that is compatible with GZDoom's so that its lighting code can be reused more easily.
This commit is contained in:
parent
68c97e3c25
commit
350acd2ac3
6 changed files with 15 additions and 12 deletions
|
@ -1645,7 +1645,9 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
|
||||||
|
|
||||||
int prevClamp = GLInterface.GetClamp();
|
int prevClamp = GLInterface.GetClamp();
|
||||||
GLInterface.SetClamp(0);
|
GLInterface.SetClamp(0);
|
||||||
auto matrixindex = GLInterface.SetIdentityMatrix(Matrix_Model);
|
VSMatrix imat = 0;
|
||||||
|
imat.scale(1024, 1024, 1024);
|
||||||
|
auto matrixindex = GLInterface.SetMatrix(Matrix_Model, &imat);
|
||||||
|
|
||||||
for (surfi=0; surfi<m->head.numsurfs; surfi++)
|
for (surfi=0; surfi<m->head.numsurfs; surfi++)
|
||||||
{
|
{
|
||||||
|
@ -1700,7 +1702,8 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
|
||||||
|
|
||||||
//Let OpenGL (and perhaps hardware :) handle the matrix rotation
|
//Let OpenGL (and perhaps hardware :) handle the matrix rotation
|
||||||
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f;
|
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f;
|
||||||
GLInterface.SetMatrix(Matrix_Model, mat);
|
for (int i = 0; i < 15; i++) mat[i] *= 1024.f;
|
||||||
|
GLInterface.SetMatrix(Matrix_Model, mat);
|
||||||
// PLAG: End
|
// PLAG: End
|
||||||
|
|
||||||
bool exact = false;
|
bool exact = false;
|
||||||
|
|
|
@ -198,8 +198,8 @@ static void resizeglcheck(void)
|
||||||
|
|
||||||
float m[4][4]{};
|
float m[4][4]{};
|
||||||
|
|
||||||
float const nearclip = 4.0f / (gxyaspect * gyxscale * 1024.f);
|
float const nearclip = 4.0f / (gxyaspect * gyxscale);
|
||||||
float const farclip = 64.f;
|
float const farclip = 65536.f;
|
||||||
|
|
||||||
m[0][0] = 1.f;
|
m[0][0] = 1.f;
|
||||||
m[1][1] = fxdimen / (fydimen * ratio);
|
m[1][1] = fxdimen / (fydimen * ratio);
|
||||||
|
@ -474,9 +474,9 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
|
|
||||||
//update verts
|
//update verts
|
||||||
vt->SetVertex(
|
vt->SetVertex(
|
||||||
(px[i] - ghalfx) * r * grhalfxdown10x,
|
(px[i] - ghalfx) * r * grhalfxdown10x * 1024.f,
|
||||||
(ghalfy - py[i]) * r * grhalfxdown10,
|
(ghalfy - py[i]) * r * grhalfxdown10 * 1024.f,
|
||||||
r * (1.f / 1024.f));
|
r);
|
||||||
|
|
||||||
}
|
}
|
||||||
GLInterface.Draw(DT_TriangleFan, data.second, npoints);
|
GLInterface.Draw(DT_TriangleFan, data.second, npoints);
|
||||||
|
|
|
@ -1122,7 +1122,9 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
|
||||||
//Let OpenGL (and perhaps hardware :) handle the matrix rotation
|
//Let OpenGL (and perhaps hardware :) handle the matrix rotation
|
||||||
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f;
|
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f;
|
||||||
|
|
||||||
int matrixindex = GLInterface.SetMatrix(Matrix_Model, mat);
|
for (int i = 0; i < 15; i++) mat[i] *= 1024.f;
|
||||||
|
|
||||||
|
int matrixindex = GLInterface.SetMatrix(Matrix_Model, mat);
|
||||||
|
|
||||||
const float ru = 1.f/((float)m->mytexx);
|
const float ru = 1.f/((float)m->mytexx);
|
||||||
const float rv = 1.f/((float)m->mytexy);
|
const float rv = 1.f/((float)m->mytexy);
|
||||||
|
|
|
@ -210,7 +210,7 @@ public:
|
||||||
|
|
||||||
void SetVisibility(float visibility, float fviewingrange)
|
void SetVisibility(float visibility, float fviewingrange)
|
||||||
{
|
{
|
||||||
renderState.VisFactor = visibility* fviewingrange* (1.f / (64.f * 65536.f));
|
renderState.VisFactor = visibility* fviewingrange* (1.f / (65536.f * 65536.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnableBlend(bool on)
|
void EnableBlend(bool on)
|
||||||
|
|
|
@ -223,7 +223,7 @@ void main()
|
||||||
}
|
}
|
||||||
if ((u_flags & RF_MapFog) != 0) // fog hack for RRRA E2L1. Needs to be done better, this is gross, but still preferable to the broken original implementation.
|
if ((u_flags & RF_MapFog) != 0) // fog hack for RRRA E2L1. Needs to be done better, this is gross, but still preferable to the broken original implementation.
|
||||||
{
|
{
|
||||||
float fogfactor = 0.55 + 0.3 * exp2 (-5.0*v_fogCoord);
|
float fogfactor = 0.55 + 0.3 * exp2 ((-5.0 / 1024.0)*v_distance);
|
||||||
color.rgb = vec3(0.6*(1.0-fogfactor)) + color.rgb * fogfactor;// mix(vec3(0.6), color.rgb, fogfactor);
|
color.rgb = vec3(0.6*(1.0-fogfactor)) + color.rgb * fogfactor;// mix(vec3(0.6), color.rgb, fogfactor);
|
||||||
}
|
}
|
||||||
if (color.a < u_alphaThreshold) discard; // it's only here that we have the alpha value available to be able to perform the alpha test.
|
if (color.a < u_alphaThreshold) discard; // it's only here that we have the alpha value available to be able to perform the alpha test.
|
||||||
|
|
|
@ -4,7 +4,6 @@ out vec4 v_color;
|
||||||
out float v_distance;
|
out float v_distance;
|
||||||
out vec4 v_texCoord;
|
out vec4 v_texCoord;
|
||||||
out vec4 v_detailCoord;
|
out vec4 v_detailCoord;
|
||||||
out float v_fogCoord;
|
|
||||||
out vec4 v_eyeCoordPosition;
|
out vec4 v_eyeCoordPosition;
|
||||||
|
|
||||||
uniform float u_usePalette;
|
uniform float u_usePalette;
|
||||||
|
@ -32,7 +31,6 @@ void main()
|
||||||
v_texCoord = u_textureMatrix * i_texCoord;
|
v_texCoord = u_textureMatrix * i_texCoord;
|
||||||
v_detailCoord = vec4(i_texCoord.x * u_detailParms.x, i_texCoord.y * u_detailParms.y, 0.0, 0.0);
|
v_detailCoord = vec4(i_texCoord.x * u_detailParms.x, i_texCoord.y * u_detailParms.y, 0.0, 0.0);
|
||||||
|
|
||||||
v_fogCoord = abs(eyeCoordPosition.z);
|
|
||||||
|
|
||||||
v_color = i_color;
|
v_color = i_color;
|
||||||
v_distance = eyeCoordPosition.z;
|
v_distance = eyeCoordPosition.z;
|
||||||
|
|
Loading…
Reference in a new issue