25 #ifndef GRAPHICS_AURORA_MODEL_H 26 #define GRAPHICS_AURORA_MODEL_H 32 #include "glm/mat4x4.hpp" 47 class SeekableReadStream;
55 class AnimationThread;
56 class AnimationChannel;
92 bool isIn(
float x,
float y)
const;
94 bool isIn(
float x,
float y,
float z)
const;
96 bool isIn(
float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
const;
102 void getScale (
float &x,
float &y,
float &z)
const;
104 void getOrientation(
float &x,
float &y,
float &z,
float &angle)
const;
106 void getPosition(
float &x,
float &y,
float &z)
const;
112 void setScale (
float x,
float y,
float z);
119 void scale (
float x,
float y,
float z);
121 void rotate(
float x,
float y,
float z,
float angle);
123 void move (
float x,
float y,
float z);
131 const std::list<Common::UString> &
getStates()
const;
157 const std::list<ModelNode *> &
getNodes();
187 void queueRender(
const glm::mat4 &parentTransform);
198 typedef std::map<Common::UString, ModelNode *, Common::UString::iless>
NodeMap;
199 typedef std::map<Common::UString, Animation *, Common::UString::iless>
AnimationMap;
213 typedef std::map<Common::UString, State *>
StateMap;
316 #endif // GRAPHICS_AURORA_MODEL_H static void readValue(Common::SeekableReadStream &stream, uint32 &value)
Shader::ShaderRenderable _boundRenderable
const Common::UString & getState() const
Return the name of the current state.
NodeMap nodeMap
The nodes within the state, indexed by name.
void getPosition(float &x, float &y, float &z) const
Get the current position of the model.
float getHeight() const
Get the height of the model's bounding box.
Model * getAttachedModel(const Common::UString &node)
Common::BoundingBox _absoluteBoundBox
The model's box after translate/rotate.
Shader renderable, a class for easier managing of a collection of items (surface, material...
void scale(float x, float y, float z)
Scale the model, relative to its current scale.
A class holding an UTF-8 string.
void advanceTime(float dt)
Advance time (used by renderables with animations).
float getWidth() const
Get the width of the model's bounding box.
std::map< Common::UString, ModelNode *, Common::UString::iless > NodeMap
std::map< Common::UString, Model * > _attachedModels
Common::UString name
The state's name.
A real object in the game world.
float getAnimationScale(const Common::UString &anim)
Determine what animation scaling applies.
NodeList rootNodes
The nodes in the state without a parent.
void hide()
Hide the object.
State * _currentState
The current state.
void move(float x, float y, float z)
Move the model, relative to its current position.
std::list< Common::UString > _stateNames
All state names.
const Common::UString & getName() const
Get the model's name.
Common::UString _fileName
The model's file name.
A bounding box around 3D points.
void clearDefaultAnimations()
void addAnimationChannel(AnimationChannelName name)
A container of OpenGL elements.
Common::UString _name
The model's name.
void setState(const Common::UString &name="")
Set the current animation state.
void createAbsolutePosition()
std::map< Common::UString, Animation *, Common::UString::iless > AnimationMap
Common::BoundingBox _boundBox
The model's bounding box.
void setOrientation(float x, float y, float z, float angle)
Set the current orientation of the model.
void drawBound(bool enabled)
Should a bounding box be drawn around this model?
float _position[3]
Model's position.
AnimationMap _animationMap
Map of all animations in this model.
ModelType
The display type of a model.
ModelType _type
The model's type.
std::map< AnimationChannelName, AnimationChannel * > AnimationChannelMap
bool _drawSkeletonInvisible
Basic Aurora graphics types.
void getScale(float &x, float &y, float &z) const
Get the current scale of the model.
static void readArray(Common::SeekableReadStream &stream, uint32 offset, uint32 count, std::vector< T > &values)
Model(ModelType type=kModelTypeObject)
A node within a 3D model.
void createStateNamesList(std::list< Common::UString > *stateNames=0)
Create the list of all state names.
void rotate(float x, float y, float z, float angle)
Rotate the model, relative to its current orientation.
bool hasNode(const Common::UString &node) const
Does the specified node exist in the current state?
bool isIn(float x, float y) const
Is that point within the model's bounding box?
const std::list< ModelNode * > & getNodes()
Get all nodes in the current state.
NodeList nodeList
The nodes within the state.
void getAbsolutePosition(float &x, float &y, float &z) const
Get the position of the node after translate/rotate.
void setPosition(float x, float y, float z)
Set the current position of the model.
void playDefaultAnimation()
StateMap _stateMap
All states within this model, index by name.
AnimationChannel * getAnimationChannel(AnimationChannelName name)
std::list< ModelNode * > NodeList
float _scale[3]
Model's scale.
void render(RenderPass pass)
Render the object.
An object that can be displayed by the graphics manager.
AnimationChannelMap _animationChannels
float _orientation[4]
Model's orientation.
void createBound()
Create the model's bounding box.
float getDepth() const
Get the depth of the model's bounding box.
void getTooltipAnchor(float &x, float &y, float &z) const
Get the point where the feedback tooltip is anchored.
void show()
Show the object.
void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
std::map< Common::UString, State * > StateMap
const std::list< Common::UString > & getStates() const
Return a list of all animation state names.
static void readArrayDef(Common::SeekableReadStream &stream, uint32 &offset, uint32 &count)
void setEnvironmentMap(const Common::UString &environmentMap="")
Change the environment map on this model.
float _center[3]
Model's center.
void getOrientation(float &x, float &y, float &z, float &angle) const
Get the current orientation of the model.
Model * _superModel
The actual super model.
glm::mat4 _absolutePosition
void manageAnimations(float dt)
A container of OpenGL elements.
bool hasAnimation(const Common::UString &anim) const
Does this model have this named animation?
void finalize()
Finalize the loading procedure.
std::list< State * > StateList
void addDefaultAnimation(const Common::UString &anim, uint8 probability)
ModelType getType() const
Return the model's type.
Animation * getAnimation(const Common::UString &anim)
Get the animation from its name.
void flushNodeBuffers()
Apply buffered changes to model nodes position and geometry.
void calculateDistance()
Calculate the object's distance.
void queueRender(const glm::mat4 &parentTransform)
Queue the object for later rendering.
ModelNode * getNode(const Common::UString &node)
Get the specified node, from the current state.
StateList _stateList
All states within this model.
float _animationScale
The scale of the animation.
An object that can be displayed by the graphics manager.
Common::UString _superModelName
Name of the super model.
Interface for a seekable & readable data stream.
void setScale(float x, float y, float z)
Set the current scale of the model.
void drawSkeleton(bool enabled, bool showInvisible)
Should a skeleton showing the nodes and their relation be drawn inside the model? ...
void attachModel(const Common::UString &nodeName, Model *model)
Add another model as a child to the named node.
void renderImmediate(const glm::mat4 &parentTransform)
For shader based systems, don't sort anything, render this right_now.
void setSkinned(bool skinned)
Set the flag if the model has skinned animations.
glm::mat4 _boundTransform