Index: ddraw/ShaderGen3D.cpp |
— | — | @@ -315,7 +315,9 @@ |
316 | 316 | static const char unif_viewport[] = "uniform float width;\n\
|
317 | 317 | uniform float height;\n\
|
318 | 318 | uniform float xoffset;\n\
|
319 | | -uniform float yoffset;\n";
|
| 319 | +uniform float yoffset;\n\
|
| 320 | +uniform float minz;\n\
|
| 321 | +uniform float maxz;\n";
|
320 | 322 | static const char unif_alpharef[] = "uniform int alpharef;\n";
|
321 | 323 | static const char unif_key[] = "uniform ivec3 keyX;\n";
|
322 | 324 | static const char unif_world[] = "uniform mat4 matWorld;\n";
|
— | — | @@ -343,9 +345,8 @@ |
344 | 346 | gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
|
345 | 347 | static const char op_normalize[] = "N = normalize(gl_NormalMatrix*nxyz);\n";
|
346 | 348 | static const char op_normalpassthru[] = "N = gl_NormalMatrix*nxyz;\n";
|
347 | | -static const char op_tlvertex[] = "xyzw = vec4(xyz.x/rhw,xyz.y/rhw,xyz.z/rhw,1.0/rhw);\n\
|
348 | | -vec4 pos = gl_ModelViewProjectionMatrix*xyzw;\n\
|
349 | | -gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
|
| 349 | +static const char op_tlvertex[] = "gl_Position = vec4(((((xyz.x-xoffset)+.5)/(width/2.0))-1.0)/rhw,\
|
| 350 | +((((xyz.y-yoffset)+.5)/(height/2.0))-1.0)/rhw,xyz.z/rhw,1.0/rhw);\n";
|
350 | 351 | static const char op_resetcolor[] = "diffuse = specular = vec4(0.0);\n\
|
351 | 352 | ambient = ambientcolor / 255.0;\n";
|
352 | 353 | static const char op_dirlight[] = "DirLight(lightX);\n";
|
— | — | @@ -1432,6 +1433,8 @@ |
1433 | 1434 | This->genshaders[index].shader.uniforms[142 + i] = This->ext->glGetUniformLocation(This->genshaders[index].shader.prog, unifkey);
|
1434 | 1435 | }
|
1435 | 1436 | This->genshaders[index].shader.uniforms[150] = This->ext->glGetUniformLocation(This->genshaders[index].shader.prog,"ditherbits");
|
| 1437 | + This->genshaders[index].shader.uniforms[151] = This->ext->glGetUniformLocation(This->genshaders[index].shader.prog, "minz");
|
| 1438 | + This->genshaders[index].shader.uniforms[151] = This->ext->glGetUniformLocation(This->genshaders[index].shader.prog, "maxz");
|
1436 | 1439 | }
|
1437 | 1440 |
|
1438 | 1441 | } |
\ No newline at end of file |
Index: ddraw/glRenderer.cpp |
— | — | @@ -1849,14 +1849,6 @@ |
1850 | 1850 | This->util->EnableArray(prog.attribs[1],true);
|
1851 | 1851 | This->ext->glVertexAttribPointer(prog.attribs[1],4,GL_FLOAT,false,vertices[1].stride,vertices[1].data);
|
1852 | 1852 | }
|
1853 | | - device->modelview_dirty = true;
|
1854 | | - device->projection_dirty = true;
|
1855 | | - glMatrixMode(GL_MODELVIEW);
|
1856 | | - glLoadIdentity();
|
1857 | | - glMatrixMode(GL_PROJECTION);
|
1858 | | - glLoadIdentity();
|
1859 | | - glOrtho(0.0, device->viewport.dwWidth, device->viewport.dwHeight, 0.0,
|
1860 | | - -device->viewport.dvMinZ, device->viewport.dvMaxZ);
|
1861 | 1853 | }
|
1862 | 1854 | for(i = 0; i < 5; i++)
|
1863 | 1855 | {
|
— | — | @@ -1927,11 +1919,8 @@ |
1928 | 1920 |
|
1929 | 1921 | }
|
1930 | 1922 | }
|
1931 | | - if (!transformed)
|
1932 | | - {
|
1933 | | - if (device->modelview_dirty) This->util->SetMatrix(GL_MODELVIEW, device->matView, device->matWorld, &device->modelview_dirty);
|
1934 | | - if (device->projection_dirty) This->util->SetMatrix(GL_PROJECTION, device->matProjection, NULL, &device->projection_dirty);
|
1935 | | - }
|
| 1923 | + if (device->modelview_dirty) This->util->SetMatrix(GL_MODELVIEW, device->matView, device->matWorld, &device->modelview_dirty);
|
| 1924 | + if (device->projection_dirty) This->util->SetMatrix(GL_PROJECTION, device->matProjection, NULL, &device->projection_dirty);
|
1936 | 1925 |
|
1937 | 1926 | This->util->SetMaterial((GLfloat*)&device->material.ambient,(GLfloat*)&device->material.diffuse,(GLfloat*)&device->material.specular,
|
1938 | 1927 | (GLfloat*)&device->material.emissive,device->material.power);
|