Skip to content

IllegalArgumentException Thrown from ColladaMeshShape.createNormals() #93

Open
@mkelly1495

Description

@mkelly1495

When working with Collada models (with lighting enabled), the ColladaMeshShape.createNormals() method throws an IllegalArgumentException intermittently. I looked at the code, and the offending line appears to be line 896:
this.normalBuffer.position(this.normalBuffer.position() + thisSize);

It looks like the position specified by this.normalBuffer.position()+thisSize is not a valid position in some cases. I think this issue can be resolved by simply introducing a check to ensure the position is valid:

if(this.normalBuffer.limit() >= this.normalBuffer.position() + thisSize)
{
this.normalBuffer.position(this.normalBuffer.position() + thisSize);
}

It may also be a good idea to provide a similar check in the ColladaMeshShape.createTexCoords() method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions