de.rico.engine.geometry
Class MeshDL
java.lang.Object
de.rico.engine.geometry.AbstractMesh
de.rico.engine.geometry.MeshDL
- Direct Known Subclasses:
- AbstractGroundMesh, Billboard, Mirror, Model3DS, Monitor, SkyBox, WaterLayer
public class MeshDL
- extends AbstractMesh
This class represents a mesh. The mesh uses the display list technology.
- Author:
- Frank Bruns
Constructor Summary |
MeshDL(boolean smooth)
Creates a new mesh object, optionally smooth shaded. |
MeshDL(boolean smooth,
BoundingVolume type)
Creates a new mesh object, optionally smooth shaded. |
Method Summary |
void |
addFace(Triangle face)
Adds a face (two triangle) to the mesh. |
void |
destroy()
Destroys the mesh. |
void |
draw(javax.media.opengl.GL gl)
Call this method to draw the mesh. |
void |
finishModel()
This method finishes important remaining work to finish the construction
of the model. |
int |
getDisplayListId()
Returns the unique display list id of this mesh |
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. |
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. |
void |
specializedDraw(javax.media.opengl.GL gl)
This method contains only the drawing operation fitting to the special
kind of mesh. |
void |
update(long elapsedTime)
Updates the mesh. |
Methods inherited from class de.rico.engine.geometry.AbstractMesh |
addShader, drawShaders, getBoundingVolume, getHeightOffset, getMaterial, getMouseOverMesh, getName, getPosition, getPosX, getPosY, getPosZ, getRotation, getRotX, getRotY, getRotZ, getScaleX, getScaleY, getScaleZ, getTex0Path, getTex1Path, getText0XMovement, getText0YMovement, getText1XMovement, getText1YMovement, getTexUnit0, getTexUnit1, isCollidable, isDrawingEnabled, isEnabledOcclusionCulling, isMouseOverMesh, isOccluded, isPickable, isShadowEnabled, isSmoothShaded, isTex0Flipped, isTex0MipMapped, isTex0Rotated, isTex1Flipped, isTex1MipMapped, isTex1Rotated, moveBackwardsGlobal, moveBackwardsLocal, moveDownGlobal, moveForwardGlobal, moveForwardLocal, moveLeftGlobal, moveLeftLocal, moveRightGlobal, moveRightLocal, moveTo, moveUpGlobal, performTransformations, rotateDown, rotateLeft, rotateRight, rotateUp, scale, setAttachedGround, setBlendDestFactor, setBlendFunction, setBlendSourceFactor, setCollidable, setDrawingEnabled, setEnabledOcclusionCulling, setEnvironmentMap, setMaterial, setName, setPickable, setPosition, setPosition, setPosX, setPosY, setPosZ, setRotation, setRotation, setRotX, setRotY, setRotZ, setScaleX, setScaleY, setScaleZ, setShadowEnabled, setShowBoundingVolume, setTex0Movement, setTex0TexEnvirMode, setTex0XMovement, setTex0YMovement, setTex1Movement, setTex1TexEnvirMode, setTex1XMovement, setTex1YMovement, setTexUnit0, setTexUnit0, setTexUnit1, setTexUnit1, setTransparency, showWireFrame, translateX, translateY, translateZ |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MeshDL
public MeshDL(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
MeshDL
public MeshDL(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=notype
- value from the BoundingVolume enumeration
getDisplayListId
public int getDisplayListId()
- Returns the unique display list id of this mesh
- Returns:
- unique mesh id
addFace
public void addFace(Triangle 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.List<Triangle> getFaces()
- Description copied from class:
AbstractMesh
- 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.
- Specified by:
getFaces
in class AbstractMesh
- Returns:
- faces of the mesh relative to (0f,0f,0f) origin
getFacesTransformed
public java.util.List<Triangle> getFacesTransformed()
- Description copied from class:
AbstractMesh
- Returns the face with coordinates that are correctly transformed
(translation, rotation, scale factor) according to the current
transformation state of the mesh.
- Specified by:
getFacesTransformed
in class AbstractMesh
- Returns:
- correctly transformed faces of the mesh
finishModel
public void finishModel()
- This method finishes important remaining work to finish the construction
of the model.
It does the following:
- create the model's display list
- calculate the bounding volume
- calculate smooth normals, if desired
It is essentiell to call this method after every face has been added to
mesh object.
update
public void update(long elapsedTime)
- Description copied from class:
AbstractMesh
- Updates the mesh. Subclasses should override this method.
- Overrides:
update
in class AbstractMesh
- Parameters:
elapsedTime
- time between two frames
draw
public void draw(javax.media.opengl.GL gl)
- Description copied from class:
AbstractMesh
- Call this method to draw the mesh.
- Specified by:
draw
in class AbstractMesh
specializedDraw
public void specializedDraw(javax.media.opengl.GL gl)
- Description copied from class:
AbstractMesh
- This method contains only the drawing operation fitting to the special
kind of mesh. It is useful for drawing shadows, too.
- Specified by:
specializedDraw
in class AbstractMesh
destroy
public void destroy()
- Description copied from class:
AbstractMesh
- Destroys the mesh.
- Specified by:
destroy
in class AbstractMesh