Well like I said in an earlier posting, it is rather disadvantageous to use
the indexed sets. This is because it is NOT sent to the card this way, but
rather unravelled. This means that your memory is being more than doubled
from your index size and there is time spent to "unravel" the index into
non-indexed.
But that aside there are two things I found out. The first one is that you
cannot stop J3d from always applying the entire array starting at the
specified index. This means that they are NOT considering vertex count when
you call the set routines. So if your array is 100, but you have a vertex
count to 50, you will get an error. The index parameter to the SET routines
indeciates the "starting" index to start assigning the coordinates. So if
you have 100 index verticies, and you do a set a setCoordinates(50,norms)
then you are starting at index 50.
The next thing is that for texture coordinates the Set number is used for
multi-texturing, so if you have one texture then zero is thr right value.
And for specifying the normals, texcoords, colors and vertices via the
indexes. make sure that for every vertex in your index, you have
corresponding maps from your index to your actual data. So the easiest case
is when you have your data laid out so that the normals, colors, texcoords
and coordinates for all "real" vertices all match perfectly. So for vertex
"1" the first set of normals, colors, texcoords and coordinates all map to
that vertex. Then the same index mapping can be used for all the
setXXXXIndices. This might not be the best strategy, like for example if
every vertex has the same color, then obviously all you need is one entry of
3 (or 4) floats to define that color, and all the other vertices can
reference that. But like I said, why bother.... they will just turn that 4
floats into 4000 (for 1000 vertices) floats before they send it to the card.
I have a module that stores the data in indexed form then either returns an
IndexGeometryArray or an unwound GeometryArray. I can send it to you this
evening if you want to use it as a reference.
Dave Yazel
> ----------
> From: Liming CHEN[SMTP:[EMAIL PROTECTED]]
> Reply To: Discussion list for Java 3D API
> Sent: Tuesday, December 19, 2000 12:36 PM
> To: [EMAIL PROTECTED]
> Subject: [JAVA3D] use of IndexTriangleArray class
>
> Does any one know IN DETAILS how to use the IndexTriangleArray (or say
> IndesGeometryArray) class?
>
> Simply spcifying a geometry with coordinates and coordinates index is
> easy.
> What make me confused is how to specify the Normal, normal index, texture
> coordinates and coordinate index.
>
> For example, if I have a geometry with 20 veritces, 32 vertex indices and
> 50
> normals and 50 texture coordinates and the corresponding arrays of
> coordinates
> and indices.
>
> that is:
>
> int versCount = 20, IndicesCount = 32, normalCount = 50, TextureCount =
> 50;
> float coord[20], texCoord[3*50], normal[2*50];
> int normalInd[3*32], texCoordInd[3*32], coordInd[3*32];
>
> I construct a shape3D with the following geometry class
>
> IndexedTriangleArray partTriangles = new IndexedTriangleArray(vertsCount,
> GeometryArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2 |
> GeometryArray.NORMALS, indicesCount);
>
> partTriangles.setCoordinates(0, coord);
> partTriangles.setCoordinateIndices(0, coordInd);
>
> When I begin to set the normals for the geometry, I am not sure what the
> first
> variable index in setNormals(index, norms) means. Should it be 32 (the
> vertex
> indices) or 50 (the normal count)?
>
> The same problem also apply to the specification of texture coordinates.
> That
> is, in the method setTextureCoordinates(texCoordSet, index, texCoord)
> what the
>
> index variable means? Furthermore, in Java3D1.2 there ia another variable
> texCoordSet, what it is? In my case should it be 50 or anything else?
>
> Thanks in advance
>
> Liming
>
> ==========================================================================
> =
> 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".
>
===========================================================================
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".