de.rico.engine.geometry
Class AbstractMesh

java.lang.Object
  extended by de.rico.engine.geometry.AbstractMesh
Direct Known Subclasses:
MeshDL, MeshVA

public abstract class AbstractMesh
extends java.lang.Object

Abstract class that represents a mesh

Author:
Frank Bruns

Constructor Summary
AbstractMesh(boolean smooth)
          Creates a new mesh object, optionally smooth shaded.
AbstractMesh(boolean smooth, BoundingVolume type)
          Creates a new mesh object, optionally smooth shaded.
 
Method Summary
 void addShader(ShaderIface shader)
          Deprecated. does not really work correctly in general ;-)
abstract  void destroy()
          Destroys the mesh.
abstract  void draw(javax.media.opengl.GL gl)
          Call this method to draw the mesh.
 void drawShaders(javax.media.opengl.GL gl)
          Deprecated. does not really work correctly in general ;-)
 BoundingVolumeIface getBoundingVolume()
          Returns the bounding volume of the mesh, if it's set.
abstract  java.util.List<Triangle> getFaces()
          Returns the faces of the mesh relative to the (0f,0f,0f) origin, i.e. the position, rotation or scale factor of the mesh is not taken into account for the faces.
abstract  java.util.List<Triangle> getFacesTransformed()
          Returns the face with coordinates that are correctly transformed (translation, rotation, scale factor) according to the current transformation state of the mesh.
 float getHeightOffset()
          Returns the height offset of the mesh that it would have over the ground mesh.
 Material getMaterial()
          Returns the current material of the mesh
 Point3D getMouseOverMesh(int screenX, int screenY)
          Convenience method to get the 3D position of the mouse, if the mouse is currently located over the mesh (resp. its bounding volume).
 java.lang.String getName()
          Returns the name of the mesh.
 Point3D getPosition()
          Returns the current Position of the mesh as a copy.
 float getPosX()
          Returns the x-coordinate of the mesh's position
 float getPosY()
          Returns the y-coordinate of the mesh's position
 float getPosZ()
          Returns the z-coordinate of the mesh's position
 Point3D getRotation()
          Returns the degrees of roation of this mesh as an instance of Point3D.
 float getRotX()
          Returns the degree of rotation around the x-axis of the mesh
 float getRotY()
          Returns the degree of rotation around the y-axis of the mesh
 float getRotZ()
          Returns the degree of rotation around the z-axis of the mesh
 float getScaleX()
          Returns the scale factor for the x-axis
 float getScaleY()
          Returns the scale factor for the y-axis
 float getScaleZ()
          Returns the scale factor for the z-axis
 java.lang.String getTex0Path()
          Returns the file path to the image that is used for texture unit 0.
 java.lang.String getTex1Path()
          Returns the file path to the image that is used for texture unit 1.
 float getText0XMovement()
          Returns the texture movement of tex unit 0 in x direction.
 float getText0YMovement()
          Returns the texture movement of tex unit 0 in y direction.
 float getText1XMovement()
          Returns the texture movement of tex unit 1 in x direction.
 float getText1YMovement()
          Returns the texture movement of tex unit 1 in y direction.
 com.sun.opengl.util.texture.Texture getTexUnit0()
          Returns the current base texture of this mesh at texture unit 0
 com.sun.opengl.util.texture.Texture getTexUnit1()
          Returns the current texture of this mesh at texture unit 1
 boolean isCollidable()
          Determines whether or not this mesh is meant to be collidable.
 boolean isDrawingEnabled()
          Determines whether or not the mesh is needed to be drawn.
 boolean isEnabledOcclusionCulling()
          Determines whether or not occlusion culling is enabled for this mesh.
 boolean isMouseOverMesh(int screenX, int screenY)
          Convenience method to check if the mouse is currently located over the mesh (resp. its bounding volume).
 boolean isOccluded()
          Determines whether or not this mesh is occluded by another one.
 boolean isPickable()
          Determines whethter or not the mesh is pickable by a picking method (OpenGL internal picking or ray picking).
 boolean isShadowEnabled()
          Determines whether the shadow of this mesh ought to be drawn.
 boolean isSmoothShaded()
          Determines whether the mesh is beeing smoothly shaded.
 boolean isTex0Flipped()
          Determines whether or not the texture at texture unit 0 was flipped initially.
 boolean isTex0MipMapped()
          Determines whether or not the texture at texture unit 0 was mip mapped initially.
 boolean isTex0Rotated()
          Determines whether or not the texture at texture unit 0 was rotated initially.
 boolean isTex1Flipped()
          Determines whether or not the texture at texture unit 1 was flipped initially.
 boolean isTex1MipMapped()
          Determines whether or not the texture at texture unit 1 was mip mapped initially.
 boolean isTex1Rotated()
          Determines whether or not the texture at texture unit 1 was rotated initially.
 void moveBackwardsGlobal(float delta, long elapsedTime)
          Moves the mesh to backward direction based on the global initial OpenGL coordinate system alignment.
 void moveBackwardsLocal(float delta, long elapsedTime)
          Moves the mesh to backward direction based on its current rotation.
 void moveDownGlobal(float delta, long elapsedTime)
          Moves the mesh to down based on the global initial OpenGL coordinate system alignment.
 void moveForwardGlobal(float delta, long elapsedTime)
          Moves the mesh to forward direction based on the global initial OpenGL coordinate system alignment
 void moveForwardLocal(float delta, long elapsedTime)
          Moves the mesh to forward direction based on its current rotation.
 void moveLeftGlobal(float delta, long elapsedTime)
          Moves the mesh to the left based on the global initial OpenGL coordinate system alignment.
 void moveLeftLocal(float delta, long elapsedTime)
          Moves the mesh to the left based on its current rotation.
 void moveRightGlobal(float delta, long elapsedTime)
          Moves the mesh to the right based on the global initial OpenGL coordinate system alignment.
 void moveRightLocal(float delta, long elapsedTime)
          Moves the mesh to the right based on its current rotation.
 void moveTo(float x, float z, float speedMove, float speedRot, long elapsedTime)
          Moves the mesh towards the specified coordinates
 void moveUpGlobal(float delta, long elapsedTime)
          Moves the mesh to up based on the global initial OpenGL coordinate system alignment.
 void performTransformations(javax.media.opengl.GL gl)
          This method performs all translations, rotations and scalings for the mesh.
 void rotateDown(float delta, long elapsedTime)
          Rotates the mesh down.
 void rotateLeft(float delta, long elapsedTime)
          Rotates the mesh to the left.
 void rotateRight(float delta, long elapsedTime)
          Rotates the mesh to the right.
 void rotateUp(float delta, long elapsedTime)
          Rotates the mesh up.
 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 setAttachedGround(AbstractGroundMesh ground)
          Attaches the mesh to the ground.
 void setBlendDestFactor(BlendDestFactor destFact)
          Sets the destination factor for the OpenGL blending function
 void setBlendFunction(BlendSourceFactor srcFact, BlendDestFactor destFact)
          Sets the source and destination factors for the OpenGL blending function.
 void setBlendSourceFactor(BlendSourceFactor srcFact)
          Sets the source factor for the OpenGL blending function
 void setCollidable(boolean collidable)
          Sets a flag to signal whether or not this mesh is meant to be collidable.
 void setDrawingEnabled(boolean draw)
          Sets whether or not the mesh should be drawn.
 void setEnabledOcclusionCulling(boolean enable)
          Sets the occluision culling mechanism enabled or disabled for this mesh.
 void setEnvironmentMap(EnvironmentMappingIface envirMap)
          Adds an environment map to the mesh.
 void setMaterial(Material material)
          Sets the material of the mesh to the specified material.
 void setName(java.lang.String name)
          Sets the (optional) name of this mesh.
 void setPickable(boolean pick)
          Sets whethter or not the mesh is pickable
 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 setPosX(float x)
          Sets the x-coordinate of this mesh's position
 void setPosY(float y)
          Sets the y-coordinate of this mesh's position
 void setPosZ(float z)
          Sets the z-coordinate of this mesh's position
 void setRotation(float degX, float degY, float degZ)
          Sets the rotation of the mesh around its x-,y- and z-axis.
 void setRotation(Point3D rot)
          Sets the rotation of the mesh according to the values of the specified rotation vector.
 void setRotX(float degrees)
          Sets the rotation of the mesh around its x-axis
 void setRotY(float degrees)
          Sets the rotation of the mesh around its y-axis
 void setRotZ(float degrees)
          Sets the rotation of the mesh around its z-axis
 void setScaleX(float x)
          Set the scale factor for the x-axis of the mesh.
 void setScaleY(float y)
          Set the scale factor for the y-axis of the mesh.
 void setScaleZ(float z)
          Set the scale factor for the z-axis of the mesh.
 void setShadowEnabled(boolean enable)
          Sets whether the shadow of this mesh ought to be drawn
 void setShowBoundingVolume(boolean show)
          Determines wheter the bounding volume shall be visually shown.
 void setTex0Movement(float moveX, float moveY)
          Set texture movement on texture unit 0 in x and y direction.
 void setTex0TexEnvirMode(TexEnvirMode mode, float[] color)
          Sets the texture environment mode and the texture environment color for texture unit 0.
 void setTex0XMovement(float dis)
          Set texture movement on texture unit 0 in x direction
 void setTex0YMovement(float dis)
          Set texture movement on texture unit 0 in y direction
 void setTex1Movement(float moveX, float moveY)
          Set texture movement on texture unit 0 in x and y direction.
 void setTex1TexEnvirMode(TexEnvirMode mode, float[] color)
          Sets the texture environment mode and the texture environment color for texture unit 1.
 void setTex1XMovement(float dis)
          Set texture movement on texture unit 0 in x direction
 void setTex1YMovement(float dis)
          Set texture movement on texture unit 0 in y direction
 void setTexUnit0(java.lang.String path, boolean mipmap)
          Specifies the base texture that shall be used for this mesh at texture unit 0.
 void setTexUnit0(java.lang.String path, boolean mipmap, boolean rotate, boolean flip)
          Specifies the base texture that shall be used for this mesh at texture unit 0.
 void setTexUnit1(java.lang.String path, boolean mipmap)
          Specifies the texture that shall be used for this mesh at texture unit 1.
 void setTexUnit1(java.lang.String path, boolean mipmap, boolean rotate, boolean flip)
          Specifies the texture that shall be used for this mesh at texture unit 1.
 void setTransparency(float alpha)
          Sets the transparency of the mesh by setting the meshes' ambient and diffuse material alpha to the specified value
 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.
 void translateX(float amount)
          Translates the x coordinate by the specified amount.
 void translateY(float amount)
          Translates the y coordinate by the specified amount.
 void translateZ(float amount)
          Translates the z coordinate by the specified amount.
 void update(long elapsedTime)
          Updates the mesh.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMesh

