Package com.jme3.anim

Class MorphControl

All Implemented Interfaces:
Savable, Control, JmeCloneable, Cloneable

public class MorphControl extends AbstractControl implements Savable
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.
  • Constructor Details

    • MorphControl

      public MorphControl()
  • Method Details

    • setSpatial

      public void setSpatial(Spatial spatial)
      Specified by:
      setSpatial in interface Control
      Overrides:
      setSpatial in class AbstractControl
      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 class AbstractControl
      Parameters:
      tpf - time per frame (in seconds)
    • controlRender

      protected void controlRender(RenderManager rm, ViewPort vp)
      Description copied from class: AbstractControl
      To be implemented in subclass.
      Specified by:
      controlRender in class AbstractControl
      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

      public void cloneFields(Cloner cloner, Object original)
      Callback from Cloner 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 interface JmeCloneable
      Overrides:
      cloneFields in class AbstractControl
      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

      public MorphControl jmeClone()
      Create a shallow clone for the JME cloner.
      Specified by:
      jmeClone in interface JmeCloneable
      Overrides:
      jmeClone in class AbstractControl
      Returns:
      a new instance
    • read

      public void read(JmeImporter importer) throws IOException
      De-serialize this Control from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface Savable
      Overrides:
      read in class AbstractControl
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • write

      public void write(JmeExporter exporter) throws IOException
      Serialize this Control to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface Savable
      Overrides:
      write in class AbstractControl
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter