Home | History | Annotate | Download | only in animation

Lines Matching refs:mesh

25  * the transformations on the mesh
38 private Mesh[] targets;
40 * Used to track when a mesh was updated. Meshes are only updated
69 SkeletonControl(Mesh[] targets, Skeleton skeleton) {
74 private boolean isMeshAnimated(Mesh mesh) {
75 return mesh.getBuffer(Type.BindPosePosition) != null;
78 private Mesh[] findTargets(Node node) {
79 Mesh sharedMesh = null;
80 ArrayList<Mesh> animatedMeshes = new ArrayList<Mesh>();
89 // is this geometry using a shared mesh?
90 Mesh childSharedMesh = geom.getUserData(UserData.JME_SHAREDMESH);
95 // child is using shared mesh,
96 // so animate the shared mesh but ignore child
104 Mesh mesh = geom.getMesh();
105 if (isMeshAnimated(mesh)) {
106 animatedMeshes.add(mesh);
115 return animatedMeshes.toArray(new Mesh[animatedMeshes.size()]);
157 for (Mesh mesh : targets) {
158 if (isMeshAnimated(mesh)) {
159 VertexBuffer bi = mesh.getBuffer(Type.BoneIndex);
162 mesh.prepareForAnim(true); // prepare for software animation
164 VertexBuffer bindPos = mesh.getBuffer(Type.BindPosePosition);
165 VertexBuffer bindNorm = mesh.getBuffer(Type.BindPoseNormal);
166 VertexBuffer pos = mesh.getBuffer(Type.Position);
167 VertexBuffer norm = mesh.getBuffer(Type.Normal);
178 VertexBuffer bindTangents = mesh.getBuffer(Type.BindPoseTangent);
180 VertexBuffer tangents = mesh.getBuffer(Type.Tangent);
262 public Mesh[] getTargets() {
270 // public void setTargets(Mesh[] targets) {
274 * Update the mesh according to the given transformation matrices
275 * @param mesh then mesh
278 private void softwareSkinUpdate(Mesh mesh, Matrix4f[] offsetMatrices) {
280 VertexBuffer tb = mesh.getBuffer(Type.Tangent);
283 applySkinning(mesh, offsetMatrices);
286 applySkinningTangents(mesh, offsetMatrices, tb);
293 * Method to apply skinning transforms to a mesh's buffers
294 * @param mesh the mesh
297 private void applySkinning(Mesh mesh, Matrix4f[] offsetMatrices) {
298 int maxWeightsPerVert = mesh.getMaxNumWeights();
307 VertexBuffer vb = mesh.getBuffer(Type.Position);
311 VertexBuffer nb = mesh.getBuffer(Type.Normal);
315 // get boneIndexes and weights for mesh
316 ByteBuffer ib = (ByteBuffer) mesh.getBuffer(Type.BoneIndex).getData();
317 FloatBuffer wb = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();
395 * @param mesh the mesh
399 private void applySkinningTangents(Mesh mesh, Matrix4f[] offsetMatrices, VertexBuffer tb) {
400 int maxWeightsPerVert = mesh.getMaxNumWeights();
410 VertexBuffer vb = mesh.getBuffer(Type.Position);
414 VertexBuffer nb = mesh.getBuffer(Type.Normal);
424 // get boneIndexes and weights for mesh
425 ByteBuffer ib = (ByteBuffer) mesh.getBuffer(Type.BoneIndex).getData();
426 FloatBuffer wb = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();
544 targets = new Mesh[sav.length];