Support Forum G3D Web Page |
Quake III MD3 model loader. More...
Inherits G3D::Model.
Classes | |
class | AnimType |
All standard animation types expected to have parameters in the animation.cfg file. More... | |
class | Pose |
Animation pose based on AnimType and animation time. More... | |
class | PoseSequence |
A sequence of animation poses that are loaded from the scene file. More... | |
class | Skin |
A set of materials for a MD3Model. More... | |
class | Specification |
Public Types | |
enum | { NUM_PARTS = 3, NUM_ANIMATED_PARTS = 2 } |
enum | PartType { PART_LOWER, PART_UPPER, PART_HEAD } |
Public Member Functions | |
virtual | ~MD3Model () |
virtual const String & | className () const override |
Name of the G3D::Model subclass. More... | |
void | computeFrameNumbers (const Pose &pose, PartType partType, int &kf0, int &kf1, float &alpha) const |
determines which frame in the animation it is currently on and will return a negative frame number if it is in the process of blending between animations More... | |
const shared_ptr< Skin > & | defaultSkin () const |
virtual bool | intersect (const Ray &ray, const CoordinateFrame &cframe, float &maxDistance, Model::HitInfo &info=Model::HitInfo::ignore, const Entity *entity=nullptr, const Model::Pose *pose=nullptr) const override |
Determines if the ray intersects the heightfield and fills the info with the proper information. More... | |
virtual const String & | name () const override |
Name of the instance (usually based on the filename it is loaded from) More... | |
virtual void | pose (Array< shared_ptr< Surface > > &surfaceArray, const CFrame &rootFrame, const CFrame &prevFrame, const shared_ptr< Entity > &entity, const Model::Pose *pose, const Model::Pose *prevPose, const Surface::ExpressiveLightScatteringProperties &e) override |
This will be replaced soon with a version that takes a shared_ptr<Pose>. More... | |
void | pose (Array< shared_ptr< class Surface > > &posedModelArray, const CFrame &cframe, const CFrame &previousFrame, const Pose ¤tPose=Pose(), const shared_ptr< Entity > &entity=nullptr, const Surface::ExpressiveLightScatteringProperties &expressiveLightScatteringProperties=Surface::ExpressiveLightScatteringProperties()) |
Poses then adds all available parts to posedModelArray. More... | |
void | pose (Array< shared_ptr< class Surface > > &posedModelArray, const CFrame &cframe=CFrame(), const Pose ¤tPose=Pose(), const shared_ptr< Entity > &entity=nullptr, const Surface::ExpressiveLightScatteringProperties &e=Surface::ExpressiveLightScatteringProperties()) |
void | simulatePose (Pose &pose, SimTime dt) const |
Advances the pose based on this character's animations. More... | |
CoordinateFrame | weaponFrame (const CoordinateFrame &cframe=CoordinateFrame(), const Pose &pose=Pose()) const |
Return the coordinate frame of the tag_weapon; this is where a simulator should place objects carried by the character. More... | |
Static Public Member Functions | |
static bool | affectsLower (AnimType a) |
static bool | affectsUpper (AnimType a) |
static shared_ptr< MD3Model > | create (const Specification &spec, const String &name="") |
static lazy_ptr< Model > | lazyCreate (const Specification &s, const String &name="") |
static lazy_ptr< Model > | lazyCreate (const String &name, const Any &any) |
static void | setUseOptimizedIntersect (bool b) |
If true, complex models should use TriTree to accelerate intersect() calls where possible. More... | |
static bool | useOptimizedIntersect () |
Static Protected Member Functions | |
template<class T , class ... ArgTypes> | |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
Like std::make_shared, but works for protected constructors. More... | |
Quake III MD3 model loader.
Quake 3 uses MD3 models for both characters and non-character objects.
Character objects contain three individual "models" inside of them with attachment points.
MD3Models are composed of up to four parts, which are named lower (legs), upper (torso), and head. The coordinate frame for each relative to its parent can be specified as part of the pose. Each part contains a set of triangle lists. The triangle lists may have different materials and are key-frame animated. A skin is a set of materials for the triangle lists. The model is created with a default skin, although an alternative skin may be provided as part of the pose. This allows sharing geometry over characters with different appearance.
It also contains a coordinate frame for a weapon's attachment location.
See http://bit.ly/acgNj9 for some models
|
virtual |
|
inlinestatic |
|
inlinestatic |
|
overridevirtual |
Name of the G3D::Model subclass.
Implements G3D::Model.
void G3D::MD3Model::computeFrameNumbers | ( | const Pose & | pose, |
PartType | partType, | ||
int & | kf0, | ||
int & | kf1, | ||
float & | alpha | ||
) | const |
determines which frame in the animation it is currently on and will return a negative frame number if it is in the process of blending between animations
|
static |
Referenced by lazyCreate().
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
|
inline |
|
overridevirtual |
Determines if the ray intersects the heightfield and fills the info with the proper information.
maxDistance | Max distance to trace to on input, hit distance written on output if hit |
Reimplemented from G3D::Model.
|
inlinestatic |
Referenced by lazyCreate().
|
inlineoverridevirtual |
Name of the instance (usually based on the filename it is loaded from)
Implements G3D::Model.
Referenced by lazyCreate().
|
overridevirtual |
This will be replaced soon with a version that takes a shared_ptr<Pose>.
pose | Must have the subclass of Model::Pose appropriate to the Model subclass. |
Implements G3D::Model.
Referenced by pose().
void G3D::MD3Model::pose | ( | Array< shared_ptr< class Surface > > & | posedModelArray, |
const CFrame & | cframe, | ||
const CFrame & | previousFrame, | ||
const Pose & | currentPose = Pose() , |
||
const shared_ptr< Entity > & | entity = nullptr , |
||
const Surface::ExpressiveLightScatteringProperties & | expressiveLightScatteringProperties = Surface::ExpressiveLightScatteringProperties() |
||
) |
Poses then adds all available parts to posedModelArray.
Each part is posed based on the animation parameters then positioned and rotated based on the appropriate tag according to Quake III model standards.
The lower.md3 part is the based. The upper.md3 part is attached to "tag_torso" in lower.md3. The head.md3 part is attached to "tag_head" in upper.md3.
The initial cframe transformation is applied to the base lower.md3 part before the whole model is posed.
|
inline |
|
inlinestaticinherited |
If true, complex models should use TriTree to accelerate intersect() calls where possible.
This can make the first intersect() call very slow for the tree build and can make loading slow. It may not affect performance of skinned or articulated models that animate.
This value should be set before the models are loaded. If it is changed after a model is loaded, the Model is not required to respond to it.
Default: false
Advances the pose based on this character's animations.
|
inlinestaticinherited |
CoordinateFrame G3D::MD3Model::weaponFrame | ( | const CoordinateFrame & | cframe = CoordinateFrame() , |
const Pose & | pose = Pose() |
||
) | const |
Return the coordinate frame of the tag_weapon; this is where a simulator should place objects carried by the character.