www.jpct.net

jPCT - a 3d engine for Java => Bugs => Topic started by: raft on January 31, 2010, 04:47:48 am

Title: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: raft on January 31, 2010, 04:47:48 am
any idea why this happens ?

Code: [Select]
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8
at com.threed.jpct.GenericVertexController.updateMesh(Unknown Source)
at com.threed.jpct.Mesh.applyVertexController(Unknown Source)
..
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: EgonOlsen on January 31, 2010, 04:01:31 pm
When does this happen? Do you have a test case?
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: raft on January 31, 2010, 08:48:36 pm
found it i guess. it happens when an empty Object3D is created with new constructor:

Code: [Select]
Object3D object = new Object3D(new float[0], new float[0], new int[0], TextureManager.TEXTURE_NOTFOUND);
object.build();

object.getMesh().setVertexController(..);
object.getMesh().applyVertexController();

an empty object created with old constructor throws same exception with different index (1)

Code: [Select]
Object3D object = new Object3D(0);

hope this helps,
r a f t
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: EgonOlsen on February 01, 2010, 07:56:36 am
I'll look into it. But what's the point of using an IVertexController on an empty object anyway?
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: raft on February 01, 2010, 12:23:49 pm
But what's the point of using an IVertexController on an empty object anyway?
no point, the collada exporter just exported so..
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: EgonOlsen on February 01, 2010, 05:14:31 pm
Try this jar: http://www.jpct.net/download/beta/jpct.jar (http://www.jpct.net/download/beta/jpct.jar). The problem was, that the controller implementation didn't require that there is a bounding box but it assumed that at least the space for it is reserved, which isn't true to "empty" objects like these. I hope this is fixed now. This release also fixes the rotate?()-methods.
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: raft on February 01, 2010, 10:23:47 pm
empty objects created with new constructor still throws same exception ;)
Code: [Select]
new Object3D(new float[0], new float[0], new int[0], TextureManager.TEXTURE_NOTFOUND);
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: EgonOlsen on February 02, 2010, 12:03:54 am
Argh...my test case didn't call build(), which obviously makes a difference. I'll fix this tomorrow.
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: EgonOlsen on February 02, 2010, 05:13:33 pm
I've updated the jar. Please give it a try.
Title: Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
Post by: raft on February 02, 2010, 05:36:30 pm
it seems ok now, thanks ;D