DXGL r582 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r581‎ | r582 | r583 >
Date:02:10, 8 January 2015
Author:admin
Status:new
Tags:
Comment:
Revert D3DTLVERTEX processing from r522.
Divide transformed vertices by RHW in vertex shader.
Modified paths:
  • /ddraw/ShaderGen3D.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)

Diff [purge]

Index: ddraw/ShaderGen3D.cpp
@@ -315,7 +315,9 @@
316316 static const char unif_viewport[] = "uniform float width;\n\
317317 uniform float height;\n\
318318 uniform float xoffset;\n\
319 -uniform float yoffset;\n";
 319+uniform float yoffset;\n\
 320+uniform float minz;\n\
 321+uniform float maxz;\n";
320322 static const char unif_alpharef[] = "uniform int alpharef;\n";
321323 static const char unif_key[] = "uniform ivec3 keyX;\n";
322324 static const char unif_world[] = "uniform mat4 matWorld;\n";
@@ -343,9 +345,8 @@
344346 gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
345347 static const char op_normalize[] = "N = normalize(gl_NormalMatrix*nxyz);\n";
346348 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";
350351 static const char op_resetcolor[] = "diffuse = specular = vec4(0.0);\n\
351352 ambient = ambientcolor / 255.0;\n";
352353 static const char op_dirlight[] = "DirLight(lightX);\n";
@@ -1432,6 +1433,8 @@
14331434 This->genshaders[index].shader.uniforms[142 + i] = This->ext->glGetUniformLocation(This->genshaders[index].shader.prog, unifkey);
14341435 }
14351436 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");
14361439 }
14371440
14381441 }
\ No newline at end of file
Index: ddraw/glRenderer.cpp
@@ -1849,14 +1849,6 @@
18501850 This->util->EnableArray(prog.attribs[1],true);
18511851 This->ext->glVertexAttribPointer(prog.attribs[1],4,GL_FLOAT,false,vertices[1].stride,vertices[1].data);
18521852 }
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);
18611853 }
18621854 for(i = 0; i < 5; i++)
18631855 {
@@ -1927,11 +1919,8 @@
19281920
19291921 }
19301922 }
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);
19361925
19371926 This->util->SetMaterial((GLfloat*)&device->material.ambient,(GLfloat*)&device->material.diffuse,(GLfloat*)&device->material.specular,
19381927 (GLfloat*)&device->material.emissive,device->material.power);

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r522Add colorkey to D3D2 texture load....admin14:12, 7 September 2014