| Index: ddraw/glRenderer.cpp |
| — | — | @@ -1001,6 +1001,8 @@ |
| 1002 | 1002 | glClearStencil(dwStencil);
|
| 1003 | 1003 | }
|
| 1004 | 1004 | glClear(clearbits);
|
| | 1005 | + if(target->zbuffer) target->zbuffer->dirty |= 2;
|
| | 1006 | + target->dirty |= 2;
|
| 1005 | 1007 | }
|
| 1006 | 1008 |
|
| 1007 | 1009 | void glRenderer::_Flush()
|
| — | — | @@ -1012,7 +1014,6 @@ |
| 1013 | 1015 | void glRenderer::_DrawPrimitives(glDirect3DDevice7 *device, GLenum mode, GLVERTEX *vertices, int *texformats, DWORD count, LPWORD indices,
|
| 1014 | 1016 | DWORD indexcount, DWORD flags)
|
| 1015 | 1017 | {
|
| 1016 | | - GLfloat tmpmat[16];
|
| 1017 | 1018 | bool transformed;
|
| 1018 | 1019 | char blendvar[] = "blendX";
|
| 1019 | 1020 | char rgbavar[] = "rgbaX";
|
| — | — | @@ -1021,8 +1022,8 @@ |
| 1022 | 1023 | char strvar[] = "strX";
|
| 1023 | 1024 | char strqvar[] = "strqX";
|
| 1024 | 1025 | int i;
|
| 1025 | | - if(vertices[1].data) transformed = false;
|
| 1026 | | - else transformed = true;
|
| | 1026 | + if(vertices[1].data) transformed = true;
|
| | 1027 | + else transformed = false;
|
| 1027 | 1028 | if(!vertices[0].data)
|
| 1028 | 1029 | {
|
| 1029 | 1030 | outputs[0] = (void*)DDERR_INVALIDPARAMS;
|
| — | — | @@ -1082,14 +1083,11 @@ |
| 1083 | 1084 | }
|
| 1084 | 1085 | if(device->normal_dirty) device->UpdateNormalMatrix();
|
| 1085 | 1086 | GLint loc = glGetUniformLocation(prog,"world");
|
| 1086 | | - viewLHtoRH(tmpmat,device->matWorld);
|
| 1087 | | - glUniformMatrix4fv(loc,1,false,tmpmat);
|
| | 1087 | + glUniformMatrix4fv(loc,1,false,device->matWorld);
|
| 1088 | 1088 | loc = glGetUniformLocation(prog,"view");
|
| 1089 | | - viewLHtoRH(tmpmat,device->matView);
|
| 1090 | | - glUniformMatrix4fv(loc,1,false,tmpmat);
|
| | 1089 | + glUniformMatrix4fv(loc,1,false,device->matView);
|
| 1091 | 1090 | loc = glGetUniformLocation(prog,"projection");
|
| 1092 | | - prjLHtoRH(tmpmat,device->matProjection);
|
| 1093 | | - glUniformMatrix4fv(loc,1,false,tmpmat);
|
| | 1091 | + glUniformMatrix4fv(loc,1,false,device->matProjection);
|
| 1094 | 1092 | loc = glGetUniformLocation(prog,"normalmat");
|
| 1095 | 1093 | glUniformMatrix4fv(loc,1,true,device->matNormal);
|
| 1096 | 1094 | loc = glGetUniformLocation(prog,"material.diffuse");
|
| — | — | @@ -1159,6 +1157,8 @@ |
| 1160 | 1158 | glViewport(device->viewport.dwX,device->viewport.dwY,device->viewport.dwWidth,device->viewport.dwHeight);
|
| 1161 | 1159 | if(indices) glDrawRangeElements(mode,0,indexcount,count,GL_UNSIGNED_SHORT,indices);
|
| 1162 | 1160 | else glDrawArrays(mode,0,count);
|
| | 1161 | + if(device->glDDS7->zbuffer) device->glDDS7->zbuffer->dirty |= 2;
|
| | 1162 | + device->glDDS7->dirty |= 2;
|
| 1163 | 1163 | if(flags & D3DDP_WAIT) glFlush();
|
| 1164 | 1164 | outputs[0] = (void*)D3D_OK;
|
| 1165 | 1165 | wndbusy = false;
|
| Index: ddraw/matrix.cpp |
| — | — | @@ -46,30 +46,6 @@ |
| 47 | 47 | * other dealings in this Software without prior written authorization from
|
| 48 | 48 | * Silicon Graphics, Inc.
|
| 49 | 49 | */
|
| 50 | | -// Portions of this file are from the dxglwrap project, and are licensed under
|
| 51 | | -// the following terms:
|
| 52 | | -/*
|
| 53 | | - *
|
| 54 | | - * dxglwrapper 0.08 - Sept. 12, 2002
|
| 55 | | - * For conditions of distribution and use, see copyright notice in d3dprj.h
|
| 56 | | - * Copyright (c) 1991-2002 realtech VR
|
| 57 | | - *
|
| 58 | | - * Copyright (c) 2002 realtech VR
|
| 59 | | - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
| 60 | | - * and associated documentation files (the "Software"), to deal in the Software without
|
| 61 | | - * restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
| 62 | | - * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
| 63 | | - * Software is furnished to do so, subject to the following conditions:
|
| 64 | | - * The above copyright notice and this permission notice shall be included in all copies or
|
| 65 | | - * substantial portions of the Software.
|
| 66 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
| 67 | | - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
| 68 | | - * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
| 69 | | - * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
| 70 | | - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
| 71 | | - * DEALINGS IN THE SOFTWARE.
|
| 72 | | - *
|
| 73 | | - */
|
| 74 | 50 | #include "common.h"
|
| 75 | 51 | #include "matrix.h"
|
| 76 | 52 |
|
| — | — | @@ -151,40 +127,4 @@ |
| 152 | 128 | m[1+4*0] = 0; m[1+4*1] = 1; m[1+4*2] = 0; m[1+4*3] = 0;
|
| 153 | 129 | m[2+4*0] = 0; m[2+4*1] = 0; m[2+4*2] = 1; m[2+4*3] = 0;
|
| 154 | 130 | m[3+4*0] = 0; m[3+4*1] = 0; m[3+4*2] = 0; m[3+4*3] = 1;
|
| 155 | | -}
|
| 156 | | -
|
| 157 | | -
|
| 158 | | -// from dxglwrap:
|
| 159 | | -/*
|
| 160 | | -
|
| 161 | | - This is one basic difference between OpenGL and Direct3D.
|
| 162 | | - In both coordinate systems, the X and Y axis are as normal.
|
| 163 | | - The Y positive axis going upwards and the X positive axis going to the right.
|
| 164 | | -
|
| 165 | | - However, the two systems differ in their Z-axis implementation.
|
| 166 | | - A Left-Handed System, which Direct3D uses, is one where the Z-axis is positive INTO the screen.
|
| 167 | | - Take your Left Hand, face the palm upwards with your fingers pointing in the direction of the positive x-axis (to the right), and curl your fingers in the direction of the Y-positive axis (up). Now if you stick your thumb STRAIGHT (like you were giving a sideways "thumbs-up" sign), your thumb is now pointing in the direction of the positive Z-axis.
|
| 168 | | -
|
| 169 | | - OpenGL, on the other hand, uses a Right-Handed system, where the positive Z-axis is coming OUT of the screen.
|
| 170 | | - Again, to remember this, take your right hand, point your palm upwards and your fingers pointing in the direction of the positive x-axis
|
| 171 | | - (to the right). Now curl your fingers up to the direction of the positive y-axis (up), and point your thumb out. It is now pointing in the direction of the positive Z-axis (out)..
|
| 172 | | -
|
| 173 | | - Note: no doc exists how to do the conversion
|
| 174 | | -*/
|
| 175 | | -
|
| 176 | | -
|
| 177 | | -void prjLHtoRH(float *d, const float *s) // Exclusive function
|
| 178 | | -{
|
| 179 | | - d[0] = -s[0]; d[1] = -s[1]; d[2] = -s[2]; d[3] = -s[3];
|
| 180 | | - d[4] = s[4]; d[5] = s[5]; d[6] = s[6]; d[7] = s[7];
|
| 181 | | - d[8] = -s[8]; d[9] = -s[9]; d[10] = -s[10]; d[11] = -s[11];
|
| 182 | | - d[12] = s[12]; d[13] = s[13]; d[14] = s[14]; d[15] = s[15];
|
| 183 | | -}
|
| 184 | | -
|
| 185 | | -void viewLHtoRH(float *d, const float *s)
|
| 186 | | -{
|
| 187 | | - d[0] = -s[0]; d[1] = s[1]; d[2] = -s[2]; d[3] = s[3];
|
| 188 | | - d[4] = -s[4]; d[5] = s[5]; d[6] = -s[6]; d[7] = s[7];
|
| 189 | | - d[8] = -s[8]; d[9] = s[9]; d[10] = -s[10]; d[11] = s[11];
|
| 190 | | - d[12] = -s[12]; d[13] = s[13]; d[14] = -s[14]; d[15] = s[15];
|
| 191 | | -}
|
| | 131 | +} |
| \ No newline at end of file |
| Index: ddraw/matrix.h |
| — | — | @@ -46,30 +46,6 @@ |
| 47 | 47 | * other dealings in this Software without prior written authorization from
|
| 48 | 48 | * Silicon Graphics, Inc.
|
| 49 | 49 | */
|
| 50 | | -// Portions of this file are from the dxglwrap project, and are licensed under
|
| 51 | | -// the following terms:
|
| 52 | | -/*
|
| 53 | | - *
|
| 54 | | - * dxglwrapper 0.08 - Sept. 12, 2002
|
| 55 | | - * For conditions of distribution and use, see copyright notice in d3dprj.h
|
| 56 | | - * Copyright (c) 1991-2002 realtech VR
|
| 57 | | - *
|
| 58 | | - * Copyright (c) 2002 realtech VR
|
| 59 | | - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
| 60 | | - * and associated documentation files (the "Software"), to deal in the Software without
|
| 61 | | - * restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
| 62 | | - * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
| 63 | | - * Software is furnished to do so, subject to the following conditions:
|
| 64 | | - * The above copyright notice and this permission notice shall be included in all copies or
|
| 65 | | - * substantial portions of the Software.
|
| 66 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
| 67 | | - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
| 68 | | - * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
| 69 | | - * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
| 70 | | - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
| 71 | | - * DEALINGS IN THE SOFTWARE.
|
| 72 | | - *
|
| 73 | | - */
|
| 74 | 50 | #pragma once
|
| 75 | 51 | #ifndef _MATRIX_H
|
| 76 | 52 | #define _MATRIX_H
|
| — | — | @@ -79,7 +55,4 @@ |
| 80 | 56 | GLfloat r[16]);
|
| 81 | 57 | void __gluMakeIdentityf(GLfloat m[16]);
|
| 82 | 58 |
|
| 83 | | -void prjLHtoRH(float *d, const float *s);
|
| 84 | | -void viewLHtoRH(float *d, const float *s);
|
| 85 | | -
|
| 86 | 59 | #endif //_MATRIX_H |
| \ No newline at end of file |
| Index: ddraw/shadergen.cpp |
| — | — | @@ -251,7 +251,8 @@ |
| 252 | 252 | static const char var_xyzw[] = "vec4 xyzw;\n";
|
| 253 | 253 | // Operations
|
| 254 | 254 | static const char op_transform[] = "xyzw = vec4(xyz,1);\n\
|
| 255 | | -gl_Position = (projection*(view*world))*xyzw;\n";
|
| | 255 | +vec4 pos = (projection*(view*world))*xyzw;\n\
|
| | 256 | +gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
|
| 256 | 257 | static const char op_passthru[] = "gl_Position = xyzw;\n";
|
| 257 | 258 | static const char op_resetcolor[] = "diffuse = specular = vec4(0.0);\n\
|
| 258 | 259 | ambient = ambientcolor / 255.0;\n";
|