This commit is contained in:
Ian Curtis 2017-08-14 23:30:34 +00:00
parent 81188bee07
commit eac76f0908
3 changed files with 8 additions and 17 deletions

View file

@ -27,7 +27,7 @@ struct Vertex
float normal[3];
float texcoords[2];
UINT8 color[4];
UINT8 fixedShade[4];
UINT8 fixedShade;
};
struct Poly // our polys are always 3 triangles, unlike the real h/w

View file

@ -289,7 +289,7 @@ void CNew3D::RenderFrame(void)
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inNormal"), 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, normal));
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inTexCoord"), 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, texcoords));
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inColour"), 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, color));
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inFixedShade"), 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, fixedShade));
glVertexAttribPointer(m_r3dShader.GetVertexAttribPos("inFixedShade"), 1, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, fixedShade));
m_r3dShader.SetShader(true);
@ -1195,16 +1195,7 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
}
}
p.v[j].fixedShade[0] = shade; // hardware doesn't really have per vertex colours, only per poly
p.v[j].fixedShade[1] = shade;
p.v[j].fixedShade[2] = shade;
p.v[j].fixedShade[3] = 255;
}
else {
p.v[j].fixedShade[0] = 255;
p.v[j].fixedShade[1] = 255;
p.v[j].fixedShade[2] = 255;
p.v[j].fixedShade[3] = 255;
p.v[j].fixedShade = shade; // hardware doesn't really have per vertex colours, only per poly
}
float texU, texV = 0;

View file

@ -18,11 +18,11 @@ uniform bool lightEnabled; // also used in fragment shader
uniform bool fixedShading; // also used in fragment shader
// attributes
attribute vec3 inVertex;
attribute vec3 inNormal;
attribute vec2 inTexCoord;
attribute vec4 inColour;
attribute vec3 inFixedShade;
attribute vec3 inVertex;
attribute vec3 inNormal;
attribute vec2 inTexCoord;
attribute vec4 inColour;
attribute float inFixedShade;
// outputs to fragment shader
varying float fsFogFactor;