David Yazel wrote:
> Hi all.  I have a couple of questions regarding indexed geometry.
>
> 1. There seesm to be no way to define the indices and by-ref. Is that
> correct?
 > So the only way to set the indices is either to pass in an array
> using setCoordinateIndices(int index, int[]) or to set each one at a time
> with setCoordinateIndices(int index, int)
>
Yes, this is currently not support and above procedure is the only
way to set coordinate indices.

> 2. SetValidVertexCount() is disabled for for indexed geometry.  The problem
> is that my by-ref arrays are larger than the valid amount of information.  I
> have always relied on this function to dynamically adjust the number of
> valid items in the arrays.  Should I assume that all the coordinate, color,
> normal and texcoord information will be sent to the card in indexed mode?
> So if you have enough room in your arrays for 300 vertices of information,
> but only have 50 relevent vertices ti would still send 300 vertices of
> information?

setValidVertexCount is for non-index geometry.

You can use validIndexCount & initialIndexIndex for index geometry
which only pass the index range (i.e. 50) as specify down to the
graphics but the whole vertex array (i.e. 300) if flag
USE_COORD_INDEX_ONLY is set.

If flag USE_COORD_INDEX_ONLY is not set, Java3D will
unindexify() the geometry and create another one
without index. Thus in your case only 50 vertices will
pass down. However the process of unindexify may be
slower if it is done every frame.

Besides, there is a bug 4720938
- IndexedGeometry shouldn't consider vertex not reference by index in
computeBound

which will go through all the 300 vertices (instead of the
index length is 50) to compute bounding box every frame
if autoBoundCompute is not disable. So for by ref geomery it is
better to set your own user bound.

>
> 3. Basically my problem is that we have a variable number of valid vertices
> stored in a larger set of by-ref arrays.  In addition the number of indexed
> vertices is also variable, so in one frame I might have 300 indexed vertices
> mapping to 50 unique coordinates and then in the next frame I might have 100
> indexed vertices mappiong to 60 unique coordinates.  The only think I can
> think of is to use the setInitialCoordinateIndex.. But to do that I would
> need to store all my indexes backward so that the ones I want are at the end
> of the array.
>
> Also.. the documentation is a but confusing because the word "index" is used
> in two compeltely different contexts...If I am reading it right,
> setInitialCoordinateIndex has nothing to do with indexed geometry, but
> rather is a way of constraining which range of coordinates are to be used.
>
> So it seems that the only solution to problems 1 and 2 is to use the
> setInitialXXX functions to contrain the arrays.  This is sort of nasty
> because I have to fill in the arrays in chunks of 3 or 4 backwards.
>

setInitialCoordinateIndex() is use for non-index geometry only.
Using it for index geometry will throws UnsupportedOperationException.

If you only modify indices but not vertices, using the DirectX version
may be faster. Since the whole vertice is put in VertexBuffer
which the driver usually put this in graphics card memory if
it fit. In this case Java3D DirectX version will only modify
the indexBuffer every frame and invoke draw routine. OpenGL version
send both vertices and index down.

- Kelvin
----------------
Java 3D Team
Sun Microsystems Inc.

===========================================================================
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