V-Gears 0
Free Final Fantasy VII engine.
EntityModel Class Reference

A 3D model for an entity. More...

#include <EntityModel.h>

Inheritance diagram for EntityModel:
Collaboration diagram for EntityModel:

Public Member Functions

 EntityModel (const Ogre::String &name, const Ogre::String file_name, Ogre::SceneNode *node)
 Constructor. More...
 
virtual ~EntityModel ()
 
virtual void Update ()
 Updates the model status. More...
 
virtual void SetVisible (const bool visible)
 Toggles the model visibility. More...
 
virtual bool IsVisible () const
 Checks the model visibility. More...
 
Ogre::Entity * GetModel ()
 
virtual void PlayAnimation (const Ogre::String &animation, AnimationState state, AnimationPlayType play_type, const float start, const float end)
 Plays an animation of the model. More...
 
virtual void PlayAnimationContinue (const Ogre::String &animation)
 Resumes an animation. More...
 
virtual void UpdateAnimation (const float delta)
 Updates the animation. More...
 
- Public Member Functions inherited from Entity
 Entity (const Ogre::String &name, Ogre::SceneNode *node)
 Constructor. More...
 
virtual ~Entity ()
 Destructor. More...
 
virtual void Update ()
 Updates the entity status. More...
 
virtual void UpdateDebug ()
 Updates the entity status with debug information. More...
 
const Ogre::String & GetName () const
 Retrieves the entity name. More...
 
void SetPosition (const Ogre::Vector3 &position)
 Sets the entity position. More...
 
void ScriptSetPosition (const float x, const float y, const float z)
 Sets the entity position. More...
 
const Ogre::Vector3 GetPosition () const
 Retrieves the entity position. More...
 
void ScriptGetPosition () const
 Retrieves the entity position. More...
 
void SetOffset (const Ogre::Vector3 &position)
 Sets the entity position. More...
 
const Ogre::Vector3 GetOffset () const
 Retrieves the entity position. More...
 
void SetRotation (const Ogre::Degree &rotation)
 Sets the entity rotation. More...
 
void ScriptSetRotation (const float rotation)
 Sets the entity rotation. More...
 
Ogre::Degree GetRotation () const
 Retrieves the entity rotation. More...
 
float ScriptGetRotation () const
 Retrieves the entity rotation. More...
 
virtual void setScale (const Ogre::Vector3 &scale)
 Sets the entity scale. More...
 
void SetIndex (const int index)
 Sets the entity index in the field. More...
 
int GetIndex ()
 Retrieves the entity index in the field. More...
 
virtual void setRootOrientation (const Ogre::Quaternion &root_orientation)
 Sets the entity's absolute orientation. More...
 
float GetHeight () const
 Retrieves the entity's height. More...
 
void SetSolidRadius (const float radius)
 Sets the entity's solid radius. More...
 
float GetSolidRadius () const
 Retrieves the entity's solid radius. More...
 
void SetSolid (const bool solid)
 Makes the entity solid or non-solid. More...
 
bool IsSolid () const
 Checks if the entity is solid. More...
 
void SetTalkRadius (const float radius)
 Sets the entity talk radius. More...
 
float GetTalkRadius () const
 Retrieves the entity talk radius. More...
 
void SetTalkable (const bool talkable)
 Sets an entity as talkable or non-talkable. More...
 
bool IsTalkable () const
 Checks if an entity is talkable or non-talkable. More...
 
virtual void SetVisible (const bool visible)=0
 Makes the entity visible or invisible. More...
 
virtual bool IsVisible () const =0
 Checks if the entity is visible or invisible. More...
 
void SetState (const State state)
 Sets the entity's state. More...
 
State GetState () const
 Retrieves the entity's state. More...
 
void SetMoveAutoSpeed (const float speed)
 Sets the entity's automatic movement speed. More...
 
float GetMoveAutoSpeed () const
 Retrieves the entity's automatic movement speed. More...
 
void SetMoveWalkSpeed (const float speed)
 Sets the entity's walking movement speed. More...
 
float GetMoveWalkSpeed () const
 Retrieves the entity's walking speed. More...
 
void SetMoveRunSpeed (const float speed)
 Sets the entity's running movement speed. More...
 
float GetMoveRunSpeed () const
 Retrieves the entity's running speed. More...
 
void SetMovePosition (const Ogre::Vector3 &target)
 Sets the entity's movement destination position. More...
 
const Ogre::Vector3 & GetMovePosition () const
 Retrieves the entity's movement destination position. More...
 
float GetMoveStopDistance () const
 Retrieves the distance to destination. More...
 
void SetMoveTriangleId (const int triangle)
 Sets the destination triangle in the walkmesh. More...
 
int GetMoveTriangleId () const
 Sets the destination triangle in the walkmesh. More...
 
void SetMoveAutoRotation (const bool rotate)
 Enables or disables autorotation while the entity is moving. More...
 
bool GetMoveAutoRotation () const
 Checks if the unit can autorotate while it's moving. More...
 
void SetMoveAutoAnimation (const bool animate)
 Enables or disables autoanimation while the entity is moving. More...
 
bool GetMoveAutoAnimation () const
 Checks if the unit can autoanimate while it's moving. More...
 
const Ogre::String & GetMoveAnimationWalkName () const
 Retrieves the entity's walk animation name. More...
 
const Ogre::String & GetMoveAnimationRunName () const
 Retrieves the entity's run animation name. More...
 
void ScriptMoveToPosition (const float x, const float y)
 Makes the entity move to a point in the map. More...
 
void ScriptMoveToEntity (Entity *entity)
 Makes the unit move towards another in the map. More...
 
int ScriptMoveSync ()
 Waits for entity's movement to end. More...
 
int ScriptJumpSync ()
 Waits for the jump to finish. More...
 
void UnsetMove ()
 Cancels the entity's current movement. More...
 
void ScriptLinearToPosition (const float x, const float y, const float z, const LinearMovement movement, const char *animation, const float orientation, const int dest_triangle)
 Linearly moves the entity. More...
 
int ScriptLinearSync ()
 Adds the unit linear movement to the sync queue. More...
 
void SetLinear (const Ogre::Vector3 &end, const LinearMovement movement, const Ogre::String &animation, const float orientation, const int dest_triangle)
 Linearly moves the entity. More...
 
void UnsetLinear ()
 Cancels the entity's current linear movement. More...
 
LinearMovement GetLinearMovement () const
 Retrieves the entity's current linear movement. More...
 
const Ogre::Vector3 & GetLinearStart () const
 Retrieves the starting point of the current linear movement. More...
 
const Ogre::Vector3 & GetLinearEnd () const
 Retrieves the ending point of the current linear movement. More...
 
const int GetLinearDestTriangle () const
 Retrieves the ending triangle of the current linear movement. More...
 
void ScriptJumpToPosition (const float x, const float y, const float z, const float seconds, const int dest_triangle)
 Makes the unit jump to a point in the field. More...
 
void SetJump (const Ogre::Vector3 &jump_to, const float seconds, const int dest_triangle)
 Makes the unit jump to a point in the field. More...
 
void UnsetJump ()
 Cancels the entity's current jump. More...
 
const Ogre::Vector3 & GetJumpStart () const
 Retrieves the starting point of the current jump. More...
 
const Ogre::Vector3 & GetJumpEnd () const
 Retrieves the ending point of the current jump. More...
 
float GetJumpSeconds () const
 Gets the total duration of the jump. More...
 
void SetJumpCurrentSeconds (const float seconds)
 Sets the current duration of the jump. More...
 
float GetJumpCurrentSeconds () const
 Gets the current duration of the jump. More...
 
const int GetJumpDestTriangle () const
 Retrieves the ending triangle of the current jump. More...
 
void ScriptOffsetToPosition (const float x, const float y, const float z, const ActionType type, const float seconds)
 
int ScriptOffsetSync ()
 
void UnsetOffset ()
 
const Ogre::Vector3 & GetOffsetPositionStart () const
 
const Ogre::Vector3 & GetOffsetPositionEnd () const
 
ActionType GetOffsetType () const
 
float GetOffsetSeconds () const
 
void SetOffsetCurrentSeconds (const float seconds)
 
float GetOffsetCurrentSeconds () const
 
void ScriptTurnToDirection (const float direction, const TurnDirection turn_direction, const ActionType turn_type, const float seconds)
 Makes the entity turn to a fixed direction. More...
 
void ScriptTurnToEntity (Entity *entity, const TurnDirection turn_direction, const float seconds)
 Makes the entity turn towards another entity. More...
 
int ScriptTurnSync ()
 Adds the entity's turn to the sync queue. More...
 
void SetTurn (const Ogre::Degree &direction_to, Entity *entity, const TurnDirection turn_direction, const ActionType turn_type, const float seconds)
 Makes the entity turn towards a point or another entity. More...
 
void UnsetTurn ()
 Cancels the entity's current jump. More...
 
Ogre::Degree CalculateTurnAngle (const Ogre::Degree &start, const Ogre::Degree &end) const
 Calculates the turn angle. More...
 
Ogre::Degree GetTurnDirectionStart () const
 Retrieves the turn staring orientation. More...
 
Ogre::Degree GetTurnDirectionEnd () const
 Retrieves the turn ending orientation. More...
 
