Various tweaks, plus prune nodes with no geometry descendants that
aren't used as bones in models. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4074 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -58,7 +58,7 @@ public abstract class EmissionController extends ModelController
|
||||
*/
|
||||
protected void getEmitterLocation (Vector3f result)
|
||||
{
|
||||
result.set(_target.getWorldBound().getCenter());
|
||||
result.set(_target.getWorldTranslation());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -233,10 +233,8 @@ public class Model extends ModelNode
|
||||
FileChannel fc = fis.getChannel();
|
||||
if (map) {
|
||||
long pos = fc.position();
|
||||
MappedByteBuffer buf = fc.map(FileChannel.MapMode.READ_ONLY,
|
||||
pos, fc.size() - pos);
|
||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
model.sliceBuffers(buf);
|
||||
model.sliceBuffers(fc.map(FileChannel.MapMode.READ_ONLY,
|
||||
pos, fc.size() - pos));
|
||||
} else {
|
||||
model.readBuffers(fc);
|
||||
}
|
||||
@@ -343,6 +341,9 @@ public class Model extends ModelNode
|
||||
*/
|
||||
public Animation getAnimation (String name)
|
||||
{
|
||||
if (_anims == null) {
|
||||
return null;
|
||||
}
|
||||
Animation anim = _anims.get(name);
|
||||
if (anim != null) {
|
||||
return anim;
|
||||
|
||||
@@ -128,25 +128,18 @@ public class ModelMesh extends TriMesh
|
||||
// initialize the model if we're displaying
|
||||
if (DisplaySystem.getDisplaySystem() == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_backCull == null) {
|
||||
initSharedStates();
|
||||
}
|
||||
if (_solid) {
|
||||
setRenderState(_backCull);
|
||||
} else {
|
||||
setRenderState(_noCull);
|
||||
}
|
||||
if (_transparent) {
|
||||
setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
|
||||
setRenderState(_blendAlpha);
|
||||
setRenderState(_overlayZBuffer);
|
||||
} else {
|
||||
setRenderQueueMode(Renderer.QUEUE_OPAQUE);
|
||||
setRenderState(_noAlpha);
|
||||
setRenderState(_lequalZBuffer);
|
||||
}
|
||||
setTextureCombineMode(TextureState.REPLACE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -432,15 +425,11 @@ public class ModelMesh extends TriMesh
|
||||
Renderer renderer = DisplaySystem.getDisplaySystem().getRenderer();
|
||||
_backCull = renderer.createCullState();
|
||||
_backCull.setCullMode(CullState.CS_BACK);
|
||||
_noCull = renderer.createCullState();
|
||||
_blendAlpha = renderer.createAlphaState();
|
||||
_blendAlpha.setBlendEnabled(true);
|
||||
_noAlpha = renderer.createAlphaState();
|
||||
_overlayZBuffer = renderer.createZBufferState();
|
||||
_overlayZBuffer.setFunction(ZBufferState.CF_LEQUAL);
|
||||
_overlayZBuffer.setWritable(false);
|
||||
_lequalZBuffer = renderer.createZBufferState();
|
||||
_lequalZBuffer.setFunction(ZBufferState.CF_LEQUAL);
|
||||
}
|
||||
|
||||
/** The sizes of the various buffers (zero for <code>null</code>). */
|
||||
@@ -469,21 +458,12 @@ public class ModelMesh extends TriMesh
|
||||
/** The shared state for back face culling. */
|
||||
protected static CullState _backCull;
|
||||
|
||||
/** The shared state for no back face culling. */
|
||||
protected static CullState _noCull;
|
||||
|
||||
/** The shared state for alpha blending. */
|
||||
protected static AlphaState _blendAlpha;
|
||||
|
||||
/** The shared state for no blending. */
|
||||
protected static AlphaState _noAlpha;
|
||||
|
||||
/** The shared state for checking, but not writing to, the z buffer. */
|
||||
protected static ZBufferState _overlayZBuffer;
|
||||
|
||||
/** The shared state for checking and writing to the z buffer. */
|
||||
protected static ZBufferState _lequalZBuffer;
|
||||
|
||||
/** Indicates that this mesh should use a bounding box. */
|
||||
protected static final int BOX_BOUND = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user