public AbstractMesh(boolean smooth)
Creates a new mesh object, optionally smooth shaded. A word of advice: If you decide to enable smooth shading the creation of the mesh will take more time than without smooth shading, because smooth normals need to be calculated beforehand, which is pretty time consuming depending on the amount of triangles in the mesh.

Parameters:
smooth - shade mesh smoothly? --> true=yes, false=no

AbstractMesh

public AbstractMesh(boolean smooth,
                    BoundingVolume type)
Creates a new mesh object, optionally smooth shaded. You can specifiy the type of the used bounding volume, too.
A word of advice: If you decide to enable smooth shading the creation of the mesh will take more time than without smooth shading, because smooth normals need to be calculated beforehand, which is pretty time consuming depending on the amount of triangles in the mesh.

Parameters:
smooth - shade mesh smoothly? --> true=yes, false=no
type - value from the BoundingVolume enumeration
Method Detail

isDrawingEnabled

public boolean isDrawingEnabled()
Determines whether or not the mesh is needed to be drawn.

Returns:
drawing of mesh enabled? --> true=yes, false=no

setDrawingEnabled

public void setDrawingEnabled(boolean draw)
Sets whether or not the mesh should be drawn.

Parameters:
draw - draw mesh? --> true=yes, false=no

isOccluded

public boolean isOccluded()
Determines whether or not this mesh is occluded by another one.

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

setEnabledOcclusionCulling

public void setEnabledOcclusionCulling(boolean enable)
Sets the occluision culling mechanism enabled or disabled for this mesh.

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

isEnabledOcclusionCulling

public boolean isEnabledOcclusionCulling()
Determines whether or not occlusion culling is enabled for this mesh.

Returns:
is occlusion culling enabled? --> true=yes, false=no

setName

public void setName(java.lang.String name)
Sets the (optional) name of this mesh. The name should be unique, because the mesh can be identified by its name in the mesh container. If the name is not unique it can't be guaranteed to be correctly identified.

Parameters:
name - name for the mesh (recommended to be unique)

getName

public java.lang.String getName()
Returns the name of the mesh. If no name was set an empty string will be returned.

Returns:
name of the mesh

getFaces

public abstract java.util.List<Triangle> getFaces()
Returns the faces of the mesh relative to the (0f,0f,0f) origin, i.e. the position, rotation or scale factor of the mesh is not taken into account for the faces.

Returns:
faces of the mesh relative to (0f,0f,0f) origin

getFacesTransformed

public abstract java.util.List<Triangle> getFacesTransformed()
Returns the face with coordinates that are correctly transformed (translation, rotation, scale factor) according to the current transformation state of the mesh.

Returns:
correctly transformed faces of the mesh

addShader

@Deprecated
public void addShader(ShaderIface shader)
Deprecated. does not really work correctly in general ;-)

Adds a shader for application on the mesh. Every added shader results in a further rendering pass of the mesh.

Parameters:
shader - shader to be applied on the mesh

setShowBoundingVolume

public void setShowBoundingVolume(boolean show)
Determines wheter the bounding volume shall be visually shown.

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

setEnvironmentMap

public void setEnvironmentMap(EnvironmentMappingIface envirMap)
Adds an environment map to the mesh. This effect will use texture unit one.

Parameters:
envirMap - environment map to apply to the mesh

setMaterial

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

Note: If you just would like to adress certain colors of the meshes material and change them, please get the current material by the getMaterial() method and then use its specified methods to complete that task.

Parameters:
material - material for the mesh

getMaterial

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

Returns:
material of the mesh

setTransparency

public void setTransparency(float alpha)
Sets the transparency of the mesh by setting the meshes' ambient and diffuse material alpha to the specified value

Parameters:
alpha - alpha value (1f = opaque. < 1f = transparent)

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

setPosX

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

Parameters:
x - x-coordinate

translateX

public void translateX(float amount)
Translates the x coordinate by the specified amount.

Parameters:
amount - amount to translate the x-coordinate by

setPosY

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

Parameters:
y - y-coordinate

translateY

public void translateY(float amount)
Translates the y coordinate by the specified amount.

Parameters:
amount - amount to translate the y-coordinate by

setPosZ

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

Parameters:
z - z-coordinate

translateZ

public void translateZ(float amount)
Translates the z coordinate by the specified amount.

Parameters:
amount - amount to translate the z-coordinate by

getHeightOffset

public float getHeightOffset()
Returns the height offset of the mesh that it would have over the ground mesh.

