Planeshift
|
#include <pscamera.h>
Classes | |
struct | CameraData |
struct | DistanceCfg |
Public Types | |
enum | CAMERA_MODES { CAMERA_FIRST_PERSON = 0, CAMERA_THIRD_PERSON, CAMERA_M64_THIRD_PERSON, CAMERA_LARA_THIRD_PERSON, CAMERA_FREE, CAMERA_ACTUAL_DATA, CAMERA_LAST_ACTUAL, CAMERA_TRANSITION, CAMERA_NPCTALK, CAMERA_COLLISION, CAMERA_ERR, CAMERA_MODES_COUNT } |
Public Member Functions | |
bool | CheckCameraCD () const |
returns whether the camera is performing CD or not | |
bool | Draw () |
applies the camera data to the viewport and renders the 3D scene | |
iMeshWrapper * | FindMeshUnder2D (int x, int y, csVector3 *pos=NULL, int *poly=NULL) |
Returns the mesh under the 2D point. | |
iMeshWrapper * | Get3DPointFrom2D (int x, int y, csVector3 *worldCoord=0, csVector3 *untransfCoord=0) |
returns the 3D point where the line under the given point intersects with the world | |
int | GetCameraMode () const |
returns the current camera mode (as integer) | |
csString | GetCameraModeVerbose () const |
returns the current camera mode (text description) | |
float | GetDampeningCoef (int mode=-1) const |
returns the dampening coefficient of the camera | |
float | GetDefaultPitch (int mode=-1) const |
returns the default (starting) pitch of the specific camera mode | |
float | GetDefaultYaw (int mode=-1) const |
returns the default (starting) yaw of the specific camera mode | |
float | GetDistance (int mode=-1) const |
returns the distance from the camera position to its target | |
DistanceCfg | GetDistanceCfg () |
int | GetFixedDistClip () |
csVector3 | GetForwardVector (int mode=-1) const |
returns the forward vector of the camera | |
iPerspectiveCamera * | GetICamera () |
returns the camera that CS use | |
int | GetLastCameraMode () |
gets the last used camera mode | |
float | GetMaxDistance (int mode=-1) const |
returns the max distance from the camera position to the target | |
float | GetMinDistance (int mode=-1) const |
returns the min distance from the camera position to the target | |
float | GetPitch (int mode=-1) const |
returns the pitch (up/down) of the camera | |
float | GetPitchVelocity () const |
gets the pitch (up/down) velocity of the camera | |
csVector3 | GetPosition (int mode=-1) const |
returns the current position of the camera (different for each mode) | |
csVector3 | GetRightVector (int mode=-1) const |
returns the forward vector of the camera | |
float | GetSpringCoef (int mode=-1) const |
returns the spring coefficient of the camera | |
float | GetSpringLength (int mode=-1) const |
returns the spring length of the camera | |
float | GetSwingCoef (int mode=-1) const |
returns the swing coefficient of the specific camera mode | |
csVector3 | GetTarget (int mode=-1) const |
returns the current position of the camera (different for each mode) | |
float | GetTransitionThreshold () const |
gets the camera transition threshold (the distance between camera position and ideal where the camera ceases to be in transition) | |
float | GetTurnSpeed (int mode=-1) const |
returns the turning speed of the camera (ignored for most camera modes) | |
csVector3 | GetUp (int mode=-1) const |
Returns the current up vector of the camera (different for each mode). | |
bool | GetUseNPCCam () |
returns whether the npc chat camera is used or not | |
iView * | GetView () |
returns the CS viewport | |
float | GetYaw (int mode=-1) const |
returns the yaw (left/right) of the camera | |
float | GetYawVelocity () const |
gets the yaw (up/down) velocity of the camera | |
const char * | HandleCommand (const char *cmd) |
Interprets a received message and executes the command. | |
void | HandleMessage (MsgEntry *msg) |
bool | InitializeView (GEMClientActor *entity) |
creates the viewport | |
bool | IsInitialized () |
bool | LoadFromFile (bool useDefault=false, bool overrideCurrent=true) |
loads the camera settings from a file | |
void | LoadOptions () |
This function is called when the options system has been issued a Save() call. | |
void | LockCameraMode (bool state) |
locks the current camera mode so it cannot be changed | |
void | MoveDistance (float deltaDistance, int mode=-1) |
moves the distance from the camera position to its target | |
void | MovePitch (float deltaPitch, int mode=-1) |
moves the pitch (up/down) of the camera | |
void | MoveYaw (float deltaYaw, int mode=-1) |
moves the yaw (left/right) of the camera | |
void | NextCameraMode () |
changes the current camera mode to the next available camera mode | |
void | npcTargetReplaceIfEqual (GEMClientObject *currentEntity, GEMClientObject *replacementEntity) |
Replace the actor the camera is targeting when in npc camera mode. | |
psCamera () | |
void | ResetActualCameraData () |
resets the actual camera data to the player position and stuff | |
void | ResetCameraPositioning () |
flags the camera positioning as bad so that it will reset it next update loop | |
bool | RotateCameraWithPlayer () const |
moves decides, based on the camera mode, whether the camera should be rotated along-side the player | |
void | SaveOptions () |
This function is called whenever the options system needs the options class to give it its options values. | |
bool | SaveToFile () |
saves the camera settings to a file | |
void | SetActor (GEMClientActor *entity) |
Set the actor the camera is following. | |
void | SetCameraCD (bool useCD) |
sets whether the camera is performing CD or not | |
void | SetCameraMode (int mode) |
sets the current camera mode | |
void | SetDampeningCoef (float coef, int mode=-1) |
sets the dampening coefficient of the camera | |
void | SetDefaultPitch (float pitch, int mode=-1) |
sets the default (starting) pitch for the specific camera mode | |
void | SetDefaultYaw (float yaw, int mode=-1) |
sets the default (starting) yaw for the specific camera mode | |
void | SetDistance (float distance, int mode=-1) |
sets the distance from the camera position to its target | |
void | SetDistanceCfg (DistanceCfg newcfg) |
void | SetMaxDistance (float dist, int mode=-1) |
sets the max distance from the camera position to the target | |
void | SetMinDistance (float dist, int mode=-1) |
sets the min distance from the camera position to the target | |
void | SetPitch (float pitch, int mode=-1) |
sets the pitch (up/down) of the camera | |
void | SetPitchVelocity (float pitchVel) |
sets the pitch (up/down) velocity of the camera | |
void | SetPosition (const csVector3 &pos, int mode=-1) |
sets the current position of the camera (different for each mode) | |
void | SetSpringCoef (float coef, int mode=-1) |
sets the spring coefficient of the camera | |
void | SetSpringLength (float length, int mode=-1) |
sets the spring length of the camera | |
void | SetSwingCoef (float swingCoef, int mode=-1) |
sets the swing coefficient of the specific camera mode | |
void | SetTarget (const csVector3 &tar, int mode=-1) |
Sets the current target of the camera (different for each mode). | |
void | SetTransitionThreshold (float threshold) |
sets the camera transition threshold (the distance between camera position and ideal where the camera ceases to be in transition) | |
void | SetTurnSpeed (float speed, int mode=-1) |
sets the turning speed of the camera (ignored for most camera modes) | |
void | SetUp (const csVector3 &up, int mode=-1) |
Sets the current up vector of the camera (different for each mode). | |
void | SetUseNPCCam (bool useNPCCam) |
sets whether the npc chat camera is used or not | |
void | SetYaw (float yaw, int mode=-1) |
sets the yaw (left/right) of the camera | |
void | SetYawVelocity (float yawVel) |
sets the yaw (up/down) velocity of the camera | |
void | UseAdaptiveDistanceClipping (int minFPS, int maxFPS, int minDist) |
puts camera to adaptive distance clipping mode - camera will automatically adjust the distance to stay in given fps interval | |
void | UseFixedDistanceClipping (float dist) |
puts camera to fixed distance clipping mode - distance clipping will be set to constant value | |
virtual | ~psCamera () |
Definition at line 51 of file pscamera.h.
Definition at line 62 of file pscamera.h.
psCamera::psCamera | ( | ) |
virtual psCamera::~psCamera | ( | ) | [virtual] |
bool psCamera::CheckCameraCD | ( | ) | const |
returns whether the camera is performing CD or not
bool psCamera::Draw | ( | ) |
applies the camera data to the viewport and renders the 3D scene
Returns the mesh under the 2D point.
x | the x part of the 2D point | |
y | the y part of the 2D point | |
[out] | pos | The best found position. |
poly | Not used |
iMeshWrapper* psCamera::Get3DPointFrom2D | ( | int | x, |
int | y, | ||
csVector3 * | worldCoord = 0 , |
||
csVector3 * | untransfCoord = 0 |
||
) |
returns the 3D point where the line under the given point intersects with the world
x | the x part of the 2D point |
y | the y part of the 2D point |
worldCoord | container to hold the calculated 3D world vector under the 2D point |
untransfCoord | container to hold the untransformed 3D world vector (untouched by warp portals) |
int psCamera::GetCameraMode | ( | ) | const |
returns the current camera mode (as integer)
csString psCamera::GetCameraModeVerbose | ( | ) | const |
returns the current camera mode (text description)
returns the dampening coefficient of the camera
mode | Optional - the camera mode to get the data from (leave blank for current) |
returns the default (starting) pitch of the specific camera mode
mode | Optional - the camera mode to get the data from (leave blank for current) |
returns the default (starting) yaw of the specific camera mode
mode | Optional - the camera mode to get the data from (leave blank for current) |
returns the distance from the camera position to its target
mode | Optional - the camera mode to get it from (leave blank for current) |
DistanceCfg psCamera::GetDistanceCfg | ( | ) |
int psCamera::GetFixedDistClip | ( | ) | [inline] |
Definition at line 492 of file pscamera.h.
csVector3 psCamera::GetForwardVector | ( | int | mode = -1 | ) | const |
returns the forward vector of the camera
mode | Optional - the camera mode to get the data from (leave blank for current) |
iPerspectiveCamera* psCamera::GetICamera | ( | ) |
returns the camera that CS use
int psCamera::GetLastCameraMode | ( | ) |
gets the last used camera mode
returns the max distance from the camera position to the target
mode | Optional - the camera mode to get the data from (leave blank for current) |
returns the min distance from the camera position to the target
mode | Optional - the camera mode to get the data from (leave blank for current) |
returns the pitch (up/down) of the camera
mode | Optional - the camera mode to get it from (leave blank for current) |
float psCamera::GetPitchVelocity | ( | ) | const |
gets the pitch (up/down) velocity of the camera
csVector3 psCamera::GetPosition | ( | int | mode = -1 | ) | const |
returns the current position of the camera (different for each mode)
mode | the camera mode |
csVector3 psCamera::GetRightVector | ( | int | mode = -1 | ) | const |
returns the forward vector of the camera
mode | Optional - the camera mode to get the data from (leave blank for current) |
returns the spring coefficient of the camera
mode | Optional - the camera mode to get the data from (leave blank for current) |
returns the spring length of the camera
mode | Optional - the camera mode to get the data from (leave blank for current) |
returns the swing coefficient of the specific camera mode
mode | Optional - the camera mode to get the data from (leave blank for current) |
csVector3 psCamera::GetTarget | ( | int | mode = -1 | ) | const |
returns the current position of the camera (different for each mode)
mode | the camera mode |
float psCamera::GetTransitionThreshold | ( | ) | const |
gets the camera transition threshold (the distance between camera position and ideal where the camera ceases to be in transition)
returns the turning speed of the camera (ignored for most camera modes)
mode | Optional - the camera mode to get the data from (leave blank for current) |
csVector3 psCamera::GetUp | ( | int | mode = -1 | ) | const |
Returns the current up vector of the camera (different for each mode).
mode | the camera mode |
bool psCamera::GetUseNPCCam | ( | ) |
returns whether the npc chat camera is used or not
iView* psCamera::GetView | ( | ) |
returns the CS viewport
returns the yaw (left/right) of the camera
mode | Optional - the camera mode to get it from (leave blank for current) |
float psCamera::GetYawVelocity | ( | ) | const |
gets the yaw (up/down) velocity of the camera
const char* psCamera::HandleCommand | ( | const char * | cmd | ) | [virtual] |
Interprets a received message and executes the command.
char * returned can be an error message to display.
Implements psCmdBase.
bool psCamera::InitializeView | ( | GEMClientActor * | entity | ) |
creates the viewport
entity | the actor for the view |
bool psCamera::IsInitialized | ( | ) | [inline] |
Definition at line 494 of file pscamera.h.
bool psCamera::LoadFromFile | ( | bool | useDefault = false , |
bool | overrideCurrent = true |
||
) |
loads the camera settings from a file
useDefault | if true, use the default config file even if the normal exists |
overrideCurrent | if true, change current camera settings with loaded data |
void psCamera::LoadOptions | ( | ) | [virtual] |
This function is called when the options system has been issued a Save() call.
Options classes will be expected to load all associated options and apply them as appropriate.
Implements iOptionsClass.
void psCamera::LockCameraMode | ( | bool | state | ) |
locks the current camera mode so it cannot be changed
state | the desired state |
moves the distance from the camera position to its target
deltaDistance | the amount to displace the current distance |
mode | Optional - the camera mode to apply it to (leave blank for current) |
moves the pitch (up/down) of the camera
deltaPitch | the amount to move from the current pitch |
mode | Optional - the camera mode to apply it to (leave blank for current) |
moves the yaw (left/right) of the camera
deltaYaw | the amount to move from the current yaw |
mode | Optional - the camera mode to apply it to (leave blank for current) |
void psCamera::NextCameraMode | ( | ) |
changes the current camera mode to the next available camera mode
void psCamera::npcTargetReplaceIfEqual | ( | GEMClientObject * | currentEntity, |
GEMClientObject * | replacementEntity | ||
) |
Replace the actor the camera is targeting when in npc camera mode.
It's replaced only if the actor is equal. This is to be used when deleting actor objects or replacing them, in order to avoid a pending invalid pointer in pscamera.
currentEntity | The actor which is being replaced/deleted. |
replacementEntity | The actor instance which is being created. Pass NULL if it's only being destroyed. |
void psCamera::ResetActualCameraData | ( | ) |
resets the actual camera data to the player position and stuff
void psCamera::ResetCameraPositioning | ( | ) |
flags the camera positioning as bad so that it will reset it next update loop
bool psCamera::RotateCameraWithPlayer | ( | ) | const |
moves decides, based on the camera mode, whether the camera should be rotated along-side the player
void psCamera::SaveOptions | ( | ) | [virtual] |
This function is called whenever the options system needs the options class to give it its options values.
The options class is expected to call SetOption for every option it uses.
Implements iOptionsClass.
bool psCamera::SaveToFile | ( | ) |
saves the camera settings to a file
void psCamera::SetActor | ( | GEMClientActor * | entity | ) |
Set the actor the camera is following.
entity | the actor for the view |
void psCamera::SetCameraCD | ( | bool | useCD | ) |
sets whether the camera is performing CD or not
useCD | true if the camera should perform CD, false otherwise |
void psCamera::SetCameraMode | ( | int | mode | ) |
sets the current camera mode
mode | the desired camera mode |
sets the dampening coefficient of the camera
coef | the dampening coefficient |
mode | Optional - the camera mode to set the data (leave blank for current) |
sets the default (starting) pitch for the specific camera mode
pitch | the new default (starting) pitch |
mode | Optional - the camera mode to set the data (leave blank for current) |
sets the default (starting) yaw for the specific camera mode
yaw | the new default (starting) yaw |
mode | Optional - the camera mode to set the data (leave blank for current) |
sets the distance from the camera position to its target
distance | the new distance |
mode | Optional - the camera mode to apply it to (leave blank for current) |
void psCamera::SetDistanceCfg | ( | DistanceCfg | newcfg | ) |
sets the max distance from the camera position to the target
dist | the max distance |
mode | Optional - the camera mode to set the data (leave blank for current) |
sets the min distance from the camera position to the target
dist | the min distance |
mode | Optional - the camera mode to set the data (leave blank for current) |
sets the pitch (up/down) of the camera
pitch | the new pitch of the camera |
mode | Optional - the camera mode to apply it to (leave blank for current) |
void psCamera::SetPitchVelocity | ( | float | pitchVel | ) |
sets the pitch (up/down) velocity of the camera
pitchVel | the velocity of the pitch |
void psCamera::SetPosition | ( | const csVector3 & | pos, |
int | mode = -1 |
||
) |
sets the current position of the camera (different for each mode)
pos | The new camera position for the current mode |
mode | the camera mode |
sets the spring coefficient of the camera
coef | the spring coefficient |
mode | Optional - the camera mode to set the data (leave blank for current) |
sets the spring length of the camera
length | the spring length |
mode | Optional - the camera mode to set the data (leave blank for current) |
sets the swing coefficient of the specific camera mode
swingCoef | the new swing coefficient |
mode | Optional - the camera mode to get the data from (leave blank for current) |
void psCamera::SetTarget | ( | const csVector3 & | tar, |
int | mode = -1 |
||
) |
Sets the current target of the camera (different for each mode).
tar | The new camera target for the current mode |
mode | the camera mode |
void psCamera::SetTransitionThreshold | ( | float | threshold | ) |
sets the camera transition threshold (the distance between camera position and ideal where the camera ceases to be in transition)
threshold | the camera transition threshold |
sets the turning speed of the camera (ignored for most camera modes)
speed | the turning speed |
mode | Optional - the camera mode to set the data (leave blank for current) |
void psCamera::SetUp | ( | const csVector3 & | up, |
int | mode = -1 |
||
) |
Sets the current up vector of the camera (different for each mode).
up | The new camera up vector for the current mode |
mode | the camera mode |
void psCamera::SetUseNPCCam | ( | bool | useNPCCam | ) |
sets whether the npc chat camera is used or not
useNPCCam | true if the npc chat camera should be used, false otherwise |
sets the yaw (left/right) of the camera
yaw | the new yaw of the camera |
mode | Optional - the camera mode to apply it to (leave blank for current) |
void psCamera::SetYawVelocity | ( | float | yawVel | ) |
sets the yaw (up/down) velocity of the camera
yawVel | the velocity of the yaw |
puts camera to adaptive distance clipping mode - camera will automatically adjust the distance to stay in given fps interval
minFPS | minimum fps (viewing distance will shrink when fps is lower) |
maxFPS | maximum fps (viewing distance will rise when fps is higher) |
minDist | lower bound on distance that will be never crossed |
void psCamera::UseFixedDistanceClipping | ( | float | dist | ) |
puts camera to fixed distance clipping mode - distance clipping will be set to constant value
dist | the maximum visible distance |