|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.geom.GeometryGenerator org.j3d.geom.BoxGenerator
public class BoxGenerator
Generator of box coordinates, normals and texture coordinates.
The width of the box is the X axis. The height of the box is along the Y axis and the depth of the box is along the Z axis. The box is always centered about the origin such that the effective coordinates are 1/2 the values provided here.
For the strip and fan arrays, we always use one fan/strip per face. While it is possible to reduce it to one big strip array and then two small ones for top and bottom. the effect is lighting normals that point out at angles from each corner, which is not realistic. So for this generator, there is no real difference between using indexed and unindexed forms as they use the same number of coordinates.
2D texture coordinates follow the classic OpenGL style. 0,0 is in the bottom left corner of each face and 1, 1 is on the top right. For the top, the texture appears the right way up looking down the -Y axis, with the -Z axis as up. For the bottom face, looking along the Y axis, with the +Z axis as up it is the right way up.
3D Texture coordinates look just like the cube. 0, 0, 0 is at the lower left corner of the front face, while 1, 1, 1 is at the top right, rear corner.
Constructor Summary | |
---|---|
BoxGenerator()
Construct a box with the default size of 2, 2, 2. |
|
BoxGenerator(float width,
float height,
float depth)
Construct a box with the given dimensions. |
Method Summary | |
---|---|
void |
generate(GeometryData data)
Generate a new set of geometry items based on the passed data. |
float[] |
getDimensions()
Get the dimensions of the box. |
int |
getVertexCount(GeometryData data)
Get the number of vertices that this generator will create for the shape given in the definition. |
void |
setDimensions(float width,
float height,
float depth)
Set the dimensions of the output box to the new values. |
Methods inherited from class org.j3d.geom.GeometryGenerator |
---|
createFaceNormal, createFaceNormal, createRadialNormal, createRadialNormal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BoxGenerator()
public BoxGenerator(float width, float height, float depth)
width
- The width of the box in unitsheight
- The height of the box in unitsdepth
- The depth of the box in unitsMethod Detail |
---|
public float[] getDimensions()
public void setDimensions(float width, float height, float depth)
width
- The width of the box in unitsheight
- The height of the box in unitsdepth
- The depth of the box in unitspublic int getVertexCount(GeometryData data) throws UnsupportedTypeException
getVertexCount
in class GeometryGenerator
data
- The data to base the calculations on
UnsupportedTypeException
- The generator cannot handle the type
of geometry you have requested.public void generate(GeometryData data) throws UnsupportedTypeException, InvalidArraySizeException
generate
in class GeometryGenerator
data
- The data to base the calculations on
InvalidArraySizeException
- The array is not big enough to contain
the requested geometry
UnsupportedTypeException
- The generator cannot handle the type
of geometry you have requested
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |