simogl.geometry
Class AbstractMesh

java.lang.Object
  extended by simogl.geometry.AbstractMesh
Direct Known Subclasses:
MeshDL, MeshVA

public abstract class AbstractMesh
extends java.lang.Object


Constructor Summary
AbstractMesh()
          Creates a new mesh object
 
Method Summary
 void addFace(Face face)
          Adds a face (two triangle) to the mesh.
abstract  void deleteMesh(javax.media.opengl.GL gl)
          Deletes the mesh
 void disableRenderOptions(javax.media.opengl.GL gl)
          This method must be called after the OpenGL rendering operation took place.
abstract  void draw(javax.media.opengl.GL gl)
          Call this method to draw the mesh
 void drawShadow(javax.media.opengl.GL gl)
          Call this method to draw the shadow of a mesh
 void enableRenderOptions(javax.media.opengl.GL gl)
          This method actives the render options for a mesh.
 BoundingBox getBoundingBox()
          Returns the bounding box of the mesh
 java.util.ArrayList<Face> getFaces()
          Returns the faces of the mesh
 Material getMaterial()
          Returns the current material of the mesh
 Point3D getPosition()
          Returns the current Position of the mesh
 float getPositionX()
          Returns the x-coordinate of the mesh's position
 float getPositionY()
          Returns the y-coordinate of the mesh's position
 float getPositionZ()
          Returns the z-coordinate of the mesh's position
 float getRoationX()
          Returns the degree of rotation around the x-axxis of the mesh
 float getRoationY()
          Returns the degree of rotation around the y-axxis of the mesh
 float getRoationZ()
          Returns the degree of rotation around the z-axxis of the mesh
 Point3D getRotation()
          Returns the degrees of roation of this mesh as an instance of Point3D.
 com.sun.opengl.util.texture.Texture getTexture()
          Returns the current texture of this mesh
 boolean isTransparent()
          Determines whether the mesh is transparent or solid
 void performTransformations(javax.media.opengl.GL gl)
          This method performs all translations, rotations and scalings for the mesh.
 void rotate(float degX, float degY, float degZ)
          Rotates the mesh around its x-,y- and z-axxis.
 void rotateAxxisX(float degrees)
          Rotates the mesh around its x-axxis
 void rotateAxxisY(float degrees)
          Rotates the mesh around its y-axxis
 void rotateAxxisZ(float degrees)
          Rotates the mesh around its z-axxis
 void scale(float x, float y, float z)
          Scales the mesh to the specified x-, y-, z-values along its axxises
Note: Do not provide a paramter which is equal to 0!
 void setDrawShadow(boolean useShadow, Light light0)
          Sets whether the shadow of the mesh ought to be drawn.
 void setEnabledFaceCulling(boolean enable)
          Specifies if face culling shall applied to the mesh.
 void setMaterial(Material material)
          Sets the material of the mesh to the specified material
 void setPosition(float x, float y, float z)
          Sets the position of the mesh by the three given parameters
 void setPosition(Point3D position)
          Sets the position of the mesh with a Point3D object
 void setPositionX(float x)
          Sets the x-coordinate of this mesh's position
 void setPositionY(float y)
          Sets the y-coordinate of this mesh's position
 void setPositionZ(float z)
          Sets the z-coordinate of this mesh's position
 void setTexture(com.sun.opengl.util.texture.Texture texture)
          Specifies the texture that shall be used for this mesh
 void setTransparent(boolean transparency)
          Sets whether the mesh shall be transparent or not transparent.
 void showBoundingBox(boolean show)
          Determines wheter the bounding box shall be visually shown by a box that is drawn around the mesh
 void showWireFrame(boolean wireFrameSwitch)
          Determines whether the mesh shall be rendered as a wireframe model
abstract  void specializedDraw(javax.media.opengl.GL gl)
          This method contains only the drawing operation fitting to the special kind of mesh.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMesh

public AbstractMesh()
Creates a new mesh object

Method Detail

addFace

public void addFace(Face face)
Adds a face (two triangle) to the mesh.

Parameters:
face - face that shall be used as a face of the mesh

getFaces

public java.util.ArrayList<Face> getFaces()
Returns the faces of the mesh

Returns:
faces of the mesh

getBoundingBox

public BoundingBox getBoundingBox()
Returns the bounding box of the mesh

Returns:
bounding box of the mesh

showBoundingBox

public void showBoundingBox(boolean show)
Determines wheter the bounding box shall be visually shown by a box that is drawn around the mesh

Parameters:
show - shoe bounding box? --> yes = true, no = false

setMaterial

public void setMaterial(Material material)
Sets the material of the mesh to the specified material

Parameters:
material - material for the mesh

getMaterial

public Material getMaterial()
Returns the current material of the mesh

Returns:
material of the mesh

setPosition

public void setPosition(Point3D position)
Sets the position of the mesh with a Point3D object

Parameters:
position - a Point3D object specifying a 3D position

setPosition

public void setPosition(float x,
                        float y,
                        float z)
Sets the position of the mesh by the three given parameters

Parameters:
x - x-coordinate
y - y-coordinate
z - z-coordinate

setPositionX

public void setPositionX(float x)
Sets the x-coordinate of this mesh's position

Parameters:
x - x-coordinate

setPositionY

public void setPositionY(float y)
Sets the y-coordinate of this mesh's position

Parameters:
y - y-coordinate

setPositionZ

