This would be a simplified (although not useful) example of the data:
Primary_vertex[0] = { 1.0, 1.0, 1.0 };
Secondary_vertex[0] = 0; // Index into primary_vertex list
Secondary_vertex[1] = 0; // Index into primary_vertex list
TexCoord[0] = { 0.0, 0.0 }; // Texture coord for Secondary_vertex[0]
TexCoord[1] = { 1.0, 1.0 }; // Texture coord for Secondary_vertex[1]
If I understand your suggestion, then the draw elements list would just
be {0, 0}, in which case the geometry would work, but it would also
apply TexCoord[0] to both vertices, which is not what was intended.
- Ken
> -----Original Message-----
> From: [email protected] [mailto:osg-users-
> [email protected]] On Behalf Of Vincent Bourdier
> Sent: Thursday, January 15, 2009 5:14 AM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] Vertex list indexing into another vertex
list?
>
> Hi,
>
> Maybe just use setVertexArray with the primary vertex list, and you
use
> the second list in a osg::DrawElementsUInt (or similar).
> In the DrawElementsUInt, you push your vertices indexes. So when the
> vertices data are modified, if they keep the same position in the list
> the geometry will update. (do not forget setUserData(DYNAMIC) )
>
> There is a setVertexIndice() method but it is now deprecated... maybe
> something can replace it.
>
> Same thing for the texture (if I understand well)
>
> Hope this help.
>
> PS : have a look on documentation
>
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs
> /a01369.html#4596d0e18fb5217a1306c324a2eaba72
>
> Regards,
> Vincent.
>
>
>
> 2009/1/14 Sewell, Kenneth R Civ USAF AFMC AFRL/RYZW
> <[email protected]>
>
>
> Is it possible to specify a vertex list by indexing into a
> different
> vertex list? Sorry if that's confusing, I'll try to explain a
> bit more.
>
> I've got some data that is organized in the following way:
>
> - A primary vertex list that is the regular xyz values you'd
> expect.
>
> - A secondary vertex list that is composed by indexing into the
> primary
> vertex list.
>
> - A texture coordinate list that has a value for each 'vertex'
in
> the
> secondary list.
>
> - Lastly, a list of indices into the secondary vertex list to
> define
> some primitives.
>
> It looks like the data was set up this way so a vertex that
> exists in
> multiple primitives can have a unique texture coordinate per
> primitive,
> yet still only be transformed once.
>
> My initial approach was just to construct the secondary list by
> replacing the index with a copy of the vertex it was
referencing.
> This
> works except for one thing, the primary vertex list is not
> static. By
> that, I mean the values of the vertices themselves, the list
size
> itself
> will not change. So, the only approach I see is to basically
> reconstruct the secondary vertex list every time the primary is
> updated.
> This could be kind of rough, since I could potentially have many
> secondary lists. From what I've seen looking through OSG
headers
> and
> mailing list postings it doesn't seem possible to do this
'vertex
> list
> by indexing another', but I thought I'd ask just in case.
> Thanks.
>
> - Ken.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-
> openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org