|
@@ -385,6 +385,8 @@ public class GltfLoader implements AssetLoader {
|
|
JsonObject attributes = meshObject.getAsJsonObject("attributes");
|
|
JsonObject attributes = meshObject.getAsJsonObject("attributes");
|
|
assertNotNull(attributes, "No attributes defined for mesh " + mesh);
|
|
assertNotNull(attributes, "No attributes defined for mesh " + mesh);
|
|
|
|
|
|
|
|
+ boolean useVertexColors = false;
|
|
|
|
+
|
|
skinBuffers.clear();
|
|
skinBuffers.clear();
|
|
|
|
|
|
for (Map.Entry<String, JsonElement> entry : attributes.entrySet()) {
|
|
for (Map.Entry<String, JsonElement> entry : attributes.entrySet()) {
|
|
@@ -408,6 +410,10 @@ public class GltfLoader implements AssetLoader {
|
|
mesh.setBuffer(vb);
|
|
mesh.setBuffer(vb);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // if the color buffer is used, we will need to enable vertex colors on the material
|
|
|
|
+ if (bufferType.startsWith("COLOR")) {
|
|
|
|
+ useVertexColors = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
handleSkinningBuffers(mesh, skinBuffers);
|
|
handleSkinningBuffers(mesh, skinBuffers);
|
|
|
|
|
|
@@ -476,6 +482,10 @@ public class GltfLoader implements AssetLoader {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (useVertexColors) {
|
|
|
|
+ geom.getMaterial().setBoolean("UseVertexColor", useVertexColors);
|
|
|
|
+ }
|
|
|
|
+
|
|
geom.setName(name + "_" + index);
|
|
geom.setName(name + "_" + index);
|
|
|
|
|
|
geom.updateModelBound();
|
|
geom.updateModelBound();
|