OpenGL:
- add converting z coordinate from NDS [-1.0,1.0] to OpenGL [0.0,1.0]
This commit is contained in:
parent
82ed19cc72
commit
14cd6b722c
|
@ -592,7 +592,7 @@ int NDS_LoadROM(const char *filename, const char *logicalFilename)
|
|||
{
|
||||
printf("%s", save_names[sv]);
|
||||
if (CommonSettings.autodetectBackupMethod == 1)
|
||||
backup_setManualBackupType(sv);
|
||||
backup_setManualBackupType(sv+1);
|
||||
}
|
||||
printf("\n\t* ROM crc: %08X\n", advsc.getCRC32());
|
||||
}
|
||||
|
|
|
@ -283,6 +283,7 @@ GLuint shaderProgram;
|
|||
|
||||
static GLint hasTexLoc;
|
||||
static GLint texBlendLoc;
|
||||
static GLint oglWBuffer;
|
||||
static bool hasTexture = false;
|
||||
|
||||
static TexCacheItem* currTexture = NULL;
|
||||
|
@ -357,7 +358,7 @@ static void OGLReset()
|
|||
glUniform1i(hasTexLoc, 0);
|
||||
hasTexture = false;
|
||||
glUniform1i(texBlendLoc, 0);
|
||||
|
||||
glUniform1i(oglWBuffer, 0);
|
||||
}
|
||||
|
||||
TexCache_Reset();
|
||||
|
@ -504,6 +505,8 @@ static char OGLInit(void)
|
|||
hasTexLoc = glGetUniformLocation(shaderProgram, "hasTexture");
|
||||
|
||||
texBlendLoc = glGetUniformLocation(shaderProgram, "texBlending");
|
||||
|
||||
oglWBuffer = glGetUniformLocation(shaderProgram, "oglWBuffer");
|
||||
}
|
||||
|
||||
//we want to use alpha destination blending so we can track the last-rendered alpha value
|
||||
|
@ -1037,6 +1040,8 @@ static void OGLRender()
|
|||
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, &rgbToonTable[0]);
|
||||
gfx3d.state.invalidateToon = false;
|
||||
}
|
||||
|
||||
glUniform1i(oglWBuffer, gfx3d.renderState.wbuffer);
|
||||
}
|
||||
|
||||
xglDepthMask(GL_TRUE);
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
|
||||
/* Vertex shader */
|
||||
const char *vertexShader = {"\
|
||||
varying vec4 pos; \n\
|
||||
void main() \n\
|
||||
{ \n\
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n\
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; \n\
|
||||
gl_FrontColor = gl_Color; \n\
|
||||
pos = gl_Position; \n\
|
||||
} \n\
|
||||
"};
|
||||
|
||||
|
@ -16,8 +18,8 @@ const char *fragmentShader = {"\
|
|||
uniform sampler2D tex2d; \n\
|
||||
uniform int hasTexture; \n\
|
||||
uniform int texBlending; \n\
|
||||
\n\
|
||||
\
|
||||
uniform int oglWBuffer; \n\
|
||||
varying vec4 pos; \n\
|
||||
void main() \n\
|
||||
{ \n\
|
||||
vec4 texColor = vec4(1.0, 1.0, 1.0, 1.0); \n\
|
||||
|
@ -58,6 +60,12 @@ const char *fragmentShader = {"\
|
|||
flagColor.rgb = texColor.rgb * gl_Color.rgb + toonColor.rgb; \n\
|
||||
flagColor.a = texColor.a * gl_Color.a; \n\
|
||||
} \n\
|
||||
if (oglWBuffer == 1) \n\
|
||||
// TODO \n\
|
||||
gl_FragDepth = (pos.z / pos.w) * 0.5 + 0.5; \n\
|
||||
else \n\
|
||||
gl_FragDepth = (pos.z / pos.w) * 0.5 + 0.5; \n\
|
||||
gl_FragColor = flagColor; \n\
|
||||
} \n\
|
||||
"};
|
||||
|
||||
|
|
Loading…
Reference in New Issue