public void setPositionZ(float z)
Sets the z-coordinate of this mesh's position

Parameters:
z - z-coordinate

getPosition

public Point3D getPosition()
Returns the current Position of the mesh

Returns:
current position

getPositionX

public float getPositionX()
Returns the x-coordinate of the mesh's position

Returns:
x-coordinate

getPositionY

public float getPositionY()
Returns the y-coordinate of the mesh's position

Returns:
y-coordinate

getPositionZ

public float getPositionZ()
Returns the z-coordinate of the mesh's position

Returns:
z-coordinate

setTexture

public void setTexture(com.sun.opengl.util.texture.Texture texture)
Specifies the texture that shall be used for this mesh

Parameters:
texture - The texture that shall be used for this mesh

getTexture

public com.sun.opengl.util.texture.Texture getTexture()
Returns the current texture of this mesh

Returns:
current texture

rotate

public void rotate(float degX,
                   float degY,
                   float degZ)
Rotates the mesh around its x-,y- and z-axxis.

Parameters:
degX - degrees of rotation of x-axxis
degY - degrees of rotation of y-axxis
degZ - degrees of rotation of z-axxis

rotateAxxisX

public void rotateAxxisX(float degrees)
Rotates the mesh around its x-axxis

Parameters:
degrees - Specifies the amount of degrees the mesh shall be rotated

rotateAxxisY

public void rotateAxxisY(float degrees)
Rotates the mesh around its y-axxis

Parameters:
degrees - Specifies the amount of degrees the mesh shall be rotated

rotateAxxisZ

public void rotateAxxisZ(float degrees)
Rotates the mesh around its z-axxis

Parameters:
degrees - Specifies the amount of degrees the mesh shall be rotated

getRotation

public Point3D getRotation()
Returns the degrees of roation of this mesh as an instance of Point3D. The instance's method getX() returns the degree of rotation around the x-axxis, getY() return the roations around the y-axxis and thus getZ() returns the rotation around the z-axxis.

Returns:
Point3D instance containig the rotational degrees of the three axxises

getRoationX

public float getRoationX()
Returns the degree of rotation around the x-axxis of the mesh

Returns:
rotation around x-axxis

getRoationY

public float getRoationY()
Returns the degree of rotation around the y-axxis of the mesh

Returns:
rotation around y-axxis

getRoationZ

public float getRoationZ()
Returns the degree of rotation around the z-axxis of the mesh

Returns:
rotation around z-axxis

scale

public void scale(float x,
                  float y,
                  float z)
Scales the mesh to the specified x-, y-, z-values along its axxises
Note: Do not provide a paramter which is equal to 0!

Parameters:
x - scale factor along the x-axxis
y - scale factor along the y-axxis
z - scale factor along the z-axxis

setEnabledFaceCulling

public void setEnabledFaceCulling(boolean enable)
Specifies if face culling shall applied to the mesh.

Parameters:
enable - enable face culling? --> true = yes, false = no

setTransparent

public void setTransparent(boolean transparency)
Sets whether the mesh shall be transparent or not transparent. Attention: In order to archieve a correct blending result, the material's alpha value has to be lesser that 1.0f

Parameters:
transparency - transparent? --> true = yes, false = no

isTransparent

public boolean isTransparent()
Determines whether the mesh is transparent or solid

Returns:
is transparent? --> true = yes, false = no

setDrawShadow

public void setDrawShadow(boolean useShadow,
                          Light light0)
Sets whether the shadow of the mesh ought to be drawn. You have to pass over the GL.GL_LIGHT0 object of the scene, in order to be able to draw the shadow according to the lights position.

Parameters:
useShadow - draw shadow? --> true = yes, false = no
light0 - the GL.LIGHT_0 object of the scene

showWireFrame

public void showWireFrame(boolean wireFrameSwitch)
Determines whether the mesh shall be rendered as a wireframe model

Parameters:
wireFrameSwitch - true = wireframe on, false = wireframe off

enableRenderOptions

public void enableRenderOptions(javax.media.opengl.GL gl)
This method actives the render options for a mesh. By calling this method in the mesh's draw()-method before the actuall OpenGL rendering operation, things like material properties, transparency or the texture would be applied to the mesh, if activated.
Note: You neccessarily have to call the disableRenderOptions()- method after the OpenGL render operation took place for the mesh. Otherwise weird behaviour could be the consequence.

Parameters:
gl -

disableRenderOptions

public void disableRenderOptions(javax.media.opengl.GL gl)
This method must be called after the OpenGL rendering operation took place. It disables the activated rendering options.

Parameters:
gl -

performTransformations

public void performTransformations(javax.media.opengl.GL gl)
This method performs all translations, rotations and scalings for the mesh. It should be usually called within a glPush/glPopMatrix() block.

Parameters:
gl -

draw

public abstract void draw(javax.media.opengl.GL gl)
Call this method to draw the mesh

Parameters:
gl -

specializedDraw

public abstract void specializedDraw(javax.media.opengl.GL gl)
This method contains only the drawing operation fitting to the special kind of mesh. It is useful for drawing shadows, too.

Parameters:
gl -

drawShadow

public void drawShadow(javax.media.opengl.GL gl)
Call this method to draw the shadow of a mesh

Parameters:
gl -

deleteMesh

public abstract void deleteMesh(javax.media.opengl.GL gl)
Deletes the mesh

Parameters:
gl -