Closed BitsAtPlayDev closed 1 year ago
We have this issue on some models. Therefore we're also investigating on that as it's a show stopper in many cases.
@dar-dev of ClassX did a great fix: https://github.com/mgsx-dev/gdx-gltf/pull/98 At last we're able to load any edg-case model flawlessly.
The property
count
andvalues.length
can have different values leading toArrayIndexOutOfBoundsException
because when looping throughvalues
,count
is often used instead ofvalues.length
The difference can occur when creating a new instance of
WeightVector
, and onlynbWeights
is specified, causingmax
to default to 8. This leads tocount
getting set to whatevernbWeights
is, whilevalues.length
== 8Places where only
nbWeights
is specified:AnimationLoader
,MeshLoader
&CubicWeightVector
classes.Places where
count
is used to loop throughvalues
:WeightVector
>LFTypes
classesThe exception below occurred when attempting to load a model where an
nbWeights
> 8 was encountered.Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 8 out of bounds for length 8 at net.mgsx.gltf.loaders.shared.GLTFTypes.map(GLTFTypes.java:105) at net.mgsx.gltf.loaders.shared.animation.AnimationLoader.load(AnimationLoader.java:164) at net.mgsx.gltf.loaders.shared.animation.AnimationLoader.load(AnimationLoader.java:37) at net.mgsx.gltf.loaders.shared.GLTFLoaderBase.load(GLTFLoaderBase.java:129) at net.mgsx.gltf.loaders.glb.GLBLoader.load(GLBLoader.java:16) at net.mgsx.gltf.loaders.glb.GLBAssetLoader.loadSync(GLBAssetLoader.java:32) at net.mgsx.gltf.loaders.glb.GLBAssetLoader.loadSync(GLBAssetLoader.java:14) [...]