HALCA.cpp File Reference

Functions

export_to_dll int addCharacter (char *path, char *name)
 adds a new avatar to the system.
export_to_dll void addMorph (int modelid, int animId)
 Adds an animation as a morph animation. Characters animated by morph animations can set their posture to any posture specified in the animation file. This is useful for example to open or close a hand. With an animation of a hand making a fist the avatars hand can be interactively controlled between open hand and fist.
export_to_dll void addRotation (int modelid, int boneid, float *quat)
 Like setRotation but uses quaternion to add to current rotation of the bone.
export_to_dll void addRotationAbs (int modelid, int boneid, float *quat)
 Like setRotation but uses quaternion to add to current rotation of the bone and multiplies with the inverse of the parent bone rotation in order to achieve an absolute rotation.
export_to_dll void addRotationEuler (int modelid, int boneid, float *euler)
 Like setRotation but uses vector of Euler angles to set the rotation.
export_to_dll void addRotationMatrix (int modelid, int boneid, float *matrix)
 Like setRotationMatrix but multiplies with current rotation matrix applied to the bone. The matrix has the x, y , z axis respectively as columns.
export_to_dll void blendCycle (int modelnum, int aninum, float weight, float delay)
 adds an animation to be blended and cycled.
export_to_dll void blendCycleN (int modelnum, int aninum, float weight, float delay, int num)
 adds an animation to be blended and cycled. Like blendCycle but allows the user to specify how often the animation should be cycled.
export_to_dll void blendCycleNMask (int modelnum, int aninum, float *weightmask, float delay, int num)
 adds an animation to be blended and cycled. Like blendCycleN but allows the user to specify a weight for every joint in the animation.
export_to_dll int boneBoneIntersection (int modelid1, int modelid2, int boneid1, int boneid2, float *point1, float *point2)
 Returns the distance of the specified point from the specified bone. If the boneid is invalid or does not have a parent bone then the function returns -1.
export_to_dll int boneCylinderIntersection (int modelid, int boneid, float *point1, float *point2, float rad)
 tests if the specified bone intersects with the specified cylinder. If cylinder radius is chosen to be 0 then the test is equivalent to a cylinder ray intersection test.
export_to_dll void clearCycle (int modelid, int aniid)
 Removes a cycling animation .
export_to_dll void clearCycleIn (int modelid, int aniid, float delay)
 Removes a cycling animation after a specified delay.
export_to_dll void clearMorph (int modelID, int num, float seconds)
 remove a morphtarget. This sbould not be confused with removeMorph, which deals with Morph animations rather than morph targets.
export_to_dll float distanceToBoundingCylinder (int modelid, int boneid, float *point)
 Returns the distance of the specified point from the specified bone. If the boneid is invalid or does not have a parent bone then the function returns -1.
export_to_dll void doIK (int modelid, int startId, int endId, float *target, float tolerance, int numIter)
 Carries out simple CCD to do inverse kinematics.
export_to_dll void doIK3 (int modelid, float *target)
 sets up IK to do simple CCD use in combination with doIK3
export_to_dll void doIKCCD (int modelid, int startId, int endId, float *target, float tolerance, int numIter)
 Carries out simple CCD to do inverse kinematics.
export_to_dll void Draw (float *reserved)
 Draws all Avatars in the system using standard OpenGL Vertex Arrays or with vertex and fragment shader loaded by the library. This function should not be used in combination with shaders loaded by the hosting application.
export_to_dll void DrawExtShader ()
 Draws all avatars in the system assuming that a shader is loaded in OpenGL before this function is called. The shader is responsible for carrying out the skin deformations. The library sends the relevant transformation information (matrix transfromation or dual quaternions of each limb to the Vertex shader as Uniform variables. If you use multiple shaders make sure the loadUniAndAttrIDs is called immediately after each shader is started.This makes sure that the library knows the id's of the uniform and attribute variables that are used to send the skeletal transformation information.
export_to_dll void DrawExtShaderOne (int modelid)
 Same as DrawExtShader but only the avatar with the given id is drawn.
export_to_dll void DrawGrid ()
 Draws a grid from -100 to 100 in x and z stepsize 10 in grey for debugging purposes.
export_to_dll void exeAct (int modelnum, int aninum, float inTime, float outTime, float weight, int lock)
 Add an animation to be executed.
export_to_dll void exeActAt (int modelnum, int aninum, float inTime, float outTime, float weight, int lock, float startTime)
 Add an animation to be executed after some time. This is useful if a sequence of animations is added to an avatar.
export_to_dll void exeActPart (int modelnum, int aninum, float inTime, float outTime, float weight, int lock, float startTime, float duration)
 Add an animation to be executed only partially. This is useful if only a part of an animation is required to be played.
export_to_dll void exeMorph (int modelID, int num, float seconds, float delay)
 execute a morphtarget.
export_to_dll void FileClose ()
 Close the file opened. This can be useful to log data to a file.
export_to_dll int FileOpen (char *fname)
 Opens a file with the name fname. This can be useful to log data to a file.
export_to_dll void FileWrite (char *text)
 Write a string to the file opened. This can be useful to log data to a file.
export_to_dll void FileWriteFloats (float *buf, int size)
 Write an array of floats to the file opened. This can be useful to log data to a file.
export_to_dll void geomShaderType (int shaderProgramId, int inout, int type)
 Changes the geometry shader input type to the specified type.
export_to_dll void getAllBoneState (int modelid, float *boneState)
 Returns a vector with the state of all bones of the avatar's skeleton. The state of the root bone is described by a translation in x, y and z and a rotation given by a quaternion x,y,z,w. The state of all other bones is described only by their rotation by using a quaternion x,y,z,w. Therefore the length of the returned float vector is 3+4*n where n is the number of bones in the skeleton.
export_to_dll int getAnimationCount (int modelid)
 Returns the number of animations loaded in the specified avatar.
export_to_dll float getAnimationDuration (int modelid, int animid)
 returns the length in seconds of the specified andimation of the specified avatar
export_to_dll char * getAnimationFilename (int modelid, int animid)
 returns the filename of the specified animation of the specified avatar
export_to_dll int getAnimationId (int modelid, char *aniName)
 returns the id of the animation specified by name of the specified avatar
export_to_dll char * getAnimationName (int modelid, int animid)
 returns the name of the specified animation of the specified avatar
export_to_dll float getAnimationNumFrames (int modelid, int aniid)
 Gets the number of frames of the animation is saved. This can be used in combination with getAnimationDuration to compute the frame rate at which the animation was saved.
export_to_dll float getAnimationTime (int modelid, int aniid)
 Gets the time at which point the animation is currently played, 0.0 at the beginning of the animation and the animation duration at the end of the animation. For cycling animations the time is set back to 0.0 after each animation cycle.
export_to_dll float getAnimationWeight (int charid, int aniid)
 returns the weight by which the specified animation is blended
export_to_dll void getBoneBB (int modelid, int boneid, float *dim)
 Returns the coordinates of the initially axis aligned bounding box of a given bone. If animated the bounding boxes are rotated to contain the underlying deformed mesh. If this function is called for boneid 0 then the axis aligned bounding box of the whole body is returned.
export_to_dll float getBoneBoundingCylinderRadius (int modelid, int boneid)
 Returns the radius of the bounding cylinder of a given bone.
export_to_dll char * getBoneChildIds (int modelid, int boneid)
 Returns a string of ids of the bone children of the bone specified by boneid of the avatar specified by modelid.
export_to_dll int getBoneId (int modelid, char *name)
 Returns the id of the bone specified by name of the avatar specified.
export_to_dll char * getBoneName (int modelid, int boneid)
 Returns the name of a bone specified by boneid of the avatar specified by modelid.
export_to_dll int getBoneParentId (int modelid, int boneid)
 Returns the id of the parent bone of the bone specified by boneid of the avatar specified by modelid.
export_to_dll float getDTOne (int modelid)
 Returns the time factor set by setDTOne of the specified avatar.
export_to_dll char * getGPUBoneIdMap (int modelid)
 Retrieves the mapping of the bone ids of the GPU mesh of the given virtual character.
export_to_dll void getInverseParentRotation (int modelid, int boneid, float *matrix)
 Returns the inverse rotation matrix of the parent of the bone specified in matrix. Parameters:.
export_to_dll float * getModelScale (int modelid)
 Gets the scale of the model.
export_to_dll int getNumAnimationTracks (int modelnum, int aninum)
 Return the number of active tracks in the animation.
export_to_dll int getNumBone (int modelid)
 Returns the number of bones in the skeleton of the specified avatar.
export_to_dll int getNumGPUMeshes (int modelid)
 Returns the number of meshes loaded to the GPU for the specified avatar. This number may not be the same as defined in the submeshes of the avatar's meshes, but depends also on the maximum number of bones per mesh setMaxBonesPerMesh.
export_to_dll int getNumMorphTargets (int modelid)
 Returns the number morph targets associated with the specified avatar.
export_to_dll GLuint getProgramID ()
 returns the ID of the currently running Shader program using glGetIntegerv(GL_CURRENT_PROGRAM,&progID);
export_to_dll void getRotation (int modelid, int boneid, float *rotation)
 gets rotation of specified bone of specified avatar relative to its parent bone.
export_to_dll void getRotationAA (int modelid, int boneid, float *rotation)
 gets rotation in axis angle form of the specified bone of specified avatar relative to its parent bone.
export_to_dll void getRotationAAAbs (int modelid, int boneid, float *rotation)
 gets rotation in axis angle form of the specified bone of specified avatar.
export_to_dll void getRotationAAbs (int modelid, int boneid, float *rotation)
 gets rotation in Axis Angle form of the specified bone of specified avatar.
export_to_dll void getRotationAbs (int modelid, int boneid, float *rotation)
 gets rotation as a quaternion form of the specified bone of specified avatar.
export_to_dll void getRotationEuler (int modelid, int boneid, float *rotation)
 gets rotation in Euler angle form of the specified bone of specified avatar relative to its parent bone.
export_to_dll void getRotationEulerAbs (int modelid, int boneid, float *rotation)
 gets rotation in Euler angle form of the specified bone of specified avatar relative to its parent bone.
export_to_dll void getRotationMatrix (int modelid, int boneid, float *matrix)
 gets the rotation in matrix form of the specified bone of specified avatar.
export_to_dll void getRotationMatrixAbs (int modelid, int boneid, float *matrix)
 gets the absolute rotation in matrix form of the specified bone of specified avatar.
export_to_dll void getRotationMatrixBoneSpace (int modelid, int boneid, float *matrix)
 gets the rotation in matrix form of the specified bone of specified avatar.
export_to_dll void getTranslation (int modelid, int boneid, float *translation)
 gets translation of specified bone of specified avatar relative to its parent bone.
export_to_dll void getTranslationAbs (int modelid, int boneid, float *translation)
 gets translation of specified bone of specified avatar in world coordinates
export_to_dll void getTranslationAbsOGL (int modelid, int boneid, float *translation)
 gets translation of specified bone of specified avatar in world coordinates
export_to_dll void getTranslationOGL (int modelid, int boneid, float *translation)
 gets translation of specified bone of specified avatar relative to its parent bone.
export_to_dll void Idle ()
 Reads the current time from the system and updates all skeleton rotation and translations according to the blended animations. Any setRotation or setTranslation function that changes bone transformations will be overwritten. Such functions should be called after the idle function and before the draw function. Idle should be called the first time before any animation commands are issued in order to setup the initial state of the animations. Look also at setDT and setDTOne to find out about how to play back animations of all or one avatar slower or faster.
export_to_dll void IdleOne (int modelID)
 runs idle only on the avatar specified by id
export_to_dll void incMorph (int modelid, int animId, float val)
 Increases the value of the morph animation by the value specified.
export_to_dll int initHALCA (char *workDir)
 initialises the library and sets working directory. This function is called automatically if you are using XVR
export_to_dll int isCycling (int modelid, int aniid)
 Returns true if the animation given by aniid is cycling on the avatar specified by modelid otherwise false.
export_to_dll int isExecuting (int modelid, int aniid)
 Returns the number of times the animation given by aniid is being executed at the moment. It returns -1 if the avatar with modelid doesn't exist and 0 if there is no animation executed.
export_to_dll int isPointInside (int modelid, float *point)
 Returns the id of the bone, if the specified point is inside the bones bounding box. The function searches through all bones of the avatar's skeleton and tests if the given point is inside one of the bone's bounding boxes. If no bone is found that has the point inside the function returns -1.
export_to_dll int isPointInsideCyl (int modelid, float *point, float sphereradius)
 Returns the id of the bone, if the specified sphere is inside the bones bounding cylinder. The function searches through all bones of the avatar's skeleton and tests if the given sphere intersects with one of the bone's bounding cylinders. If no bone is found that intersects with the sphere inside the function returns -1.
export_to_dll int loadAnimation (int charid, char *fname)
 Allows you to load a new animation to the specified avatar.
export_to_dll int loadShaders (char *fnameVS, char *fnameGS, char *fnameFS, char *infoLog)
 loads and compiles a GLSL vertex, geometry and fragment shader to carry out the skin deformations if fnameGS is an empty string then no geometry shader code is loaded.
export_to_dll void loadUniAndAttrIDs (unsigned int dummy)
 loads the required uniform and attribute ids of the specified shader program;
export_to_dll void lockBone (int modelid, int boneid)
 Locks the bone specified not to be influenced by updates.
export_to_dll void lookAt (int modelid, int boneid, float *from, float *to)
 Rotates specified bone of specified avatar in direction between from and to.
export_to_dll void MessageWrite (char *text)
 Write a string to the HALCA messages file. This can be useful to debug OpenGL errors.
export_to_dll int numCharacters (void)
 Returns the number avatars loaded.
export_to_dll void ogreLookAt (int modelID, int headID, float *target, int opposite)
 makes specified bone of specified avatar look in specified direction
export_to_dll void PointAt (int modelID, int boneID, float *target)
 Make specified bone of specified avatar point in target direction.
export_to_dll int reLoadAnimations ()
 Reloads all loaded animations of all loaded avatars. This may be useful for editing animations in another program and to check the results interacitvely.
export_to_dll void removeAct (int modelnum, int aninum)
 Removes an action that was added before. Also those animations are removed that are locked at the final pose .
export_to_dll void removeMorph (int modelid, int animId)
 Removes an animation from the morph animations.
export_to_dll void resetBone (int modelid, int boneid)
 Removes all previous influence to the bone and resets it to the original transformation specified in the skeleton.
export_to_dll void selectMesh (int modelid, int meshid)
 Allows you to select the mesh that should be rendered.
export_to_dll void setAccumulativeRoot (int modelnum, int accumulate)
 Changes the animation mixer behaviour, so that the root position and orientation of an avatar is accumulated.
export_to_dll void setAllBoneState (int modelid, float *state)
 Sets the state of all bones of the specified avatar. The state of the root bone is described by a translation in x, y and z and a rotation given by a quaternion x,y,z,w. The state of all other bones is described only by their rotation by using a quaternion x,y,z,w. Therefore the length of the state vector is 3+4*n where n is the number of bones in the skeleton.
export_to_dll void setCycleAsync (int modelid, int aniid, float delay)
 Change mode of cycling animation to asychronous.
export_to_dll void setDT (float dt)
 Specifies the amount of time to advance in relation to real seconds passed. This is the factor by which the time difference between two successive calls of idle is multiplied in order to compute the new time in the animation.
export_to_dll int setDTOne (int modelid, float dt)
 Like setDT this function sets the factor of time to multiply the difference between 2 calls to idle with. But this function allows you to do that for every character the overall time factor can still be set with setDT.
export_to_dll void setLocalDir (char *workDir, char *cfgDir, char *avatarsDir)
 Changes the directory that contains the data for the avatars.
export_to_dll void setMaxBonesPerMesh (int maxBonesPerMesh)
 Allows you to set the maximum number of bones used in a mesh. If the number of bones exceeds this value then the mesh is separated until all meshes have at most this number of bones attached. This function will only affect subsequent calls to addCharacter. If not set the default value is 29. Note that the max value this can be set to depends on the number of registers supported by the GPU. This number should be identical to the dimension of your transformation matrix or dual quaternion array.
export_to_dll int setModel (int modelPointer)
 Allows you to set a pointer to a cal 3D model loaded from a different application.
export_to_dll void setModelScale (int modelid, float *scale)
 Sets the scale of the model. By default the scale of the avatar is 1.0. This can be changed in the .cfg by changing the scale value. In the .cfg scaling is only possible in a uniform way for all 3 axes x,y,z. By using this function the avatar can be scaled interactively and independently for x,y and z. All getTranslation and setTranslation functions are adapted to correctly reflect this scale.
export_to_dll void setMorph (int modelid, int animId, float val)
 Sets the morph animation to the value specified.
export_to_dll void setMorphMask (int modelid, int animId, float *weights)
 Sets the blend mask of the morph animation to the values specified in weights.
export_to_dll void setPrimitive (int primitive)
 Sets the OpenGL Primitive Type to be used to render all avatars. This can either be GL_POINTS, GL_LINES or GL_TRIANGLES.
export_to_dll void setPrimitiveOne (int modelid, int primitive)
 Sets the OpenGL Primitive Type to be used to render the avatar. This can either be GL_POINTS, GL_LINES or GL_TRIANGLES.
export_to_dll void setRotation (int modelid, int boneid, float *quat)
 Sets the rotation of a specified bone on an avatar.
export_to_dll void setRotationAbs (int modelid, int boneid, float *quat)
 Like setRotation it sets the rotation of a specified bone by a quaternion but it takes the inverse of the absolute rotation of the parent bone so that the rotation to be set is absolute.
export_to_dll void setRotationEuler (int modelid, int boneid, float *euler)
 Sets the rotation of a bone of a given avatar in Euler angles.
export_to_dll void setRotationEulerAbs (int modelid, int boneid, float *euler)
 Like setRotationAbs but uses three Euler angles to set the rotation.
export_to_dll void setRotationMatrix (int modelid, int boneid, float *matrix)
 Like setRotation but uses a 3x3 Rotation Matrix to set the rotation. The matrix has the x, y , z axis respectively as columns.
export_to_dll void setRotationMatrixAbs (int modelid, int boneid, float *matrix)
 Like setRotationAbs but uses a 3x3 Rotation Matrix to set the rotation. The matrix has the x, y , z axis respectively as columns.
export_to_dll void setShaderUniformOne (int modelid, int shaderProgramId, char *uniformName, int num, int typ, float *values)
 sets the values of the uniforms of a shader for a particular avatar. This can be useful for example to change the facial expressions of each avatar loaded in the system. The name of the uniform is assumed to be present in the shader. If the name does not exist in the shader program new values set will be ignored. Since the function needs access to the shader program to identify Uniform locations the opengl context must be active when this function is called.
export_to_dll void setTransformType (int type)
 specifies the transformation information that is sent from HALCA to the graphics card. if the type has a value >= 100 then the visualisation uses an external VBO
export_to_dll void setTranslation (int modelid, int boneid, float *translation)
 set translation of specified bone of specified avatar.
export_to_dll void setUpIK3 (int modelid, int startId, int endId, float *target, float tolerance, int numIter)
 sets up IK to do simple CCD use in combination with doIK3
export_to_dll void setUseTBO (int useTBO)
 Activates or deactivates the use of Texture Buffer Objects for blend shapes. The uniform samplerBuffer vertexmorphs; uniform int numvertices; uniform int nummorphtargets; and attribute float vertexindex; should be used in the vertex shader to access the morph target data, access the number of vertices in the morph targets, access the number of morph targets and to address each vertex by index respectively. If useTBO is set to 1 Texture Buffer Object mode is active and therefore a larger number of morph targets can be used per avatar.
export_to_dll void setVertexWeightThreshold (int modelid, float thresh)
 Sets the threshold that is used when bounding boxes or bounding cylinders are pre-computed. The threshold is used for the comparison of the skinning weight. A low threshold means that the bounding volumes will overlap more.
export_to_dll void setWireFrame (int modelid, int on)
 Switches wireframe rendering on or off.
export_to_dll void showBB (int on)
 Allows you to switch on and off the rendering of axis aligned bounding boxes of all the limbs of all the avatars loaded.
export_to_dll void showBody (int on)
 Allows you to switch on and off rendering of the body meshes of all avatars loaded.
export_to_dll void showSkel (int on)
 Switches skeleton rendering on or off.
export_to_dll void ShutDown ()
 Removes all the avatars from the system and clears the used memory in order to close the system.
export_to_dll void updateBoneBB (int modelid, int boneid)
 Updates the bounding box of the bone of the avatar specified. the state of the underlying mesh.
export_to_dll void updateSkeleton (int modelid)
 updates the skeleton of the avatar to the rotations set with setRotation functions. The function does not update the animation state and therefore is useful for direct manipulation of the state of the bones.
export_to_dll void useShaderOne (int modelid, int shaderProgramId)
 switches the shader so that for avatar the shader with the given program id is used.
export_to_dll void useTextureUnit (GLint textureUnit)
 Specifies which texture unit to use for the diffuse, opacity, normal, gloss and subsurface on the avatar. By default the texture unit used is 0.
export_to_dll void writeFrameAsJpeg (char *fname, int quality)
 Safes the current openGL frame as a jpeg image. This can be used to create video sequences of animations. But the frame rate will reduce if you use this function. Make sure that the OpenGl context is active when this function is executed.

Detailed Description


Function Documentation

export_to_dll int addCharacter ( char *  path,
char *  name 
)

adds a new avatar to the system.

Parameters:
path the path of the avatar data which starts in the current project directory under the data/data/ directory
name the filename of the .cfg file used
export_to_dll void addMorph ( int  modelid,
int  animId 
)

Adds an animation as a morph animation. Characters animated by morph animations can set their posture to any posture specified in the animation file. This is useful for example to open or close a hand. With an animation of a hand making a fist the avatars hand can be interactively controlled between open hand and fist.

Parameters:
modelid,: the id of the avatar.
animId,: the id of the animation to be morphed.
See also:
setMorph, incMorph, removeMorph, setMorphMask
export_to_dll void addRotation ( int  modelid,
int  boneid,
float *  quat 
)

Like setRotation but uses quaternion to add to current rotation of the bone.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
quat,: the quaternion xyzw to be used to multiply with current bone rotation.
See also:
setRotation
export_to_dll void addRotationAbs ( int  modelid,
int  boneid,
float *  quat 
)

Like setRotation but uses quaternion to add to current rotation of the bone and multiplies with the inverse of the parent bone rotation in order to achieve an absolute rotation.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
quat,: the quaternion xyzw to be used to multiply with current bone rotation.
See also:
setRotation
Bug:
the rotation may not be added in the way expected. Use your own quaternion multiplication if in doubt.
export_to_dll void addRotationEuler ( int  modelid,
int  boneid,
float *  euler 
)

Like setRotation but uses vector of Euler angles to set the rotation.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
euler,: the Euler angles. Euler angles are in radians.
export_to_dll void addRotationMatrix ( int  modelid,
int  boneid,
float *  matrix 
)

Like setRotationMatrix but multiplies with current rotation matrix applied to the bone. The matrix has the x, y , z axis respectively as columns.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
matrix,: the 3x3 rotation matrix
See also:
setRotationMatrix
export_to_dll void blendCycle ( int  modelnum,
int  aninum,
float  weight,
float  delay 
)

adds an animation to be blended and cycled.

Parameters:
modelnum,: id of the avatar to add an animation to
aninum,: id of the animation to add to the avatar
weight,: the weight that the animation will reach after the delay
delay,: the number of seconds until the animation is at the specified weight.

The animation is blended in linearly to the specified weight withing the specified delay. The function can be called anytime to increase or decrease the weight of the animation. If the weight is specified to be 0 then the animation is removed once the weight has reached 0 weight. Therefore blendCycle with 0 for both weight and delay is equivalent to the clearCycle function.

See also:
clearCycle(), clearCycleIn(), isCycling()
Todo:
add a function that takes an array of animation ids that are then cycled.
export_to_dll void blendCycleN ( int  modelnum,
int  aninum,
float  weight,
float  delay,
int  num 
)

adds an animation to be blended and cycled. Like blendCycle but allows the user to specify how often the animation should be cycled.

Parameters:
modelnum,: id of the avatar to add an animation to
aninum,: id of the animation to add to the avatar
weight,: the weight that the animation will reach after the delay
delay,: the number of seconds until the animation is at the specified weight.
num,: the number of times it should be cycled.

The number of cycles is counted from the first time the animation is added with this function. The number of cycles that the animation should be cycled can be changed in every call.

See also:
clearCycle(), clearCycleIn(), isCycling(), blendCycle(), setCycleAsync(), blendCycleNMask();
export_to_dll void blendCycleNMask ( int  modelnum,
int  aninum,
float *  weightmask,
float  delay,
int  num 
)

adds an animation to be blended and cycled. Like blendCycleN but allows the user to specify a weight for every joint in the animation.

Parameters:
modelnum,: id of the avatar to add an animation to
aninum,: id of the animation to add to the avatar
weightmask,: the array of weights that the animation tracks will reach after the delay. This has to have a length of the number of bones in the skeleton of the avatar.
delay,: the number of seconds until the animation is at the specified weights.
num,: the number of times it should be cycled.

The weightmask has to be an array of floats that specifies the weight of the animation for each bone of the skeleton.

See also:
clearCycle(), clearCycleIn(), isCycling(), blendCycle(), setCycleAsync();
export_to_dll int boneBoneIntersection ( int  modelid1,
int  modelid2,
int  boneid1,
int  boneid2,
float *  point1,
float *  point2 
)

Returns the distance of the specified point from the specified bone. If the boneid is invalid or does not have a parent bone then the function returns -1.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone.
point,: a 3D vector that contains the point to measure the distance to.
export_to_dll int boneCylinderIntersection ( int  modelid,
int  boneid,
float *  point1,
float *  point2,
float  rad 
)

tests if the specified bone intersects with the specified cylinder. If cylinder radius is chosen to be 0 then the test is equivalent to a cylinder ray intersection test.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone.
point1,: first point defining the cylinder
point2,: second point defining the cylinder
rad,: radius of the cylinder
point,: a 3D vector that contains the point to measure the distance to.
export_to_dll void clearCycle ( int  modelid,
int  aniid 
)

Removes a cycling animation .

Parameters:
modelid,: ID of the avatar to remove a cycling animation from
aniid,: ID of the cycling animation to remove from the avatar
See also:
clearCycleIn(), blendCycle(), isCycling()
export_to_dll void clearCycleIn ( int  modelid,
int  aniid,
float  delay 
)

Removes a cycling animation after a specified delay.

Parameters:
modelid,: ID of the avatar to remove a cycling animation from
aniid,: ID of the cycling animation to removed from the avatar
delay,: time until the animation is removed
See also:
clearCycle(), blendCycle(), isCycling()
export_to_dll void clearMorph ( int  modelID,
int  num,
float  seconds 
)

remove a morphtarget. This sbould not be confused with removeMorph, which deals with Morph animations rather than morph targets.

Parameters:
modelID the id of the avatar
num the id of the morphtarget
seconds how many seconds does it take until the morph is removed
See also:
exeMorph
export_to_dll float distanceToBoundingCylinder ( int  modelid,
int  boneid,
float *  point 
)

Returns the distance of the specified point from the specified bone. If the boneid is invalid or does not have a parent bone then the function returns -1.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone.
point,: a 3D vector that contains the point to measure the distance to.
export_to_dll void doIK ( int  modelid,
int  startId,
int  endId,
float *  target,
float  tolerance,
int  numIter 
)

Carries out simple CCD to do inverse kinematics.

Parameters:
modelid the avatar on which to use IK
startId the boneid on which to start the CCD
endId the id of the bone that should reach the target position
target 3 vector of the target position
tolerance distance between target and end bone position allowed to finish the method
numIter maximum number of iterations until the method gives up.
export_to_dll void doIK3 ( int  modelid,
float *  target 
)

sets up IK to do simple CCD use in combination with doIK3

Parameters:
modelid the avatar on which to use IK
target 3 vector of the target position
export_to_dll void doIKCCD ( int  modelid,
int  startId,
int  endId,
float *  target,
float  tolerance,
int  numIter 
)

Carries out simple CCD to do inverse kinematics.

Parameters:
modelid the avatar on which to use IK
startId the boneid on which to start the CCD
endId the id of the bone that should reach the target position
target 3 vector of the target position
tolerance distance between target and end bone position allowed to finish the method
numIter maximum number of iterations until the method gives up.
export_to_dll void Draw ( float *  reserved  ) 

Draws all Avatars in the system using standard OpenGL Vertex Arrays or with vertex and fragment shader loaded by the library. This function should not be used in combination with shaders loaded by the hosting application.

Parameters:
reserved is reserved.
export_to_dll void DrawExtShader (  ) 

Draws all avatars in the system assuming that a shader is loaded in OpenGL before this function is called. The shader is responsible for carrying out the skin deformations. The library sends the relevant transformation information (matrix transfromation or dual quaternions of each limb to the Vertex shader as Uniform variables. If you use multiple shaders make sure the loadUniAndAttrIDs is called immediately after each shader is started.This makes sure that the library knows the id's of the uniform and attribute variables that are used to send the skeletal transformation information.

See also:
loadUniAndAttrIDs, DrawExtShaderOne
export_to_dll void DrawExtShaderOne ( int  modelid  ) 

Same as DrawExtShader but only the avatar with the given id is drawn.

Parameters:
modelid,: the id of the avatar to be drawn
See also:
DrawExtShader
export_to_dll void exeAct ( int  modelnum,
int  aninum,
float  inTime,
float  outTime,
float  weight,
int  lock 
)

Add an animation to be executed.

Parameters:
modelnum,: ID of the avatar to add an animation to
aninum,: ID of the animation to add to the avatar
inTime,: the time it takes until the animation is added with the full weight specified in the weight parameter
outTime,: the duration of the fade out
weight,: the weight the animation reaches at its maximum
lock,: if true the last pose of the animation will stay on the avatar
See also:
removeAct(), isExecuting(), exeActAt(), exeActPart()
Todo:
allow to pass weights to addMorph as in blendCycleNMask
export_to_dll void exeActAt ( int  modelnum,
int  aninum,
float  inTime,
float  outTime,
float  weight,
int  lock,
float  startTime 
)

Add an animation to be executed after some time. This is useful if a sequence of animations is added to an avatar.

Parameters:
modelnum,: ID of the avatar to add an animation to
aninum,: ID of the animation to add to the avatar
inTime,: the time it takes until the animation is added with the full weight specified in the weight parameter
outTime,: the duration of the fade out
weight,: the weight the animation reaches at its maximum
lock,: if true the last pose of the animation will stay on the avatar
startTime,: the time at which the animation is started. if startTime is negative the animation will be executed after startTime seconds.
export_to_dll void exeActPart ( int  modelnum,
int  aninum,
float  inTime,
float  outTime,
float  weight,
int  lock,
float  startTime,
float  duration 
)

Add an animation to be executed only partially. This is useful if only a part of an animation is required to be played.

Parameters:
modelnum,: ID of the avatar to add an animation to
aninum,: ID of the animation to add to the avatar
inTime,: the time it takes until the animation is added with the full weight specified in the weight parameter
outTime,: the duration of the fade out
weight,: the weight the animation reaches at its maximum
lock,: if true the last pose of the animation will stay on the avatar
startTime,: the time at which the animation is started. if startTime is negative the animation will be executed after startTime seconds.
duration,: the time in seconds how long the animation should be played for. if set to a negative value or to a value larger than the whole animation the whole duration will be played.
export_to_dll void exeMorph ( int  modelID,
int  num,
float  seconds,
float  delay 
)

execute a morphtarget.

Parameters:
modelID the id of the avatar
num the id of the morphtarget
seconds how many seconds should it take till the morph is at 1
delay how long to wait before the morph starts Only works if a morphtarget mesh was loaded. Not supported with shader rendering.
export_to_dll void FileClose (  ) 

Close the file opened. This can be useful to log data to a file.

See also:
FileOpen(), FileWrite()
export_to_dll int FileOpen ( char *  fname  ) 

Opens a file with the name fname. This can be useful to log data to a file.

Parameters:
fname the name and directory of the file to open. this is relative to the project directory
Returns:
true if function succeeded.
Todo:
at the moment only one file can be opened and written to. It may be useful to allow the user to open multiple files.
See also:
FileWrite(), FileClose()
export_to_dll void FileWrite ( char *  text  ) 

Write a string to the file opened. This can be useful to log data to a file.

Parameters:
text the string to be written.
See also:
FileOpen(), FileClose()
export_to_dll void FileWriteFloats ( float *  buf,
int  size 
)

Write an array of floats to the file opened. This can be useful to log data to a file.

Parameters:
buf the array of floats to save.
size the number of elements in the float array.
See also:
FileOpen(), FileClose()
export_to_dll void geomShaderType ( int  shaderProgramId,
int  inout,
int  type 
)

Changes the geometry shader input type to the specified type.

Parameters:
shaderProtramId is the opengl id of the shader program returned in loadShaders
inout if 0 it changes the input primitive otherwise the output primitive of the specified geometry shader
type is the opengl primitive type to be used for the geometry shader input
export_to_dll void getAllBoneState ( int  modelid,
float *  boneState 
)

Returns a vector with the state of all bones of the avatar's skeleton. The state of the root bone is described by a translation in x, y and z and a rotation given by a quaternion x,y,z,w. The state of all other bones is described only by their rotation by using a quaternion x,y,z,w. Therefore the length of the returned float vector is 3+4*n where n is the number of bones in the skeleton.

Parameters:
modelid,: the id of the avatar
boneState,: the state vector containing the root translation and rotation and all joint rotations
See also:
getBoneName
export_to_dll int getAnimationCount ( int  modelid  ) 

Returns the number of animations loaded in the specified avatar.

Parameters:
modelid the id of the avatar
Returns:
number of loaded animations
export_to_dll float getAnimationDuration ( int  modelid,
int  animid 
)

returns the length in seconds of the specified andimation of the specified avatar

Parameters:
modelid the id of the avatar
animid the id of the animation
Returns:
duration of the animation in seconds, assuming real time play back
See also:
setDT,
setDTOne()
export_to_dll char* getAnimationFilename ( int  modelid,
int  animid 
)

returns the filename of the specified animation of the specified avatar

Parameters:
modelid the id of the avatar
animid the id of the animation
Returns:
filename of the specified animation
export_to_dll int getAnimationId ( int  modelid,
char *  aniName 
)

returns the id of the animation specified by name of the specified avatar

Parameters:
modelid the id of the avatar
aniName substring of the name of the animation to search.
Returns:
ID of the specified animation. If the animation is not found -1 is returned.
export_to_dll char* getAnimationName ( int  modelid,
int  animid 
)

returns the name of the specified animation of the specified avatar

Parameters:
modelid the id of the avatar
animid the id of the animation
Returns:
name of the specified animation
export_to_dll float getAnimationNumFrames ( int  modelid,
int  aniid 
)

Gets the number of frames of the animation is saved. This can be used in combination with getAnimationDuration to compute the frame rate at which the animation was saved.

Parameters:
modelid,: ID of the avatar of which to get the animation time.
aniid,: ID of the animation of which to get the time
See also:
clearCycle, clearCycleIn(), blendCycle(), isCycling(), getAnimationDuration()
export_to_dll float getAnimationTime ( int  modelid,
int  aniid 
)

Gets the time at which point the animation is currently played, 0.0 at the beginning of the animation and the animation duration at the end of the animation. For cycling animations the time is set back to 0.0 after each animation cycle.

Parameters:
modelid,: ID of the avatar of which to get the animation time.
aniid,: ID of the animation of which to get the time
See also:
clearCycle, clearCycleIn(), blendCycle(), isCycling(), getAnimationDuration()
export_to_dll float getAnimationWeight ( int  charid,
int  aniid 
)

returns the weight by which the specified animation is blended

Parameters:
charid the id of the avatar
aniid the id of the animation
Returns:
blend weight of specified animation
export_to_dll void getBoneBB ( int  modelid,
int  boneid,
float *  dim 
)

Returns the coordinates of the initially axis aligned bounding box of a given bone. If animated the bounding boxes are rotated to contain the underlying deformed mesh. If this function is called for boneid 0 then the axis aligned bounding box of the whole body is returned.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone
dim,: a 24 vector that contains the coordinates of all 8 corner points of the bounding box.
export_to_dll float getBoneBoundingCylinderRadius ( int  modelid,
int  boneid 
)

Returns the radius of the bounding cylinder of a given bone.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone
Returns:
the radius of the bounding cylinder which is defined as the maximum distance between the bone line segment and any vertex attached.
See also:
isPointInsideCyl
export_to_dll char* getBoneChildIds ( int  modelid,
int  boneid 
)

Returns a string of ids of the bone children of the bone specified by boneid of the avatar specified by modelid.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone
Returns:
character string of ids of bone children. each character in the string encodes a boneid of a child. The string is terminated by a 0
See also:
getBoneName, getBoneParentId
export_to_dll int getBoneId ( int  modelid,
char *  name 
)

Returns the id of the bone specified by name of the avatar specified.

Parameters:
modelid,: the id of the avatar
name,: the name of the bone, can be a substring of the bone searched for. If multiple bones match the search criterion the first one will be returned
Returns:
boneid of the first bone fulfilling the search criterion or -1 if not found.
See also:
getBoneName, getBoneParentId
export_to_dll char* getBoneName ( int  modelid,
int  boneid 
)

Returns the name of a bone specified by boneid of the avatar specified by modelid.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone
export_to_dll int getBoneParentId ( int  modelid,
int  boneid 
)

Returns the id of the parent bone of the bone specified by boneid of the avatar specified by modelid.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone
Returns:
the bone id of the parent bone -1 if no parent bone exists
See also:
getBoneName
export_to_dll float getDTOne ( int  modelid  ) 

Returns the time factor set by setDTOne of the specified avatar.

Parameters:
modelid the id of the avatar of which to get the time factor.
Returns:
the time factor that is used to multiply the time difference between 2 calls of idle.
See also:
setDTOne()
export_to_dll char* getGPUBoneIdMap ( int  modelid  ) 

Retrieves the mapping of the bone ids of the GPU mesh of the given virtual character.

Parameters:
modelid,: id of the virtual character.
export_to_dll void getInverseParentRotation ( int  modelid,
int  boneid,
float *  matrix 
)

Returns the inverse rotation matrix of the parent of the bone specified in matrix. Parameters:.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
matrix,: the 3x3 rotation matrix
export_to_dll float* getModelScale ( int  modelid  ) 

Gets the scale of the model.

Parameters:
modelid,: the id of the avatar
Returns:
a 3 vector that specifies the scale for the x y and z axis
See also:
setTranslation, getTranslation, setModelScale
export_to_dll int getNumAnimationTracks ( int  modelnum,
int  aninum 
)

Return the number of active tracks in the animation.

Parameters:
modelnum,: ID of the avatar to add an animation to
aninum,: ID of the animation to add to the avatar
export_to_dll int getNumBone ( int  modelid  ) 

Returns the number of bones in the skeleton of the specified avatar.

Parameters:
modelid the id of the avatar
Returns:
the number of bones in the skeleton of the specified avatar
See also:
getBoneName, getBoneParentId
export_to_dll int getNumGPUMeshes ( int  modelid  ) 

Returns the number of meshes loaded to the GPU for the specified avatar. This number may not be the same as defined in the submeshes of the avatar's meshes, but depends also on the maximum number of bones per mesh setMaxBonesPerMesh.

Parameters:
modelid,: the id of the avatar to query.
See also:
setMaxBonesPerMesh
export_to_dll int getNumMorphTargets ( int  modelid  ) 

Returns the number morph targets associated with the specified avatar.

Parameters:
modelid,: the id of the avatar to query.
See also:
setUseTBO
export_to_dll GLuint getProgramID (  ) 

returns the ID of the currently running Shader program using glGetIntegerv(GL_CURRENT_PROGRAM,&progID);

Returns:
the id of the currently running shader program
See also:
drawExtShader
export_to_dll void getRotation ( int  modelid,
int  boneid,
float *  rotation 
)

gets rotation of specified bone of specified avatar relative to its parent bone.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
rotation 4 vector containing the quaternion x y z w of the rotation The rotation is relative to the parent bone and also dependent on the scale value set in the character configuration.
See also:
setRotation, getRotation. addRotation, setRotationAbs
export_to_dll void getRotationAA ( int  modelid,
int  boneid,
float *  rotation 
)

gets rotation in axis angle form of the specified bone of specified avatar relative to its parent bone.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
rotation 4 vector containing the angle and the axis of the rotation w x y z The rotation is relative to the parent bone and also dependent on the scale value set in the character configuration.
See also:
getRotation
export_to_dll void getRotationAAAbs ( int  modelid,
int  boneid,
float *  rotation 
)

gets rotation in axis angle form of the specified bone of specified avatar.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
rotation 4 vector containing the angle and the axis of the rotation w x y z The rotation is absolute and takes the whole hierarchy of rotations of the parent bones into account.
See also:
getRotationAbs
export_to_dll void getRotationAAbs ( int  modelid,
int  boneid,
float *  rotation 
)

gets rotation in Axis Angle form of the specified bone of specified avatar.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
rotation 4 vector containing the axis angle of the rotation x y z The rotation is absolute and takes the whole hierarchy of rotations of the parent bones into account.
See also:
getRotationAbs
export_to_dll void getRotationAbs ( int  modelid,
int  boneid,
float *  rotation 
)

gets rotation as a quaternion form of the specified bone of specified avatar.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone
rotation,: 4 vector containing the quaternion of the rotation x y z w The rotation is absolute and takes the whole hierarchy of rotations of the parent bones into account.
export_to_dll void getRotationEuler ( int  modelid,
int  boneid,
float *  rotation 
)

gets rotation in Euler angle form of the specified bone of specified avatar relative to its parent bone.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
rotation 3 vector containing the Euler angles of the rotation x y z. Euler angles are in radians. The rotation is relative to the parent bone and also dependent on the scale value set in the character configuration.
See also:
getRotation
export_to_dll void getRotationEulerAbs ( int  modelid,
int  boneid,
float *  rotation 
)

gets rotation in Euler angle form of the specified bone of specified avatar relative to its parent bone.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
rotation 3 vector containing the Euler angles of the rotation x y z. Euler angles are in radians. The rotation is absolute and takes the whole hierarchy of rotations of the parent bones into account.
See also:
getRotationAbs
export_to_dll void getRotationMatrix ( int  modelid,
int  boneid,
float *  matrix 
)

gets the rotation in matrix form of the specified bone of specified avatar.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone.
matrix rotation 9 vector containing the 3x3 rotation matrix xx xy xz yx yy yz zx zy zz The rotation is absolute and takes the whole hierarchy of rotations of the parent bones into account.
See also:
getRotation
export_to_dll void getRotationMatrixAbs ( int  modelid,
int  boneid,
float *  matrix 
)

gets the absolute rotation in matrix form of the specified bone of specified avatar.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone.
matrix rotation 9 vector containing the 3x3 rotation matrix xx xy xz yx yy yz zx zy zz The rotation is absolute and takes the whole hierarchy of rotations of the parent bones into account.
See also:
getRotationAbs
export_to_dll void getRotationMatrixBoneSpace ( int  modelid,
int  boneid,
float *  matrix 
)

gets the rotation in matrix form of the specified bone of specified avatar.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone.
matrix rotation 9 vector containing the 3x3 rotation matrix xx xy xz yx yy yz zx zy zz The rotation is absolute and takes the whole hierarchy of rotations of the parent bones into account.
See also:
getRotation
export_to_dll void getTranslation ( int  modelid,
int  boneid,
float *  translation 
)

gets translation of specified bone of specified avatar relative to its parent bone.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
translation 3 vector of the translate set in the bone The translation is relative to the parent bone and also dependent on the scale value set in the character configuration
export_to_dll void getTranslationAbs ( int  modelid,
int  boneid,
float *  translation 
)

gets translation of specified bone of specified avatar in world coordinates

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
translation 3 vector of the translate set in the bone The translation is relative to the parent bone and also dependent on the scale value set in the character configuration
export_to_dll void getTranslationAbsOGL ( int  modelid,
int  boneid,
float *  translation 
)

gets translation of specified bone of specified avatar in world coordinates

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
translation 3 vector of the translate set in the bone The translation is relative to the parent bone and also dependent on the scale value set in the character configuration. In addition the coodinates returned are modified from the typical 3DS Max coodinate system with the z axis up to the typical opengl coodinate system which has the y axis up
export_to_dll void getTranslationOGL ( int  modelid,
int  boneid,
float *  translation 
)

gets translation of specified bone of specified avatar relative to its parent bone.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
translation 3 vector of the translate set in the bone The translation is relative to the parent bone and also dependent on the scale value set in the character configuration. In addition the coodinates returned are modified from the typical 3DS Max coodinate system with the z axis up to the typical opengl coodinate system which has the y axis up
export_to_dll void Idle (  ) 

Reads the current time from the system and updates all skeleton rotation and translations according to the blended animations. Any setRotation or setTranslation function that changes bone transformations will be overwritten. Such functions should be called after the idle function and before the draw function. Idle should be called the first time before any animation commands are issued in order to setup the initial state of the animations. Look also at setDT and setDTOne to find out about how to play back animations of all or one avatar slower or faster.

See also:
setDT(), setDTOne(), setTranslation(), setRotation(), exeAct(), blendCycle(), addMorph(), setMorph(), incMorph(), exeActAt(), exeActPart()
export_to_dll void IdleOne ( int  modelID  ) 

runs idle only on the avatar specified by id

Parameters:
modelID,: the id of the avatar
export_to_dll void incMorph ( int  modelid,
int  animId,
float  val 
)

Increases the value of the morph animation by the value specified.

Parameters:
modelid,: the id of the avatar
animId,: the id of the animation to be morphed.
val,: the value by which to increase the morph. this can be negative to go backwards in the animation.

the animation has to be added with addMorph so that it can be used as a morph animation.

See also:
setMorph, addMorph, removeMorph
export_to_dll int initHALCA ( char *  workDir  ) 

initialises the library and sets working directory. This function is called automatically if you are using XVR

Parameters:
workDir the name of the main directory where the data is stored.
See also:
setLocalDir
export_to_dll int isCycling ( int  modelid,
int  aniid 
)

Returns true if the animation given by aniid is cycling on the avatar specified by modelid otherwise false.

Parameters:
modelid,: ID of the avatar to add an animation to
aniid,: ID of the animation to add to the avatar
See also:
clearCycle, clearCycleIn, blendCycle
export_to_dll int isExecuting ( int  modelid,
int  aniid 
)

Returns the number of times the animation given by aniid is being executed at the moment. It returns -1 if the avatar with modelid doesn't exist and 0 if there is no animation executed.

Parameters:
modelid,: ID of the avatar to add an animation to
aniid,: ID of the animation to add to the avatar
See also:
exeAct, removeAct
export_to_dll int isPointInside ( int  modelid,
float *  point 
)

Returns the id of the bone, if the specified point is inside the bones bounding box. The function searches through all bones of the avatar's skeleton and tests if the given point is inside one of the bone's bounding boxes. If no bone is found that has the point inside the function returns -1.

Parameters:
modelid,: the id of the avatar
point,: a 3 vector containing the position of the point to test.
export_to_dll int isPointInsideCyl ( int  modelid,
float *  point,
float  sphereradius 
)

Returns the id of the bone, if the specified sphere is inside the bones bounding cylinder. The function searches through all bones of the avatar's skeleton and tests if the given sphere intersects with one of the bone's bounding cylinders. If no bone is found that intersects with the sphere inside the function returns -1.

Parameters:
modelid,: the id of the avatar
point,: a 3 vector containing the position of the point to test.
sphereradius,: the radius of the sphere that tested.
export_to_dll int loadAnimation ( int  charid,
char *  fname 
)

Allows you to load a new animation to the specified avatar.

Parameters:
charid the id of the character to which to add the specified animation
fname the filename of the animation relative to the avatars path
Returns:
the new id of the loaded animation
export_to_dll int loadShaders ( char *  fnameVS,
char *  fnameGS,
char *  fnameFS,
char *  infoLog 
)

loads and compiles a GLSL vertex, geometry and fragment shader to carry out the skin deformations if fnameGS is an empty string then no geometry shader code is loaded.

Parameters:
fnameVS,: the filename of the Vertex Shader to be loaded
fnameGS,: the filename of the Geometry Shader to be loaded
fnameFS,: the filename of the Fragement Shader to be loaded
infoLog,: space for the log string that is returned when compiling
Returns:
opengl id of shaderprogram
void Viewer::loadUniAndAttrIDs ( unsigned int  dummy  ) 

loads the required uniform and attribute ids of the specified shader program;

Parameters:
dummy reserved for compatibility reasons

The shader program has to contain the following Attributes: "weight", "index", "normal" and "texturecoord" are used

In mode TRANSFORM_TM the following Uniforms are used: "transforms", "tex" and "envMap" are used. envMap was used for the case that an environment map is loaded in the library. This is better done by the host application.

In the the modes that use dual quaternions for the skin blending uniforms "quats" and "trans" are used.

See also:
drawExtShader
export_to_dll void lockBone ( int  modelid,
int  boneid 
)

Locks the bone specified not to be influenced by updates.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
export_to_dll void lookAt ( int  modelid,
int  boneid,
float *  from,
float *  to 
)

Rotates specified bone of specified avatar in direction between from and to.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
from 3 vector
to 3 vector
export_to_dll void MessageWrite ( char *  text  ) 

Write a string to the HALCA messages file. This can be useful to debug OpenGL errors.

Parameters:
text the string to be written.
export_to_dll int numCharacters ( void   ) 

Returns the number avatars loaded.

Returns:
the number of avatars added to the system
export_to_dll void ogreLookAt ( int  modelID,
int  headID,
float *  target,
int  opposite 
)

makes specified bone of specified avatar look in specified direction

Parameters:
modelID the avatar which to change the lookat
headID the boneid on which to start the CCD
target the position where to look at
opposite look exactly in the opposite direction of the specified position
export_to_dll void PointAt ( int  modelID,
int  boneID,
float *  target 
)

Make specified bone of specified avatar point in target direction.

Parameters:
modelID the avatar to make point
boneID the boneid to make point
target 3 vector of the target position
Bug:
doesn't take reference coordinate system properly into account
Todo:
fix it

instead.

export_to_dll int reLoadAnimations (  ) 

Reloads all loaded animations of all loaded avatars. This may be useful for editing animations in another program and to check the results interacitvely.

Returns:
0
Bug:
doesn't work as expected
export_to_dll void removeAct ( int  modelnum,
int  aninum 
)

Removes an action that was added before. Also those animations are removed that are locked at the final pose .

Parameters:
modelnum,: ID of the avatar to add an animation to
aninum,: ID of the animation to add to the avatar
See also:
exeAct
export_to_dll void removeMorph ( int  modelid,
int  animId 
)

Removes an animation from the morph animations.

Parameters:
modelid,: the id of the avatar
animId,: the id of the animation to be morphed.
export_to_dll void resetBone ( int  modelid,
int  boneid 
)

Removes all previous influence to the bone and resets it to the original transformation specified in the skeleton.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
See also:
idle
setRotation
export_to_dll void selectMesh ( int  modelid,
int  meshid 
)

Allows you to select the mesh that should be rendered.

Parameters:
modelid,: the id of the avatar
meshid,: the id of the mesh to be rendered. If meshid is -1 all meshes of the avatar are rendered.
See also:
setMaxBonesPerMesh
getNumGPUMeshes
export_to_dll void setAccumulativeRoot ( int  modelnum,
int  accumulate 
)

Changes the animation mixer behaviour, so that the root position and orientation of an avatar is accumulated.

Parameters:
modelnum,: ID of the avatar to add an animation to
accumulate,: if not 0 accumulation behaviour is switched on.
See also:
blendCycle
export_to_dll void setAllBoneState ( int  modelid,
float *  state 
)

Sets the state of all bones of the specified avatar. The state of the root bone is described by a translation in x, y and z and a rotation given by a quaternion x,y,z,w. The state of all other bones is described only by their rotation by using a quaternion x,y,z,w. Therefore the length of the state vector is 3+4*n where n is the number of bones in the skeleton.

Parameters:
modelid,: the id of the avatar
state,: the state vector containing the root translation and all joint rotations
See also:
getBoneName, getNumBone
export_to_dll void setCycleAsync ( int  modelid,
int  aniid,
float  delay 
)

Change mode of cycling animation to asychronous.

Parameters:
modelid,: ID of the avatar of which to change a cycling animation to Asynchronous
aniid,: ID of the cycling animation
delay,: time until the animation is removed
See also:
clearCycle(), blendCycle(), isCycling() By default animation cycles are in synchronous mode which means that the animation mixer tries to match the durations of all currently cycling animations, so that all animations cycle for the same duration.
clearCycle(), clearCycleIn(), isCycling(), blendCycle(), blendCycleNMask();
export_to_dll void setDT ( float  dt  ) 

Specifies the amount of time to advance in relation to real seconds passed. This is the factor by which the time difference between two successive calls of idle is multiplied in order to compute the new time in the animation.

Parameters:
dt,: the factor with which to multiply the time difference between 2 calls of idle.
See also:
setDTOne
export_to_dll int setDTOne ( int  modelid,
float  dt 
)

Like setDT this function sets the factor of time to multiply the difference between 2 calls to idle with. But this function allows you to do that for every character the overall time factor can still be set with setDT.

Parameters:
modelid the id of the avatar of which to change the time factor.
dt the time factor with which to multiply the time difference between 2 calls of idle.
See also:
setDT
getAnimationDuration
export_to_dll void setLocalDir ( char *  workDir,
char *  cfgDir,
char *  avatarsDir 
)

Changes the directory that contains the data for the avatars.

Parameters:
workDir the name of the main directory where the data is stored. If this is a null pointer then the XVR project directory is used.
cfgDir the name of the subdirectory containing the .cfg files (default is data\)
avatarsDir the name of the subdirectory that contains the avatars (default is data\data\)
See also:
initHALCA
void Model::setMaxBonesPerMesh ( int  maxBonesPerMesh  ) 

Allows you to set the maximum number of bones used in a mesh. If the number of bones exceeds this value then the mesh is separated until all meshes have at most this number of bones attached. This function will only affect subsequent calls to addCharacter. If not set the default value is 29. Note that the max value this can be set to depends on the number of registers supported by the GPU. This number should be identical to the dimension of your transformation matrix or dual quaternion array.

Parameters:
maxBonesPerMesh,: the id of the mesh to be rendered. If meshid is -1 all meshes of the avatar are rendered.
export_to_dll int setModel ( int  modelPointer  ) 

Allows you to set a pointer to a cal 3D model loaded from a different application.

Parameters:
modelPointer an integer encoding a pointer to the specified cal3D model
Returns:
1 if successful
export_to_dll void setModelScale ( int  modelid,
float *  scale 
)

Sets the scale of the model. By default the scale of the avatar is 1.0. This can be changed in the .cfg by changing the scale value. In the .cfg scaling is only possible in a uniform way for all 3 axes x,y,z. By using this function the avatar can be scaled interactively and independently for x,y and z. All getTranslation and setTranslation functions are adapted to correctly reflect this scale.

Parameters:
modelid,: the id of the avatar
scale a 3 vector that specifies the scale for the x y and z axis
See also:
setTranslation, getTranslation, getModelScale
export_to_dll void setMorph ( int  modelid,
int  animId,
float  val 
)

Sets the morph animation to the value specified.

Parameters:
modelid,: the id of the avatar
animId,: the id of the animation to be morphed.
val,: the value to which to set the animation between 0 the beginning of the animation an 1 the end of the animation.

The animation has to be added with addMorph so that it can be used as a morph animation.

See also:
addMorph, incMorph, removeMorph, setMorphMask
export_to_dll void setMorphMask ( int  modelid,
int  animId,
float *  weights 
)

Sets the blend mask of the morph animation to the values specified in weights.

Parameters:
modelid,: the id of the avatar
animId,: the id of the animation to be morphed.
weights,: a vector of float values that defines the weight for each bone of the skeleton for the animation specified by animId.

The animation has to be added with addMorph so that it can be used as a morph animation.

See also:
addMorph, incMorph, removeMorph
bool Viewer::setPrimitive ( int  primitive  ) 

Sets the OpenGL Primitive Type to be used to render all avatars. This can either be GL_POINTS, GL_LINES or GL_TRIANGLES.

See also:
setPrimitiveOne
export_to_dll void setPrimitiveOne ( int  modelid,
int  primitive 
)

Sets the OpenGL Primitive Type to be used to render the avatar. This can either be GL_POINTS, GL_LINES or GL_TRIANGLES.

See also:
setPrimitive, DrawExtShaderOne
export_to_dll void setRotation ( int  modelid,
int  boneid,
float *  quat 
)

Sets the rotation of a specified bone on an avatar.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone
quat,: the quaternion

The rotation is relative to the previous bone in the hierarchy.

See also:
addRotation
export_to_dll void setRotationAbs ( int  modelid,
int  boneid,
float *  quat 
)

Like setRotation it sets the rotation of a specified bone by a quaternion but it takes the inverse of the absolute rotation of the parent bone so that the rotation to be set is absolute.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
quat,: the quaternion x y z w
export_to_dll void setRotationEuler ( int  modelid,
int  boneid,
float *  euler 
)

Sets the rotation of a bone of a given avatar in Euler angles.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
euler,: a 3 vector containing the 3 euler angles. Euler angles are in radians.
See also:
addRotation, setRotation
export_to_dll void setRotationEulerAbs ( int  modelid,
int  boneid,
float *  euler 
)

Like setRotationAbs but uses three Euler angles to set the rotation.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
euler,: the 3 vector containing the Euler angles. Euler angles are in radians.
See also:
setRotation, addRotation
export_to_dll void setRotationMatrix ( int  modelid,
int  boneid,
float *  matrix 
)

Like setRotation but uses a 3x3 Rotation Matrix to set the rotation. The matrix has the x, y , z axis respectively as columns.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
matrix,: the 3x3 rotation matrix
See also:
setRotation
export_to_dll void setRotationMatrixAbs ( int  modelid,
int  boneid,
float *  matrix 
)

Like setRotationAbs but uses a 3x3 Rotation Matrix to set the rotation. The matrix has the x, y , z axis respectively as columns.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone to be rotated.
matrix,: the 3x3 rotation matrix
See also:
setRotationAbs
export_to_dll void setShaderUniformOne ( int  modelid,
int  shaderProgramId,
char *  uniformName,
int  num,
int  typ,
float *  values 
)

sets the values of the uniforms of a shader for a particular avatar. This can be useful for example to change the facial expressions of each avatar loaded in the system. The name of the uniform is assumed to be present in the shader. If the name does not exist in the shader program new values set will be ignored. Since the function needs access to the shader program to identify Uniform locations the opengl context must be active when this function is called.

Parameters:
modelid the id of the avatar of which to change the uniform.
shaderProgramId the id of the shader of which to change the uniform.
uniformName the name of the Uniform to change the values of.
num number of elements of the Uniform
typ the type of the elements float, int, vec2, vec3 vec4 or matrix types
values the value(s) that the uniform should be set to.
export_to_dll void setTransformType ( int  type  ) 

specifies the transformation information that is sent from HALCA to the graphics card. if the type has a value >= 100 then the visualisation uses an external VBO

Parameters:
type the type to use
0... Vertex Arrays
1... Transformation Matrices 4x4 16
2... Rotation Matrix and tranlation 3x3+3=12
3... Quaternion and translation 4+3=7
4... exponential quaternion and translation 3+3=6
6... dual quaternion 4+4=8
export_to_dll void setTranslation ( int  modelid,
int  boneid,
float *  translation 
)

set translation of specified bone of specified avatar.

Parameters:
modelid,: the id of the avatar
boneid the id of the bone
translation 3 vector to translate by The translation set is relative to the parent bone and also dependent on the scale value set in the character configuration
export_to_dll void setUpIK3 ( int  modelid,
int  startId,
int  endId,
float *  target,
float  tolerance,
int  numIter 
)

sets up IK to do simple CCD use in combination with doIK3

Parameters:
modelid the avatar on which to use IK
startId the boneid on which to start the CCD
endId the id of the bone that should reach the target position
target 3 vector of the target position
tolerance distance between target and end bone position allowed to finish the method
numIter maximum number of iterations until the method gives up.
export_to_dll void setUseTBO ( int  useTBO  ) 

Activates or deactivates the use of Texture Buffer Objects for blend shapes. The uniform samplerBuffer vertexmorphs; uniform int numvertices; uniform int nummorphtargets; and attribute float vertexindex; should be used in the vertex shader to access the morph target data, access the number of vertices in the morph targets, access the number of morph targets and to address each vertex by index respectively. If useTBO is set to 1 Texture Buffer Object mode is active and therefore a larger number of morph targets can be used per avatar.

Parameters:
useTBO if set to 0 then vertex attributes are used for blendshapes otherwise texture buffer objects.
export_to_dll void setVertexWeightThreshold ( int  modelid,
float  thresh 
)

Sets the threshold that is used when bounding boxes or bounding cylinders are pre-computed. The threshold is used for the comparison of the skinning weight. A low threshold means that the bounding volumes will overlap more.

Parameters:
modelid,: the id of the avatar of which to change the threshold
thresh,: the vertex weight threshold used to compute bounding volumes. The default value is 0.5
export_to_dll void setWireFrame ( int  modelid,
int  on 
)

Switches wireframe rendering on or off.

Parameters:
modelid,: ID of the avatar to render in wireframe
on,: if 0 it turns wireframe rendering off otherwise on. Obsolete, its better to do this in the host application by changing the openGL states for example by using the glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); function.
export_to_dll void showBB ( int  on  ) 

Allows you to switch on and off the rendering of axis aligned bounding boxes of all the limbs of all the avatars loaded.

Parameters:
on,: if on different to 0 then the bounding boxes will be rendered Only relevant if shaders are NOT used for rendering.
export_to_dll void showBody ( int  on  ) 

Allows you to switch on and off rendering of the body meshes of all avatars loaded.

Parameters:
on,: if on is different to 0 then the body will be rendered

Only relevant if shaders are NOT used for rendering.

export_to_dll void showSkel ( int  on  ) 

Switches skeleton rendering on or off.

Parameters:
on,: if on is different to 0 then the skeletons of all avatars will be rendered. do not use this function with shaders.
export_to_dll void ShutDown (  ) 

Removes all the avatars from the system and clears the used memory in order to close the system.

See also:
addCharacter
export_to_dll void updateBoneBB ( int  modelid,
int  boneid 
)

Updates the bounding box of the bone of the avatar specified. the state of the underlying mesh.

Parameters:
modelid,: the id of the avatar
boneid,: the id of the bone
See also:
getBoneBB
export_to_dll void updateSkeleton ( int  modelid  ) 

updates the skeleton of the avatar to the rotations set with setRotation functions. The function does not update the animation state and therefore is useful for direct manipulation of the state of the bones.

Parameters:
modelid,: the id of the avatar
See also:
setRotation, addRotation, getRotation
export_to_dll void useShaderOne ( int  modelid,
int  shaderProgramId 
)

switches the shader so that for avatar the shader with the given program id is used.

Parameters:
modelid the id of the avatar of which to change the shader.
shaderProgramId the id of the shader to use for this avatar.
bool Viewer::useTextureUnit ( GLint  textureUnit  ) 

Specifies which texture unit to use for the diffuse, opacity, normal, gloss and subsurface on the avatar. By default the texture unit used is 0.

Parameters:
textureUnit,: The id of the openGL texture unit to be used.
Todo:
add map type information to material file.
export_to_dll void writeFrameAsJpeg ( char *  fname,
int  quality 
)

Safes the current openGL frame as a jpeg image. This can be used to create video sequences of animations. But the frame rate will reduce if you use this function. Make sure that the OpenGl context is active when this function is executed.

Parameters:
fname specifies the filename of the image to be saved.
quality between 0 and 100 that specifies the quality of the jpeg file to be saved.