Author Topic: building custom plane: is there an addTriangle() order?  (Read 3458 times)

Offline stormp

  • byte
  • *
  • Posts: 38
    • View Profile
building custom plane: is there an addTriangle() order?
« on: June 14, 2007, 11:24:20 am »
Hi,

I was experimenting with building a custom plane.  Is there any order which the addTriangle() or the vectors must be added?

This works:
Code: [Select]
objSurface.addTriangle(new SimpleVector(-8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));

objSurface.addTriangle(new SimpleVector( 8.0f, -8.0f, 0.0f),
                       new SimpleVector(-8.0f, -8.0f, 0.0f),
                       new SimpleVector(-8.0f,  8.0f, 0.0f));

Where as this doesn't work:

Code: [Select]
       
objSurface.addTriangle(new SimpleVector(-8.0f, 8.0f, 0.0f),
                       new SimpleVector( 8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));

objSurface.addTriangle(new SimpleVector(-8.0f,  8.0f, 0.0f),
                       new SimpleVector(-8.0f, -8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));


Can someone explain? :)

Thanks.
« Last Edit: June 14, 2007, 11:27:17 am by stormp »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: building custom plane: is there an addTriangle() order?
« Reply #1 on: June 14, 2007, 12:25:26 pm »
Can someone explain? :)
The docs for addTriangle already do so:

Quote
The vertices have to be defined counter-clockwise because jPCT backface culls them by default.

Your second code works...it's just that the object will be visible from the other side.

Offline stormp

  • byte
  • *
  • Posts: 38
    • View Profile
Re: building custom plane: is there an addTriangle() order?
« Reply #2 on: June 14, 2007, 12:39:29 pm »
Doh! I cant believe i didn't notice that.  thx.