Tabnine Logo
Skeleton.getBoneCount
Code IndexAdd Tabnine to your IDE (free)

How to use
getBoneCount
method
in
com.jme3.animation.Skeleton

Best Java code snippets using com.jme3.animation.Skeleton.getBoneCount (Showing top 20 results out of 315)

origin: jMonkeyEngine/jmonkeyengine

private boolean testHardwareSupported(RenderManager rm) {
  //Only 255 bones max supported with hardware skinning
  if (skeleton.getBoneCount() > 255) {
    return false;
  }
  switchToHardware();
  
  try {
    rm.preloadScene(spatial);
    return true;
  } catch (RendererException e) {
    Logger.getLogger(SkeletonControl.class.getName()).log(Level.WARNING, "Could not enable HW skinning due to shader compile error:", e);
    return false;
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Add a single bone to be influenced by this animation channel.
 */
public void addBone(Bone bone) {
  int boneIndex = control.getSkeleton().getBoneIndex(bone);
  if(affectedBones == null) {
    affectedBones = new BitSet(control.getSkeleton().getBoneCount());
  }
  affectedBones.set(boneIndex);
}
origin: jMonkeyEngine/jmonkeyengine

  @Override
  public void apply(Node node, BlenderContext blenderContext) {
    if (invalid) {
      LOGGER.log(Level.WARNING, "Armature modifier is invalid! Cannot be applied to: {0}", node.getName());
    }

    if (modifying) {
      TemporalMesh temporalMesh = this.getTemporalMesh(node);
      if (temporalMesh != null) {
        LOGGER.log(Level.FINE, "Applying armature modifier to: {0}", temporalMesh);
        
        LOGGER.fine("Creating map between bone name and its index.");
        for (int i = 0; i < skeleton.getBoneCount(); ++i) {
          Bone bone = skeleton.getBone(i);
          temporalMesh.addBoneIndex(bone.getName(), i);
        }
        temporalMesh.applyAfterMeshCreate(this);
      } else {
        LOGGER.log(Level.WARNING, "Cannot find temporal mesh for node: {0}. The modifier will NOT be applied!", node);
      }
    }
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Remove any bones without vertices from the boneList, so that every hull
 * shape will contain at least 1 vertex.
 */
private void filterBoneList(SkeletonControl skeletonControl) {
  Mesh[] targets = skeletonControl.getTargets();
  Skeleton skel = skeletonControl.getSkeleton();
  for (int boneI = 0; boneI < skel.getBoneCount(); boneI++) {
    String boneName = skel.getBone(boneI).getName();
    if (boneList.contains(boneName)) {
      boolean hasVertices = RagdollUtils.hasVertices(boneI, targets,
          weightThreshold);
      if (!hasVertices) {
        boneList.remove(boneName);
      }
    }
  }
}
origin: jMonkeyEngine/jmonkeyengine

for (int i = 0; i < skeleton.getBoneCount(); ++i) {
  String boneName = skeleton.getBone(i).getName();
  if (boneName != null && boneName.length() > 0) {
origin: jMonkeyEngine/jmonkeyengine

/**
 * Remove any bones without vertices from the boneList, so that every hull
 * shape will contain at least 1 vertex.
 */
private void filterBoneList(SkeletonControl skeletonControl) {
  Mesh[] targets = skeletonControl.getTargets();
  Skeleton skel = skeletonControl.getSkeleton();
  for (int boneI = 0; boneI < skel.getBoneCount(); boneI++) {
    String boneName = skel.getBone(boneI).getName();
    if (boneList.contains(boneName)) {
      boolean hasVertices = RagdollUtils.hasVertices(boneI, targets,
          weightThreshold);
      if (!hasVertices) {
        boneList.remove(boneName);
      }
    }
  }
}
origin: jMonkeyEngine/jmonkeyengine

private void switchToHardware() {
  numberOfBonesParam.setEnabled(true);
  boneMatricesParam.setEnabled(true);
  
  // Next full 10 bones (e.g. 30 on 24 bones)
  int numBones = ((skeleton.getBoneCount() / 10) + 1) * 10;
  numberOfBonesParam.setValue(numBones);
  
  for (Geometry geometry : targets) {
    Mesh mesh = geometry.getMesh();
    if (mesh != null && mesh.isAnimated()) {
      mesh.prepareForAnim(false);
    }
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * The method updates the geometry according to the poitions of the bones.
 */
public void updateGeometry() {
  VertexBuffer vb = this.getBuffer(Type.Position);
  FloatBuffer posBuf = this.getFloatBuffer(Type.Position);
  posBuf.clear();
  for (int i = 0; i < skeleton.getBoneCount(); ++i) {
    Bone bone = skeleton.getBone(i);
    Vector3f head = bone.getModelSpacePosition();
    posBuf.put(head.getX()).put(head.getY()).put(head.getZ());
    if (boneLengths != null) {
      Vector3f tail = head.add(bone.getModelSpaceRotation().mult(Vector3f.UNIT_Y.mult(boneLengths.get(i))));
      posBuf.put(tail.getX()).put(tail.getY()).put(tail.getZ());
    }
  }
  posBuf.flip();
  vb.updateData(posBuf);
  this.updateBound();
}
origin: jMonkeyEngine/jmonkeyengine

  /**
   * The method updates the geometry according to the positions of the bones.
   */
  public void updateGeometry() {
    VertexBuffer vb = this.getBuffer(Type.Position);
    FloatBuffer posBuf = this.getFloatBuffer(Type.Position);
    posBuf.clear();
    for (int i = 0; i < skeleton.getBoneCount(); ++i) {
      Bone bone = skeleton.getBone(i);
      Vector3f head = bone.getModelSpacePosition();

      posBuf.put(head.getX()).put(head.getY()).put(head.getZ());
      if (boneLengths != null) {
        Vector3f tail = head.add(bone.getModelSpaceRotation().mult(Vector3f.UNIT_Y.mult(boneLengths.get(i))));
        posBuf.put(tail.getX()).put(tail.getY()).put(tail.getZ());
      }
    }
    posBuf.flip();
    vb.updateData(posBuf);

    this.updateBound();
  }
}
origin: jMonkeyEngine/jmonkeyengine

@Override
public void visit(Spatial spatial) {
  SkeletonControl control = spatial.getControl(SkeletonControl.class);
  if (control != null) {
    Armature armature = skeletonArmatureMap.get(control.getSkeleton());
    SkinningControl skinningControl = new SkinningControl(armature);
    Map<String, List<Spatial>> attachedSpatials = new HashMap<>();
    for (int i = 0; i < control.getSkeleton().getBoneCount(); i++) {
      Bone b = control.getSkeleton().getBone(i);
      Node n = control.getAttachmentsNode(b.getName());
      n.removeFromParent();
      if (!n.getChildren().isEmpty()) {
        attachedSpatials.put(b.getName(), n.getChildren());
      }
    }
    spatial.removeControl(control);
    spatial.addControl(skinningControl);
    for (String name : attachedSpatials.keySet()) {
      List<Spatial> spatials = attachedSpatials.get(name);
      for (Spatial child : spatials) {
        skinningControl.getAttachmentsNode(name).attachChild(child);
      }
    }
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Creates a points with bone lengths data. If the data is supplied then the points will show both head and tail of each bone.
 * @param skeleton
 *            the skeleton that will be shown
 * @param boneLengths
 *            a map between the bone's index and the bone's length
 */
public SkeletonPoints(Skeleton skeleton, Map<Integer, Float> boneLengths) {
  this.skeleton = skeleton;
  this.setMode(Mode.Points);
  int pointsCount = skeleton.getBoneCount();
  if (boneLengths != null) {
    this.boneLengths = boneLengths;
    pointsCount *= 2;
  }
  VertexBuffer pb = new VertexBuffer(Type.Position);
  FloatBuffer fpb = BufferUtils.createFloatBuffer(pointsCount * 3);
  pb.setupData(Usage.Stream, 3, Format.Float, fpb);
  this.setBuffer(pb);
  this.updateCounts();
}
origin: jMonkeyEngine/jmonkeyengine

Joint[] joints = new Joint[skeleton.getBoneCount()];
for (int i = 0; i < skeleton.getBoneCount(); i++) {
  Bone b = skeleton.getBone(i);
  Joint j = joints[i];
origin: jMonkeyEngine/jmonkeyengine

for (int i = 0; i < skeleton.getBoneCount(); ++i) {
  Bone bone = skeleton.getBone(i);
  boneStartTransforms.put(bone, new Transform(bone.getBindPosition(), bone.getBindRotation(), bone.getBindScale()));
origin: jMonkeyEngine/jmonkeyengine

/**
 * The method updates the geometry according to the poitions of the bones.
 */
public void updateGeometry() {
  VertexBuffer vb = this.getBuffer(Type.Position);
  FloatBuffer posBuf = this.getFloatBuffer(Type.Position);
  posBuf.clear();
  for (int i = 0; i < skeleton.getBoneCount(); ++i) {
    Bone bone = skeleton.getBone(i);
    Vector3f parentTail = bone.getModelSpacePosition().add(bone.getModelSpaceRotation().mult(Vector3f.UNIT_Y.mult(boneLengths.get(i))));
    for (Bone child : bone.getChildren()) {
      Vector3f childHead = child.getModelSpacePosition();
      Vector3f v = childHead.subtract(parentTail);
      float pointDelta = v.length() / POINT_AMOUNT;
      v.normalizeLocal().multLocal(pointDelta);
      Vector3f pointPosition = parentTail.clone();
      for (int j = 0; j < POINT_AMOUNT; ++j) {
        posBuf.put(pointPosition.getX()).put(pointPosition.getY()).put(pointPosition.getZ());
        pointPosition.addLocal(v);
      }
    }
  }
  posBuf.flip();
  vb.updateData(posBuf);
  this.updateBound();
}
origin: jMonkeyEngine/jmonkeyengine

for (int boneI = 0; boneI < skeleton.getBoneCount(); boneI++) {
  String boneName = skeleton.getBone(boneI).getName();
  boneList.add(boneName);
origin: jMonkeyEngine/jmonkeyengine

for (int boneI = 0; boneI < skeleton.getBoneCount(); boneI++) {
  String boneName = skeleton.getBone(boneI).getName();
  boneList.add(boneName);
origin: jMonkeyEngine/jmonkeyengine

int lineVerticesCount = skeleton.getBoneCount();
if (boneLengths != null) {
  this.boneLengths = boneLengths;
origin: org.jmonkeyengine/jme3-dae

private Animation[] createAnimations(DAENode animationsNode, Skeleton skeleton)
{
 List<Animation> list = new ArrayList<Animation>();
 for (int i = 0; i < skeleton.getBoneCount(); i++)
 {
   Bone bone = skeleton.getBone(i);
   List<Animation> animations = createAnimationList(animationsNode, bone, skeleton);
   list.addAll(animations);
 }
 return list.toArray(new Animation[list.size()]);
}
origin: org.jmonkeyengine/jme3-core

/**
 * Add a single bone to be influenced by this animation channel.
 */
public void addBone(Bone bone) {
  int boneIndex = control.getSkeleton().getBoneIndex(bone);
  if(affectedBones == null) {
    affectedBones = new BitSet(control.getSkeleton().getBoneCount());
  }
  affectedBones.set(boneIndex);
}
origin: info.projectkyoto/mms-engine

/**
 * Add a single bone to be influenced by this animation channel.
 */
public void addBone(Bone bone) {
  int boneIndex = control.getSkeleton().getBoneIndex(bone);
  if(affectedBones == null) {
    affectedBones = new BitSet(control.getSkeleton().getBoneCount());
  }
  affectedBones.set(boneIndex);
}
com.jme3.animationSkeletongetBoneCount

Javadoc

returns the number of bones of this skeleton

Popular methods of Skeleton

  • getBoneIndex
    returns the bone index of the bone that has the given name
  • getBone
    returns the bone with the given name
  • getRoots
    returns the array of all root bones of this skeleton
  • resetAndUpdate
    Reset the skeleton to bind pose and updates the bones
  • <init>
    Creates a skeleton from a bone list. The root bones are found automatically. Note that using this c
  • updateWorldVectors
    Updates world transforms for all bones in this skeleton. Typically called after setting local animat
  • computeSkinningMatrices
    Compute the skining matrices for each bone of the skeleton that would be used to transform vertices
  • reset
    Reset the skeleton to bind pose.
  • setBindingPose
    Saves the current skeleton state as its binding pose.
  • createSkinningMatrices
  • recreateBoneStructure
  • recreateBoneStructure

Popular in Java

  • Creating JSON documents from java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • runOnUiThread (Activity)
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • BoxLayout (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now