Added option to depth-sort the triangles in transparent meshes. I tried

to optimize this, and seems reasonably fast, but not fast enough to 
enable it for all transparent meshes.  Hopefully the artists can improve 
performance by merging meshes together, and we can strike a happy 
balance between sorting by mesh and sorting by triangles.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@29 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Andrzej Kapolka
2006-08-23 23:14:38 +00:00
parent 4a4f9755c8
commit f8c230df6f
2 changed files with 188 additions and 23 deletions
@@ -175,20 +175,10 @@ public class SkinMesh extends ModelMesh
{
super.reconstruct(vertices, normals, colors, textures, indices);
// store the current buffers as the originals
storeOriginalBuffers();
// initialize the quantized frame table
_frames = new HashIntMap<Object>();
}
@Override // documentation inherited
public void centerVertices ()
{
super.centerVertices();
storeOriginalBuffers();
}
@Override // documentation inherited
public Spatial putClone (Spatial store, Model.CloneCreator properties)
{
@@ -279,10 +269,10 @@ public class SkinMesh extends ModelMesh
VBOInfo vboinfo = new VBOInfo(false);
vboinfo.setVBOColorEnabled(true);
vboinfo.setVBOTextureEnabled(true);
vboinfo.setVBOIndexEnabled(true);
vboinfo.setVBOIndexEnabled(!_depthSorted);
setVBOInfo(vboinfo);
}
_useDisplayLists = useDisplayLists;
_useDisplayLists = useDisplayLists && !_depthSorted;
}
@Override // documentation inherited
@@ -410,7 +400,7 @@ public class SkinMesh extends ModelMesh
VBOInfo ovboinfo = batch.getVBOInfo();
if (ovboinfo != null) {
VBOInfo vboinfo = new VBOInfo(true);
vboinfo.setVBOIndexEnabled(true);
vboinfo.setVBOIndexEnabled(!_depthSorted);
vboinfo.setVBOColorID(ovboinfo.getVBOColorID());
for (int ii = 0; ii < nunits; ii++) {
vboinfo.setVBOTextureID(ii, ovboinfo.getVBOTextureID(ii));
@@ -425,11 +415,11 @@ public class SkinMesh extends ModelMesh
}
}
/**
* Stores the current vertex and normal buffers for later deformation.
*/
@Override // documentation inherited
protected void storeOriginalBuffers ()
{
super.storeOriginalBuffers();
FloatBuffer vbuf = getVertexBuffer(0), nbuf = getNormalBuffer(0);
vbuf.rewind();
nbuf.rewind();
@@ -483,7 +473,7 @@ public class SkinMesh extends ModelMesh
/** The original (undeformed) vertex and normal buffers and the deformed
* versions. */
protected float[] _ovbuf, _onbuf, _vbuf, _nbuf;
protected float[] _onbuf, _ovbuf, _nbuf;
/** The frame id to store on the next update. If 0, don't store any frame
* and skin the mesh as normal. If -1, a frame has been stored and thus