|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jme.scene.Spatial
com.jme.scene.Geometry
com.jme.scene.TriMesh
com.jme.scene.MorphingTriMesh
public class MorphingTriMesh
A MorphingGeometry implementation for TriMesh component morph Geometries.
Only component TriMeshes of mode Triangles are supported.
The base morph must have >= vertexes as the other morphs. TODO: Optimize the instantiation procedure. It's pretty complicated to get to reconstitute or instantiate local and delegated influences properly without invoking expensive but unnecessary forceMorphs.
#MorphingGeometry,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.jme.scene.TriMesh |
|---|
TriMesh.Mode |
| Nested classes/interfaces inherited from class com.jme.scene.Spatial |
|---|
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode |
| Field Summary | |
|---|---|
protected boolean |
autoMorph
|
protected TriMesh |
baseMorph
|
protected java.util.Map<TriMesh,java.nio.FloatBuffer> |
extrapolatedNormBuf
|
protected java.util.Map<TriMesh,java.nio.FloatBuffer> |
extrapolatedVertBuf
|
protected ListenableStringFloatMap |
localMorphInfluencesMap
This one is persisted with this MorphingTriMesh instance |
protected ListenableStringFloatMap |
morphInfluencesMap
This one may be a reference to a remotely managed map |
protected java.util.List<java.lang.String> |
morphKeys
|
protected java.util.List<TriMesh> |
morphs
|
protected boolean |
needExtrapolation
|
(package private) static long |
serialVersionUID
|
| Fields inherited from class com.jme.scene.TriMesh |
|---|
indexBuffer, mode, triangleQuantity |
| Fields inherited from class com.jme.scene.Geometry |
|---|
binormalBuf, bound, castsShadows, colorBuf, compVect, defaultColor, displayListID, enabled, fogBuf, hasDirtyVertices, normBuf, states, tangentBuf, texBuf, vboInfo, vertBuf, vertQuantity |
| Fields inherited from class com.jme.scene.Spatial |
|---|
collisionBits, cullHint, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
| Constructor Summary | |
|---|---|
MorphingTriMesh()
Constructor for internal use only. |
|
MorphingTriMesh(TriMesh baseMorph)
Normal constructor. |
|
| Method Summary | |
|---|---|
void |
addMorph(java.lang.String morphKey,
Geometry morphGeo)
Add a component Geometry morph with same quantity of vertexes as the base morph. |
boolean |
delegateInfluences()
If we have an influences map before you invoke this method (either local or remote), it will be retained unless we successfully find delegate to another (in which case 'yes' will be returned). |
void |
draw(Renderer r)
draw calls super to set the render state then passes
itself to the renderer. |
protected void |
enforceEquality(java.lang.String label,
java.nio.FloatBuffer fb1,
java.nio.FloatBuffer fb2)
|
protected void |
extrapolateMorphBuffers()
Extrapolate component morph FloatBuffers to match the size of the base Morph geometry. |
void |
floatChanged(StringFloatMap sfm)
|
void |
forceMorph()
Unconditionally merges the relevant floats from FloabBuffers of the component morphs. |
ListenableStringFloatMap |
getMorphInfluencesMap()
|
protected java.nio.FloatBuffer |
getMorphNormBuffer(TriMesh m)
|
protected java.nio.FloatBuffer |
getMorphVertBuffer(TriMesh m)
|
SkinNode |
getSkinNode()
|
void |
initBase()
Replaces data other than merge data, by copying from the virgin base morph TriMesh. |
protected java.nio.FloatBuffer |
mergeBuffers(java.nio.FloatBuffer baseBuffer,
java.util.List<java.nio.FloatBuffer> morphBuffers,
float[] influences)
Assumes that influence.length == morphBuffers.size() - 1 |
void |
morph()
Morphs (verb) if any of the morphs (noun) or any of the morph influence values have changed. |
void |
read(JMEImporter e)
|
void |
setAutoMorph(boolean autoMorph)
Causes morph merges to automatically occur as needed during update loops. |
void |
setMorphInfluences(java.util.Map<? extends java.lang.String,? extends java.lang.Float> m)
Assign morph influence values. |
void |
setMorphInfluencesMap(ListenableStringFloatMap m)
Set a local morph influences map. |
void |
setSingleMorphInfluence(java.lang.String morphKey,
float influence)
Use setMorphInfluences if you want to change multiple floats, to avoid unnecessary listener callbacks. |
void |
updateGeometricState(float time,
boolean initiator)
updateGeometricState updates all the geometry information
for the node. |
void |
write(JMEExporter e)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.jme.util.export.Savable |
|---|
getClassTag |
| Field Detail |
|---|
static final long serialVersionUID
protected java.util.Map<TriMesh,java.nio.FloatBuffer> extrapolatedVertBuf
protected java.util.Map<TriMesh,java.nio.FloatBuffer> extrapolatedNormBuf
protected java.util.List<TriMesh> morphs
protected java.util.List<java.lang.String> morphKeys
protected TriMesh baseMorph
protected boolean needExtrapolation
protected ListenableStringFloatMap morphInfluencesMap
protected ListenableStringFloatMap localMorphInfluencesMap
protected boolean autoMorph
| Constructor Detail |
|---|
public MorphingTriMesh()
public MorphingTriMesh(TriMesh baseMorph)
morphingTriMesh.addMorph(...);... // anytime before morph()ing
morphingTriMesh.setMorphInfluencesMap(
new ListenableStringFloatMap());
morphingTriMesh.setMorphInfluences(...);
morphingTriMesh.morph();
before attaching to a live scene.
For remote influence control, if you know there is an available
ancestor Node MorphInfluencesMapProvider, run
morphingTriMesh.addMorph(...);... // anytime before morph()ing
morphingTriMesh.delegateInfluences();
morphingTriMesh.morph();
between attaching to the scene and rendering (like in a single update()
run).
If you want to delegate but aren't certain a capable ancestor is at-hand, then run
morphingTriMesh.addMorph(...);... // anytime before morph()ing
morphingTriMesh.setMorphInfluencesMap(
new ListenableStringFloatMap());
morphingTriMesh.setMorphInfluences(...);
morphingTriMesh.delegateInfluences();
morphingTriMesh.morph();
In this case, the local morphingInfluencesMap that you set up will be
overridden if the following delegateInfluences() call finds a provider.
| Method Detail |
|---|
protected java.nio.FloatBuffer getMorphVertBuffer(TriMesh m)
protected java.nio.FloatBuffer getMorphNormBuffer(TriMesh m)
public ListenableStringFloatMap getMorphInfluencesMap()
getMorphInfluencesMap in interface MorphingGeometry#MorphingGeometry#getMorphInfluencesMap()public void setMorphInfluencesMap(ListenableStringFloatMap m)
MorphingGeometry
setMorphInfluencesMap in interface MorphingGeometry#MorphingGeometry#setMorphInfluencesMap(ListenableStringFloatMap)
public void setSingleMorphInfluence(java.lang.String morphKey,
float influence)
MorphingGeometry
setSingleMorphInfluence in interface MorphingGeometry#MorphingGeometry#setSingleMorphInfluence(String, float)public void setMorphInfluences(java.util.Map<? extends java.lang.String,? extends java.lang.Float> m)
MorphingGeometry
setMorphInfluences in interface MorphingGeometry#MorphingGeometry#setMorphInfluences(
Map extends String, ? extends Float>)public boolean delegateInfluences()
MorphingGeometry
delegateInfluences in interface MorphingGeometry#MorphingGeometry#delegateInfluences()
public void addMorph(java.lang.String morphKey,
Geometry morphGeo)
MorphingGeometry
addMorph in interface MorphingGeometrymorphGeo - Must be a TriMesh instance.morphKey - Key in the influences map for the influence for this
morph.#MorphingGeometry#addMorph(String, Geometry)
protected void enforceEquality(java.lang.String label,
java.nio.FloatBuffer fb1,
java.nio.FloatBuffer fb2)
public void initBase()
public void morph()
MorphingGeometry
morph in interface MorphingGeometry#MorphingGeometry#morph()public void forceMorph()
MorphingGeometry
forceMorph in interface MorphingGeometry#MorphingGeometry#forceMorph()public SkinNode getSkinNode()
getSkinNode in interface MorphingGeometryMorphingGeometry.getSkinNode()
protected java.nio.FloatBuffer mergeBuffers(java.nio.FloatBuffer baseBuffer,
java.util.List<java.nio.FloatBuffer> morphBuffers,
float[] influences)
public void write(JMEExporter e)
throws java.io.IOException
write in interface Savablewrite in class TriMeshjava.io.IOException
public void read(JMEImporter e)
throws java.io.IOException
read in interface Savableread in class TriMeshjava.io.IOExceptionpublic void floatChanged(StringFloatMap sfm)
floatChanged in interface ListenableStringFloatMap.FloatListenerpublic void draw(Renderer r)
TriMeshdraw calls super to set the render state then passes
itself to the renderer. LOGIC: 1. If we're not RenderQueue calling draw
goto 2, if we are, goto 3 2. If we are supposed to use queue, add to
queue and RETURN, else 3 3. call super draw 4. tell renderer to draw me.
draw in class TriMeshr - the renderer to displaySpatial.draw(com.jme.renderer.Renderer)public void setAutoMorph(boolean autoMorph)
MorphingGeometry
setAutoMorph in interface MorphingGeometry#MorphingGeometry#setAutoMorph(boolean)
public void updateGeometricState(float time,
boolean initiator)
SpatialupdateGeometricState updates all the geometry information
for the node.
updateGeometricState in class Spatialtime - the frame time.initiator - true if this node started the update process.protected void extrapolateMorphBuffers()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||