www.jpct.net
jPCT - a 3d engine for Java => Support => Topic started by: stormp 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:
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:
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.
-
Can someone explain? :)
The docs for addTriangle already do so:
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.
-
Doh! I cant believe i didn't notice that. thx.