Chien,

you're right: normal.length is shorter than coords.length, 
but for the test case with ArrayIndexOutOfBoundsException:

1. I use GeometryInfo.class --> I dont' use setNormalsRefFloat..
2. it makes no sense, that normals length can't be shorter than coords.length 
for INDEXED-Geometry right ? GeometryInfo.getIndexedGeometry..


the demo also includes test cases without GeomteryInfo,
then the case you mention cames valid. to get rid of this, I set the 
vertexCount to min(coords.length, normals.length, tcoords.length) 
-- > USE_GEOM_INFO == false && USE_BY_REF == true, runs fine..


finally you missed to look at the second error case:
USE_GEOM_INFO == false && USE_BY_REF == false, where tcoords appear to be 
wrong..


hope you have time to take another look..

regards
-Michael Nischt





>       You're getting an ArrayIndexOutOfBoundsException is because
> normal.length is shorter than the coords.length. I didn't spend time
> on the logic of your code, but quick check at the length of coords and
> normals shows that there aren't the same. May this be a problem ?
> You might want to check out the doc. on GeometryArray class :
>
>
> public void setNormalRefFloat(float[] normals)
>
>  **** deleted *****
>
>      Parameters:
>          normals - an array of 3*n values to which a reference will be set.
>      Throws:
>          CapabilityNotSetException - if the appropriate capability is not
> set and this object is part of a live or compiled scene graph
> java.lang.IllegalStateException - if the data mode for this geometry array
> object is not BY_REFERENCE, is USE_NIO_BUFFER, or is INTERLEAVED.
>          java.lang.IllegalArgumentException - if the specified array is
>          non-null and any other normal reference is also non-null.
>          java.lang.ArrayIndexOutOfBoundsException - if normals.length
>          < 3 * (initialNormalIndex + validVertexCount).
>      Since:
>          Java 3D 1.2
>
>
>
> java.lang.ArrayIndexOutOfBoundsException: GeometryArray: normal array
> length is incorrect
>       at
> javax.media.j3d.GeometryArrayRetained.setNormalRefFloat(GeometryArrayRetain
>ed.ja va:8695)
>       at
> javax.media.j3d.GeometryArray.setNormalRefFloat(GeometryArray.java:5092)
>
> - Chien Yang
>   Java 3D Team.

==========================================================================To 
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to