Author Topic: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh  (Read 9571 times)

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
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)
..

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #1 on: January 31, 2010, 04:01:31 pm »
When does this happen? Do you have a test case?

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #2 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #3 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?

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #4 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..

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #5 on: February 01, 2010, 05:14:31 pm »
Try this 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.

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #6 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);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #7 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #8 on: February 02, 2010, 05:13:33 pm »
I've updated the jar. Please give it a try.

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: ArrayIndexOutOfBoundsException at GenericVertexController.updateMesh
« Reply #9 on: February 02, 2010, 05:36:30 pm »
it seems ok now, thanks ;D