Example #1
0
  /**
   * @param boneName the name of the bone
   * @return the node attached to this bone
   */
  public Node getAttachmentsNode(String boneName) {
    Bone b = skeleton.getBone(boneName);
    if (b == null) {
      throw new IllegalArgumentException("Given bone name does not exist " + "in the skeleton.");
    }

    Node n = b.getAttachmentsNode();
    Node model = (Node) spatial;
    model.attachChild(n);
    return n;
  }
Example #2
0
  @Override
  protected void controlRender(RenderManager rm, ViewPort vp) {
    if (!wasMeshUpdated) {
      resetToBind(); // reset morph meshes to bind pose

      Matrix4f[] offsetMatrices = skeleton.computeSkinningMatrices();

      // if hardware skinning is supported, the matrices and weight buffer
      // will be sent by the SkinningShaderLogic object assigned to the shader
      for (int i = 0; i < targets.length; i++) {
        // NOTE: This assumes that code higher up
        // Already ensured those targets are animated
        // otherwise a crash will happen in skin update
        // if (isMeshAnimated(targets[i])) {
        softwareSkinUpdate(targets[i], offsetMatrices);
        // }
      }

      wasMeshUpdated = true;
    }
  }