Archived

This topic is now archived and is closed to further replies.

tuxx

Triangle List Cube

Recommended Posts

Hey. this sounds kind of newbish, but I'm trying to convert my triangle strip cube to a triangle list cube. This is the code I came up with:
    
//  X      Y      Z     NX    NY    NZ    TU    TV

// Top Face

{ -5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, // Back   left   - 01

{ -5.0f,  5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Front  left   - 02

{  5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Back   right  - 03

{ -5.0f,  5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Front  left   - 04

{  5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Back   right  - 05

{  5.0f,  5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, }, // Front  right  - 06


// Back Face

{ -5.0f, -5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, // Bottom left   - 07

{ -5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Top    left   - 08

{  5.0f, -5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Bottom right  - 09

{ -5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Top    left   - 10

{  5.0f, -5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Bottom right  - 11

{  5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, }, // Top    right  - 12


// Left face

{ -5.0f, -5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, // Back   bottom - 13

{ -5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Back   top    - 14

{ -5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Front  bottom - 15

{ -5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Back   top    - 16

{ -5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Front  bottom - 17

{ -5.0f,  5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, }, // Front  top    - 18


// Right face

{  5.0f, -5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, // Back   bottom - 19

{  5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Back   top    - 20

{  5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Front  bottom - 21

{  5.0f,  5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Back   top    - 22

{  5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Front  bottom - 23

{  5.0f,  5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, }, // Front  top    - 24


// Front Face

{ -5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, // Bottom left   - 25

{ -5.0f,  5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Top    left	 - 26

{  5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Bottom right  - 27

{ -5.0f,  5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Top    left	 - 28

{  5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Bottom right  - 29

{  5.0f,  5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, }, // Top    right  - 30


// Bottom Face

{  5.0f, -5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, // Back  right   - 31

{  5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Front right   - 32

{ -5.0f, -5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Back  left    - 33

{  5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, // Front right   - 34

{ -5.0f, -5.0f, -5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, }, // Back  left    - 35

{ -5.0f, -5.0f,  5.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, }, // Front left    - 36

  
The first three numbers are X, Y, and Z coordinates. The next three are normal coordinates. The last two are U and V texels. If anyone could give me the correct coordinates for a triangle list cube, please respond. Thank you! edit: Fixed code formatting. [edited by - tuxx on June 8, 2002 5:55:46 PM]

Share this post


Link to post
Share on other sites