com.jme3.animation.Animation.getTracks()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中com.jme3.animation.Animation.getTracks()方法的一些代码示例,展示了Animation.getTracks()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Animation.getTracks()方法的具体详情如下:
包路径:com.jme3.animation.Animation
类名称:Animation
方法名:getTracks

Animation.getTracks介绍

[英]Returns the tracks set in #setTracks(com.jme3.animation.Track[]).
[中]返回在#setTracks(com.jme3.animation.Track[])中设置的轨迹。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Computes the maximum frame and time for the animation. Different tracks
 * can have different lengths so here the maximum one is being found.
 * 
 * @param animation
 *            the animation
 * @return maximum frame and time of the animation
 */
private float[] computeAnimationTimeBoundaries(Animation animation) {
  int maxFrame = Integer.MIN_VALUE;
  float maxTime = -Float.MAX_VALUE;
  for (Track track : animation.getTracks()) {
    if (track instanceof BoneTrack) {
      maxFrame = Math.max(maxFrame, ((BoneTrack) track).getTranslations().length);
      maxTime = Math.max(maxTime, ((BoneTrack) track).getTimes()[((BoneTrack) track).getTimes().length - 1]);
    } else if (track instanceof SpatialTrack) {
      maxFrame = Math.max(maxFrame, ((SpatialTrack) track).getTranslations().length);
      maxTime = Math.max(maxTime, ((SpatialTrack) track).getTimes()[((SpatialTrack) track).getTimes().length - 1]);
    } else {
      throw new IllegalStateException("Unsupported track type for simuation: " + track);
    }
  }
  return new float[] { maxFrame, maxTime };
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

for (Track track : animation.getTracks()) {
  float time = ((BoneTrack) track).getTimes()[frame];
  track.setTime(time, 1, animControl, animChannel, vars);
if (newTrack != null) {
  boolean trackReplaced = false;
  for (Track track : animation.getTracks()) {
    if (((BoneTrack) track).getTargetBoneIndex() == trackEntry.getKey().intValue()) {
      animation.removeTrack(track);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

Track[] tracks = anim.getTracks();
if(tracks == null || tracks.length == 0)
  continue;

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

for (Track track : anim.getTracks()) {
  if (track instanceof BoneTrack) {
    BoneTrack boneTrack = (BoneTrack) track;

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

for (Track track : animation.getTracks()) {
  for (int frame = 0; frame < maxFrame; ++frame) {
    spatial.setLocalTranslation(((SpatialTrack) track).getTranslations()[frame]);

代码示例来源:origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport-jmonkey

private static Node findAnimNode(Node node) {
  AnimControl l_animControl;
  l_animControl = node.getControl(AnimControl.class);
  if (l_animControl != null) {
    if (!l_animControl.getAnimationNames().isEmpty()) {
      Animation l_anim = l_animControl.getAnim(l_animControl.getAnimationNames().iterator().next());
      if (l_anim != null && l_anim.getTracks().length > 0 && l_anim.getTracks()[0] instanceof BoneTrack) {
        return node;
      }
    }
  }
  
  for (Spatial l_child : node.getChildren()) {
    if(l_child.getControl(AnimControl.class) != null) {
      return (Node) l_child;
    }
    if(!(l_child instanceof Geometry)){
      
      Node l_ret = findAnimNode((Node) l_child);
      if (l_ret != null) {
        return l_ret;
      }
    }
  }
  return null;
}

代码示例来源:origin: org.jmonkeyengine/jme3-plugins

Track[] tracks = anim.getTracks();
if(tracks == null || tracks.length == 0)
  continue;

相关文章