Returns:
height offset over the ground mesh

getPosition

public Point3D getPosition()
Returns the current Position of the mesh as a copy.

Returns:
current position

getPosX

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

Returns:
x-coordinate

getPosY

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

Returns:
y-coordinate

getPosZ

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

Returns:
z-coordinate

setBlendFunction

public void setBlendFunction(BlendSourceFactor srcFact,
                             BlendDestFactor destFact)
Sets the source and destination factors for the OpenGL blending function.

Parameters:
srcFact - source factor for blending function
destFact - destination factor for blending functions

setBlendSourceFactor

public void setBlendSourceFactor(BlendSourceFactor srcFact)
Sets the source factor for the OpenGL blending function

Parameters:
srcFact - source factor for blending function

setBlendDestFactor

public void setBlendDestFactor(BlendDestFactor destFact)
Sets the destination factor for the OpenGL blending function

Parameters:
destFact - destination factor for blending function

setTexUnit0

public void setTexUnit0(java.lang.String path,
                        boolean mipmap)
Specifies the base texture that shall be used for this mesh at texture unit 0. The texture gets rotated and flipped automatically, because it is usually neccessary to do so.

Parameters:
path - Path to the texture that shall be used for this mesh
mipmap - mipmap the texture? --> true=yes, false=no

setTexUnit0

public void setTexUnit0(java.lang.String path,
                        boolean mipmap,
                        boolean rotate,
                        boolean flip)
Specifies the base texture that shall be used for this mesh at texture unit 0.

Parameters:
path - Path to the texture that shall be used for this mesh
mipmap - mipmap the texture? --> true=yes, false=no
rotate - rotate texture? --> true=yes, false=no
flip - flip texture? --> true=yes, false=no

getTexUnit0

public com.sun.opengl.util.texture.Texture getTexUnit0()
Returns the current base texture of this mesh at texture unit 0

Returns:
current texture at unit 0

getTex0Path

public java.lang.String getTex0Path()
Returns the file path to the image that is used for texture unit 0. This is important for the editor, for example.

Returns:
path to texture unit 0 image file

isTex0MipMapped

public boolean isTex0MipMapped()
Determines whether or not the texture at texture unit 0 was mip mapped initially.

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

isTex0Rotated

public boolean isTex0Rotated()
Determines whether or not the texture at texture unit 0 was rotated initially.

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

isTex0Flipped

public boolean isTex0Flipped()
Determines whether or not the texture at texture unit 0 was flipped initially.

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

setTex0TexEnvirMode

public void setTex0TexEnvirMode(TexEnvirMode mode,
                                float[] color)
Sets the texture environment mode and the texture environment color for texture unit 0.

Note: The specified environment color is not effective for the modes Decal and Modulate

Parameters:
mode - texture environment mode for texture unit 0
color - new texture environment color

setTex0XMovement

public void setTex0XMovement(float dis)
Set texture movement on texture unit 0 in x direction

Parameters:
dis - movement in x direction (values like 0.1f are good starting points)

getText0XMovement

public float getText0XMovement()
Returns the texture movement of tex unit 0 in x direction.

Returns:
texture movement in x direction on tex unit 0

setTex0YMovement

public void setTex0YMovement(float dis)
Set texture movement on texture unit 0 in y direction

Parameters:
dis - movement in z direction (values like 0.1f are good starting points)

getText0YMovement

public float getText0YMovement()
Returns the texture movement of tex unit 0 in y direction.

Returns:
texture movement in y direction on tex unit 0

setTex0Movement

public void setTex0Movement(float moveX,
                            float moveY)
Set texture movement on texture unit 0 in x and y direction. Values like 0.1f are good starting points

Parameters:
moveX - movement in x direction
moveY - movemnt in y direction

setTexUnit1

public void setTexUnit1(java.lang.String path,
                        boolean mipmap)
Specifies the texture that shall be used for this mesh at texture unit 1. The texture gets rotated and flipped automatically, because it is usually neccessary to do so.

Parameters:
path - Path to the texture that shall be used for this mesh
mipmap - mipmap the texture? --> true=yes, false=no

setTexUnit1

public void setTexUnit1(java.lang.String path,
                        boolean mipmap,
                        boolean rotate,
                        boolean flip)
Specifies the texture that shall be used for this mesh at texture unit 1.

Parameters:
path - Path to the texture that shall be used for this mesh
mipmap - mipmap the texture? --> true=yes, false=no
rotate - rotate texture? --> true=yes, false=no
flip - flip texture? --> true=yes, false=no

getTexUnit1

public com.sun.opengl.util.texture.Texture getTexUnit1()
Returns the current texture of this mesh at texture unit 1

Returns:
current texture at unit 1

getTex1Path

public java.lang.String getTex1Path()
Returns the file path to the image that is used for texture unit 1. This is important for the editor, for example.

Returns:
path to texture unit 1 image file

isTex1MipMapped

public boolean isTex1MipMapped()
Determines whether or not the texture at texture unit 1 was mip mapped initially.

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

isTex1Rotated

public boolean isTex1Rotated()
Determines whether or not the texture at texture unit 1 was rotated initially.

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

isTex1Flipped

public boolean isTex1Flipped()
Determines whether or not the texture at texture unit 1 was flipped initially.

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

setTex1TexEnvirMode

public void setTex1TexEnvirMode(TexEnvirMode mode,
                                float[] color)
Sets the texture environment mode and the texture environment color for texture unit 1.

Note: The specified environment color is not effective for the modes Decal and Modulate

Parameters:
mode - texture environment mode for texture unit 1
color - new texture environment color

setTex1XMovement

public void setTex1XMovement(float dis)
Set texture movement on texture unit 0 in x direction

Parameters:
dis - movement in x direction (values like 0.1f are good starting points)

getText1XMovement

public float getText1XMovement()
Returns the texture movement of tex unit 1 in x direction.

Returns:
texture movement in x direction on tex unit 1

setTex1YMovement

public void setTex1YMovement(float dis)
Set texture movement on texture unit 0 in y direction

Parameters:
dis - movement in z direction (values like 0.1f are good starting points)

getText1YMovement

public float getText1YMovement()
Returns the texture movement of tex unit 1 in y direction.

Returns:
texture movement in y direction on tex unit 1

setTex1Movement

public void setTex1Movement(float moveX,
                            float moveY)
Set texture movement on texture unit 0 in x and y direction. Values like 0.1f are good starting points

Parameters:
moveX - movement in x direction
moveY - movemnt in y direction

setShadowEnabled

public void setShadowEnabled(boolean enable)
Sets whether the shadow of this mesh ought to be drawn

Parameters:
enable - draw shadow? --> true=yes, false=no

isShadowEnabled

public boolean isShadowEnabled()
Determines whether the shadow of this mesh ought to be drawn.

Returns:
draw shadow? --> true=yes, false=no

getBoundingVolume

public BoundingVolumeIface getBoundingVolume()
Returns the bounding volume of the mesh, if it's set. Otherwise it returns null

Returns:
bounding volume of the mesh, otherwise null

setRotation

public void setRotation(Point3D rot)
Sets the rotation of the mesh according to the values of the specified rotation vector.

Parameters:
rot - rotation vector

setRotation

public void setRotation(float degX,
                        float degY,
                        float degZ)
Sets the rotation of the mesh around its x-,y- and z-axis.

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

setRotX

public void setRotX(float degrees)
Sets the rotation of the mesh around its x-axis

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

setRotY

public void setRotY(float degrees)
Sets the rotation of the mesh around its y-axis

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

setRotZ

public void setRotZ(float degrees)
Sets the rotation of the mesh around its z-axis

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-axis, getY() return the roations around the y-axis and thus getZ() returns the rotation around the z-axis.

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

