|
Jazz3D API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sygem.jazz3d3.Object3d | +--com.sygem.jazz3d3.primitive.Freeform3d
Allows you to create any object you can think of. It uses a simple approach - you add the points which make up the object, then add the faces which connect those points.
For example:
Freeform3d obj = new Freeform3d(0,0,8);
// Now we can add points - 8 points for a cube...
obj.addPoint(-0.5,-0.5,-0.5);
obj.addPoint(0.5,-0.5,-0.5);
obj.addPoint(0.5,0.5,-0.5);
obj.addPoint(-0.5,0.5,-0.5);
obj.addPoint(-0.5,-0.5,0.5);
obj.addPoint(0.5,-0.5,0.5);
obj.addPoint(0.5,0.5,0.5);
obj.addPoint(-0.5,0.5,0.5);
// And 6 faces in a cube...
obj.addFace(0,1,2,3,255,255,255,false);
obj.addFace(4,5,6,7,255,255,255,false);
obj.addFace(2,6,5,1,255,255,255,false);
obj.addFace(7,3,0,4,255,255,255,false);
obj.addFace(0,1,5,4,255,255,255,false);
obj.addFace(7,6,2,3,255,255,255,false);
// And finally, we need to call prep()...
obj.prep();
Object3d
Constructor Summary | |
Freeform3d(double x,
double y,
double z)
Default constructor. |
Method Summary | |
void |
addFace(int p1,
int p2,
int p3,
int r,
int g,
int b,
boolean doublesided)
Adds a trianglular face to the object. |
void |
addFace(int p1,
int p2,
int p3,
int p4,
int r,
int g,
int b,
boolean doublesided)
Adds a quadrilateral face to the object. |
void |
addPoint(double x,
double y,
double z)
Add a point to the object. |
void |
addPoint(double x,
double y,
double z,
double u,
double v)
Add a point to the object. |
void |
prep()
Finalizes the object creation process. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Freeform3d(double x, double y, double z)
x
- The x position of the center of the objecty
- The y position of the center of the objectz
- The z position of the center of the objectMethod Detail |
public final void addPoint(double x, double y, double z)
x
- The x position of the pointy
- The y position of the pointz
- The z position of the pointpublic final void addPoint(double x, double y, double z, double u, double v)
x
- The x position of the pointy
- The y position of the pointz
- The z position of the pointu
- The U coordinate of the pointv
- The V coordinate of the pointpublic final void addFace(int p1, int p2, int p3, int r, int g, int b, boolean doublesided)
p1
- The first point of the triangle.p2
- The second point of the triangle.p3
- The third point of the triangle.r
- The red value of the colour. Ranges from 0 to 255.g
- The green value of the colour. Ranges from 0 to 255.b
- The blue value of the colour. Ranges from 0 to 255.doublesided
- True if the face should be double-sided, false if notpublic final void addFace(int p1, int p2, int p3, int p4, int r, int g, int b, boolean doublesided)
p1
- The first point of the quad.p2
- The second point of the quad.p3
- The third point of the quad.p4
- The fourth point of the quad.r
- The red value of the colour. Ranges from 0 to 255.g
- The green value of the colour. Ranges from 0 to 255.b
- The blue value of the colour. Ranges from 0 to 255.doublesided
- True if the face should be double-sided, false if notpublic final void prep()
NOTE: If this is not called, the object will not render correctly...
|
©2001 SyGem Software |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |