@ -397,10 +397,23 @@ public class GltfLoader implements AssetLoader {
mesh . generateBindPose ( ) ;
mesh . generateBindPose ( ) ;
}
}
//Read morph target names
LinkedList < String > targetNames = new LinkedList < > ( ) ;
if ( meshData . has ( "extras" ) & & meshData . getAsJsonObject ( "extras" ) . has ( "targetNames" ) ) {
JsonArray targetNamesJson = meshData . getAsJsonObject ( "extras" ) . getAsJsonArray ( "targetNames" ) ;
for ( JsonElement target : targetNamesJson ) {
targetNames . add ( target . getAsString ( ) ) ;
}
}
//Read morph targets
JsonArray targets = meshObject . getAsJsonArray ( "targets" ) ;
JsonArray targets = meshObject . getAsJsonArray ( "targets" ) ;
if ( targets ! = null ) {
if ( targets ! = null ) {
for ( JsonElement target : targets ) {
for ( JsonElement target : targets ) {
MorphTarget morphTarget = new MorphTarget ( ) ;
MorphTarget morphTarget = new MorphTarget ( ) ;
if ( targetNames . size ( ) > 0 ) {
morphTarget . setName ( targetNames . pop ( ) ) ;
}
for ( Map . Entry < String , JsonElement > entry : target . getAsJsonObject ( ) . entrySet ( ) ) {
for ( Map . Entry < String , JsonElement > entry : target . getAsJsonObject ( ) . entrySet ( ) ) {
String bufferType = entry . getKey ( ) ;
String bufferType = entry . getKey ( ) ;
VertexBuffer . Type type = getVertexBufferType ( bufferType ) ;
VertexBuffer . Type type = getVertexBufferType ( bufferType ) ;
@ -413,6 +426,7 @@ public class GltfLoader implements AssetLoader {
}
}
}
}
//Read mesh extras
mesh = customContentManager . readExtensionAndExtras ( "primitive" , meshObject , mesh ) ;
mesh = customContentManager . readExtensionAndExtras ( "primitive" , meshObject , mesh ) ;
Geometry geom = new Geometry ( null , mesh ) ;
Geometry geom = new Geometry ( null , mesh ) ;