Index: ddraw/glDirect3DViewport.cpp |
— | — | @@ -293,6 +293,7 @@ |
294 | 294 | vp.dvClipWidth = viewport.dvClipWidth;
|
295 | 295 | vp.dvClipX = viewport.dvClipX;
|
296 | 296 | vp.dvClipY = viewport.dvClipY;
|
| 297 | + if((vp.dvMinZ == 0) && (vp.dvMaxZ == 0)) vp.dvMaxZ = 1.0f;
|
297 | 298 | viewport = vp;
|
298 | 299 | maxX = lpData->dvMaxX;
|
299 | 300 | maxY = lpData->dvMaxY;
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -1553,18 +1553,20 @@ |
1554 | 1554 | }
|
1555 | 1555 | else SetTexture(i,0);
|
1556 | 1556 | glUniform1i(prog.uniforms[128+i],i);
|
1557 | | - if(device->renderstate[D3DRENDERSTATE_COLORKEYENABLE] && device->texstages[i].texture && (prog.uniforms[140+i] != -1))
|
| 1557 | + if(device->renderstate[D3DRENDERSTATE_COLORKEYENABLE] && device->texstages[i].texture && (prog.uniforms[142+i] != -1))
|
1558 | 1558 | {
|
1559 | 1559 | if(device->texstages[i].texture->ddsd.dwFlags & DDSD_CKSRCBLT)
|
1560 | 1560 | {
|
1561 | 1561 | dwordto4int(device->texstages[i].texture->colorkey[0].key.dwColorSpaceLowValue,keycolor);
|
1562 | | - glUniform4iv(prog.uniforms[140+i],1,keycolor);
|
| 1562 | + glUniform4iv(prog.uniforms[142+i],1,keycolor);
|
1563 | 1563 | }
|
1564 | 1564 | }
|
1565 | 1565 | }
|
1566 | | - if(prog.uniforms[137]!= -1) glUniform1f(prog.uniforms[137],device->glDDS7->fakex);
|
1567 | | - if(prog.uniforms[138]!= -1) glUniform1f(prog.uniforms[138],device->glDDS7->fakey);
|
1568 | | - if(prog.uniforms[139]!= -1) glUniform1i(prog.uniforms[139],device->renderstate[D3DRENDERSTATE_ALPHAREF]);
|
| 1566 | + if(prog.uniforms[137]!= -1) glUniform1f(prog.uniforms[137],device->viewport.dwWidth);
|
| 1567 | + if(prog.uniforms[138]!= -1) glUniform1f(prog.uniforms[138],device->viewport.dwHeight);
|
| 1568 | + if(prog.uniforms[139]!= -1) glUniform1f(prog.uniforms[139],device->viewport.dwX);
|
| 1569 | + if(prog.uniforms[140]!= -1) glUniform1f(prog.uniforms[140],device->viewport.dwY);
|
| 1570 | + if(prog.uniforms[141]!= -1) glUniform1i(prog.uniforms[141],device->renderstate[D3DRENDERSTATE_ALPHAREF]);
|
1569 | 1571 | if(device->glDDS7->zbuffer) SetFBO(device->glDDS7->texture,device->glDDS7->zbuffer->texture,device->glDDS7->zbuffer->hasstencil);
|
1570 | 1572 | else SetFBO(device->glDDS7->texture,0,false);
|
1571 | 1573 | SetViewport(device->viewport.dwX,device->viewport.dwY,device->viewport.dwWidth,device->viewport.dwHeight);
|
Index: ddraw/shadergen.cpp |
— | — | @@ -260,8 +260,10 @@ |
261 | 261 | static const char unif_light[] = "uniform Light lightX;\n";
|
262 | 262 | static const char unif_ambient[] = "uniform vec4 ambientcolor;\n";
|
263 | 263 | static const char unif_tex[] = "uniform sampler2D texX;\n";
|
264 | | -static const char unif_size[] = "uniform float width;\n\
|
265 | | -uniform float height;\n";
|
| 264 | +static const char unif_viewport[] = "uniform float width;\n\
|
| 265 | +uniform float height;\n\
|
| 266 | +uniform float xoffset;\n\
|
| 267 | +uniform float yoffset;\n";
|
266 | 268 | static const char unif_alpharef[] = "uniform int alpharef;\n";
|
267 | 269 | static const char unif_key[] = "uniform ivec4 keyX;\n";
|
268 | 270 | static const char unif_world[] = "uniform mat4 matWorld;\n";
|
— | — | @@ -280,7 +282,7 @@ |
281 | 283 | gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
|
282 | 284 | static const char op_normalize[] = "N = normalize(gl_NormalMatrix*nxyz);\n";
|
283 | 285 | static const char op_normalpassthru[] = "N = gl_NormalMatrix*nxyz;\n";
|
284 | | -static const char op_passthru[] = "gl_Position = vec4(((xyz.x+.5)/(width/2.0))-1.0,((xyz.y+.5)/(height/2.0))-1.0,(xyz.z),1.0);\n";
|
| 286 | +static const char op_tlvertex[] = "gl_Position = vec4((((xyz.x-xoffset)+.5)/(width/2.0))-1.0,(((xyz.y-yoffset)+.5)/(height/2.0))-1.0,(xyz.z),1.0);\n";
|
285 | 287 | static const char op_resetcolor[] = "diffuse = specular = vec4(0.0);\n\
|
286 | 288 | ambient = ambientcolor / 255.0;\n";
|
287 | 289 | static const char op_dirlight[] = "DirLight(lightX);\n";
|
— | — | @@ -473,7 +475,7 @@ |
474 | 476 |
|
475 | 477 | // Uniforms
|
476 | 478 | vsrc->append(unif_ambient);
|
477 | | - if((id>>50)&1) vsrc->append(unif_size);
|
| 479 | + if((id>>50)&1) vsrc->append(unif_viewport);
|
478 | 480 | if((id>>59)&1) numlights = (id>>18)&7;
|
479 | 481 | else numlights = 0;
|
480 | 482 | if((id>>50)&1) numlights = 0;
|
— | — | @@ -513,7 +515,7 @@ |
514 | 516 | if(hasdir) vsrc->append(func_dirlight);
|
515 | 517 | //Main
|
516 | 518 | vsrc->append(mainstart);
|
517 | | - if((id>>50)&1) vsrc->append(op_passthru);
|
| 519 | + if((id>>50)&1) vsrc->append(op_tlvertex);
|
518 | 520 | else vsrc->append(op_transform);
|
519 | 521 | if((id>>49)&1) vsrc->append(op_normalize);
|
520 | 522 | else vsrc->append(op_normalpassthru);
|
— | — | @@ -1138,11 +1140,13 @@ |
1139 | 1141 | genshaders[index].shader.uniforms[136] = glGetUniformLocation(genshaders[index].shader.prog,"ambientcolor");
|
1140 | 1142 | genshaders[index].shader.uniforms[137] = glGetUniformLocation(genshaders[index].shader.prog,"width");
|
1141 | 1143 | genshaders[index].shader.uniforms[138] = glGetUniformLocation(genshaders[index].shader.prog,"height");
|
1142 | | - genshaders[index].shader.uniforms[139] = glGetUniformLocation(genshaders[index].shader.prog,"alpharef");
|
| 1144 | + genshaders[index].shader.uniforms[139] = glGetUniformLocation(genshaders[index].shader.prog,"xoffset");
|
| 1145 | + genshaders[index].shader.uniforms[140] = glGetUniformLocation(genshaders[index].shader.prog,"yoffset");
|
| 1146 | + genshaders[index].shader.uniforms[141] = glGetUniformLocation(genshaders[index].shader.prog,"alpharef");
|
1143 | 1147 | char unifkey[] = "keyX";
|
1144 | 1148 | for(int i = 0; i < 8; i++)
|
1145 | 1149 | {
|
1146 | 1150 | unifkey[3] = i + '0';
|
1147 | | - genshaders[index].shader.uniforms[140+i] = glGetUniformLocation(genshaders[index].shader.prog,unifkey);
|
| 1151 | + genshaders[index].shader.uniforms[142+i] = glGetUniformLocation(genshaders[index].shader.prog,unifkey);
|
1148 | 1152 | }
|
1149 | 1153 | }
|