Various performance tweaks: cull nodes with no mesh children, allow
locking the transforms and bounds of models whose positions will not change, skip/postpone updates for models that aren't in view. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4078 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -186,8 +186,10 @@ public class ModelMesh extends TriMesh
|
||||
@Override // documentation inherited
|
||||
public Spatial putClone (Spatial store, CloneCreator properties)
|
||||
{
|
||||
ModelMesh mstore;
|
||||
if (store == null) {
|
||||
ModelMesh mstore = (ModelMesh)properties.originalToCopy.get(this);
|
||||
if (mstore != null) {
|
||||
return mstore;
|
||||
} else if (store == null) {
|
||||
mstore = new ModelMesh(getName());
|
||||
} else {
|
||||
mstore = (ModelMesh)store;
|
||||
@@ -213,6 +215,14 @@ public class ModelMesh extends TriMesh
|
||||
return mstore;
|
||||
}
|
||||
|
||||
@Override // documentation inherited
|
||||
public void updateWorldVectors ()
|
||||
{
|
||||
if (!_transformLocked) {
|
||||
super.updateWorldVectors();
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited from interface Externalizable
|
||||
public void writeExternal (ObjectOutput out)
|
||||
throws IOException
|
||||
@@ -401,6 +411,16 @@ public class ModelMesh extends TriMesh
|
||||
reconstruct(vbbuf, nbbuf, cbbuf, tbbuf, ibbuf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Locks the transform and bounds of this mesh on the assumption that its
|
||||
* position will not change.
|
||||
*/
|
||||
protected void lockInstance ()
|
||||
{
|
||||
lockBounds();
|
||||
_transformLocked = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposes the specified order on the given buffer of 32 bit values.
|
||||
*/
|
||||
@@ -455,6 +475,11 @@ public class ModelMesh extends TriMesh
|
||||
/** For prototype meshes, the resolved texture states. */
|
||||
protected TextureState[] _tstates;
|
||||
|
||||
/** Whether or not the transform has been locked. This operates in a
|
||||
* slightly different way than JME's locking, in that it allows applying
|
||||
* transformations to display lists. */
|
||||
protected boolean _transformLocked;
|
||||
|
||||
/** The shared state for back face culling. */
|
||||
protected static CullState _backCull;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user