/** * Th method couns the connections between bones. * @param bone * the bone where counting starts */ private void countConnections(Bone bone) { for (Bone child : bone.getChildren()) { numConnections++; this.countConnections(child); } }
/** * Th method couns the connections between bones. * @param bone * the bone where counting starts */ private void countConnections(Bone bone) { for (Bone child : bone.getChildren()) { ++connectionsAmount; this.countConnections(child); } } }
/** * Add bones to be influenced by this animation channel, starting * from the given bone and going toward its children. */ public void addFromRootBone(Bone bone) { addBone(bone); if (bone.getChildren() == null) return; for (Bone childBone : bone.getChildren()) { addBone(childBone); addFromRootBone(childBone); } }
/** * Alter the user-control flags of a bone and all its descendents. * * @param bone the ancestor bone (not null, modified) * @param bool true to enable user control, false to disable */ public static void setUserControl(Bone bone, boolean bool) { bone.setUserControl(bool); for (Bone child : bone.getChildren()) { setUserControl(child, bool); } }
/** * Alter the user-control flags of a bone and all its descendents. * * @param bone the ancestor bone (not null, modified) * @param bool true to enable user control, false to disable */ public static void setUserControl(Bone bone, boolean bool) { bone.setUserControl(bool); for (Bone child : bone.getChildren()) { setUserControl(child, bool); } }
/** * Enumerate the bone indices of the specified bone and all its descendents. * * @param bone the input bone (not null) * @param skeleton the skeleton containing the bone (not null) * @param boneList a set of bone names (not null, unaffected) * * @return a new list (not null) */ public static List<Integer> getBoneIndices(Bone bone, Skeleton skeleton, Set<String> boneList) { List<Integer> list = new LinkedList<Integer>(); if (boneList.isEmpty()) { list.add(skeleton.getBoneIndex(bone)); } else { list.add(skeleton.getBoneIndex(bone)); for (Bone chilBone : bone.getChildren()) { if (!boneList.contains(chilBone.getName())) { list.addAll(getBoneIndices(chilBone, skeleton, boneList)); } } } return list; }
/** * The method writes the indexes for the connection vertices. Used in non-length mode. * @param indexBuf * the index buffer * @param bone * the bone */ private void writeConnections(ShortBuffer indexBuf, Bone bone) { for (Bone child : bone.getChildren()) { // write myself indexBuf.put((short) skeleton.getBoneIndex(bone)); // write the child indexBuf.put((short) skeleton.getBoneIndex(child)); this.writeConnections(indexBuf, child); } } }
/** * Enumerate the bone indices of the specified bone and all its descendents. * * @param bone the input bone (not null) * @param skeleton the skeleton containing the bone (not null) * @param boneList a set of bone names (not null, unaffected) * * @return a new list (not null) */ public static List<Integer> getBoneIndices(Bone bone, Skeleton skeleton, Set<String> boneList) { List<Integer> list = new LinkedList<Integer>(); if (boneList.isEmpty()) { list.add(skeleton.getBoneIndex(bone)); } else { list.add(skeleton.getBoneIndex(bone)); for (Bone chilBone : bone.getChildren()) { if (!boneList.contains(chilBone.getName())) { list.addAll(getBoneIndices(chilBone, skeleton, boneList)); } } } return list; }
private Bone recreateBoneStructure(Bone sourceRoot) { Bone targetRoot = getBone(sourceRoot.getName()); List<Bone> children = sourceRoot.getChildren(); for (int i = 0; i < children.size(); i++) { Bone sourceChild = children.get(i); // find my version of the child Bone targetChild = getBone(sourceChild.getName()); targetRoot.addChild(targetChild); recreateBoneStructure(sourceChild); } return targetRoot; }
List<Bone> children = bone.getChildren(); if (children != null && children.size() > 0) { for (Bone child : bone.getChildren()) { this.applyConstraints(child, alteredOmas, applied, frame, bonesStack);
for (Bone childBone : bone.getChildren()) {
for (Bone childBone : bone.getChildren()) {
joints[i] = j; for (Bone bone : b.getChildren()) { int index = skeleton.getBoneIndex(bone); Joint joint = joints[index];
/** * 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(); }
for (Iterator<Bone> it = bone.getChildren().iterator(); it.hasNext();) { Bone childBone = it.next(); boneRecursion(model, childBone, parentShape, reccount + 1, pointsMap);
for (Iterator<Bone> it = bone.getChildren().iterator(); it.hasNext();) { Bone childBone = it.next(); boneRecursion(model, childBone, parentShape, reccount + 1, pointsMap);
public static void setUserControl(Bone bone, boolean bool) { bone.setUserControl(bool); for (Bone child : bone.getChildren()) { setUserControl(child, bool); } } }
public static void setUserControl(Bone bone, boolean bool) { bone.setUserControl(bool); for (Bone child : bone.getChildren()) { setUserControl(child, bool); } } }
/** * Alter the user-control flags of a bone and all its descendents. * * @param bone the ancestor bone (not null, modified) * @param bool true to enable user control, false to disable */ public static void setUserControl(Bone bone, boolean bool) { bone.setUserControl(bool); for (Bone child : bone.getChildren()) { setUserControl(child, bool); } }
protected final void updateSkeletonGeoms(Bone bone) { if (guessBonesOrientation && bone.getName().equalsIgnoreCase("Site")) { return; } Node n = boneNodes.get(bone); n.setLocalTranslation(bone.getLocalPosition()); n.setLocalRotation(bone.getLocalRotation()); n.setLocalScale(bone.getLocalScale()); for (Bone childBone : bone.getChildren()) { updateSkeletonGeoms(childBone); } }