logger.debug("\nGroup: \"" + currentGroup.name + "\" ->Vertices: " + currentGroup.verticesForGroup.size()+ " ->TextureCoords: " + currentGroup.texCoordsForGroup.size() + " ->Indices: " + currentGroup.indexArray.length + " ->Texcoord Indices: " + currentGroup.texCoordIndexArray.length );
logger.debug("");
if (vertices.length > 2){
GeometryInfo geometry = null;
//Load as all vertex normals smoothed if creaseAngle == 180;
if (creaseAngle == 180){
geometry = normalGenerator.generateSmoothNormals(pa, newVertices , newIndices, newTextureCoords, newTexIndices, creaseAngle, flipTextureY, flipTextureX);
}else{
geometry = normalGenerator.generateCreaseAngleNormals(pa, newVertices, newIndices, newTextureCoords, newTexIndices, creaseAngle, flipTextureY, flipTextureX);
}
MTTriangleMesh mesh = new MTTriangleMesh(pa, geometry);
if (mesh != null){
mesh.setName(m.name() + " material: " + new Integer(currentGroupName).toString());
//Assign texture
this.assignMaterial(pathToModel, file, scene, m, currentGroupName, mesh);
if (mesh.getTexture() != null){
mesh.setTextureEnabled(true);
}else{
logger.debug("No texture could be assigned to mesh.");
}
returnMeshList.add(mesh);
}
}
}
}else{
//If there are no materials for this mesh dont split mesh into
//groups by material
//Fill indices array and texcoords array (Here: vertex index = texcoord index)
for( int faceIndex = 0; faceIndex < m.faces(); faceIndex++ ){
Face3ds f = m.face( faceIndex );
indices[faceIndex*3] = f.P0;
indices[faceIndex*3+1] = f.P1;
indices[faceIndex*3+2] = f.P2;
texCoordIndices[faceIndex*3] = f.P0;
texCoordIndices[faceIndex*3+1] = f.P1;
texCoordIndices[faceIndex*3+2] = f.P2;
}//for faces
//Create the Mesh and set a texture
if (vertices.length > 2){
//Create normals for the mesh and duplicate vertices for faces that share the same
//Vertex, but with different texture coordinates or different normals
GeometryInfo geometry = null;
//Generate normals and denormalize vertices with more than 1 texture coordinate
if (creaseAngle == 180){
geometry = normalGenerator.generateSmoothNormals(pa, vertices, indices, textureCoords, texCoordIndices, creaseAngle, flipTextureY, flipTextureX);
}else{
geometry = normalGenerator.generateCreaseAngleNormals(pa, vertices, indices, textureCoords, texCoordIndices, creaseAngle, flipTextureY, flipTextureX);