| java.lang.Object com.sun.j3d.utils.geometry.GeomBuffer
GeomBuffer | class GeomBuffer extends Object (Code) | | 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.
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));
Notice, that you only need to specify some upperbound on the number of
points you'll use at the beginning (100 in this case).
Currently, you are limited to one primitive type per geom buffer. Future
versions will add support for mixed primitive types.
|
Constructor Summary | |
| GeomBuffer(int numVerts, int numTexUnit) Creates a geometry buffer of given number of vertices
Parameters: numVerts - total number of vertices to allocate by this buffer. | | GeomBuffer(int numVerts) |
Method Summary | |
void | begin(int prim) Begins a new primitive given the primitive type. | void | end() End of primitive. | GeometryArray | getComputedGeometry() Returns the Java 3D geometry gotten from calling getGeom. | GeometryArray | getGeom(int format) | int | getNumTris() | int | getNumVerts() | TexCoord2f[] | getTexCoords() | void | normal3d(double x, double y, double z) | void | outVertex(Point3f[] dpts, Vector3f[] dnormals, TexCoord2f[] dtcoords, int dloc, Point3f[] spts, Vector3f[] snormals, TexCoord2f[] stcoords, int sloc) | void | texCoord2d(double s, double t) | void | vertex3d(double x, double y, double z) |
QUADS | final static int QUADS(Code) | | |
QUAD_STRIP | final static int QUAD_STRIP(Code) | | |
TRIANGLES | final static int TRIANGLES(Code) | | |
TRIANGLE_FAN | final static int TRIANGLE_FAN(Code) | | |
TRIANGLE_STRIP | final static int TRIANGLE_STRIP(Code) | | |
currPrimCnt | int currPrimCnt(Code) | | |
currPrimTypecurrPrimStartVertexcurrPrimEndVertex | int[] currPrimTypecurrPrimStartVertexcurrPrimEndVertex(Code) | | |
currVertCnt | int currVertCnt(Code) | | |
debug | final static int debug(Code) | | |
normals | Vector3f[] normals(Code) | | |
numTexUnit | int numTexUnit(Code) | | |
tcoords | TexCoord2f[] tcoords(Code) | | |
texCoordSetMap | int texCoordSetMap(Code) | | |
GeomBuffer | GeomBuffer(int numVerts, int numTexUnit)(Code) | | Creates a geometry buffer of given number of vertices
Parameters: numVerts - total number of vertices to allocate by this buffer. This is an upper bound estimate. |
GeomBuffer | GeomBuffer(int numVerts)(Code) | | |
begin | void begin(int prim)(Code) | | Begins a new primitive given the primitive type.
Parameters: prim - the primitive type (listed above). |
end | void end()(Code) | | End of primitive.
|
getComputedGeometry | GeometryArray getComputedGeometry()(Code) | | Returns the Java 3D geometry gotten from calling getGeom.
|
getNumTris | int getNumTris()(Code) | | |
getNumVerts | int getNumVerts()(Code) | | |
getTexCoords | TexCoord2f[] getTexCoords()(Code) | | |
normal3d | void normal3d(double x, double y, double z)(Code) | | |
outVertex | void outVertex(Point3f[] dpts, Vector3f[] dnormals, TexCoord2f[] dtcoords, int dloc, Point3f[] spts, Vector3f[] snormals, TexCoord2f[] stcoords, int sloc)(Code) | | |
texCoord2d | void texCoord2d(double s, double t)(Code) | | |
vertex3d | void vertex3d(double x, double y, double z)(Code) | | |
|
|