Base class for all complex model types. More...
#include <GModel.h>
Public Member Functions | |
GModel () | |
standard constructor | |
GModel (GSkeleton *_Skeleton, GAnimatedMesh *_Mesh, GAnimationManager *AnimationManager) | |
constructor for use with modelloader | |
~GModel () | |
standard destructor | |
virtual int | Draw (double time, double dtime, GMatrix16 *viewmatrix, GMatrix16 *worldmatrix, int FLAGS) |
draw model with a viewmatrix | |
virtual int | DrawSprites (double time, double dtime, GMatrix16 *viewmatrix, GMatrix16 *worldmatrix, int FLAGS) |
draw sprites with a viewmatrix | |
int | RecalculateBoneData (void) |
recalculate data needed vor gpu-based vertex skinning | |
unsigned int | GetMeshCount (void) |
get number of registered meshes | |
GVec4f | GetOffset (void) |
get offset from world position | |
void | SetOffset (GVec4f _offset) |
set offset from world position | |
NxCCDSkeleton * | GetCCDSkeleton (void) |
obtain pointer to ccd skeleton as used with the physix sdk | |
void | SetCCDSkeleton (NxCCDSkeleton *s) |
set new pointer to ccd skeleton as used with the physix sdk | |
Command | GetCurrentCommand (void) |
get the current command | |
void | SetCurrentCommand (Command c) |
set the current command | |
Command | GetNextCommand (void) |
void | SetNextCommand (Command c) |
NxActor * | SetActor (NxActor *a) |
NxActor * | GetActor (void) |
void | SetVelocity (GVec4f _v) |
GVec4f | GetVelocity (void) |
ActionState | GetState (void) |
int | OutLineMappedVertices (int FLAGS) |
outline vertices that are registered in the vertexmapper structure (debug function, DEPRECATED) | |
int | Skin (int FLAGS) |
skin mesh | |
int | Rotate (GVec4f _Rotations) |
Rotate a model in world space. | |
GSkeleton * | GetSkeleton (void) |
acquire pointer to attached skeleton | |
float | GetMass (void) |
get the models mass | |
void | SetMass (float _m) |
set the models mass | |
int | SetSkeleton (GSkeleton *s) |
attach skeleton to model | |
void | setCamera (GCamera *cam) |
attach camera to model (make the camera follow that model) | |
GAnimatedMesh * | GetMesh (int pos=0) |
acquire pointer to attached mesh | |
GAnimationManager * | GetAnimationManager (void) |
return pointer to attached animationmanager | |
virtual GBoundingBox * | GetBoundingBox (void) |
return pointer to attached boundingbox | |
virtual GBoundingSphere * | GetBoundingSphere (void) |
return pointer to attached boundingsphere | |
int | UpdateAnimation (float now, int FLAGS) |
update animation | |
int | ResetAnimation (void) |
reset current animation to time 0 | |
int | ComposeModel (std::string Path, std::string Modelname, std::string Skeletonname, animationlibrary_t *AnimationLibrary, keyframelibrary_t *KeyframeLibrary) |
compose model from mesh, skeleton, animationlibrary and keyframelibrary | |
int | Move (GVec4f v) |
move model in world space | |
int | Move (float x, float y, float z) |
move model in world space | |
void | queryPosition (GVec4f *v) |
query x,y,z position | |
virtual int | setPosition (GVec4f v) |
set x,y,z position | |
void | queryRotation (GVec4f *v) |
query x,y,z position | |
GVec4f | getLookDir () |
query models look direction | |
virtual int | setRotation (GVec4f v) |
set x,y,z position | |
int | AddMesh (GAnimatedMesh *_Mesh) |
add new (sub)mesh to model | |
int | SetMesh (GAnimatedMesh *_Mesh, int pos=-1) |
Assign the model a Mesh. | |
int | RecalculateBoundingBox (int FLAGS) |
Recalculate the surrounding boundingbox. | |
int | RecalculateBoundingSphere (int FLAGS) |
Recalculate the surrounding boundingsphere. | |
GGraphicsObject * | GetParent (void) |
Get parent object. | |
int | SetParent (GGraphicsObject *_Parent) |
Attach to a parent. | |
void | SetVelocityMemory (GVec4f m) |
assign the model a velocity to remember | |
GVec4f | GetVelocityMemory (void) |
query remembered velocity | |
int | CreateDefaultSkeleton (int FLAGS) |
Create a default skeleton with only a root-bone. | |
int | CreateDefaultVertexMapper (int FLAGS) |
Create a default vertex mapper with all vertices mapped to the rootbone. | |
int | MoveTo (GVec4f v) |
Move model to coordinate. | |
int | AddAnimationManager (GAnimationManager *AM=NULL) |
Add either a default or a specified Animation Manager. | |
int | SetAnimationManager (GAnimationManager *am) |
Set active animation manager to existing animation manager. | |
virtual int | RebuildMatrix (void) |
recalculate world space matrix | |
GVec4f | GetLinearVelocity (void) |
obtain linear velocity | |
int | SetBoundingType (BoundingType b) |
set bounding type | |
BoundingType | GetBoundingType (void) |
get bounding type | |
NxController * | GetController (void) |
obtain pointer to controller as registered with physx api | |
void | SetController (NxController *_c) |
set controller as used with physx api | |
bool | IsFalling (void) |
true if model is in "falling" state (this should be moved to Creature) | |
bool | IsJumping (void) |
true if model is in "jumping" state (this should be moved to Creature) | |
bool | IsRunning (void) |
true if model is in "running" state (this should be moved to Creature) | |
bool | IsIdle (void) |
true if model is in "idle" state (this should be moved to Creature) | |
void | SetRunningDirection (GVec4f d) |
running direction (this should be moved to Creature) | |
void | SetJumpingDirection (GVec4f d) |
jumping direction (this should be moved to Creature) | |
int | SetState (ActionState s) |
set current action state | |
void | Lock (void) |
protect model from further inputs | |
void | Unlock (void) |
unprotect model from further inputs | |
void | SetFallingStart (double d) |
Set a timestamp to mark the beginning of free fall or jumping (this should be moved to Creature). | |
double | GetFallingStart (void) |
Get timestamp that marks the beginning of free fall or jumping (this should be moved to Creature). | |
bool | IsLocked (void) |
check wheter model is protected against inputs | |
GMatrix16 | GetRotationMatrix (void) |
obtain world space rotation matrix | |
GVec4f | GetWorldSpaceCenter (void) |
obtain world space center. this is the models position + (the boundingbox->minvalues + ((boundingbox->maxvalues - boundingbox->minvalues) / 2)) | |
GMatrix16 | GetWorldSpaceMatrix (void) |
obtain world space transformations | |
virtual int | Update (double time, double dtime) |
update model | |
float | GetSpeed (void) |
get speed | |
void | SetSpeed (float) |
set speed | |
vector< GAnimatedMesh * > | GetMeshes (void) |
Get a list of all registered meshes. | |
int | SetMeshes (vector< GAnimatedMesh * >) |
reset the submesh-list. this will copy geometry and vertexmapping. Also, each submeshes model reference will be set to this. | |
Public Attributes | |
HitCallBack | myHitCallBack |
Hit callback to be invoked if collision with another PhysX actor is detected. | |
Protected Attributes | |
GSkeleton * | Skeleton |
model skeleton for animation and skinning | |
vector< GAnimatedMesh * > | Meshes |
list of animated meshes | |
GBoundingSphere * | BoundingSphere |
bounding sphere for simple collision detection | |
GBoundingBox * | BoundingBox |
bounding box for simple collision detection | |
GAnimationManager * | AnimationManager |
animation-manager for keyframe interpolation | |
GVec4f | Position |
Model position in world space. | |
GVec4f | Offset |
Offset from world space position. | |
GVec4f | Rotation |
Model rotation in world space. | |
GVec4f | JumpDir |
Direction of jump (this should be moved to Creature). | |
GVec4f | RunDir |
Direction of run (this should be moved to Creature). | |
float | Speed |
Running speed (this should be moved to Creature). | |
float | JumpPower |
Jump height (this should be moved to Creature). | |
vector< GGraphicsObject * > | Children |
Attached graphics objects. | |
GGraphicsObject * | Parent |
Graphics object the model is attached to (e.g. a moving platform). | |
GCamera * | Camera |
Model-Viewing-Camera. | |
float | m_Mass |
The model's mass. | |
GVec4f | mVelocityMemory |
Direction of movement before fall was initiated (this should be somehow generalized). | |
ActionState | State |
Current action (this should be moved to Creature). | |
keyframe_t * | IntermediateKeframe |
Intermediate Keyframe to interpolate animation from arbitrary point. | |
bool | lock |
Locks the model against state-changes. | |
double | FallingStart |
Begin time of free fall (or jumping) (this should be moved to Creature). | |
GMatrix16 | WorldSpaceMatrix |
world-space transformations | |
BoundingType | m_BoundingType |
BoundingType (sphere, cube, ...). | |
NxActor * | m_Actor |
NVidia PhysX actor. | |
NxController * | m_Controller |
NVidia PhysX controller. | |
NxCCDSkeleton * | m_CCDSkeleton |
NVidia PhysX CCD Skeleton. | |
GVec4f | Velocity |
The models velocity in XYZ. | |
Command | currentCommand |
Current commmand for state machine (this should be moved to Creature). | |
Command | nextCommand |
Next command for state machine (this should be moved to Creature). | |
float | mfUpwardsForce |
The models upwards force when jumping (this should be moved to Creature). |
Base class for all complex model types.
GModel::GModel | ( | ) |
standard constructor
GModel::GModel | ( | GSkeleton * | _Skeleton, | |
GAnimatedMesh * | _Mesh, | |||
GAnimationManager * | AnimationManager | |||
) |
constructor for use with modelloader
GModel::~GModel | ( | ) |
standard destructor
int GModel::AddAnimationManager | ( | GAnimationManager * | AM = NULL |
) |
Add either a default or a specified Animation Manager.
int GModel::AddMesh | ( | GAnimatedMesh * | _Mesh | ) |
add new (sub)mesh to model
int GModel::ComposeModel | ( | std::string | Path, | |
std::string | Modelname, | |||
std::string | Skeletonname, | |||
animationlibrary_t * | AnimationLibrary, | |||
keyframelibrary_t * | KeyframeLibrary | |||
) |
compose model from mesh, skeleton, animationlibrary and keyframelibrary
int GModel::CreateDefaultSkeleton | ( | int | FLAGS | ) |
Create a default skeleton with only a root-bone.
int GModel::CreateDefaultVertexMapper | ( | int | FLAGS | ) |
Create a default vertex mapper with all vertices mapped to the rootbone.
int GModel::Draw | ( | double | time, | |
double | dtime, | |||
GMatrix16 * | viewmatrix, | |||
GMatrix16 * | worldmatrix, | |||
int | FLAGS | |||
) | [virtual] |
draw model with a viewmatrix
Implements GGraphicsObject.
int GModel::DrawSprites | ( | double | time, | |
double | dtime, | |||
GMatrix16 * | viewmatrix, | |||
GMatrix16 * | worldmatrix, | |||
int | FLAGS | |||
) | [virtual] |
draw sprites with a viewmatrix
Implements GGraphicsObject.
NxActor * GModel::GetActor | ( | void | ) | [virtual] |
Reimplemented from GGraphicsObject.
GAnimationManager * GModel::GetAnimationManager | ( | void | ) |
return pointer to attached animationmanager
GBoundingBox * GModel::GetBoundingBox | ( | void | ) | [virtual] |
return pointer to attached boundingbox
GBoundingSphere * GModel::GetBoundingSphere | ( | void | ) | [virtual] |
return pointer to attached boundingsphere
BoundingType GModel::GetBoundingType | ( | void | ) |
get bounding type
NxCCDSkeleton * GModel::GetCCDSkeleton | ( | void | ) |
obtain pointer to ccd skeleton as used with the physix sdk
NxController * GModel::GetController | ( | void | ) | [virtual] |
obtain pointer to controller as registered with physx api
Reimplemented from GGraphicsObject.
Command GModel::GetCurrentCommand | ( | void | ) |
get the current command
double GModel::GetFallingStart | ( | void | ) |
Get timestamp that marks the beginning of free fall or jumping (this should be moved to Creature).
GVec4f GModel::GetLinearVelocity | ( | void | ) |
obtain linear velocity
GVec4f GModel::getLookDir | ( | ) |
query models look direction
float GModel::GetMass | ( | void | ) |
get the models mass
GAnimatedMesh * GModel::GetMesh | ( | int | pos = 0 |
) |
acquire pointer to attached mesh
unsigned int GModel::GetMeshCount | ( | void | ) |
get number of registered meshes
vector< GAnimatedMesh * > GModel::GetMeshes | ( | void | ) |
Get a list of all registered meshes.
Command GModel::GetNextCommand | ( | void | ) |
GVec4f GModel::GetOffset | ( | void | ) |
get offset from world position
GGraphicsObject * GModel::GetParent | ( | void | ) |
Get parent object.
GMatrix16 GModel::GetRotationMatrix | ( | void | ) |
obtain world space rotation matrix
GSkeleton * GModel::GetSkeleton | ( | void | ) |
acquire pointer to attached skeleton
float GModel::GetSpeed | ( | void | ) |
get speed
ActionState GModel::GetState | ( | void | ) |
GVec4f GModel::GetVelocity | ( | void | ) |
GVec4f GModel::GetVelocityMemory | ( | void | ) |
query remembered velocity
GVec4f GModel::GetWorldSpaceCenter | ( | void | ) |
obtain world space center. this is the models position + (the boundingbox->minvalues + ((boundingbox->maxvalues - boundingbox->minvalues) / 2))
GMatrix16 GModel::GetWorldSpaceMatrix | ( | void | ) |
obtain world space transformations
bool GModel::IsFalling | ( | void | ) |
true if model is in "falling" state (this should be moved to Creature)
bool GModel::IsIdle | ( | void | ) |
true if model is in "idle" state (this should be moved to Creature)
bool GModel::IsJumping | ( | void | ) |
true if model is in "jumping" state (this should be moved to Creature)
bool GModel::IsLocked | ( | void | ) |
check wheter model is protected against inputs
bool GModel::IsRunning | ( | void | ) |
true if model is in "running" state (this should be moved to Creature)
void GModel::Lock | ( | void | ) |
protect model from further inputs
int GModel::Move | ( | float | x, | |
float | y, | |||
float | z | |||
) |
move model in world space
int GModel::Move | ( | GVec4f | v | ) | [virtual] |
move model in world space
Reimplemented from GGraphicsObject.
int GModel::MoveTo | ( | GVec4f | v | ) | [virtual] |
Move model to coordinate.
Reimplemented from GGraphicsObject.
int GModel::OutLineMappedVertices | ( | int | FLAGS | ) |
outline vertices that are registered in the vertexmapper structure (debug function, DEPRECATED)
void GModel::queryPosition | ( | GVec4f * | v | ) | [virtual] |
query x,y,z position
Reimplemented from GGraphicsObject.
void GModel::queryRotation | ( | GVec4f * | v | ) | [virtual] |
query x,y,z position
Reimplemented from GGraphicsObject.
int GModel::RebuildMatrix | ( | void | ) | [virtual] |
recalculate world space matrix
Reimplemented in Creature.
int GModel::RecalculateBoneData | ( | void | ) |
recalculate data needed vor gpu-based vertex skinning
int GModel::RecalculateBoundingBox | ( | int | FLAGS | ) |
Recalculate the surrounding boundingbox.
int GModel::RecalculateBoundingSphere | ( | int | FLAGS | ) |
Recalculate the surrounding boundingsphere.
int GModel::ResetAnimation | ( | void | ) |
reset current animation to time 0
int GModel::Rotate | ( | GVec4f | _Rotations | ) |
Rotate a model in world space.
NxActor * GModel::SetActor | ( | NxActor * | a | ) | [virtual] |
Reimplemented from GGraphicsObject.
int GModel::SetAnimationManager | ( | GAnimationManager * | am | ) |
Set active animation manager to existing animation manager.
int GModel::SetBoundingType | ( | BoundingType | b | ) |
set bounding type
void GModel::setCamera | ( | GCamera * | cam | ) |
attach camera to model (make the camera follow that model)
void GModel::SetCCDSkeleton | ( | NxCCDSkeleton * | s | ) |
set new pointer to ccd skeleton as used with the physix sdk
void GModel::SetController | ( | NxController * | _c | ) |
set controller as used with physx api
void GModel::SetCurrentCommand | ( | Command | c | ) |
set the current command
void GModel::SetFallingStart | ( | double | d | ) |
Set a timestamp to mark the beginning of free fall or jumping (this should be moved to Creature).
void GModel::SetMass | ( | float | _m | ) |
set the models mass
int GModel::SetMesh | ( | GAnimatedMesh * | _Mesh, | |
int | pos = -1 | |||
) |
Assign the model a Mesh.
int GModel::SetMeshes | ( | vector< GAnimatedMesh * > | _meshes | ) |
reset the submesh-list. this will copy geometry and vertexmapping. Also, each submeshes model reference will be set to this.
void GModel::SetNextCommand | ( | Command | c | ) |
void GModel::SetOffset | ( | GVec4f | _offset | ) |
set offset from world position
int GModel::SetParent | ( | GGraphicsObject * | _Parent | ) |
Attach to a parent.
int GModel::setPosition | ( | GVec4f | v | ) | [virtual] |
int GModel::setRotation | ( | GVec4f | v | ) | [virtual] |
int GModel::SetSkeleton | ( | GSkeleton * | s | ) |
attach skeleton to model
void GModel::SetSpeed | ( | float | n | ) |
set speed
int GModel::SetState | ( | ActionState | s | ) |
set current action state
void GModel::SetVelocity | ( | GVec4f | _v | ) |
void GModel::SetVelocityMemory | ( | GVec4f | m | ) |
assign the model a velocity to remember
int GModel::Skin | ( | int | FLAGS | ) |
skin mesh
void GModel::Unlock | ( | void | ) |
unprotect model from further inputs
int GModel::Update | ( | double | time, | |
double | dtime | |||
) | [virtual] |
int GModel::UpdateAnimation | ( | float | now, | |
int | FLAGS | |||
) |
update animation
GAnimationManager* GModel::AnimationManager [protected] |
animation-manager for keyframe interpolation
GBoundingBox* GModel::BoundingBox [protected] |
bounding box for simple collision detection
GBoundingSphere* GModel::BoundingSphere [protected] |
bounding sphere for simple collision detection
GCamera* GModel::Camera [protected] |
Model-Viewing-Camera.
vector<GGraphicsObject *> GModel::Children [protected] |
Attached graphics objects.
Command GModel::currentCommand [protected] |
Current commmand for state machine (this should be moved to Creature).
double GModel::FallingStart [protected] |
Begin time of free fall (or jumping) (this should be moved to Creature).
keyframe_t* GModel::IntermediateKeframe [protected] |
Intermediate Keyframe to interpolate animation from arbitrary point.
GVec4f GModel::JumpDir [protected] |
Direction of jump (this should be moved to Creature).
float GModel::JumpPower [protected] |
Jump height (this should be moved to Creature).
bool GModel::lock [protected] |
Locks the model against state-changes.
NxActor* GModel::m_Actor [protected] |
NVidia PhysX actor.
Reimplemented from GGraphicsObject.
BoundingType GModel::m_BoundingType [protected] |
BoundingType (sphere, cube, ...).
NxCCDSkeleton* GModel::m_CCDSkeleton [protected] |
NVidia PhysX CCD Skeleton.
NxController* GModel::m_Controller [protected] |
NVidia PhysX controller.
float GModel::m_Mass [protected] |
The model's mass.
vector<GAnimatedMesh*> GModel::Meshes [protected] |
list of animated meshes
float GModel::mfUpwardsForce [protected] |
The models upwards force when jumping (this should be moved to Creature).
GVec4f GModel::mVelocityMemory [protected] |
Direction of movement before fall was initiated (this should be somehow generalized).
Hit callback to be invoked if collision with another PhysX actor is detected.
Command GModel::nextCommand [protected] |
Next command for state machine (this should be moved to Creature).
GVec4f GModel::Offset [protected] |
Offset from world space position.
GGraphicsObject* GModel::Parent [protected] |
Graphics object the model is attached to (e.g. a moving platform).
GVec4f GModel::Position [protected] |
Model position in world space.
Reimplemented from GGraphicsObject.
GVec4f GModel::Rotation [protected] |
Model rotation in world space.
Reimplemented from GGraphicsObject.
GVec4f GModel::RunDir [protected] |
Direction of run (this should be moved to Creature).
GSkeleton* GModel::Skeleton [protected] |
model skeleton for animation and skinning
float GModel::Speed [protected] |
Running speed (this should be moved to Creature).
ActionState GModel::State [protected] |
Current action (this should be moved to Creature).
GVec4f GModel::Velocity [protected] |
The models velocity in XYZ.
GMatrix16 GModel::WorldSpaceMatrix [protected] |
world-space transformations