OpenGL Renderer: The fragment depth calculation now works more like how SoftRasterizer does it.

- Also update some comments in gfx3d.h.
This commit is contained in:
rogerman 2017-10-09 11:05:56 -07:00
parent c6a5740665
commit c9025e81cb
3 changed files with 4 additions and 4 deletions

View File

@ -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\

View File

@ -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\

View File

@ -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;