Exemplo n.º 1
0
  /**
   * Applies channels in this clip to given {@link AnimatedGroup}. Animations are cumulative. The
   * Meshes are not changed by calling this method.
   *
   * @see AnimatedGroup#resetAnimation()
   * @see AnimatedGroup#applyAnimation()
   */
  public void applyTo(float time, AnimatedGroup targetGroup, float weight) {
    time = SkinHelper.clamp(0f, maxTime, time);

    for (MeshChannel channel : channels) {
      if (channel == null) continue;
      Animated3D target = targetGroup.get(channel.objectIndex);
      channel.applyTo(time, target, weight);
    }
  }
Exemplo n.º 2
0
  /**
   * Adds a new channel.
   *
   * @throws IllegalStateException if there is already a channel related to same object
   */
  public void addChannel(MeshChannel channel) {
    if (channels[channel.objectIndex] != null)
      throw new IllegalStateException(
          "there is already a channel for joint " + channel.objectIndex);

    channels[channel.objectIndex] = channel;
    size++;
    if (channel.getTime() > maxTime) maxTime = channel.getTime();
  }
Exemplo n.º 3
0
  private void updateTime() {
    maxTime = 0;

    for (MeshChannel channel : channels) {
      if (channel == null) continue;
      float max = channel.getTime();
      if (max > maxTime) {
        maxTime = max;
      }
    }
  }
Exemplo n.º 4
0
 /**
  * Applies channels in this clip to given {@link Animated3D}. Animations are cumulative. The Mesh
  * is not changed by calling this method.
  *
  * @see Animated3D#resetAnimation()
  * @see Animated3D#applyAnimation()
  */
 public void applyTo(float time, Animated3D target, float weight) {
   MeshChannel channel = channels[target.getIndex()];
   if (channel == null) return;
   time = SkinHelper.clamp(0f, maxTime, time);
   channel.applyTo(time, target, weight);
 }