ActionType GetTurnType () const
 Retrieves the turn type. More...
 
float GetTurnSeconds () const
 Retrieves the turn total duration. More...
 
void SetTurnCurrentSeconds (const float seconds)
 Sets the turn current duration. More...
 
float GetTurnCurrentSeconds () const
 Retrieves the turn current duration. More...
 
void ScriptSetAnimationSpeed (const float speed)
 Sets the animation speed. More...
 
const Ogre::String & GetDefaultAnimationName () const
 Retrieves the entity's default animation name. More...
 
const Ogre::String & GetCurrentAnimationName () const
 Retrieves the entity's current animation name. More...
 
AnimationState GetAnimationState () const
 Retrieves the entity's current animation state. More...
 
virtual void PlayAnimation (const Ogre::String &animation, AnimationState state, AnimationPlayType play_type, const float start, const float end)=0
 Plays one of the entity's animations. More...
 
virtual void PlayAnimationContinue (const Ogre::String &animation)=0
 Resumes an animation. More...
 
virtual void UpdateAnimation (const float delta)=0
 Updates the animation state. More...
 
void ScriptPlayAnimation (const char *name)
 Plays one of the entity's animations. More...
 
void ScriptPlayAnimationStop (const char *name)
 Stops one of the entity's animations. More...
 
void ScriptPlayAnimation (const char *name, const float start, const float end)
 Plays one of the entity's animations. More...
 
void ScriptPlayAnimationStop (const char *name, const float start, const float end)
 Stops one of the entity's animations. More...
 
void ScriptSetDefaultAnimation (const char *animation)
 Sets the default animation of the entity. More...
 
int ScriptAnimationSync ()
 Adds the entity's animation to the sync queue. More...
 
void SetCharacter (int char_id)
 Assigns the entity as a character. More...
 
bool IsCharacter ()
 Checks if the entity is a character. More...
 
int GetCharacterId ()
 Retrieves the entity's character ID. More...
 
bool IsLine ()
 Checks if the entity is a line. More...
 

Private Member Functions

 EntityModel ()
 Constructor. More...
 

Private Attributes

Ogre::Entity * model_
 The model. More...
 
Ogre::AnimationState * animation_current_
 The current animation state. More...
 

Additional Inherited Members

- Public Types inherited from Entity
enum  AnimationState { REQUESTED_ANIMATION , AUTO_ANIMATION }
 Entity animation states. More...
 
enum  AnimationPlayType { PLAY_DEFAULT , PLAY_ONCE , PLAY_LOOPED }
 Types of animations. More...
 
enum  State {
  NONE , WALKMESH , LINEAR , JUMP ,
  NEEDS_TO_REATTACH
}
 Entity state. More...
 
- Protected Attributes inherited from Entity
Ogre::String name_
 The name of the entity. More...
 
Ogre::SceneNode * scene_node_
 The scene node the entity is attached to. More...
 
Ogre::SceneNode * model_node_
 The entity's model. More...
 
Ogre::SceneNode * model_root_node_
 The entity's root node. More...
 
float height_
 The entity's height. More...
 
Ogre::SceneNode * direction_node_
 The entity's direction node. More...
 
EntityDirectiondirection_
 The entity's direction. More...
 
Ogre::SceneNode * solid_collision_node_
 The entity's collision node. More...
 
EntityCollisionsolid_collision_
 The entity's collision. More...
 
float solid_radius_
 The entity's solid radius. More...
 
bool solid_
 Indicates it the entity is solid and can handle collisions. More...
 
Ogre::SceneNode * talk_collision_node_
 The entity's talk collision node. More...
 
EntityCollisiontalk_collision_
 The entity's talk collision. More...
 
float talk_radius_
 The radius at which the entity can be interacted with. More...
 
bool talkable_
 Indicates if the entity can be interacted with. More...
 
State state_
 Entity's movement status. More...
 
std::vector< ScriptIdsync_
 Entity's movement sync queue. More...
 
float move_auto_speed_
 The entity's automatic movement speed. More...
 
float move_walk_speed_
 The entity's walking speed. More...
 
float move_run_speed_
 The entity's running speed. More...
 
Ogre::Vector3 move_position_
 The entity's movement destination point. More...
 
Entitymove_entity_
 The entity's movement destination entity. More...
 
float move_stop_distance_
 Distance between the entity and it's movement destination point. More...
 
int move_triangle_id_
 Entity's movement destination triangle ID. More...
 
bool move_auto_rotation_
 Indicates if the entity can rotate while moving. More...
 
bool move_auto_animation_
 Indicates if the entity can animate while moving. More...
 
Ogre::String move_animation_walk_
 The name of the entity's walk animation. More...
 
Ogre::String move_animation_run_
 The name of the entity's run animation. More...
 
LinearMovement linear_movement_
 The entity's linear movement direction. More...
 
Ogre::Vector3 linear_start_
 The linear movement starting point. More...
 
Ogre::Vector3 linear_end_
 The linear movement ending point. More...
 
int linear_dest_triangle_
 Triangle to set the entity on after a linear movement. More...
 
Ogre::Vector3 jump_start_
 The jump starting point. More...
 
Ogre::Vector3 jump_end_
 The jump ending point. More...
 
float jump_seconds_
 Total jump duration. More...
 
float jump_current_seconds_
 Current jump duration. More...
 
bool jump_was_solid_
 Used to store solidity status before a jump. More...
 
int jump_dest_triangle_
 Triangle to set the entity on after a jump. More...
 
Ogre::Vector3 offset_position_start_
 
Ogre::Vector3 offset_position_end_
 
ActionType offset_type_
 
float offset_seconds_
 
float offset_current_seconds_
 
std::vector< ScriptIdoffset_sync_
 
TurnDirection turn_direction_
 Turn movement direction. More...
 
Ogre::Degree turn_direction_start_
 Turn initial orientation. More...
 
Ogre::Degree turn_direction_end_
 Turn final orientation. More...
 
Entityturn_entity_
 The turn destination entity. More...
 
ActionType turn_type_
 The turn type. More...
 
float turn_seconds_
 Total turn duration. More...
 
float turn_current_seconds_
 Current turn duration. More...
 
std::vector< ScriptIdturn_sync_
 Entity's turning sync queue. More...
 
float animation_speed_
 The animation speed. More...
 
Ogre::String animation_current_name_
 The entity's current animation name. More...
 
std::vector< ScriptIdanimation_sync_
 Entity's animation sync queue. More...
 
AnimationState animation_state_
 The entity's current animation state. More...
 
AnimationPlayType animation_play_type_
 The entity's current animation type. More...
 
Ogre::String animation_default_
 The name of the entity's default name. More...
 
float animation_end_time_
 
bool animation_auto_play_
 Indicates if an automation must be played automatically. More...
 

Detailed Description

A 3D model for an entity.

Constructor & Destructor Documentation

◆ EntityModel() [1/2]

EntityModel::EntityModel ( const Ogre::String &  name,
const Ogre::String  file_name,
Ogre::SceneNode *  node 
)

Constructor.

Creates an entity model.

The models will be looked for in the resource groups FIELD_MODELS, BATTLE_MODELS or WORLD_MODELS, depending on the module the {

See also
EntityManager} is currerntly set to.
Parameters
[in]nameEntity name.
[in]file_nameFile with the model data.
[in]nodeScene node to attach the model to.

◆ ~EntityModel()

EntityModel::~EntityModel ( )
virtual

◆ EntityModel() [2/2]

EntityModel::EntityModel ( )
private

Constructor.

Member Function Documentation

◆ GetModel()

Ogre::Entity * EntityModel::GetModel ( )

◆ IsVisible()

bool EntityModel::IsVisible ( ) const
virtual

Checks the model visibility.

Returns
True if the model is visible, false if it's invisible.

Implements Entity.

◆ PlayAnimation()

void EntityModel::PlayAnimation ( const Ogre::String &  animation,
Entity::AnimationState  state,
Entity::AnimationPlayType  play_type,
const float  start,
const float  end 
)
virtual

Plays an animation of the model.

Parameters
[in]animationName of the animation to play.
[in]stateInitial state of the animation.
[in]play_typePlay mode, for single or looped playbacks.
[in]startStart point in time of the animation, in seconds.
[in]endEnd point in time of the animation, in seconds.

Implements Entity.

◆ PlayAnimationContinue()

void EntityModel::PlayAnimationContinue ( const Ogre::String &  animation)
virtual

Resumes an animation.

Parameters
[in]animationThe name of the animation to resume.

Implements Entity.

◆ SetVisible()

void EntityModel::SetVisible ( const bool  visible)
virtual

Toggles the model visibility.

Parameters
[in]visibleTrue to make the model visible, false to turn it invisible.

Implements Entity.

◆ Update()

void EntityModel::Update ( )
virtual

Updates the model status.

Reimplemented from Entity.

◆ UpdateAnimation()

void EntityModel::UpdateAnimation ( const float  delta)
virtual

Updates the animation.

Parameters
[in]deltaEllapsed time.

Implements Entity.

Member Data Documentation

◆ animation_current_

Ogre::AnimationState* EntityModel::animation_current_
private

The current animation state.

◆ model_

Ogre::Entity* EntityModel::model_
private

The model.


The documentation for this class was generated from the following files: