Examples of SkinnedMeshAttachment


Examples of com.esotericsoftware.spine.attachments.SkinnedMeshAttachment

        vertices = mesh.getWorldVertices();
        triangles = mesh.getTriangles();
        texture = mesh.getRegion().getTexture();

      } else if (attachment instanceof SkinnedMeshAttachment) {
        SkinnedMeshAttachment mesh = (SkinnedMeshAttachment)attachment;
        mesh.updateWorldVertices(slot, true);
        vertices = mesh.getWorldVertices();
        triangles = mesh.getTriangles();
        texture = mesh.getRegion().getTexture();

      } else if (attachment instanceof SkeletonAttachment) {
        Skeleton attachmentSkeleton = ((SkeletonAttachment)attachment).getSkeleton();
        if (attachmentSkeleton == null) continue;
        Bone bone = slot.getBone();
View Full Code Here

Examples of com.esotericsoftware.spine.attachments.SkinnedMeshAttachment

      mesh.setWidth(map.getFloat("width", 0) * scale);
      mesh.setHeight(map.getFloat("height", 0) * scale);
      return mesh;
    }
    case skinnedmesh: {
      SkinnedMeshAttachment mesh = attachmentLoader.newSkinnedMeshAttachment(skin, name, path);
      if (mesh == null) return null;
      mesh.setPath(path);
      float[] uvs = map.require("uvs").asFloatArray();
      float[] vertices = map.require("vertices").asFloatArray();
      FloatArray weights = new FloatArray(uvs.length * 3 * 3);
      IntArray bones = new IntArray(uvs.length * 3);
      for (int i = 0, n = vertices.length; i < n;) {
        int boneCount = (int)vertices[i++];
        bones.add(boneCount);
        for (int nn = i + boneCount * 4; i < nn;) {
          bones.add((int)vertices[i]);
          weights.add(vertices[i + 1] * scale);
          weights.add(vertices[i + 2] * scale);
          weights.add(vertices[i + 3]);
          i += 4;
        }
      }
      mesh.setBones(bones.toArray());
      mesh.setWeights(weights.toArray());
      mesh.setTriangles(map.require("triangles").asShortArray());
      mesh.setRegionUVs(uvs);
      mesh.updateUVs();

      String color = map.getString("color", null);
      if (color != null) mesh.getColor().set(Color.valueOf(color));

      if (map.has("hull")) mesh.setHullLength(map.require("hull").asInt() * 2);
      if (map.has("edges")) mesh.setEdges(map.require("edges").asIntArray());
      mesh.setWidth(map.getFloat("width", 0) * scale);
      mesh.setHeight(map.getFloat("height", 0) * scale);
      return mesh;
    }
    }

    // RegionSequenceAttachment regionSequenceAttachment = (RegionSequenceAttachment)attachment;
View Full Code Here

Examples of com.esotericsoftware.spine.attachments.SkinnedMeshAttachment

      return mesh;
    }
    case skinnedmesh: {
      String path = input.readString();
      if (path == null) path = name;
      SkinnedMeshAttachment mesh = attachmentLoader.newSkinnedMeshAttachment(skin, name, path);
      if (mesh == null) return null;
      mesh.setPath(path);
      float[] uvs = readFloatArray(input, 1);
      short[] triangles = readShortArray(input);

      int vertexCount = input.readInt(true);
      FloatArray weights = new FloatArray(uvs.length * 3 * 3);
      IntArray bones = new IntArray(uvs.length * 3);
      for (int i = 0; i < vertexCount; i++) {
        int boneCount = (int)input.readFloat();
        bones.add(boneCount);
        for (int nn = i + boneCount * 4; i < nn; i += 4) {
          bones.add((int)input.readFloat());
          weights.add(input.readFloat() * scale);
          weights.add(input.readFloat() * scale);
          weights.add(input.readFloat());
        }
      }
      mesh.setBones(bones.toArray());
      mesh.setWeights(weights.toArray());
      mesh.setTriangles(triangles);
      mesh.setRegionUVs(uvs);
      mesh.updateUVs();
      Color.rgba8888ToColor(mesh.getColor(), input.readInt());
      mesh.setHullLength(input.readInt(true) * 2);
      if (nonessential) {
        mesh.setEdges(readIntArray(input));
        mesh.setWidth(input.readFloat() * scale);
        mesh.setHeight(input.readFloat() * scale);
      }
      return mesh;
    }
    }
    return null;
View Full Code Here

Examples of com.esotericsoftware.spine.attachments.SkinnedMeshAttachment

          mesh.updateWorldVertices(slot, false);
          vertices = mesh.getWorldVertices();
          triangles = mesh.getTriangles();
          hullLength = mesh.getHullLength();
        } else if (attachment instanceof SkinnedMeshAttachment) {
          SkinnedMeshAttachment mesh = (SkinnedMeshAttachment)attachment;
          mesh.updateWorldVertices(slot, false);
          vertices = mesh.getWorldVertices();
          triangles = mesh.getTriangles();
          hullLength = mesh.getHullLength();
        }
        if (vertices == null || triangles == null) continue;
        if (drawMeshTriangles) {
          shapes.setColor(triangleLineColor);
          for (int ii = 0, nn = triangles.length; ii < nn; ii += 3) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.