Colobot
|
Camera moving in 3D scene. More...
#include <camera.h>
Public Member Functions | |
bool | EventProcess (const Event &event) |
Management of an event. More... | |
void | Init (Math::Vector eye, Math::Vector lookat, float delay) |
Initializes the camera. More... | |
void | SetControllingObject (CObject *object) |
Sets the object controlling the camera. More... | |
CObject * | GetControllingObject () |
Gets the object controlling the camera. More... | |
void | SetType (CameraType type) |
Change the type of camera. More... | |
CameraType | GetType () |
Get the type of the camera. More... | |
void | SetSmooth (CameraSmooth type) |
Set smoothing mode. More... | |
CameraSmooth | GetSmooth () |
Get smoothing mode. More... | |
void | GetCamera (Math::Vector &eye, Math::Vector &lookat) |
Returns the current point of view of the camera. More... | |
void | SetFreeze (bool freeze) |
Temporarily freeze camera movement. More... | |
void | SetCameraSpeed (float speed) |
Set camera speed. More... | |
Visit camera management (CAM_TYPE_VISIT) - camera in this mode shows a position, constantly rotating around it | |
void | StartVisit (Math::Vector goal, float dist) |
Start visit camera. More... | |
void | StopVisit () |
Stop visit camera. More... | |
Camera "centering" - moves the camera to show some happening action (e.g. sniffer sniffing) | |
bool | StartCentering (CObject *object, float angleH, float angleV, float dist, float time) |
Move camera to show happening action. More... | |
bool | StopCentering (CObject *object, float time) |
Go back to normal position after showing some happening action. More... | |
void | AbortCentering () |
Abort centering animation in the current position. More... | |
Camera shake effects | |
void | StartEffect (CameraEffect effect, Math::Vector pos, float force) |
Starts a camera shake effect. More... | |
void | FlushEffect () |
Removes the camera shake effect. More... | |
Camera overlay effects | |
void | StartOver (CameraOverEffect effect, Math::Vector pos, float force) |
Starts camera overlay effect. More... | |
void | FlushOver () |
Removes camera overlay effect. More... | |
void | SetOverBaseColor (Color color) |
Specifies camera overlay effect base color. More... | |
Script camera - cutscenes controlled by external code | |
void | SetScriptCamera (Math::Vector eye, Math::Vector lookat) |
Script camera: Set camera position. More... | |
void | SetScriptCameraAnimate (Math::Vector eye, Math::Vector lookat) |
Script camera: Animate to given camera position. More... | |
void | SetScriptCameraAnimateEye (Math::Vector eye) |
Script camera: Animate to given eye position. More... | |
void | SetScriptCameraAnimateLookat (Math::Vector lookat) |
Script camera: Animate to given lookat position. More... | |
Protected Member Functions | |
void | EffectFrame (const Event &event) |
Advances the effect of the camera. More... | |
void | OverFrame (const Event &event) |
Advanced overlay effect in the foreground. More... | |
bool | EventFrameFree (const Event &event, bool keysAllowed) |
bool | EventFrameBack (const Event &event) |
bool | EventFrameFix (const Event &event) |
bool | EventFrameExplo (const Event &event) |
bool | EventFrameOnBoard (const Event &event) |
bool | EventFrameVisit (const Event &event) |
bool | EventFrameScript (const Event &event) |
void | UpdateCameraAnimation (const Math::Vector &eyePt, const Math::Vector &lookatPt, float rTime) |
Calculates camera animation and sends updated camera position to the 3D engine. More... | |
void | IsCollision (Math::Vector &eye, Math::Vector lookat) |
Avoid the obstacles. More... | |
void | IsCollisionBack () |
Avoid the obstacles (CAM_TYPE_BACK) More... | |
void | IsCollisionFix (Math::Vector &eye, Math::Vector lookat) |
Avoid the obstacles (CAM_TYPE_FIX or CAM_TYPE_PLANE) More... | |
Math::Vector | ExcludeTerrain (Math::Vector eye, Math::Vector lookat, float &angleH, float &angleV) |
Adjusts the camera not to enter the ground. More... | |
Math::Vector | ExcludeObject (Math::Vector eye, Math::Vector lookat, float &angleH, float &angleV) |
Adjusts the camera not to enter an object. More... | |
void | SetViewParams (const Math::Vector &eye, const Math::Vector &lookat, const Math::Vector &up=Math::Vector(0.0f, 1.0f, 0.0f)) |
Updates the location and direction of the camera in the 3D engine. More... | |
Math::Vector | CalculateCameraMovement (const Event &event, bool keysAllowed=true) |
Calculate camera movement (from user inputs) to apply. More... | |
Protected Attributes | |
CEngine * | m_engine |
CRobotMain * | m_main |
CTerrain * | m_terrain |
CWater * | m_water |
CInput * | m_input |
CameraType | m_type |
The type of camera. More... | |
CameraSmooth | m_smooth |
Type of smoothing. More... | |
CObject * | m_cameraObj |
Object linked to the camera. More... | |
float | m_initDelay |
Remaining time of initial camera entry animation. More... | |
Math::Vector | m_actualEye |
Current eye. More... | |
Math::Vector | m_actualLookat |
Current aim. More... | |
Math::Vector | m_finalEye |
Final eye. More... | |
Math::Vector | m_finalLookat |
Final lookat. More... | |
Math::Vector | m_prevEye |
Eye position at the moment of entering CAM_TYPE_INFO/CAM_TYPE_VISIT. More... | |
Math::Vector | m_prevLookat |
Lookat position at the moment of entering CAM_TYPE_INFO/CAM_TYPE_VISIT. More... | |
float | m_focus |
Math::Vector | m_eyePt |
CAM_TYPE_FREE: eye. More... | |
float | m_directionH |
CAM_TYPE_FREE: horizontal direction. More... | |
float | m_directionV |
CAM_TYPE_FREE: vertical direction. More... | |
float | m_heightEye |
CAM_TYPE_FREE: height above the ground. More... | |
float | m_heightLookat |
CAM_TYPE_FREE: height above the ground. More... | |
float | m_speed |
CAM_TYPE_FREE: speed of movement. More... | |
float | m_backDist |
CAM_TYPE_BACK: distance. More... | |
float | m_backMin |
CAM_TYPE_BACK: minimal distance. More... | |
float | m_addDirectionH |
CAM_TYPE_BACK: additional horizontal direction. More... | |
float | m_addDirectionV |
CAM_TYPE_BACK: additional vertical direction. More... | |
float | m_fixDist |
CAM_TYPE_FIX: distance. More... | |
float | m_fixDirectionH |
CAM_TYPE_FIX: horizontal direction. More... | |
float | m_fixDirectionV |
CAM_TYPE_FIX: vertical direction. More... | |
Math::Vector | m_visitGoal |
CAM_TYPE_VISIT: target position. More... | |
float | m_visitDist |
CAM_TYPE_VISIT: distance. More... | |
float | m_visitTime |
CAM_TYPE_VISIT: relative time. More... | |
CameraType | m_visitType |
CAM_TYPE_VISIT: initial type. More... | |
float | m_visitDirectionV |
CAM_TYPE_VISIT: direction. More... | |
Math::Point | m_mousePos = Math::Point(0.5f, 0.5f) |
Last known mouse position, used to calculate change since last frame. More... | |
Math::Point | m_mouseDelta = Math::Point(0.0f, 0.0f) |
Change of mouse position since last frame. More... | |
Math::Point | m_mouseDeltaEdge = Math::Point(0.0f, 0.0f) |
Change of camera position caused by edge camera. More... | |
float | m_mouseWheelDelta = 0.0f |
Change of mouse wheel since last frame. More... | |
CenteringPhase | m_centeringPhase |
float | m_centeringAngleH |
float | m_centeringAngleV |
float | m_centeringDist |
float | m_centeringCurrentH |
float | m_centeringCurrentV |
float | m_centeringTime |
float | m_centeringProgress |
CameraEffect | m_effectType |
Math::Vector | m_effectPos |
float | m_effectForce |
float | m_effectProgress |
Math::Vector | m_effectOffset |
CameraOverEffect | m_overType |
float | m_overForce |
float | m_overTime |
Color | m_overColorBase |
Color | m_overColor |
int | m_overMode |
float | m_overFadeIn |
float | m_overFadeOut |
Math::Vector | m_scriptEye |
Math::Vector | m_scriptLookat |
bool | m_freeze = false |
Is camera frozen? More... | |
Camera moving in 3D scene.
This class manages everything related to animating the camera in 3D scene. Calculated values are then passed to Gfx::CEngine.
bool Gfx::CCamera::EventProcess | ( | const Event & | event | ) |
Management of an event.
void Gfx::CCamera::Init | ( | Math::Vector | eye, |
Math::Vector | lookat, | ||
float | delay | ||
) |
Initializes the camera.
eye | Initial eye position |
lookat | Initial lookat position |
delay | Time of the initial entry animation |
void Gfx::CCamera::SetControllingObject | ( | CObject * | object | ) |
Sets the object controlling the camera.
CObject * Gfx::CCamera::GetControllingObject | ( | ) |
Gets the object controlling the camera.
void Gfx::CCamera::SetType | ( | CameraType | type | ) |
Change the type of camera.
CameraType Gfx::CCamera::GetType | ( | ) |
Get the type of the camera.
void Gfx::CCamera::SetSmooth | ( | CameraSmooth | type | ) |
Set smoothing mode.
CameraSmooth Gfx::CCamera::GetSmooth | ( | ) |
Get smoothing mode.
void Gfx::CCamera::GetCamera | ( | Math::Vector & | eye, |
Math::Vector & | lookat | ||
) |
Returns the current point of view of the camera.
void Gfx::CCamera::StartVisit | ( | Math::Vector | goal, |
float | dist | ||
) |
Start visit camera.
void Gfx::CCamera::StopVisit | ( | ) |
Stop visit camera.
bool Gfx::CCamera::StartCentering | ( | CObject * | object, |
float | angleH, | ||
float | angleV, | ||
float | dist, | ||
float | time | ||
) |
Move camera to show happening action.
bool Gfx::CCamera::StopCentering | ( | CObject * | object, |
float | time | ||
) |
Go back to normal position after showing some happening action.
void Gfx::CCamera::AbortCentering | ( | ) |
Abort centering animation in the current position.
void Gfx::CCamera::StartEffect | ( | CameraEffect | effect, |
Math::Vector | pos, | ||
float | force | ||
) |
Starts a camera shake effect.
void Gfx::CCamera::FlushEffect | ( | ) |
Removes the camera shake effect.
void Gfx::CCamera::StartOver | ( | CameraOverEffect | effect, |
Math::Vector | pos, | ||
float | force | ||
) |
Starts camera overlay effect.
void Gfx::CCamera::FlushOver | ( | ) |
Removes camera overlay effect.
void Gfx::CCamera::SetOverBaseColor | ( | Color | color | ) |
Specifies camera overlay effect base color.
void Gfx::CCamera::SetScriptCamera | ( | Math::Vector | eye, |
Math::Vector | lookat | ||
) |
Script camera: Set camera position.
void Gfx::CCamera::SetScriptCameraAnimate | ( | Math::Vector | eye, |
Math::Vector | lookat | ||
) |
Script camera: Animate to given camera position.
void Gfx::CCamera::SetScriptCameraAnimateEye | ( | Math::Vector | eye | ) |
Script camera: Animate to given eye position.
void Gfx::CCamera::SetScriptCameraAnimateLookat | ( | Math::Vector | lookat | ) |
Script camera: Animate to given lookat position.
void Gfx::CCamera::SetFreeze | ( | bool | freeze | ) |
Temporarily freeze camera movement.
void Gfx::CCamera::SetCameraSpeed | ( | float | speed | ) |
Set camera speed.
|
protected |
Advances the effect of the camera.
|
protected |
Advanced overlay effect in the foreground.
|
protected |
Calculates camera animation and sends updated camera position to the 3D engine.
eyePt | Eye point |
lookatPt | Lookat point |
rTime | Time since last time this function was called (used to calculate animation) |
|
protected |
Avoid the obstacles.
For CAM_TYPE_BACK: make obstacles transparent For CAM_TYPE_FIX or CAM_TYPE_PLANE: adjust eye not to hit the obstacles
eye | Eye position, may be adjusted |
lookat | Lookat point |
|
protected |
Avoid the obstacles (CAM_TYPE_BACK)
|
protected |
Avoid the obstacles (CAM_TYPE_FIX or CAM_TYPE_PLANE)
|
protected |
Adjusts the camera not to enter the ground.
|
protected |
Adjusts the camera not to enter an object.
|
protected |
Updates the location and direction of the camera in the 3D engine.
eye | Eye point |
lookat | Lookat point |
up | Up vector |
|
protected |
Calculate camera movement (from user inputs) to apply.
|
protected |
The type of camera.
|
protected |
Type of smoothing.
|
protected |
Object linked to the camera.
|
protected |
Remaining time of initial camera entry animation.
|
protected |
Current eye.
|
protected |
Current aim.
|
protected |
Final eye.
|
protected |
Final lookat.
|
protected |
Eye position at the moment of entering CAM_TYPE_INFO/CAM_TYPE_VISIT.
|
protected |
Lookat position at the moment of entering CAM_TYPE_INFO/CAM_TYPE_VISIT.
|
protected |
CAM_TYPE_FREE: eye.
|
protected |
CAM_TYPE_FREE: horizontal direction.
|
protected |
CAM_TYPE_FREE: vertical direction.
|
protected |
CAM_TYPE_FREE: height above the ground.
|
protected |
CAM_TYPE_FREE: height above the ground.
|
protected |
CAM_TYPE_FREE: speed of movement.
|
protected |
CAM_TYPE_BACK: distance.
|
protected |
CAM_TYPE_BACK: minimal distance.
|
protected |
CAM_TYPE_BACK: additional horizontal direction.
|
protected |
CAM_TYPE_BACK: additional vertical direction.
|
protected |
CAM_TYPE_FIX: distance.
|
protected |
CAM_TYPE_FIX: horizontal direction.
|
protected |
CAM_TYPE_FIX: vertical direction.
|
protected |
CAM_TYPE_VISIT: target position.
|
protected |
CAM_TYPE_VISIT: distance.
|
protected |
CAM_TYPE_VISIT: relative time.
|
protected |
CAM_TYPE_VISIT: initial type.
|
protected |
CAM_TYPE_VISIT: direction.
|
protected |
Last known mouse position, used to calculate change since last frame.
|
protected |
Change of mouse position since last frame.
|
protected |
Change of camera position caused by edge camera.
|
protected |
Change of mouse wheel since last frame.
|
protected |
Is camera frozen?