Package com.badlogic.gdx.utils

Examples of com.badlogic.gdx.utils.IntArray


      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());
View Full Code Here


      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();

View Full Code Here

    }
  }

  private static StillSubMesh readStillSubMesh (BufferedReader in, boolean flipV) throws IOException {
    String name = readString(in);
    IntArray indices = readFaces(in);
    int numVertices = readInt(in);
    int numAttributes = readInt(in);

    if (!readString(in).equals("position")) throw new GdxRuntimeException("first attribute must be position.");
    int numUvs = 0;
View Full Code Here

    return uvSet;
  }

  private static IntArray readFaces (BufferedReader in) throws NumberFormatException, IOException {
    int numFaces = readInt(in);
    IntArray faceIndices = new IntArray();
    IntArray triangles = new IntArray();
    IntArray indices = new IntArray();

    for (int face = 0; face < numFaces; face++) {
      readIntArray(in, faceIndices);
      int numIndices = faceIndices.get(0);
      triangles.clear();
      int baseIndex = faceIndices.get(1);
      for (int i = 2; i < numIndices; i++) {
        triangles.add(baseIndex);
        triangles.add(faceIndices.items[i]);
        triangles.add(faceIndices.items[i + 1]);
      }
      indices.addAll(triangles);
    }

    indices.shrink();
    return indices;
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.utils.IntArray

Copyright © 2018 www.massapicom. 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.