fix opengl im2d. d3d still no fog

This commit is contained in:
aap
2021-02-12 13:58:11 +01:00
parent 4c77fb5754
commit fb859c0fa6
5 changed files with 60 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ float3 DoDirLight(Light L, float3 N)
return l*L.color.xyz;
}
float3 DoDirLightSpec(Light L, float3 N, float3 V, float power))
float3 DoDirLightSpec(Light L, float3 N, float3 V, float power)
{
return pow(saturate(dot(N, normalize(V + -L.direction.xyz))), power)*L.color.xyz;
}

View File

@@ -130,8 +130,9 @@ struct Im2DVertex
void setScreenX(float32 x) { this->x = x; }
void setScreenY(float32 y) { this->y = y; }
void setScreenZ(float32 z) { this->z = z; }
void setCameraZ(float32 z) { this->w = z; }
void setRecipCameraZ(float32 recipz) { }
// This is a bit unefficient but we have to counteract GL's divide, so multiply
void setCameraZ(float32 z) { }
void setRecipCameraZ(float32 recipz) { this->w = 1.0f/recipz; }
void setColor(uint8 r, uint8 g, uint8 b, uint8 a) {
this->r = r; this->g = g; this->b = b; this->a = a; }
void setU(float32 u, float recipz) { this->u = u; }

View File

@@ -10,9 +10,8 @@ void
main(void)
{
gl_Position = in_pos;
gl_Position.w = 1.0;
gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw;
v_fog = DoFog(gl_Position.z);
v_fog = DoFog(gl_Position.w);
gl_Position.xyz *= gl_Position.w;
v_color = in_color;
v_tex0 = in_tex0;

View File

@@ -11,9 +11,8 @@ const char *im2d_vert_src =
"main(void)\n"
"{\n"
" gl_Position = in_pos;\n"
" gl_Position.w = 1.0;\n"
" gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw;\n"
" v_fog = DoFog(gl_Position.z);\n"
" v_fog = DoFog(gl_Position.w);\n"
" gl_Position.xyz *= gl_Position.w;\n"
" v_color = in_color;\n"
" v_tex0 = in_tex0;\n"