diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index 314f4035f..b2a58c974 100755 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -332,7 +332,7 @@ static const char *GeometryFragShader_100 = {"\ \n\ float vertW = (vtxPosition.w == 0.0) ? 0.00000001 : vtxPosition.w;\n\ // hack: when using z-depth, drop some LSBs so that the overworld map in Dragon Quest IV shows up correctly\n\ - float newFragDepthValue = (stateUseWDepth) ? vtxPosition.w/4096.0 : clamp( (floor((((vtxPosition.z/vertW) * 0.5 + 0.5) * 16777215.0) / 4.0) * 4.0) / 16777215.0, 0.0, 1.0);\n\ + float newFragDepthValue = (stateUseWDepth) ? floor(vtxPosition.w * 4096.0) / 16777215.0 : (floor(clamp(((vtxPosition.z/vertW) * 0.5 + 0.5), 0.0, 1.0) * 32767.0) * 512.0) / 16777215.0;\n\ \n\ if ((polyMode != 3) || polyDrawShadow)\n\ {\n\ diff --git a/desmume/src/OGLRender_3_2.cpp b/desmume/src/OGLRender_3_2.cpp index 5d606e3b5..7bdbbb9ff 100644 --- a/desmume/src/OGLRender_3_2.cpp +++ b/desmume/src/OGLRender_3_2.cpp @@ -204,7 +204,7 @@ static const char *GeometryFragShader_150 = {"\ \n\ float vertW = (vtxPosition.w == 0.0) ? 0.00000001 : vtxPosition.w;\n\ // hack: when using z-depth, drop some LSBs so that the overworld map in Dragon Quest IV shows up correctly\n\ - float newFragDepthValue = (state.useWDepth) ? vtxPosition.w/4096.0 : clamp( (floor((((vtxPosition.z/vertW) * 0.5 + 0.5) * 16777215.0) / 4.0) * 4.0) / 16777215.0, 0.0, 1.0);\n\ + float newFragDepthValue = (state.useWDepth) ? floor(vtxPosition.w * 4096.0) / 16777215.0 : (floor(clamp(((vtxPosition.z/vertW) * 0.5 + 0.5), 0.0, 1.0) * 32767.0) * 512.0) / 16777215.0;\n\ \n\ if ((polyMode != 3u) || polyDrawShadow)\n\ {\n\ diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index afac5ed61..a13c8b941 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -250,12 +250,12 @@ typedef union u16 SizeShiftT:3; // 23-25: Texel size shift for T-coordinate; 0...7, where the actual texel size is (8 << N) u16 PackedFormat:3; // 26-28: Packed texture format; // 0=None - // 1=A3I5, 5-bit indexed color with 3-bit alpha + // 1=A3I5, 5-bit indexed color (32-color palette) with 3-bit alpha (0...7, where 0=Fully Transparent and 7=Opaque) // 2=I2, 2-bit indexed color (4-color palette) // 3=I4, 4-bit indexed color (16-color palette) // 4=I8, 8-bit indexed color (256-color palette) // 5=4x4-texel compressed - // 6=A5I3, 3-bit indexed color with 5-bit alpha + // 6=A5I3, 3-bit indexed color (8-color palette) with 5-bit alpha (0...31, where 0=Fully Transparent and 31=Opaque) // 7=Direct 16-bit color u16 KeyColor0_Enable:1; // 29: Use palette color 0 as transparent; 0=Displayed 1=Transparent u16 TexCoordTransformMode:2; // 30-31: Texture coordinate transformation mode;