|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--go.Go
Field Summary | |
static int |
AUTO_NORMAL
|
static int |
BACKGROUND
|
static int |
BOUND_BOX
|
static int |
COLOR
|
static int |
CONTEXT
|
static int |
CULL
|
static int |
DIRECTIONAL
|
static int |
FEEDBACK
|
static int |
FLAGS
|
static int |
FLAT_SHADE
|
static int |
IMAGE
|
static int |
LIGHT
|
static int |
LIGHT_0
|
static int |
LIGHT_1
|
static int |
LIGHT_2
|
static int |
LIGHT_3
|
static int |
LINE
|
static int |
MATRIX
|
static int |
MATRIX_MODE
|
static int |
MODELVIEW
|
static int |
NAME
|
static int |
NONE
|
static int |
NORMAL
|
static int |
POSITIONAL
|
static int |
PROJECTION
|
static int |
RENDER_MODE
|
static int |
SELECTION
|
static int |
TRIANGLE
|
Constructor Summary | |
Go()
Constructor for a new rendering context. |
|
Go(int width,
int height)
Constructor for a new rendering context. |
Method Summary | |
void |
background(double r,
double g,
double b)
Sets the image background color. |
void |
background(GoColor color)
Sets the image background color. |
GoBoundBox |
boundBox()
Returns the cumulative bounding box of rendered primitives. |
void |
clear(int flags)
Clears the image buffer, selection list, feedback list or cumulative bounding box. |
void |
color(double r,
double g,
double b)
Sets the image foreground color. |
void |
color(GoColor color)
Sets the image foreground color. |
void |
disable(int flags)
Disable features. |
void |
enable(int flags)
Enable features. |
GoFeedback |
feedback(boolean sort)
Returns the first item in the feedback list. |
void |
frustum(double left,
double right,
double bottom,
double top,
double zNear,
double zFar)
Multiply the current target matrix (see matrixMode) with a perspective matrix. |
void |
getBackground(GoColor background)
Returns the current background value (see background). |
void |
getColor(GoColor color)
Returns the current color value (see color). |
int |
getFlags()
Returns the current flags value (see enable and disable). |
boolean |
getLight(int number)
Returns the on/off state of a light (see light(int, boolean)). |
void |
getLight(int number,
GoLight light)
Returns information about a light (see light(int, GoLight)). |
void |
getMatrix(GoMatrix m)
Returns the current target matrix (see matrixMode). |
int |
getMatrixMode()
Returns the current matrix mode value (see matrixMode). |
void |
getModelview(GoMatrix m)
Returns the current modelview matrix. |
int |
getName()
Returns the current name value (see name). |
void |
getProjection(GoMatrix m)
Returns the current projection matrix. |
int |
getRenderMode()
Returns the current rendering mode value (see renderMode). |
int |
height()
Returns the height of the image rendering context. |
void |
identity()
Replace the current target matrix (see matrixMode) with the identity matrix. |
void |
inverse()
Replace the current target matrix (see matrixMode) with the matrix inverse of itself. |
void |
light(int number,
boolean enabled)
Turns a light on or off. |
void |
light(int number,
GoLight light)
Sets up the direction or position of a light. |
void |
light(int number,
int type,
double x,
double y,
double z)
Sets up the direction or position of a light. |
void |
load(GoMatrix m)
Replace the current target matrix (see matrixMode) with the specified matrix. |
void |
lookAt(double eyeX,
double eyeY,
double eyeZ,
double centerX,
double centerY,
double centerZ,
double upX,
double upY,
double upZ)
Multiply the current target matrix (see matrixMode) with a viewing matrix. |
void |
matrixMode(int mode)
Specifies which matrix is the target for any subsequent matrix operations. |
void |
multiply(GoMatrix m)
Multiply the current target matrix (see matrixMode) with the specified matrix. |
void |
name(int name)
Sets the current name value. |
void |
ortho(double left,
double right,
double bottom,
double top,
double zNear,
double zFar)
Multiply the current target matrix (see matrixMode) with an orthographic matrix. |
void |
perspective(double fovy,
double aspect,
double zNear,
double zFar)
Multiply the current target matrix (see matrixMode) with a perspective matrix. |
void |
pop(int flags)
Pop specified stacks. |
void |
push(int flags)
Push specified stacks. |
void |
render(GoVertex data)
Renders a primitive in the current rendering mode. |
void |
render(GoVertex data,
int startIndex,
int endIndex)
Renders a primitive in the current rendering mode. |
void |
renderMode(int mode)
Sets the current rendering mode. |
void |
rotate(double angle,
double x,
double y,
double z)
Multiply the current target matrix (see matrixMode) with a rotation matrix. |
void |
scale(double x,
double y,
double z)
Multiply the current target matrix (see matrixMode) with a scaling matrix. |
void |
select(double x,
double y,
double width,
double height)
Multiply the current target matrix (see matrixMode) with a selection matrix. |
GoSelection |
selection()
Returns the first item in the selection list. |
void |
size(int width,
int height)
Resize the rendering context. |
void |
translate(double x,
double y,
double z)
Multiply the current target matrix (see matrixMode) with a translation matrix. |
int |
width()
Returns the width of the image rendering context. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int NONE
public static final int IMAGE
public static final int SELECTION
public static final int FEEDBACK
public static final int BOUND_BOX
public static final int RENDER_MODE
public static final int NORMAL
public static final int AUTO_NORMAL
public static final int BACKGROUND
public static final int COLOR
public static final int NAME
public static final int LIGHT_0
public static final int LIGHT_1
public static final int LIGHT_2
public static final int LIGHT_3
public static final int LIGHT
public static final int MATRIX_MODE
public static final int MATRIX
public static final int MODELVIEW
public static final int PROJECTION
public static final int CULL
public static final int FLAT_SHADE
public static final int FLAGS
public static final int CONTEXT
public static final int LINE
public static final int TRIANGLE
public static final int POSITIONAL
public static final int DIRECTIONAL
Constructor Detail |
public Go()
Equivalent to:
Go(0, 0)
public Go(int width, int height)
Creates a rendering context with image size equal to width x height.
Method Detail |
public void size(int width, int height)
Sets the image rendering context to size width x height.
public int width()
public int height()
public void renderMode(int mode)
Possible values for mode are one of:
IMAGEPrimitives are rasterized in the image buffer. This is the default rendering mode.SELECTIONNo rasterization is done, instead a list of names (associated with each primitive rendered) is created. The start of this list can be obtained via the method selection().FEEDBACKNo rasterization is done, instead a list of lines and triangles (associated with each primitive rendered) is created. The start of this list can be obtained via the method feedback().BOUND_BOXNo rasterization is done, instead the enclosing bounding box of each primitive rendered is added to the cumulative bounding box. The cumulative bounding box can be obtained via the method boundBox().
public void render(GoVertex data)
Equivalent to:
render(data, 0, data.vertexNum - 1)
public void render(GoVertex data, int startIndex, int endIndex)
Render the vertices pointed to by data according it's primitive type. The data index range included starts at startIndex and ends at endindex.
data can be a one of the following GoVertex subclasses:
public GoSelection selection()
The selection list is generated when the rendering mode is set to SELECTION. To clear the selection list, use the method clear(SELECTION). An example of traversing the selection list is as follows:
for(GoSelection selection = Go.selection(); selection != null; selection = selection.next()) {
for(int i = 0; i < selection.stackSize(); i++) {
// process selection.name(i) } }
clear(SELECTION);
public GoFeedback feedback(boolean sort)
The feedback list is generated when the rendering mode is set to FEEDBACK. If sort is equal to true, then the feedback will be depth sorted, else it will leave it in the order that the primitives were rendered. To clear the feedback list, use the method clear(FEEDBACK). An example of traversing the feedback list is as follows:
for(GoFeedback feedback = Go.feedback(true); feedback != null; feedback = feedback.next()) {
// process feedback }
clear(FEEDBACK);
public GoBoundBox boundBox()
The cumulative bounding box is generated when the rendering mode is set to BOUND_BOX. This is done by first transforming primitives to object coordinates (i.e. vertices of each primitive are multiplied with the current value of the modelview matrix) and then, if necessary, replacing the minimum and maximum cumulative bounding box values in order to include all rendered primitives. To clear the cumulative bounding box, use the method clear(BOUND_BOX).
public void clear(int flags)
The bits set in flags determine what is to be cleared.
Possible values for flags are any or'ed combination of:
IMAGEClears the image buffer.SELECTIONClears the selection list.FEEDBACKClears the feedback list.BOUND_BOXClears the cumulative bounding box.
public void enable(int flags)
The bits set in flags determine what features are to be enabled.
Possible values for flags are any or'ed combination of:
CULLEnables back facing triangles to be culled (i.e. not rendered). A back facing triangle is a triangle who's projected vertices are defined in a clockwise manner. A front facing triangle is a triangle who's projected vertices are defined in a counterclockwise manner. By default this is disabled.FLAT_SHADEEnables shading of lines and triangles to consist of a solid color. By default this is disabled.
public void disable(int flags)
The bits set in flags determine what features are to be disabled.
Possible values for flags are any or'ed combination of:
CULLDisables back facing triangles to be culled. By default this is disabled.FLAT_SHADEDisables shading of lines and triangles to consist of a solid color. By default this is disabled.
public void light(int number, boolean enabled)
The light of interest is specified with number. If enabled is equal to true the light is on, else it is off. All lights are by default off.
Possible values for number are one of:
LIGHT_0Light number 0.LIGHT_1Light number 1.LIGHT_2Light number 2.LIGHT_3Light number 3.
public void light(int number, GoLight light)
Equivalent to:
light(number, light.type, light.x, light.y, light.z)
public void light(int number, int type, double x, double y, double z)
Lights are defined in object coordinates, hence, upon calling this method, the x, y and z are multiplied with the current value of the modelview matrix.
The light of interest is specified with number.
Possible values for number are one of:
LIGHT_0Light number 0.LIGHT_1Light number 1.LIGHT_2Light number 2.LIGHT_3Light number 3.
The light will be treated as either a directional or positional light, which is specified with type.
Possible values for type are one of:
DIRECTIONALSets up the specified light as a directional light. A directional light treats x, y and z as the lights direction in object coordinates. The light shines opposite to it's direction. By default all lights are directional with an (x, y, z) value of (0, 0, 1), which defines a light positioned at an infinite distance along the positive z-axis and pointed towards the negative z-axis.POSITIONALSets up the specified light as a positional light. A positional light treats x, y and z as the lights position in object coordinates.
public void background(GoColor color)
Equivalent to:
background(color.r, color.g, color.b)
public void background(double r, double g, double b)
The image background RGB color value is set to (r, g, b). The background color is used to clear the image buffer when the method clear(IMAGE) is called.
The default background color is set to gray (0.5, 0.5, 0.5).
public void color(GoColor color)
Equivalent to:
color(color.r, color.g, color.b)
public void color(double r, double g, double b)
The image foreground RGB color value is set to (r, g, b). The foreground color is used in conjunction with a call to the method:
If data contains no color information, then the foreground color is used while rendering data.render(data)
The default foreground color is set to white (1.0, 1.0, 1.0).
public void name(int name)
The current name value is set to name. This method is usually used in conjunction with selection and feedback rendering modes.
The default name value is set to 0.
public void matrixMode(int mode)
The target is either the modelview matrix or projection matrix.
Possible values for mode are one of:
MODELVIEWTarget matrix will be set to the modelview matrix. This is the default matrix.PROJECTIONTarget matrix will be set to the projection matrix.
public void load(GoMatrix m)
The current target matrix is replaced with:
/ \ | m[0] m[4] m[8] m[12] | | m[1] m[5] m[9] m[13] | | m[2] m[6] m[10] m[14] | | m[3] m[7] m[11] m[15] | \ /
public void multiply(GoMatrix m)
If c is the current target matrix, then c will will be replaces with:
/ \ / \ | c[0] c[4] c[8] c[12] | | m[0] m[4] m[8] m[12] | | c[1] c[5] c[9] c[13] | X | m[1] m[5] m[9] m[13] | | c[2] c[6] c[10] c[14] | | m[2] m[6] m[10] m[14] | | c[3] c[7] c[11] c[15] | | m[3] m[7] m[11] m[15] | \ / \ /
public void identity()
The current target matrix is replaced with:
/ \ | 1 0 0 0 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 0 1 | \ /
public void inverse()
public void translate(double x, double y, double z)
The translation matrix will be set up internally based on the arguments:
x - units translated along x-axis
y - units translated along y-axis
z - units translated along z-axis
public void scale(double x, double y, double z)
The scaling matrix will be set up internally based on the arguments:
x - scale factor for x-axis
y - scale factor for y-axis
z - scale factor for z-axis
public void rotate(double angle, double x, double y, double z)
The rotation matrix will be set up internally based on the arguments:
angle - degrees to rotate
(x, y, z) - vector to rotate about
public void ortho(double left, double right, double bottom, double top, double zNear, double zFar)
The orthographic matrix will be set up internally based on the arguments:
left, right - x coordinates specifying left and right vertical clipping planes
bottom, top - y coordinates specifying bottom and top horizontal clipping planes
zNear, zFar - z coordinates specifying the near and far perpendicular clipping planes
public void frustum(double left, double right, double bottom, double top, double zNear, double zFar)
The perspective matrix will be set up internally based on the arguments:
left, right - x coordinates specifying left and right vertical clipping planes
bottom, top - y coordinates specifying bottom and top horizontal clipping planes
zNear, zFar - z coordinates specifying the near and far perpendicular clipping planes
public void lookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ)
The viewing matrix will be set up internally based on the arguments:
eyeX, eyeY, eyeZ - position of eye
centerX, centerY, centerZ - center of scene
upX, upY, upZ - up vector
public void perspective(double fovy, double aspect, double zNear, double zFar)
The perspective matrix will be set up internally based on the arguments:
fovy - field of view angle, in degrees, in the y direction
aspect - aspect ratio that determines the field of view in the x direction
zNear, zFar - z coordinates specifying the near and far perpendicular clipping planes
public void select(double x, double y, double width, double height)
The selection matrix will be set up internally based on the arguments:
x, y - center of selection in image coordinates
width, height - width and height of selection in image coordinates
public void push(int flags)
The stacks that are to be pushed are indicated by the bit fields in the flags argument.
Possible values for flags are any or'ed combination of:
RENDER_MODEPush the current render mode value (see renderMode) onto the render mode stack.FLAGSPush the current flags value (see enable and disable) onto the flags stack.LIGHT_0Push the current state of light number 0 (see light(int, boolean) and light(int, int, double, double, double)) onto the light number 0 stack.LIGHT_1Push the current state of light number 1 (see light(int, boolean) and light(int, int, double, double, double)) onto the light number 1 stack.LIGHT_2Push the current state of light number 2 (see light(int, boolean) and light(int, int, double, double, double)) onto the light number 2 stack.LIGHT_3Push the current state of light number 3 (see light(int, boolean) and light(int, int, double, double, double)) onto the light number 3 stack.LIGHTEquivalent to:BACKGROUNDLIGHT_0 | LIGHT_1 | LIGHT_2 | LIGHT_3Push the current background value (see background) onto the background stack.COLORPush the current color value (see color) onto the color stack.NAMEPush the current name value (see name) onto the name stack.MATRIX_MODEPush the current matrix mode value (see matrixMode) onto the matrix mode stack.MATRIXPush the current target matrix onto the target matrix stack (see matrixMode).MODELVIEWPush the current modelview matrix onto the modelview matrix stack.PROJECTIONPush the current projection matrix onto the projection matrix stack.CONTEXTEquivalent to:RENDER_MODE | FLAGS | LIGHT | BACKGROUND | COLOR | NAME | MATRIX_MODE | MODELVIEW | PROJECTION
public void pop(int flags)
The stacks that are to be popped are indicated by the bit fields in the flags argument.
Possible values for flags are any or'ed combination of:
RENDER_MODEPop the render mode stack and set the current render mode value (see renderMode) equal to the popped off value.FLAGSPop the flags stack and set the current flags value (see enable and disable) equal to the popped off value.LIGHT_0Pop the light number 0 stack and set the current state of light number 0 (see light(int, boolean) and light(int, int, double, double, double)) equal to the popped off value.LIGHT_1Pop the light number 1 stack and set the current state of light number 1 (see light(int, boolean) and light(int, int, double, double, double)) equal to the popped off value.LIGHT_2Pop the light number 2 stack and set the current state of light number 2 (see light(int, boolean) and light(int, int, double, double, double)) equal to the popped off value.LIGHT_3Pop the light number 3 stack and set the current state of light number 3 (see light(int, boolean) and light(int, int, double, double, double)) equal to the popped off value.LIGHTEquivalent to:BACKGROUNDLIGHT_0 | LIGHT_1 | LIGHT_2 | LIGHT_3Pop the background stack and set the current background value (see background) equal to the popped off value.COLORPop the color stack and set the current color value (see color) equal to the popped off value.NAMEPop the name stack and set the current name value (see name) equal to the popped off value.MATRIX_MODEPop the matrix mode stack and set the current matrix mode value (see matrixMode) equal to the popped off value.MATRIXPop the current matrix stack and set the current target matrix equal to the popped off matrix (see matrixMode).MODELVIEWPop the modelview matrix stack and set the current modelview matrix equal to the popped off matrix.PROJECTIONPop the projection matrix stack and set the current projection matrix equal to the popped off matrix.CONTEXTEquivalent to:RENDER_MODE | FLAGS | LIGHT | BACKGROUND | COLOR | NAME | MATRIX_MODE | MODELVIEW | PROJECTION
public int getRenderMode()
public int getFlags()
public boolean getLight(int number)
The value of number indicates the light of interest. Possible values for number are the same as for light(int, boolean).
public void getLight(int number, GoLight light)
The value of number indicates the light of interest. Possible values for number are the same as for light(int, GoLight).
The argument light is filled in with the light type and direction/position information (see GoLight).
public void getBackground(GoColor background)
public void getColor(GoColor color)
public int getName()
public int getMatrixMode()
public void getMatrix(GoMatrix m)
public void getModelview(GoMatrix m)
public void getProjection(GoMatrix m)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |