Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
CameraManager.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2017-2020 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#pragma once
23
24#include "Application.h"
25
26#include <OIS.h>
27#include <Ogre.h>
28
29namespace RoR {
30
33
36
38{
39public:
40
43
57
58 void UpdateInputEvents(float dt);
59
60 bool hasActiveBehavior();
61
63 Ogre::SceneNode* GetCameraNode() { return m_camera_node; }
64 Ogre::Camera* GetCamera() { return m_camera; }
65
67 void NotifyVehicleChanged(ActorPtr new_vehicle);
68
72
73 bool handleMouseMoved();
74 bool handleMousePressed();
75
76 void ResetAllBehaviors();
77 void ReCreateCameraNode();
78
81
82protected:
83
84 void switchBehavior(CameraBehaviors new_behavior);
85 void SwitchBehaviorOnVehicleChange(CameraBehaviors new_behavior, ActorPtr new_vehicle);
86 void ToggleCameraBehavior(CameraBehaviors new_behavior);
87 void ActivateNewBehavior(CameraBehaviors new_behavior, bool reset);
104 void CreateCameraNode();
105
106 Ogre::Camera* m_camera;
107 Ogre::SceneNode* m_camera_node;
108
112 // Old `CameraContext`
113 ActorPtr m_cct_player_actor; // TODO: duplicates `GameContext::m_player_actor`
114 Ogre::Degree m_cct_rot_scale;
115 Ogre::Real m_cct_dt;
117 float m_cct_sim_speed; // TODO: duplicates `ActorManager::m_simulation_speed`
118 // Old `CameraBehaviorOrbit` attributes
119 Ogre::Radian m_cam_rot_x;
120 Ogre::Radian m_cam_rot_y;
122 Ogre::Radian m_cam_target_pitch;
127 Ogre::Vector3 m_cam_look_at;
129 Ogre::Vector3 m_cam_look_at_last;
130 Ogre::Vector3 m_cam_look_at_smooth;
132 // Static cam attributes
136 Ogre::Vector3 m_staticcam_look_at;
137 Ogre::Vector3 m_staticcam_position;
139 // Character cam attributes
141 // Spline cam attributes
142 Ogre::ManualObject* m_splinecam_mo;
143 Ogre::SimpleSpline* m_splinecam_spline;
148 std::deque<node_t*> m_splinecam_spline_nodes;
150};
151
154
155} // namespace RoR
Central state/object manager and communications hub.
Ogre::Radian m_cam_rot_y
bool CameraBehaviorVehicleMousePressed()
Ogre::Radian m_cam_target_direction
Ogre::Degree m_cct_rot_scale
ActorPtr m_cct_player_actor
CameraBehaviors m_current_behavior
Ogre::Radian m_cam_rot_x
void ActivateNewBehavior(CameraBehaviors new_behavior, bool reset)
Ogre::ManualObject * m_splinecam_mo
void CameraBehaviorVehicleSplineCreateSpline()
Ogre::Radian m_staticcam_previous_fov
std::deque< node_t * > m_splinecam_spline_nodes
Ogre::Vector3 m_staticcam_position
void CameraBehaviorVehicleSplineReset()
Ogre::Vector3 m_cam_look_at_smooth
CameraBehaviors m_cam_before_toggled
Toggled modes (FREE, FREEFIX) remember original state.
unsigned int m_splinecam_num_linked_beams
void ReCreateCameraNode()
Needed since we call Ogre::SceneManager::ClearScene() after end of sim. session.
Ogre::Vector3 m_cam_look_at_last
bool CameraBehaviorStaticMouseMoved()
void NotifyVehicleChanged(ActorPtr new_vehicle)
void UpdateInputEvents(float dt)
bool CameraBehaviorVehicleSplineMouseMoved()
Ogre::Real m_splinecam_spline_len
CameraBehaviors m_prev_toggled_cam
Switching toggled modes (FREE, FREEFIX) keeps 1-slot history.
Ogre::Camera * m_camera
Ogre::SceneNode * GetCameraNode()
Ogre::Real m_cct_trans_scale
void switchBehavior(CameraBehaviors new_behavior)
void SwitchBehaviorOnVehicleChange(CameraBehaviors new_behavior, ActorPtr new_vehicle)
void CameraBehaviorVehicleSplineUpdateSpline()
CameraBehaviors GetCurrentBehavior() const
Ogre::SimpleSpline * m_splinecam_spline
Ogre::Vector3 m_cam_look_at_smooth_last
Ogre::Camera * GetCamera()
bool CameraBehaviorOrbitMouseMoved()
Ogre::Radian m_cam_target_pitch
void CameraBehaviorVehicleSplineUpdate()
void CameraBehaviorVehicleSplineUpdateSplineDisplay()
Ogre::Vector3 m_cam_look_at
void ToggleCameraBehavior(CameraBehaviors new_behavior)
Only accepts FREE and FREEFIX modes.
Ogre::Timer m_staticcam_update_timer
Ogre::Real m_splinecam_spline_pos
Ogre::Vector3 m_staticcam_look_at
Ogre::SceneNode * m_camera_node