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:
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user