Shapes 3D  3.0
 All Classes Functions Variables Pages
shapes3d.MD2shape Class Reference
Inheritance diagram for shapes3d.MD2shape:

Public Member Functions

 MD2shape (PApplet app, String...files)
 
MD2shape getThis ()
 
void update (float delta_t)
 
float getAnimPos ()
 
void setState (int stateNo)
 
MD2shape setState (int stateNo, boolean repeat)
 
MD2_AnimState getAnimState (int stateNo)
 
MD2_AnimState[] getAnimStates ()
 
MD2shape orientModel (Orientation orientation)
 
MD2shape centreModel ()
 
MD2shape centreModel (PVector offset)
 
MD2shape scaleModel (float scale)
 
PVector getModOffset ()
 
PVector getModSize ()
 
MD2_Data getData ()
 
- Public Member Functions inherited from shapes3d.Shape3D
 Shape3D ()
 
void addPickHandler (Object obj, String methodName)
 
Shape3D pickable (boolean pickable)
 
boolean pickable ()
 
int nbrParts ()
 
Shape3D use (int parts_to_use)
 
Shape3D tag (String tag)
 
Shape3D tag (String tag, int parts)
 
String[] tags ()
 
Shape3D drawMode (int mode)
 
Shape3D drawMode (int mode, int parts)
 
int[] drawModes ()
 
Shape3D fill (int col)
 
Shape3D fill (int col, int parts)
 
int[] fills ()
 
Shape3D stroke (int col)
 
Shape3D stroke (int col, int parts)
 
int[] strokes ()
 
Shape3D strokeWeight (float weight)
 
Shape3D strokeWeight (float weight, int parts)
 
float[] strokeWeights ()
 
Shape3D scale (float scale)
 
float scale ()
 
Shape3D movie (PApplet pApplet, PImage movie)
 
Shape3D movie (PApplet pApplet, PImage movie, int parts)
 
Shape3D texture (PApplet app, String filename)
 
Shape3D texture (PImage texture)
 
Shape3D texture (PApplet app, String filename, int parts)
 
Shape3D texture (PImage texture, int parts)
 
PImage[] textures ()
 
Shape3D uv (float u0, float u1, float v0, float v1)
 
Shape3D uv (float u0, float u1, float v0, float v1, int parts)
 
Shape3D uvt (TransformUV transformer)
 
Shape3D uvt (TransformUV transformer, int parts)
 
Shape3D uvwrap (int wrap)
 
Shape3D uvwrap (int wrap, int parts)
 
Shape3D mesh (int nbrColSlices, int nbrRowSlices)
 
Shape3D mesh (int nbrColSlices, int nbrRowSlices, int parts)
 
Shape3D visible (boolean visible)
 
Shape3D visible (boolean visible, int parts)
 
boolean[] visibles ()
 
Shape3D moveTo (PVector pos)
 
Shape3D moveTo (float x, float y, float z)
 
Shape3D moveTo (float[] xyz)
 
float x ()
 
float y ()
 
float z ()
 
PVector getPosVec ()
 
PVector getPosVec (PVector target)
 
float[] getPosArray ()
 
float[] getPosArray (float[] target)
 
PVector getRotVec ()
 
PVector getRotVec (PVector target)
 
float[] getRotArray ()
 
float[] getRotArray (float[] target)
 
Shape3D rotateTo (PVector angles)
 
Shape3D rotateTo (float[] angles)
 
Shape3D rotateTo (float x, float y, float z)
 
Shape3D rotateToX (float x)
 
Shape3D rotateToY (float y)
 
Shape3D rotateToZ (float z)
 
Shape3D rotateBy (float x, float y, float z)
 
Shape3D rotateBy (float[] angle)
 
Shape3D rotateBy (PVector angles)
 
Shape3D rotateByX (float x)
 
Shape3D rotateByY (float y)
 
Shape3D rotateByZ (float z)
 
void draw (PGraphics pg)
 
void drawPickBuffer (PGraphics pg)
 

Protected Member Functions

void calcShape ()
 
void makeParts ()
 
void releaseMemory ()
 
- Protected Member Functions inherited from shapes3d.Shape3D
void fireEvent (Object...objects)
 

Additional Inherited Members

- Static Public Member Functions inherited from shapes3d.Shape3D
static void showSurfaceNormals ()
 
static void showSurfaceNormals (int color, float weight, float length)
 
static void hideSurfaceNormals ()
 
static int nextPickColor ()
 
static Picked pick (PApplet app, PGraphics canvas, int x, int y)
 
static Picked[] pick (PApplet app, PGraphics canvas, int x0, int y0, int x1, int y1)
 
static Picked[] mergePicks (Picked[] picked)
 
static void keepPickBufferImage (boolean keep)
 
static PImage pickBufferImage ()
 
static int nbrShapes3D ()
 
- Public Attributes inherited from shapes3d.Shape3D
String tag
 
int tagNo = 0
 
- Public Attributes inherited from shapes3d.utils.SConstants
int WIRE = 0x00000011
 
int SOLID = 0x00000012
 
int TEXTURE = 0x00000014
 
int DRAWALL = WIRE | SOLID | TEXTURE
 
int WHITE = 0xFFFFFFFF
 
int BLACK = 0xFF000000
 
int GREY = 0xFFC0C0C0
 
int RED = 0xFFFF0000
 
int GREEN = 0xFF00FF00
 
int BLUE = 0xFF0000FF
 
int YELLOW = 0xFFFFFF00
 
int PURPLE = 0xFFFF00FF
 
int CYAN = 0xFF00FFFF
 
int ORANGE = 0xFFFFC000
 
int CW = 1
 
int CCW = 2
 
int ALL = 0b11111111
 
int BOTTOM = 0b00000001
 
int TOP = 0b00000010
 
int FRONT = 0b00000100
 
int BACK = 0b00001000
 
int LEFT = 0b00010000
 
int RIGHT = 0b00100000
 
int BODY = 0b00000001
 
int END0 = 0b00000010
 
int END1 = 0b00000100
 
float ONE_DEG_T = (float) (Math.PI / 180.0)
 
PathOrthogonal ORTHO_X = new PathOrthogonal.PathNormalX()
 
PathOrthogonal ORTHO_Y = new PathOrthogonal.PathNormalY()
 
PathOrthogonal ORTHO_Z = new PathOrthogonal.PathNormalZ()
 
PathOrthogonal ORTHO_A = new PathOrthogonal.PathNormalAMC()
 
TransformUV ROT_0 = TransformUV.ROT0
 
TransformUV ROT_90 = TransformUV.ROT90
 
TransformUV ROT_180 = TransformUV.ROT180
 
TransformUV ROT_270 = TransformUV.ROT270
 
TransformUV FLIP_H = TransformUV.FLIPH
 
TransformUV FLIP_V = TransformUV.FLIPV
 
Rotation ROTATION_ZERO = new Rotation()
 
int T_BOX = 0x1001
 
int T_DOME = 0x1002
 
int T_CONE = 0x1003
 
int T_ELLIPSOID = 0x1004
 
int T_EXTRUSION = 0x1005
 
int T_LATHESTOCK = 0x1006
 
int T_MD2 = 0x1007
 
int T_SKYBOX = 0x1008
 
int T_SKYDOME = 0x1009
 
int T_TERRAIN = 0x100A
 
int T_TUBE = 0x100B
 
int C_LATHESURFACE = 0x2001
 
int C_OVAL = 0x2002
 
int C_POLYGON = 0x2003
 
int P_BCURVE2D = 0x3001
 
int P_BCURVE3D = 0x3002
 
int P_BSPLINE2D = 0x3003
 
int P_BSPLINE3D = 0x3004
 
int P_LINEAR = 0x3005
 
int P_LISSAJOUS = 0x3006
 
int P_RING = 0x3007
 
int P_SPIRAL = 0x3008
 
- Protected Attributes inherited from shapes3d.Shape3D
PGraphics on_canvas
 
PMatrix on_canvas_matrix
 
PVector pos = new PVector(0,0,0)
 
PVector rot = new PVector(0,0,0)
 
PVector up = new PVector(0,1,0)
 
PVector centreRot = new PVector(0,0,0)
 
float shapeScale = 1.0f
 
_ShapePart[] shapeParts = new _ShapePart[0]
 
int useParts = ALL
 
int pickColor
 
boolean pickable = true
 
Object eventHandlerObject = null
 
Method eventHandlerMethod = null
 
String eventHandlerMethodName
 
- Static Protected Attributes inherited from shapes3d.Shape3D
static HashMap< Integer, Shape3DmapColor2Shape = new HashMap<Integer, Shape3D>()
 
static HashMap< PGraphics,
PGraphics > 
mapCanvas2ColorBuffer = new HashMap<PGraphics, PGraphics>()
 
static List< Shape3DshapesMade = new ArrayList<Shape3D>()
 
static Set< PickedmarqueeSelection = new HashSet<Picked>()
 
static boolean show_normals = false
 
static int normal_color = 0xFFFF00FF
 
static float normal_weight = 1.0f
 
static float normal_length = 10
 
static int nextPickColor = 0xFF000000
 
static boolean keepCopy = false
 
static PImage pbImage = null
 

Detailed Description

This shape can be built using 1 to 8 linked MD2 models. Linked models share the same number of frames and animation states, for instance a warrior and his weapon.

Author
Peter Lager

Constructor & Destructor Documentation

shapes3d.MD2shape.MD2shape ( PApplet  app,
String...  files 
)

Each MD2 model requires two files, the first first holds the numerical and rendering data and the second file a bitmap for the skin texture. Since a MD2shape can have more than one model simply pass a list of files as data+skin file pairs.

Parameters
appallows access to Processing methods/functions
filesdata0, skin0, data1, skin1 ...

Member Function Documentation

MD2shape shapes3d.MD2shape.centreModel ( )

Centers the model so it evenly spaced over (0,0,0) Note: this will change all the XYZ points in the model

Returns
MD2shape shapes3d.MD2shape.centreModel ( PVector  offset)

Centers the model so it evenly spaced over a given offset useful if we have 2 linked models. Note: this will change all the XYZ points in the model

Parameters
offsetthe distance to move vertices
Returns
float shapes3d.MD2shape.getAnimPos ( )

Gets the current animation position. Integer part is frame number and fractional part is interpolation value to next frame.

Returns
MD2_AnimState shapes3d.MD2shape.getAnimState ( int  stateNo)

get a particular animation state

Parameters
stateNo
Returns
animation state
MD2_AnimState [] shapes3d.MD2shape.getAnimStates ( )

Allows user to get and use any animation states available

Returns
MD2_Data shapes3d.MD2shape.getData ( )

Get the model data from the first model

Returns
the model data
PVector shapes3d.MD2shape.getModOffset ( )

Get the offset of the model center from (0,0,0)

Returns
distance of model center from [0,0,0]
PVector shapes3d.MD2shape.getModSize ( )

Get the size of the model

Returns
the model's width, height and depth
MD2shape shapes3d.MD2shape.getThis ( )
virtual
Returns
this shape

Implements shapes3d.Shape3D.

MD2shape shapes3d.MD2shape.orientModel ( Orientation  orientation)

Orient the vertex data for this model

Parameters
orientation
Returns
MD2shape shapes3d.MD2shape.scaleModel ( float  scale)

Scales the model Note: this will change all the XYZ points in the model

Parameters
scalethe scale factor to apply to vertices
void shapes3d.MD2shape.setState ( int  stateNo)

Set the model state to be rendered animation is repeated for ever.

Parameters
stateNo
MD2shape shapes3d.MD2shape.setState ( int  stateNo,
boolean  repeat 
)

Set the model state to be rendered

Parameters
stateNo
true= repeat animation is repeated for ever
Returns
void shapes3d.MD2shape.update ( float  delta_t)

Update the model shape

Parameters
delta_t

The documentation for this class was generated from the following file: