Question about vertexes ordering [nearly newbie]

Started by
1 comment, last by BlueChip 20 years, 9 months ago
Hi at all.. I''ve a simple question..... If I read the vertexes of a cube, I get this data:

-4,-4,-4
4,-4,4
-4,-4,4
4,-4,-4
-4,4,-4
4,4,4
4,4,-4
-4,4,4
-4,-4,-4
4,4,-4
4,-4,-4
-4,4,-4
4,-4,4
4,4,-4
4,-4,4
-4,4,4
-4,-4,4
4,4,4
-4,-4,4
-4,4,-4
4,-4,-4
4,4,4
-4,-4,-4
-4,4,4
How do I read these?? Each three vertexes I get a triangle? i.e (-4,-4,-4) plus (4,-4,4) plus (-4,-4,4) is the first triangle... (4,-4,-4) plus (-4,4,-4) plus (4,4,4) is the secon triangle ecc ecc? I must do a collision system versus triangle, but I am not sure that data above are that that I think. Bye...
Advertisement
quote:
How do I read these??
Each three vertexes I get a triangle?
i.e (-4,-4,-4) plus (4,-4,4) plus (-4,-4,4) is the first triangle... (4,-4,-4) plus (-4,4,-4) plus (4,4,4) is the secon triangle ecc ecc?


For a non-indexed triangle list. Yes . That''s the way the vertices in a non-indexed primitive will be layed out.

Usually the vertices represent the clockwise direction around the polygon so you can determine which way the polygon is facing from that (it''s how backface culling works).


For "indexed" primitives, you also have a list of indices, where each index tells you the location to fetch a vertex within the list of vertices. So with indexed primitives, a triangle is reprsented by 3 consecutive *indices*.

The advantage of indexed primitives is you can reuse any vertex value that gets used more than once, for example in your data, "-4,-4,-4" is used 3 times. With an indexed primitive you only need to store it once so less memory is used and less transformation & lighting work is required.


You''ll find details of these concepts in most 3D graphics textbooks and information about how it relates to D3D in the D3D documentation:

DirectX Graphics ->
Programming Guide ->
Getting Started with Direct3D ->
Devices ->
Device-Supported Primitive Types

DirectX Graphics ->
Programming Guide ->
Getting Started with Direct3D ->
Object Geometry

etc

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Thank you Simon... it''s a useful explanation =)
I''ll try to use a index.

This topic is closed to new replies.

Advertisement