getRotX

public float getRotX()
Returns the degree of rotation around the x-axis of the mesh

Returns:
rotation around x-axxis

getRotY

public float getRotY()
Returns the degree of rotation around the y-axis of the mesh

Returns:
rotation around y-axxis

getRotZ

public float getRotZ()
Returns the degree of rotation around the z-axis 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-axis
y - scale factor along the y-axis
z - scale factor along the z-axis

setScaleX

public void setScaleX(float x)
Set the scale factor for the x-axis of the mesh.
Note: 0 won't have any effect

Parameters:
x - scale factor along the x-axis

setScaleY

public void setScaleY(float y)
Set the scale factor for the y-axis of the mesh.
Note: 0 won't have any effect

Parameters:
y - scale factor along the y-axis

setScaleZ

public void setScaleZ(float z)
Set the scale factor for the z-axis of the mesh.
Note: 0 won't have any effect

Parameters:
z - scale factor along the z-axis

getScaleX

public float getScaleX()
Returns the scale factor for the x-axis

Returns:
scale factor

getScaleY

public float getScaleY()
Returns the scale factor for the y-axis

Returns:
scale factor

getScaleZ

public float getScaleZ()
Returns the scale factor for the z-axis

Returns:
scale factor

setAttachedGround

public void setAttachedGround(AbstractGroundMesh ground)
Attaches the mesh to the ground. The effect of this is, that the y-position (height-position) of the center point of the mesh is adjusted to the current height of the ground level. The height offset value can be used to lift the center point of the mesh by the specified value above the ground mesh. used to set the center point of the mesh to You will have to make sure that this mesh is positioned somewhere (xz-plane) on the ground mesh at start up, otherwise the mesh won't be able to move. Note: This mesh is prevented from leaving the ground mesh.

Parameters:
ground - ground mesh to attach this mesh to

moveForwardLocal

public void moveForwardLocal(float delta,
                             long elapsedTime)
Moves the mesh to forward direction based on its current rotation. It is assumed that the mesh is oriented with its front facing down the positve z-axis.

Parameters:
delta - change of position
elapsedTime - time between two frames

moveForwardGlobal

public void moveForwardGlobal(float delta,
                              long elapsedTime)
Moves the mesh to forward direction based on the global initial OpenGL coordinate system alignment

Parameters:
delta - change of position
elapsedTime - time bewteen two frames

moveBackwardsLocal

public void moveBackwardsLocal(float delta,
                               long elapsedTime)
Moves the mesh to backward direction based on its current rotation. It is assumed that the mesh is oriented with its front facing down the positve z-axis.

Parameters:
delta - change of position
elapsedTime - time between two frames

moveBackwardsGlobal

public void moveBackwardsGlobal(float delta,
                                long elapsedTime)
Moves the mesh to backward direction based on the global initial OpenGL coordinate system alignment.

Parameters:
delta - change of position
elapsedTime - time bewteen two frames

moveLeftLocal

public void moveLeftLocal(float delta,
                          long elapsedTime)
Moves the mesh to the left based on its current rotation. It is assumed that the mesh is oriented with its front facing down the positve z-axis.

Parameters:
delta - change of position
elapsedTime - time between two frames

moveLeftGlobal

public void moveLeftGlobal(float delta,
                           long elapsedTime)
Moves the mesh to the left based on the global initial OpenGL coordinate system alignment.

Parameters:
delta - change of position
elapsedTime - time bewteen two frames

moveRightLocal

public void moveRightLocal(float delta,
                           long elapsedTime)
Moves the mesh to the right based on its current rotation. It is assumed that the mesh is oriented with its front facing down the positve z-axis.

Parameters:
delta - change of position
elapsedTime - time between two frames

moveRightGlobal

public void moveRightGlobal(float delta,
                            long elapsedTime)
Moves the mesh to the right based on the global initial OpenGL coordinate system alignment.

Parameters:
delta - change of position
elapsedTime - time bewteen two frames

moveUpGlobal

public void moveUpGlobal(float delta,
                         long elapsedTime)
Moves the mesh to up based on the global initial OpenGL coordinate system alignment.

Parameters:
delta - change of position
elapsedTime - time bewteen two frames

moveDownGlobal

public void moveDownGlobal(float delta,
                           long elapsedTime)
Moves the mesh to down based on the global initial OpenGL coordinate system alignment.

Parameters:
delta - change of position
elapsedTime - time bewteen two frames

moveTo

public void moveTo(float x,
                   float z,
                   float speedMove,
                   float speedRot,
                   long elapsedTime)
Moves the mesh towards the specified coordinates

Parameters:
x - x-coordinate
z - z-coordinate
speedMove - speed of movement
speedRot - speed of rotation
elapsedTime - time between two frames

rotateRight

public void rotateRight(float delta,
                        long elapsedTime)
Rotates the mesh to the right.

Parameters:
delta - change of rotation
elapsedTime - time bewteen two frames

rotateLeft

public void rotateLeft(float delta,
                       long elapsedTime)
Rotates the mesh to the left.

Parameters:
delta - change of rotation
elapsedTime - time bewteen two frames

rotateUp

public void rotateUp(float delta,
                     long elapsedTime)
Rotates the mesh up.

Parameters:
delta - change of rotation
elapsedTime - time bewteen two frames

rotateDown

public void rotateDown(float delta,
                       long elapsedTime)
Rotates the mesh down.

Parameters:
delta - change of rotation
elapsedTime - time bewteen two frames

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

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 -

isSmoothShaded

public boolean isSmoothShaded()
Determines whether the mesh is beeing smoothly shaded.

Returns:
is mesh shaded smoothly? --> true=yes, false=no

setPickable

public void setPickable(boolean pick)
Sets whethter or not the mesh is pickable

Parameters:
pick - set pickable? --> true=yes, false=no

isPickable

public boolean isPickable()
Determines whethter or not the mesh is pickable by a picking method (OpenGL internal picking or ray picking).

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

isCollidable

public boolean isCollidable()
Determines whether or not this mesh is meant to be collidable. This is just a flag. You have have to check its value, if you are about to check for collision with this mesh.

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

setCollidable

public void setCollidable(boolean collidable)
Sets a flag to signal whether or not this mesh is meant to be collidable.

Parameters:
collidable - collidable flag

isMouseOverMesh

public boolean isMouseOverMesh(int screenX,
                               int screenY)
Convenience method to check if the mouse is currently located over the mesh (resp. its bounding volume). It makes use of the getPointOfIntersection() method from the CollisionFinder class.
Note: This method doesn't care, if the mesh is set to be pickable or not.

Parameters:
screenX - screen x-coordinate
screenY - screen y-coordinate
Returns:
is mouse over mesh? --> true=yes, false=no

getMouseOverMesh

public Point3D getMouseOverMesh(int screenX,
                                int screenY)
Convenience method to get the 3D position of the mouse, if the mouse is currently located over the mesh (resp. its bounding volume). It makes use of the getPointOfIntersection() method from the CollisionFinder class.
Note: This method doesn't care, if the mesh is set to be pickable or not.

Parameters:
screenX - screen x-coordinate
screenY - screen y-coordinate
Returns:
3D position of the mouse over the mesh

update

public void update(long elapsedTime)
Updates the mesh. Subclasses should override this method.

Parameters:
elapsedTime - time between two frames

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 -

drawShaders

@Deprecated
public void drawShaders(javax.media.opengl.GL gl)
Deprecated. does not really work correctly in general ;-)

Draws all the shaders applied to the mesh. Every shader is drawn in a new render pass.

Parameters:
gl -

destroy

public abstract void destroy()
Destroys the mesh.