modelviewer: fix zfighting of models

This uses the stencil buffer to hold face priorities and prevents drawing fragments of a lower priority overtop those of higher on the same model
This commit is contained in:
Adam
2018-08-04 16:19:25 -04:00
parent 90c962accf
commit 7e7fb16693
3 changed files with 80 additions and 8 deletions

View File

@@ -54,6 +54,8 @@ public class ModelDefinition
private transient int[] origVY;
private transient int[] origVZ;
public transient int maxPriority;
public static transient int animOffsetX, animOffsetY, animOffsetZ;
public void computeNormals()
@@ -612,4 +614,20 @@ public class ModelDefinition
}
this.reset();
}
public void computeMaxPriority()
{
if (faceRenderPriorities == null)
{
return;
}
for (int i = 0; i < faceCount; ++i)
{
if (faceRenderPriorities[i] > maxPriority)
{
maxPriority = faceRenderPriorities[i];
}
}
}
}