Merge pull request #1002 from raven02/patch-1

Flip in throughmode for SW/HW T&L
This commit is contained in:
Henrik Rydgård 2013-03-16 07:27:16 -07:00
commit d8c0a9410c
3 changed files with 12 additions and 9 deletions

View File

@ -238,8 +238,8 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
if (g_Config.bBufferedRendering) {
renderX = 0;
renderY = 0;
renderWidth = framebufferManager_->GetRenderWidth();
renderHeight = framebufferManager_->GetRenderHeight();
renderWidth = framebufferManager_->GetRenderWidth();
renderHeight = framebufferManager_->GetRenderHeight();
renderWidthFactor = (float)renderWidth / framebufferManager_->GetTargetWidth();
renderHeightFactor = (float)renderHeight / framebufferManager_->GetTargetHeight();
} else {
@ -261,8 +261,8 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
// This is a bit of a hack as the render buffer isn't always that size
if (scissorX1 == 0 && scissorY1 == 0 &&
scissorX2 >= gstate_c.curRTWidth - 1 &&
scissorY2 >= gstate_c.curRTHeight - 1) {
scissorX2 >= gstate_c.curRTWidth - 1 &&
scissorY2 >= gstate_c.curRTHeight - 1) {
glstate.scissorTest.disable();
} else {
glstate.scissorTest.enable();

View File

@ -640,10 +640,10 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
transformed[index].fog = fogCoef;
memcpy(&transformed[index].u, uv, 2 * sizeof(float));
if (gstate_c.flipTexture) {
//if (throughmode)
// transformed[index].v = (float)gstate_c.actualTextureHeight / gstate_c.curTextureHeight - transformed[index].v;
//else
transformed[index].v = 1.0f - transformed[index].v; // * 2.0f;
if (throughmode)
transformed[index].v = 1.0f - transformed[index].v;
else
transformed[index].v = 1.0f - transformed[index].v * 2.0f;
}
for (int i = 0; i < 4; i++) {
transformed[index].color0[i] = c0[i] * 255.0f;

View File

@ -408,7 +408,10 @@ void GenerateVertexShader(int prim, char *buffer) {
break;
}
if (flipV)
WRITE(p, " v_texcoord.y = 1.0 - v_texcoord.y * 2.0;\n");
if (gstate.isModeThrough())
WRITE(p, " v_texcoord.y = 1.0 - v_texcoord.y;\n");
else
WRITE(p, " v_texcoord.y = 1.0 - v_texcoord.y * 2.0;\n");
}
// Compute fogdepth