![]() |
V-Gears 0
Free Final Fantasy VII engine.
|
The camera manager. More...
#include <CameraManager.h>
Public Member Functions | |
CameraManager () | |
Constructor. More... | |
virtual | ~CameraManager () |
Destructor. More... | |
void | Input (const VGears::Event &event) override |
Handles camera actions. More... | |
void | Input (const VGears::Event &event, Ogre::Real time_since_last_frame) |
Handles camera actions. More... | |
void | OnResize () override |
Trigered when the viewport is resized. More... | |
void | UpdateDebug () override |
Updates debug information. More... | |
void | ClearField () override |
Clears all field information in the camera manager. More... | |
void | ClearBattle () override |
Clears all battle information in the camera manager. More... | |
void | ClearWorld () override |
Clears all world map information in the camera manager. More... | |
void | SetCameraFree (const bool enable) |
Enables or disables the free camera. More... | |
void | Set2DCamera (const Ogre::Vector3 position, const Ogre::Quaternion orientation, const Ogre::Radian fov) |
Sets the camera properties. More... | |
void | StartBattleCamera (const Ogre::Vector3 position, const Ogre::Vector3 orientation) |
Starts the battle camera. More... | |
void | EndBattleCamera () |
Ends the battle camera. More... | |
void | Set2DScroll (const Ogre::Vector2 &position) |
Sets the camera scroll. More... | |
const Ogre::Vector2 & | Get2DScroll () const |
Retrieves the camera position. More... | |
const Ogre::Vector3 | ProjectPointToScreen (const Ogre::Vector3 &point) |
Calculates the position of a point in screen. More... | |
Ogre::Camera * | GetCurrentCamera () |
Retrieves the camera. More... | |
Ogre::Viewport * | getViewport () |
Retrieves the viewport. More... | |
void | EnableWireFrame (bool enable) |
Enables or disables the camera wireframe. More... | |
void | ScriptSetCamera (const int x, const int y, const int z, const int d_x, const int d_y, const int d_z) |
Sets the camera position and orientation. More... | |
![]() | |
Manager () | |
Constructor. More... | |
virtual | ~Manager () |
Destructor. More... | |
Module | GetModule () const |
Retrieves the currently selected module. More... | |
bool | IsModule (const Module module) const |
Checks the currently selected module. More... | |
bool | IsFieldModule () const |
Checks if the currently selected module is the field module. More... | |
bool | IsBattleModule () const |
Checks if the currently selected module is the battle module. More... | |
bool | IsWorldModule () const |
Checks if the currently selected module is the world module. More... | |
void | SetModule (const Module module) |
Sets the current module for the entity manager. More... | |
void | SetFieldModule () |
Sets the current module to the field mode. More... | |
void | SetBattleModule () |
Sets the current module to the battle mode. More... | |
void | SetWorldModule () |
Sets the current module to the world map mode. More... | |
void | SetPreviousModule () |
Sets the module that was loaded before a battle. More... | |
virtual void | Input (const VGears::Event &event)=0 |
Handles an input event. More... | |
void | Update () |
Called every frame, performs an update on the things controlled by the manager. More... | |
virtual void | UpdateDebug ()=0 |
Called every frame, performs an update on the things controlled by the manager. More... | |
virtual void | OnResize ()=0 |
Handles resizing events. More... | |
void | Clear () |
Clears the manager. More... | |
void | Clear (const Module module) |
Clears the manager. More... | |
virtual void | ClearField ()=0 |
Clear all field information in the manager. More... | |
virtual void | ClearBattle ()=0 |
Clear all battle information in the manager. More... | |
virtual void | ClearWorld ()=0 |
Clear all world map information in the manager. More... | |
void | ClearAll () |
Clears the manager. More... | |
void | ScriptSetPaused (const bool paused) |
Handles game pausing. More... | |
Private Member Functions | |
void | InitCommands () |
Initializes the camera parameters. More... | |
void | UpdateField () override |
Updates while the camera is in the field. More... | |
void | UpdateBattle () override |
Updates while the camera is in battle. More... | |
void | UpdateWorld () override |
Updates while the camera is in the world map. More... | |
Private Attributes | |
Ogre::Camera * | camera_ |
The camera. More... | |
Ogre::Viewport * | viewport_ |
The viewport. More... | |
Ogre::Vector3 | position_initial_ |
The initial position of the camera, saved when created. More... | |
Ogre::Quaternion | orientation_initial_ |
The initial orientation of the camera, saved when created. More... | |
Ogre::Vector3 | position_backup_ |
A backup of the field or world camera position for when the battle camera is activated. More... | |
Ogre::Quaternion | orientation_backup_ |
A backup of the field or world camera orientation for when the battle camera is active. More... | |
bool | camera_free_ |
Flag to indicate a free camera. More... | |
bool | camera_free_rotate_ |
Flag to indicate the free camera has rotated. More... | |
Ogre::Vector3 | d2_position_ |
Camera position. More... | |
Ogre::Quaternion | d2_orientation_ |
Camera orientation. More... | |
Ogre::Radian | d2_fov_ |
The field of view. More... | |
Ogre::Vector2 | d2_scroll_ |
The camera scroll. More... | |
Additional Inherited Members | |
![]() | |
enum | Module { FIELD = 0 , BATTLE = 1 , WORLD = 2 } |
The modules the entity manager can handle. More... | |
![]() | |
virtual void | UpdateField ()=0 |
Updates the field entities in the manager. More... | |
virtual void | UpdateBattle ()=0 |
Updates the battle entities in the manager. More... | |
virtual void | UpdateWorld ()=0 |
Updates the world map entities in the manager. More... | |
void | Update (Module module) |
Updates the entities of one module in the manager. More... | |
![]() | |
Module | module_ |
The currently selected module. More... | |
Module | prev_module_ |
The previous module. More... | |
bool | paused_ |
Indicates if the game is paused. More... | |
The camera manager.
CameraManager::CameraManager | ( | ) |
Constructor.
Initializes the camera with default parameters attached to the root scene manager.
|
virtual |
Destructor.
|
overridevirtual |
Clears all battle information in the camera manager.
Implements Manager.
|
overridevirtual |
Clears all field information in the camera manager.
Implements Manager.
|
overridevirtual |
Clears all world map information in the camera manager.
Implements Manager.
void CameraManager::EnableWireFrame | ( | bool | enable | ) |
Enables or disables the camera wireframe.
In wireframe mode, faces will not be rendered, only edges
[in] | enable | True to enable wireframe mode, false to disable. |
void CameraManager::EndBattleCamera | ( | ) |
Ends the battle camera.
Returns the camera to the state it was when {
const Ogre::Vector2 & CameraManager::Get2DScroll | ( | ) | const |
Retrieves the camera position.
Ogre::Camera * CameraManager::GetCurrentCamera | ( | ) |
Retrieves the camera.
Ogre::Viewport * CameraManager::getViewport | ( | ) |
Retrieves the viewport.
|
private |
Initializes the camera parameters.
Must be called on construction.
|
overridevirtual |
Handles camera actions.
Handles the scene manager camera actions based on events.
[in] | event | Event that triggers the camera action. |
Implements Manager.
void CameraManager::Input | ( | const VGears::Event & | event, |
Ogre::Real | time_since_last_frame | ||
) |
Handles camera actions.
Handles the scene manager camera actions based on events.
[in] | event | Event that triggers the camera action. |
[in] | time_since_last_frame | For speed calculation. |
|
overridevirtual |
const Ogre::Vector3 CameraManager::ProjectPointToScreen | ( | const Ogre::Vector3 & | point | ) |
Calculates the position of a point in screen.
The calculation is done using A map position and the camera scroll.
[in] | point | Position of the map to be translated to screen position. |
void CameraManager::ScriptSetCamera | ( | const int | x, |
const int | y, | ||
const int | z, | ||
const int | d_x, | ||
const int | d_y, | ||
const int | d_z | ||
) |
Sets the camera position and orientation.
It's only meand to be used for 3D cameras (battle, world map...), and using it while on a field can have unexpected results.
[in] | x | X coordinate for the camera position. |
[in] | y | Y coordinate for the camera position. |
[in] | z | Z coordinate for the camera position. |
[in] | d_x | X coordinate of the point the camera looks at. |
[in] | d_y | Y coordinate of the point the camera looks at. |
[in] | d_z | Z coordinate of the point the camera looks at. |
void CameraManager::Set2DCamera | ( | const Ogre::Vector3 | position, |
const Ogre::Quaternion | orientation, | ||
const Ogre::Radian | fov | ||
) |
Sets the camera properties.
[in] | position | Camera coordinates. |
[in] | orientation | Camera rotation, in quaternion format. |
[in] | fov | Field of view, in radians. |
void CameraManager::Set2DScroll | ( | const Ogre::Vector2 & | position | ) |
Sets the camera scroll.
Moves the camera to the desired position. If the camera is in free mode, it sets the position, but it won't actually move the camera.
[in] | position | Position to scroll the camera to. |
void CameraManager::SetCameraFree | ( | const bool | enable | ) |
Enables or disables the free camera.
A free camera moves depending on player input, not according to a script. For example, a camera following the PC is a free camera.
[in] | enable | True to enable free camera, false to disable it. |
void CameraManager::StartBattleCamera | ( | const Ogre::Vector3 | position, |
const Ogre::Vector3 | orientation | ||
) |
Starts the battle camera.
Saves the position and orientation of the current camera to return once the battle is over.
[in] | position | Initial position of the battle camera. |
[in] | orientation | Initial orientation of the battle camera. It indicates the point the camera will look at. |
|
overrideprivatevirtual |
Updates while the camera is in battle.
Implements Manager.
|
overridevirtual |
Updates debug information.
Implements Manager.
|
overrideprivatevirtual |
Updates while the camera is in the field.
Implements Manager.
|
overrideprivatevirtual |
Updates while the camera is in the world map.
Implements Manager.
|
private |
The camera.
|
private |
Flag to indicate a free camera.
A free camera moves depending on player input, not according to a script. For example, a camera following the PC is a free camera.
|
private |
Flag to indicate the free camera has rotated.
|
private |
The field of view.
|
private |
Camera orientation.
|
private |
Camera position.
|
private |
The camera scroll.
|
private |
A backup of the field or world camera orientation for when the battle camera is active.
|
private |
The initial orientation of the camera, saved when created.
|
private |
A backup of the field or world camera position for when the battle camera is activated.
|
private |
The initial position of the camera, saved when created.
|
private |
The viewport.