de.rico.engine.geometry.modelloader.md2
Class ModelMD2

java.lang.Object
  extended by de.rico.engine.geometry.AbstractMesh
      extended by de.rico.engine.geometry.MeshVA
          extended by de.rico.engine.geometry.modelloader.md2.ModelMD2
All Implemented Interfaces:
ImportableModelIface

public class ModelMD2
extends MeshVA
implements ImportableModelIface

This class represents a model read in from the a file with the MD2 format.

Author:
Frank Bruns

Constructor Summary
ModelMD2(boolean smooth)
          Creates a new MD2 model object.
ModelMD2(boolean smooth, BoundingVolume type)
          Creates a new MD2 mesh object, optionally smooth shaded.
 
Method Summary
 java.lang.String getFilePath()
          Returns the file path of the model file used.
 void load(java.lang.String modelFile, float scale)
          This method loads a model from the specified file.
 
Methods inherited from class de.rico.engine.geometry.MeshVA
addAnimation, addFaces, destroy, draw, finishModel, getAnimation, getAnimations, getCurrentAnimation, getFaces, getFacesTransformed, getTotalFrameCount, removeAnimation, setAnimation, specializedDraw, update
 
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
 

Constructor Detail

ModelMD2

public ModelMD2(boolean smooth)
Creates a new MD2 model object. The loader uses precalculated smooth mesh normals that should be fine, but you can optionally decide to let the engine calculate smooth normals which sometimes returns normals that are smoother. 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

ModelMD2

public ModelMD2(boolean smooth,
                BoundingVolume type)
Creates a new MD2 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

getFilePath

public java.lang.String getFilePath()
Description copied from interface: ImportableModelIface
Returns the file path of the model file used. This is usually important for the editor.

Specified by:
getFilePath in interface ImportableModelIface
Returns:
file path of the model file

load

public void load(java.lang.String modelFile,
                 float scale)
Description copied from interface: ImportableModelIface
This method loads a model from the specified file.

Specified by:
load in interface ImportableModelIface
Parameters:
modelFile - path to the model file
scale - scale factor