private static Mesh processMesh(AIMesh aiMesh, List<Material> materials, List<Bone> boneList) { List<Float> vertices = new ArrayList<>(); List<Float> textures = new ArrayList<>(); List<Float> normals = new ArrayList<>(); List<Integer> indices = new ArrayList<>(); List<Integer> boneIds = new ArrayList<>(); List<Float> weights = new ArrayList<>(); processVertices(aiMesh, vertices); processNormals(aiMesh, normals); processTextCoords(aiMesh, textures); processIndices(aiMesh, indices); processBones(aiMesh, boneList, boneIds, weights); Mesh mesh = new Mesh(Utils.listToArray(vertices), Utils.listToArray(textures), Utils.listToArray(normals), Utils.listIntToArray(indices), Utils.listIntToArray(boneIds), Utils.listToArray(weights)); Material material; int materialIdx = aiMesh.mMaterialIndex(); if (materialIdx >= 0 && materialIdx < materials.size()) { material = materials.get(materialIdx); } else { material = new Material(); } mesh.setMaterial(material); return mesh; }
private static Mesh processMesh(AIMesh aiMesh, List<Material> materials, List<Bone> boneList) { List<Float> vertices = new ArrayList<>(); List<Float> textures = new ArrayList<>(); List<Float> normals = new ArrayList<>(); List<Integer> indices = new ArrayList<>(); List<Integer> boneIds = new ArrayList<>(); List<Float> weights = new ArrayList<>(); processVertices(aiMesh, vertices); processNormals(aiMesh, normals); processTextCoords(aiMesh, textures); processIndices(aiMesh, indices); processBones(aiMesh, boneList, boneIds, weights); Mesh mesh = new Mesh(Utils.listToArray(vertices), Utils.listToArray(textures), Utils.listToArray(normals), Utils.listIntToArray(indices), Utils.listIntToArray(boneIds), Utils.listToArray(weights)); Material material; int materialIdx = aiMesh.mMaterialIndex(); if (materialIdx >= 0 && materialIdx < materials.size()) { material = materials.get(materialIdx); } else { material = new Material(); } mesh.setMaterial(material); return mesh; }