|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.j3d.utils.geometry.GeomBuffer
class GeomBuffer
GeomBuffer allows OpenGL-like input of geometry data. It outputs Java 3D geometry array objects. This utility is to simplify porting of OpenGL programs to Java 3D.
Here is a sample code that use this utility to create some quads.
Notice, that you only need to specify some upperbound on the number of points you'll use at the beginning (100 in this case).GeomBuffer gbuf = new GeomBuffer(100); gbuf.begin(GeomBuffer.QUADS); for (int i = 0; i < 5; i++){ gbuf.normal3d(0.0, 1.0, 0.0); gbuf.vertex3d(1.0, 1.0, 0.0); gbuf.normal3d(0.0, 1.0, 0.0); gbuf.vertex3d(0.0, 1.0, 0.0); gbuf.normal3d(0.0, 1.0, 0.0); gbuf.vertex3d(0.0, 0.0, 0.0); gbuf.normal3d(0.0, 1.0, 0.0); gbuf.vertex3d(1.0, 0.0, 0.0); } gbuf.end(); Shape3D shape = new Shape3D(gbuf.getGeom(GeomBuffer.GENERATE_NORMALS));
Currently, you are limited to one primitive type per geom buffer. Future versions will add support for mixed primitive types.
Field Summary | |
---|---|
(package private) int |
currPrimCnt
|
(package private) int[] |
currPrimEndVertex
|
(package private) int[] |
currPrimStartVertex
|
(package private) int[] |
currPrimType
|
(package private) int |
currVertCnt
|
(package private) static int |
debug
|
private int |
flags
|
(package private) GeometryArray |
geometry
|
(package private) Vector3f[] |
normals
|
(package private) int |
numTexUnit
|
(package private) int |
numTris
|
(package private) int |
numVerts
|
(package private) Point3f[] |
pts
|
(package private) static int |
QUAD_STRIP
|
(package private) static int |
QUADS
|
(package private) TexCoord2f[] |
tcoords
|
(package private) int[] |
texCoordSetMap
|
(package private) static int |
TRIANGLE_FAN
|
(package private) static int |
TRIANGLE_STRIP
|
(package private) static int |
TRIANGLES
|
Constructor Summary | |
---|---|
GeomBuffer(int numVerts)
|
|
GeomBuffer(int numVerts,
int numTexUnit)
Creates a geometry buffer of given number of vertices |
Method Summary | |
---|---|
(package private) void |
begin(int prim)
Begins a new primitive given the primitive type. |
(package private) void |
end()
End of primitive. |
(package private) GeometryArray |
getComputedGeometry()
Returns the Java 3D geometry gotten from calling getGeom. |
(package private) GeometryArray |
getGeom(int format)
|
(package private) int |
getNumTris()
|
(package private) int |
getNumVerts()
|
(package private) TexCoord2f[] |
getTexCoords()
|
(package private) void |
normal3d(double x,
double y,
double z)
|
(package private) void |
outVertex(Point3f[] dpts,
Vector3f[] dnormals,
TexCoord2f[] dtcoords,
int dloc,
Point3f[] spts,
Vector3f[] snormals,
TexCoord2f[] stcoords,
int sloc)
|
private GeometryArray |
processQuads()
|
private GeometryArray |
processQuadStrips()
|
private GeometryArray |
processTriangleFan()
|
private GeometryArray |
processTriangles()
|
(package private) void |
texCoord2d(double s,
double t)
|
(package private) void |
vertex3d(double x,
double y,
double z)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final int QUAD_STRIP
static final int TRIANGLES
static final int QUADS
static final int TRIANGLE_FAN
static final int TRIANGLE_STRIP
private int flags
Point3f[] pts
Vector3f[] normals
TexCoord2f[] tcoords
int currVertCnt
int currPrimCnt
int[] currPrimType
int[] currPrimStartVertex
int[] currPrimEndVertex
GeometryArray geometry
int numVerts
int numTris
int numTexUnit
int[] texCoordSetMap
static final int debug
Constructor Detail |
---|
GeomBuffer(int numVerts, int numTexUnit)
numVerts
- total number of vertices to allocate by this buffer.
This is an upper bound estimate.GeomBuffer(int numVerts)
Method Detail |
---|
GeometryArray getGeom(int format)
void begin(int prim)
prim
- the primitive type (listed above).void end()
void vertex3d(double x, double y, double z)
void normal3d(double x, double y, double z)
void texCoord2d(double s, double t)
TexCoord2f[] getTexCoords()
GeometryArray getComputedGeometry()
int getNumTris()
int getNumVerts()
private GeometryArray processQuadStrips()
private GeometryArray processQuads()
private GeometryArray processTriangles()
private GeometryArray processTriangleFan()
void outVertex(Point3f[] dpts, Vector3f[] dnormals, TexCoord2f[] dtcoords, int dloc, Point3f[] spts, Vector3f[] snormals, TexCoord2f[] stcoords, int sloc)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |