Functions

D:/Shootemup/Toolbox/AnimationEditor/Dialog/functions.h File Reference

#include "types.h"
#include <fstream>

Go to the source code of this file.

Functions

float Deg2Rad (float fDeg)
float Rad2Deg (float fRad)
 convert degrees to radians
vec3f transformVector (vec3f v3f, float m16[16])
 convert radians to degree
void myMultMatrix (float A[16], float B[16], float RESULT[16])
 transform a row-major vector with a row-major matrix
void copymatrix (float DEST[16], float SOURCE[16])
 multiply two row-major matrices, store the result to a new one
void cleanupmatrix (float M[16])
 copy a row-major matrix to another one
void applytransformation (bone_t *bone, float transformationmatrix[16])
 correct rounding-errors BUGGY
float interpolate (float oldvalue, float newvalue, float totaltime, float dt)
 recursively apply a transformation matrix to a bone and all attached children
void createunitymatrix (float[16])
 interpolate a float value based on elapsed time
void getXRotationMatrix (float m[16], float pitch)
 create a unity matrix
void getYRotationMatrix (float m[16], float yaw)
 create a row-major rotation matrix for x-rotations
void getZRotationMatrix (float m[16], float azimuth)
 create a row-major rotation matrix for y-rotations
void getTranslationMatrix (float m[16], float x, float y, float z)
 create a row-major rotation matrix for z-rotations
void normalizeVector (vec3f v)
 create a row-major translation matrix
void calculateNormal (vec3f result, vec3f p1, vec3f p2, vec3f p3)
 normalize a vector
void crossProduct (vec3f *n, vec3f *v1, vec3f *v2)
 calculate a normal-vector for a triangle with points given in clockwise order
void rotatebone (bone_t *bone, bone_t *parentbone, float pitch, float yaw, float azimuth)
 calculate the cross-product of two vectors
void drawbone (bone_t *bone, bone_t *selectedbone, int flags)
 rotate a bone and apply the new transformation matrix to all attached children
void draw (bone_t *root)
 draw a bone
void initmatrix (bone_t *bone)
 draw a skeleton
bone_tgetboneforindex (int i, bone_t *root)
 set a bones transformation matrix to identity
int updateskeleton (skeleton_t *skeleton, keyframe_t oldstate, keyframe_t newstate, int dt)
 get a bone from a skeleton providing an index
int resetbones (bone_t *root)
 recalculate all bones by interpolation between two keyframes
int countchildren (bone_t *root)
 reset bone positions
int updatemodel (model_t *model, skeleton_t *skeleton, keyframe_t oldstate, keyframe_t newstate, float dt)
 count children for a given bone
int rebuildskeleton (bone_t *root, float ACCUMULATION_MATRIX[16])
 update model
int skin_mesh (model_t *model, skeleton_t *skeleton)
 rebuild bone-accumulation matrices and positions
int createvertexmapping (model_t *model, bone_t *root)
 skin mesh
int updateanimation (model_t *model, float now)
 create a vertex mapper based on the models bone structure
keyframe_tgetkeyframe (keyframelibrary_t *library, char *_lpcstrName)
 update a model over time
int replacekeyframe (keyframelibrary_t *library, char *_lpcstrName, keyframe_t *_newkeyframe)
 acquire a handle to a keyframe identified by its name
keyframe_tmakekeyframe (int _iidx, char *_lpcstrName, float _fduration, vec3f _offset, bone_t *root)
 in a given keyframe library, replace a keyframe identified by its name by another one
int fillkeyframe (keyframe_t *newkeyframe, bone_t *root)
 generate a new keyframe for a given root bone and its children
animation_tgetanimation (animationlibrary_t *library, char *_lpcstrName)
 register a bone and its children to a given keyframe
void reshape (int w, int h)
 acquire a handle to an animation identified by its name
int handleInput (void)
 reshape window
int loadskeleton (std::string filename, skeleton_t *skeleton)
 react to user input
int loadkeyframes (std::string filename, keyframelibrary_t *library)
 load a skeleton from a file
int loadOBJ (std::string filename, model_t *model)
 load keyframes from a file
int parsematerial (std::string filename, model_t *model)
 load obj model from a file
int loadvertexmapping (std::string filename, model_t *model)
 parse mtl file
int loadanimations (std::string filename, animationlibrary_t *library)
 load vertex / bone associations
int storeBoneRotations (fstream *f, bone_t *bone)
 load animations from a file
int storeAllBones (fstream *f, bone_t *root)
 store rotation for a bone
float nextFloatFromString (char *, int &)
 recursively store all bone rotations
int trimString (char *)
 read next numeric value from a string
int trimStringRight (char *)
 remove all whitespaces, tabs, newlines, etc. from a string
int firstWord (char *, int &, char *)
 remove all whitespaces, tabs, newlines, etc. from the end of a string
int trimleft (char *)
 get first word from a string with a specified offset
int trimright (char *)
 trim whitespaces from the front of a string
int countslash (char *str)
 trim whitespaces from the end of a string
int getval (char *str, char *res, int &pos)
 count amount of slashes ('/') in a string
int getpart (char *str, char *result, int &pos)
 get a value from a slash-delimited list (e.g. "v 5/3/2"), return position of last found value
int getindex (vector< int > v, int a)
 get a part of a string (blank-delimited), (e.g. "hello" from "hello world")
int mapmaterial (std::string str, model_t *model)
 get the index of an integer in a vector
void displaymodel (model_t *model, int flags, int selectedvertex)
 get index of a specified material in a model
int skinmesh (model_t *model, skeleton_t *skeleton)
 display a model (source type "obj")
int displaymesh (model_t *model, int flags)
 obsolete
int outlinemappedvertices (model_t *model)
 display the obj mesh
int BeginWithZero (model_t *model)
 outline all vertices that are associated with a bone
int transformboundingbox (bone_t *root)
int resetbounds (vec3f bounds[8], vec3f *minvalues, vec3f *maxvalues)
 transform a bones bounding box
int drawboundingbox (boundingbox_t *boundingbox)
 reset boundingbox to inital values
int getminima (vec3f bounds[8], vec3f *result)
 display a boundingbox
int getmaxima (vec3f bounds[8], vec3f *result)
int checkcollision (boundingbox_t *box1, boundingbox_t *box2)
int reboundmodel (model_t *model)
 check a collision between two bounding boxes
vec3f calculatenormal (vec3f *p1, vec3f *p2, vec3f *p3)
 recalculate the bounding boxes for all bones of a models skeleton
int checknormals (model_t *model)
 calculate a normal from a CCW triangle

Function Documentation

void applytransformation ( bone_t bone,
float  transformationmatrix[16] 
)

correct rounding-errors BUGGY

int BeginWithZero ( model_t model  ) 

outline all vertices that are associated with a bone

vec3f calculatenormal ( vec3f p1,
vec3f p2,
vec3f p3 
)

recalculate the bounding boxes for all bones of a models skeleton

void calculateNormal ( vec3f  result,
vec3f  p1,
vec3f  p2,
vec3f  p3 
)

normalize a vector

int checkcollision ( boundingbox_t box1,
boundingbox_t box2 
)
int checknormals ( model_t model  ) 

calculate a normal from a CCW triangle

void cleanupmatrix ( float  M[16]  ) 

copy a row-major matrix to another one

void copymatrix ( float  DEST[16],
float  SOURCE[16] 
)

multiply two row-major matrices, store the result to a new one

int countchildren ( bone_t root  ) 

reset bone positions

int countslash ( char *  str  ) 

trim whitespaces from the end of a string

void createunitymatrix ( float  [16]  ) 

interpolate a float value based on elapsed time

int createvertexmapping ( model_t model,
bone_t root 
)

skin mesh

void crossProduct ( vec3f n,
vec3f v1,
vec3f v2 
)

calculate a normal-vector for a triangle with points given in clockwise order

float Deg2Rad ( float  fDeg  ) 
int displaymesh ( model_t model,
int  flags 
)

obsolete

void displaymodel ( model_t model,
int  flags,
int  selectedvertex 
)

get index of a specified material in a model

void draw ( bone_t root  ) 

draw a bone

void drawbone ( bone_t bone,
bone_t selectedbone,
int  flags 
)

rotate a bone and apply the new transformation matrix to all attached children

int drawboundingbox ( boundingbox_t boundingbox  ) 

reset boundingbox to inital values

int fillkeyframe ( keyframe_t newkeyframe,
bone_t root 
)

generate a new keyframe for a given root bone and its children

int firstWord ( char *  ,
int &  ,
char *   
)

remove all whitespaces, tabs, newlines, etc. from the end of a string

animation_t* getanimation ( animationlibrary_t library,
char *  _lpcstrName 
)

register a bone and its children to a given keyframe

bone_t* getboneforindex ( int  i,
bone_t root 
)

set a bones transformation matrix to identity

int getindex ( vector< int >  v,
int  a 
)

get a part of a string (blank-delimited), (e.g. "hello" from "hello world")

keyframe_t* getkeyframe ( keyframelibrary_t library,
char *  _lpcstrName 
)

update a model over time

int getmaxima ( vec3f  bounds[8],
vec3f result 
)
int getminima ( vec3f  bounds[8],
vec3f result 
)

display a boundingbox

int getpart ( char *  str,
char *  result,
int &  pos 
)

get a value from a slash-delimited list (e.g. "v 5/3/2"), return position of last found value

void getTranslationMatrix ( float  m[16],
float  x,
float  y,
float  z 
)

create a row-major rotation matrix for z-rotations

int getval ( char *  str,
char *  res,
int &  pos 
)

count amount of slashes ('/') in a string

void getXRotationMatrix ( float  m[16],
float  pitch 
)

create a unity matrix

void getYRotationMatrix ( float  m[16],
float  yaw 
)

create a row-major rotation matrix for x-rotations

void getZRotationMatrix ( float  m[16],
float  azimuth 
)

create a row-major rotation matrix for y-rotations

int handleInput ( void   ) 

reshape window

void initmatrix ( bone_t bone  ) 

draw a skeleton

float interpolate ( float  oldvalue,
float  newvalue,
float  totaltime,
float  dt 
)

recursively apply a transformation matrix to a bone and all attached children

int loadanimations ( std::string  filename,
animationlibrary_t library 
)

load vertex / bone associations

int loadkeyframes ( std::string  filename,
keyframelibrary_t library 
)

load a skeleton from a file

int loadOBJ ( std::string  filename,
model_t model 
)

load keyframes from a file

int loadskeleton ( std::string  filename,
skeleton_t skeleton 
)

react to user input

int loadvertexmapping ( std::string  filename,
model_t model 
)

parse mtl file

keyframe_t* makekeyframe ( int  _iidx,
char *  _lpcstrName,
float  _fduration,
vec3f  _offset,
bone_t root 
)

in a given keyframe library, replace a keyframe identified by its name by another one

int mapmaterial ( std::string  str,
model_t model 
)

get the index of an integer in a vector

void myMultMatrix ( float  A[16],
float  B[16],
float  RESULT[16] 
)

transform a row-major vector with a row-major matrix

float nextFloatFromString ( char *  ,
int &   
)

recursively store all bone rotations

void normalizeVector ( vec3f  v  ) 

create a row-major translation matrix

int outlinemappedvertices ( model_t model  ) 

display the obj mesh

int parsematerial ( std::string  filename,
model_t model 
)

load obj model from a file

float Rad2Deg ( float  fRad  ) 

convert degrees to radians

int reboundmodel ( model_t model  ) 

check a collision between two bounding boxes

int rebuildskeleton ( bone_t root,
float  ACCUMULATION_MATRIX[16] 
)

update model

int replacekeyframe ( keyframelibrary_t library,
char *  _lpcstrName,
keyframe_t _newkeyframe 
)

acquire a handle to a keyframe identified by its name

int resetbones ( bone_t root  ) 

recalculate all bones by interpolation between two keyframes

int resetbounds ( vec3f  bounds[8],
vec3f minvalues,
vec3f maxvalues 
)

transform a bones bounding box

void reshape ( int  w,
int  h 
)

acquire a handle to an animation identified by its name

void rotatebone ( bone_t bone,
bone_t parentbone,
float  pitch,
float  yaw,
float  azimuth 
)

calculate the cross-product of two vectors

int skin_mesh ( model_t model,
skeleton_t skeleton 
)

rebuild bone-accumulation matrices and positions

int skinmesh ( model_t model,
skeleton_t skeleton 
)

display a model (source type "obj")

int storeAllBones ( fstream *  f,
bone_t root 
)

store rotation for a bone

int storeBoneRotations ( fstream *  f,
bone_t bone 
)

load animations from a file

int transformboundingbox ( bone_t root  ) 
vec3f transformVector ( vec3f  v3f,
float  m16[16] 
)

convert radians to degree

int trimleft ( char *   ) 

get first word from a string with a specified offset

int trimright ( char *   ) 

trim whitespaces from the front of a string

int trimString ( char *   ) 

read next numeric value from a string

int trimStringRight ( char *   ) 

remove all whitespaces, tabs, newlines, etc. from a string

int updateanimation ( model_t model,
float  now 
)

create a vertex mapper based on the models bone structure

int updatemodel ( model_t model,
skeleton_t skeleton,
keyframe_t  oldstate,
keyframe_t  newstate,
float  dt 
)

count children for a given bone

int updateskeleton ( skeleton_t skeleton,
keyframe_t  oldstate,
keyframe_t  newstate,
int  dt 
)

get a bone from a skeleton providing an index

 All Classes Files Functions Variables Enumerator Defines