private Point buildPoints(final Element colladaGeometry, final Element mesh) {
if (mesh == null || mesh.getChild("vertices") == null || mesh.getChild("vertices").getChild("input") == null) {
return null;
}
final Point points = new Point();
points.setName(mesh.getAttributeValue("name", mesh.getName()));
// Find POSITION vertices source
final Element source = _colladaDOMUtil.getPositionSource(mesh.getChild("vertices"));
if (source == null) {
return null;
}
if (source.getChild("float_array") != null) {
// Turn into Floatbuffer if we have float array data
final Element floatArray = source.getChild("float_array");
if ("0".equals(floatArray.getAttributeValue("count"))) {
return null;
}
final FloatBuffer vertices = BufferUtils.createFloatBuffer(_colladaDOMUtil.parseFloatArray(floatArray));
// Add to points
points.getMeshData().setVertexBuffer(vertices);
} else if (source.getChild("int_array") != null) {
// Turn into Floatbuffer if we have int array data
final Element intArray = source.getChild("int_array");
if ("0".equals(intArray.getAttributeValue("count"))) {
return null;
}
final int[] data = _colladaDOMUtil.parseIntArray(intArray);
final FloatBuffer vertices = BufferUtils.createFloatBuffer(data.length);
for (final int i : data) {
vertices.put(i);
}
// Add to points
points.getMeshData().setVertexBuffer(vertices);
}
// Add to vert mapping
final int[] indices = new int[points.getMeshData().getVertexCount()];
for (int i = 0; i < indices.length; i++) {
indices[i] = i;
}
final MeshVertPairs mvp = new MeshVertPairs(points, indices);
_dataCache.getVertMappings().put(colladaGeometry, mvp);
if (_optimizeMeshes) {
final VertMap map = GeometryTool.minimizeVerts(points, _optimizeSettings);
_dataCache.setMeshVertMap(points, map);
}
// Update bound
points.updateModelBound();
// return
return points;
}