|
Zappy GUI
C++ graphic client: renderer, camera, network
|
#include <CameraController.hpp>
Collaboration diagram for CameraController:Public Member Functions | |
| void | init (float worldWidth, float worldHeight) |
| void | update (float dt, float worldWidth, float worldHeight, const WorldState *world) |
| void | handleInput () |
| const Camera3D & | camera () const |
| void | enterFreecam () |
| void | exitFreecam () |
| void | startFollow (int playerId) |
| void | stopFollow () |
| bool | isFreecamActive () const |
| bool | isFollowActive () const |
| bool | isTransitioning () const |
| int | followedPlayerId () const |
Public Attributes | |
| float | orbitalMoveSpeed = 2.0f |
| float | freecamMoveSpeed = 5.0f |
| float | freecamLookSpeed = 0.002f |
| float | followDist = 2.5f |
| float | followHeight = 1.8f |
| float | followLookOffsetY = 0.5f |
| float | transitionDuration = 0.8f |
Private Types | |
| enum class | Mode { Orbital , Freecam , Follow , FollowLive } |
Private Member Functions | |
| void | _startTransition (Vector3 toPos, Vector3 toTarget, Mode nextMode) |
| void | _applyOrbital (float worldWidth, float worldHeight) |
| void | _orbitalDest (float worldWidth, float worldHeight, Vector3 &outPos, Vector3 &outTarget) const |
| bool | _followTarget (const WorldState *world, Vector3 &outPos, Vector3 &outLookAt) const |
| void | _handleOrbitalInput () |
| void | _handleFreecamInput () |
Private Attributes | |
| Camera3D | _camera = {} |
| Mode | _mode = Mode::Orbital |
| float | _angle = 0.0f |
| float | _height = 5.0f |
| float | _savedOrbitalAngle = 0.0f |
| float | _savedOrbitalHeight = 5.0f |
| float | _freecamYaw = 0.0f |
| float | _freecamPitch = 0.0f |
| int | _followedPlayerId = -1 |
| float | _lastWorldWidth = 10.0f |
| float | _lastWorldHeight = 10.0f |
| float | _transitionT = 1.0f |
| Vector3 | _fromPos = {} |
| Vector3 | _fromTarget = {} |
| Vector3 | _toPos = {} |
| Vector3 | _toTarget = {} |
| Mode | _pendingMode = Mode::Orbital |
Definition at line 9 of file CameraController.hpp.
|
strongprivate |
| Enumerator | |
|---|---|
| Orbital | |
| Freecam | |
| Follow | |
| FollowLive | |
Definition at line 40 of file CameraController.hpp.
|
private |
|
private |
Definition at line 56 of file CameraController.cpp.
References _followedPlayerId, VisualState::angle, followDist, followHeight, followLookOffsetY, WorldState::playerExists(), WorldState::players, and VisualState::pos.
Referenced by update().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 156 of file CameraController.cpp.
References _camera, _freecamPitch, _freecamYaw, freecamLookSpeed, and freecamMoveSpeed.
Referenced by handleInput().
Here is the caller graph for this function:
|
private |
Definition at line 148 of file CameraController.cpp.
References _angle, and orbitalMoveSpeed.
Referenced by handleInput().
Here is the caller graph for this function:
|
private |
Definition at line 26 of file CameraController.cpp.
References _angle, and _height.
Referenced by exitFreecam(), and stopFollow().
Here is the caller graph for this function:
|
private |
Definition at line 71 of file CameraController.cpp.
References _camera, _fromPos, _fromTarget, _pendingMode, _toPos, _toTarget, and _transitionT.
Referenced by exitFreecam(), startFollow(), and stopFollow().
Here is the caller graph for this function:
|
inline |
Definition at line 25 of file CameraController.hpp.
References _camera.
Referenced by RaylibRenderer::_performRaycast(), RaylibRenderer::_render2D(), RaylibRenderer::_render3D(), and RaylibRenderer::render().
Here is the caller graph for this function:| void CameraController::enterFreecam | ( | ) |
Definition at line 179 of file CameraController.cpp.
References _angle, _camera, _freecamPitch, _freecamYaw, _height, _mode, _savedOrbitalAngle, _savedOrbitalHeight, _transitionT, Freecam, isTransitioning(), and transitionDuration.
Referenced by RaylibRenderer::handleInput().
Here is the call graph for this function:
Here is the caller graph for this function:| void CameraController::exitFreecam | ( | ) |
Definition at line 193 of file CameraController.cpp.
References _angle, _height, _lastWorldHeight, _lastWorldWidth, _mode, _orbitalDest(), _savedOrbitalAngle, _savedOrbitalHeight, _startTransition(), Freecam, and Orbital.
Referenced by RaylibRenderer::handleInput().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 37 of file CameraController.hpp.
References _followedPlayerId.
Referenced by RaylibRenderer::handleInput().
Here is the caller graph for this function:| void CameraController::handleInput | ( | ) |
Definition at line 138 of file CameraController.cpp.
References _handleFreecamInput(), _handleOrbitalInput(), _mode, Freecam, isTransitioning(), and Orbital.
Referenced by RaylibRenderer::handleInput().
Here is the call graph for this function:
Here is the caller graph for this function:| void CameraController::init | ( | float | worldWidth, |
| float | worldHeight | ||
| ) |
Definition at line 15 of file CameraController.cpp.
References _applyOrbital(), _camera, _transitionT, and transitionDuration.
Referenced by RaylibRenderer::init().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 35 of file CameraController.hpp.
References _followedPlayerId.
Referenced by RaylibRenderer::_render2D(), RaylibRenderer::handleInput(), and stopFollow().
Here is the caller graph for this function:
|
inline |
Definition at line 34 of file CameraController.hpp.
References _mode, and Freecam.
Referenced by RaylibRenderer::handleInput().
Here is the caller graph for this function:
|
inline |
Definition at line 36 of file CameraController.hpp.
References _transitionT, and transitionDuration.
Referenced by enterFreecam(), handleInput(), and startFollow().
Here is the caller graph for this function:| void CameraController::startFollow | ( | int | playerId | ) |
Definition at line 204 of file CameraController.cpp.
References _camera, _followedPlayerId, _mode, _startTransition(), Follow, Freecam, and isTransitioning().
Referenced by RaylibRenderer::handleInput().
Here is the call graph for this function:
Here is the caller graph for this function:| void CameraController::stopFollow | ( | ) |
Definition at line 213 of file CameraController.cpp.
References _lastWorldHeight, _lastWorldWidth, _orbitalDest(), _startTransition(), isFollowActive(), and Orbital.
Referenced by RaylibRenderer::handleInput(), and update().
Here is the call graph for this function:
Here is the caller graph for this function:| void CameraController::update | ( | float | dt, |
| float | worldWidth, | ||
| float | worldHeight, | ||
| const WorldState * | world | ||
| ) |
Definition at line 81 of file CameraController.cpp.
References _applyOrbital(), _camera, _followedPlayerId, _followTarget(), _freecamPitch, _freecamYaw, _fromPos, _fromTarget, _lastWorldHeight, _lastWorldWidth, _mode, _pendingMode, _toPos, _toTarget, _transitionT, Follow, FollowLive, Freecam, Orbital, smoothstep(), stopFollow(), and transitionDuration.
Referenced by RaylibRenderer::render().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 45 of file CameraController.hpp.
Referenced by _applyOrbital(), _handleOrbitalInput(), _orbitalDest(), enterFreecam(), and exitFreecam().
|
private |
Definition at line 42 of file CameraController.hpp.
Referenced by _applyOrbital(), _handleFreecamInput(), _startTransition(), camera(), enterFreecam(), init(), startFollow(), and update().
|
private |
Definition at line 53 of file CameraController.hpp.
Referenced by _followTarget(), followedPlayerId(), isFollowActive(), startFollow(), and update().
|
private |
Definition at line 51 of file CameraController.hpp.
Referenced by _handleFreecamInput(), enterFreecam(), and update().
|
private |
Definition at line 50 of file CameraController.hpp.
Referenced by _handleFreecamInput(), enterFreecam(), and update().
|
private |
Definition at line 58 of file CameraController.hpp.
Referenced by _startTransition(), and update().
|
private |
Definition at line 59 of file CameraController.hpp.
Referenced by _startTransition(), and update().
|
private |
Definition at line 46 of file CameraController.hpp.
Referenced by _applyOrbital(), _orbitalDest(), enterFreecam(), and exitFreecam().
|
private |
Definition at line 55 of file CameraController.hpp.
Referenced by exitFreecam(), stopFollow(), and update().
|
private |
Definition at line 54 of file CameraController.hpp.
Referenced by exitFreecam(), stopFollow(), and update().
|
private |
Definition at line 43 of file CameraController.hpp.
Referenced by enterFreecam(), exitFreecam(), handleInput(), isFreecamActive(), startFollow(), and update().
|
private |
Definition at line 62 of file CameraController.hpp.
Referenced by _startTransition(), and update().
|
private |
Definition at line 47 of file CameraController.hpp.
Referenced by enterFreecam(), and exitFreecam().
|
private |
Definition at line 48 of file CameraController.hpp.
Referenced by enterFreecam(), and exitFreecam().
|
private |
Definition at line 60 of file CameraController.hpp.
Referenced by _startTransition(), and update().
|
private |
Definition at line 61 of file CameraController.hpp.
Referenced by _startTransition(), and update().
|
private |
Definition at line 57 of file CameraController.hpp.
Referenced by _startTransition(), enterFreecam(), init(), isTransitioning(), and update().
| float CameraController::followDist = 2.5f |
Definition at line 15 of file CameraController.hpp.
Referenced by _followTarget().
| float CameraController::followHeight = 1.8f |
Definition at line 16 of file CameraController.hpp.
Referenced by _followTarget().
| float CameraController::followLookOffsetY = 0.5f |
Definition at line 17 of file CameraController.hpp.
Referenced by _followTarget().
| float CameraController::freecamLookSpeed = 0.002f |
Definition at line 14 of file CameraController.hpp.
Referenced by _handleFreecamInput().
| float CameraController::freecamMoveSpeed = 5.0f |
Definition at line 13 of file CameraController.hpp.
Referenced by _handleFreecamInput().
| float CameraController::orbitalMoveSpeed = 2.0f |
Definition at line 12 of file CameraController.hpp.
Referenced by _handleOrbitalInput().
| float CameraController::transitionDuration = 0.8f |
Definition at line 18 of file CameraController.hpp.
Referenced by enterFreecam(), init(), isTransitioning(), and update().