Package com.jme3.anim
Class MorphControl
java.lang.Object
com.jme3.scene.control.AbstractControl
com.jme3.anim.MorphControl
- All Implemented Interfaces:
Savable
,Control
,JmeCloneable
,Cloneable
A control that handle morph animation for Position, Normal and Tangent buffers.
All stock shaders only support morphing these 3 buffers, but note that MorphTargets can have any type of buffers.
If you want to use other types of buffers you will need a custom MorphControl and a custom shader.
Note that if morphed children are attached to or detached from the sub graph after the MorphControl is added to
spatial, you must detach and attach the control again for the changes to get reflected.
-
Field Summary
Fields inherited from class com.jme3.scene.control.AbstractControl
enabled, spatial
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cloneFields
(Cloner cloner, Object original) Callback fromCloner
to convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.protected void
controlRender
(RenderManager rm, ViewPort vp) To be implemented in subclass.protected void
controlUpdate
(float tpf) To be implemented in subclass.boolean
Test whether this Control approximates tangents.jmeClone()
Create a shallow clone for the JME cloner.void
read
(JmeImporter importer) De-serialize this Control from the specified importer, for example when loading from a J3O file.void
setApproximateTangents
(boolean approximateTangents) Alter whether this Control approximates tangents.void
setSpatial
(Spatial spatial) void
write
(JmeExporter exporter) Serialize this Control to the specified exporter, for example when saving to a J3O file.Methods inherited from class com.jme3.scene.control.AbstractControl
cloneForSpatial, getSpatial, isEnabled, render, setEnabled, update
-
Constructor Details
-
MorphControl
public MorphControl()
-
-
Method Details
-
setSpatial
- Specified by:
setSpatial
in interfaceControl
- Overrides:
setSpatial
in classAbstractControl
- Parameters:
spatial
- the spatial to be controlled. This should not be called from user code.
-
controlUpdate
protected void controlUpdate(float tpf) Description copied from class:AbstractControl
To be implemented in subclass.- Specified by:
controlUpdate
in classAbstractControl
- Parameters:
tpf
- time per frame (in seconds)
-
controlRender
Description copied from class:AbstractControl
To be implemented in subclass.- Specified by:
controlRender
in classAbstractControl
- Parameters:
rm
- the RenderManager rendering the controlled Spatial (not null)vp
- the ViewPort being rendered (not null)
-
setApproximateTangents
public void setApproximateTangents(boolean approximateTangents) Alter whether this Control approximates tangents.- Parameters:
approximateTangents
- true to approximate tangents, false to get them from a VertexBuffer
-
isApproximateTangents
public boolean isApproximateTangents()Test whether this Control approximates tangents.- Returns:
- true if approximating tangents, false if getting them from a VertexBuffer
-
cloneFields
Callback fromCloner
to convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFields
in interfaceJmeCloneable
- Overrides:
cloneFields
in classAbstractControl
- Parameters:
cloner
- the Cloner that's cloning this Control (not null, modified)original
- the instance from which this Control was shallow-cloned (not null, unaffected)
-
jmeClone
Create a shallow clone for the JME cloner.- Specified by:
jmeClone
in interfaceJmeCloneable
- Overrides:
jmeClone
in classAbstractControl
- Returns:
- a new instance
-
read
De-serialize this Control from the specified importer, for example when loading from a J3O file.- Specified by:
read
in interfaceSavable
- Overrides:
read
in classAbstractControl
- Parameters:
importer
- (not null)- Throws:
IOException
- from the importer
-
write
Serialize this Control to the specified exporter, for example when saving to a J3O file.- Specified by:
write
in interfaceSavable
- Overrides:
write
in classAbstractControl
- Parameters:
exporter
- (not null)- Throws:
IOException
- from the exporter
-