Planeshift
|
Handles camera modes like first person, thrid person, speak to npc manages collision of camera with meshes, moving, turning, ... More...
#include <pscamera.h>
Classes | |
struct | DistanceCfg |
Public Member Functions | |
bool | CheckCameraCD () const |
returns whether the camera is performing CD or not More... | |
bool | Draw () |
applies the camera data to the viewport and renders the 3D scene More... | |
iMeshWrapper * | FindMeshUnder2D (int x, int y, csVector3 *pos=NULL, int *poly=NULL) |
Returns the mesh under the 2D point. More... | |
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 More... | |
int | GetCameraMode () const |
returns the current camera mode (as integer) More... | |
csString | GetCameraModeVerbose () const |
returns the current camera mode (text description) More... | |
float | GetDampeningCoef (int mode=-1) const |
returns the dampening coefficient of the camera More... | |
float | GetDefaultPitch (int mode=-1) const |
returns the default (starting) pitch of the specific camera mode More... | |
float | GetDefaultYaw (int mode=-1) const |
returns the default (starting) yaw of the specific camera mode More... | |
float | GetDistance (int mode=-1) const |
returns the distance from the camera position to its target More... | |
DistanceCfg | GetDistanceCfg () |
int | GetFixedDistClip () |
csVector3 | GetForwardVector (int mode=-1) const |
returns the forward vector of the camera More... | |
iPerspectiveCamera * | GetICamera () |
returns the camera that CS use More... | |
int | GetLastCameraMode () |
gets the last used camera mode More... | |
float | GetMaxDistance (int mode=-1) const |
returns the max distance from the camera position to the target More... | |
float | GetMinDistance (int mode=-1) const |
returns the min distance from the camera position to the target More... | |
float | GetPitch (int mode=-1) const |
returns the pitch (up/down) of the camera More... | |
float | GetPitchVelocity () const |
gets the pitch (up/down) velocity of the camera More... | |
csVector3 | GetPosition (int mode=-1) const |
returns the current position of the camera (different for each mode) More... | |
csVector3 | GetRightVector (int mode=-1) const |
returns the forward vector of the camera More... | |
float | GetSpringCoef (int mode=-1) const |
returns the spring coefficient of the camera More... | |
float | GetSpringLength (int mode=-1) const |
returns the spring length of the camera More... | |
float | GetSwingCoef (int mode=-1) const |
returns the swing coefficient of the specific camera mode More... | |
csVector3 | GetTarget (int mode=-1) const |
returns the current position of the camera (different for each mode) More... | |
float | GetTransitionThreshold () const |
gets the camera transition threshold (the distance between camera position and ideal where the camera ceases to be in transition) More... | |
float | GetTurnSpeed (int mode=-1) const |
returns the turning speed of the camera (ignored for most camera modes) More... | |
csVector3 | GetUp (int mode=-1) const |
Returns the current up vector of the camera (different for each mode). More... | |
bool | GetUseNPCCam () |
returns whether the npc chat camera is used or not More... | |
iView * | GetView () |
returns the CS viewport More... | |
float | GetYaw (int mode=-1) const |
returns the yaw (left/right) of the camera More... | |
float | GetYawVelocity () const |
gets the yaw (up/down) velocity of the camera More... | |
const char * | HandleCommand (const char *cmd) |
Interprets a received message and executes the command. More... | |
void | HandleMessage (MsgEntry *msg) |
bool | InitializeView (GEMClientActor *entity) |
creates the viewport More... | |
bool | IsInitialized () |
bool | LoadFromFile (bool useDefault=false, bool overrideCurrent=true) |
loads the camera settings from a file More... | |
void | LoadOptions () |
This function is called when the options system has been issued a Save() call. More... | |
void | LockCameraMode (bool state) |
locks the current camera mode so it cannot be changed More... | |
void | MoveDistance (float deltaDistance, int mode=-1) |
moves the distance from the camera position to its target More... | |
void | MovePitch (float deltaPitch, int mode=-1) |
moves the pitch (up/down) of the camera More... | |
void | MoveYaw (float deltaYaw, int mode=-1) |
moves the yaw (left/right) of the camera More... | |
void | NextCameraMode () |
changes the current camera mode to the next available camera mode More... | |
void | npcTargetReplaceIfEqual (GEMClientObject *currentEntity, GEMClientObject *replacementEntity) |
Replace the actor the camera is targeting when in npc camera mode. More... | |
psCamera () | |
void | ResetActualCameraData () |
resets the actual camera data to the player position and stuff More... | |
void | ResetCameraPositioning () |
flags the camera positioning as bad so that it will reset it next update loop More... | |
bool | RotateCameraWithPlayer () const |
moves decides, based on the camera mode, whether the camera should be rotated along-side the player More... | |
void | SaveOptions () |
This function is called whenever the options system needs the options class to give it its options values. More... | |
bool | SaveToFile () |
saves the camera settings to a file More... | |
void | SetActor (GEMClientActor *entity) |
Set the actor the camera is following. More... | |
void | SetCameraCD (bool useCD) |
sets whether the camera is performing CD or not More... | |
void | SetCameraMode (int mode) |
sets the current camera mode More... | |
void | SetDampeningCoef (float coef, int mode=-1) |
sets the dampening coefficient of the camera More... | |
void | SetDefaultPitch (float pitch, int mode=-1) |
sets the default (starting) pitch for the specific camera mode More... | |
void | SetDefaultYaw (float yaw, int mode=-1) |
sets the default (starting) yaw for the specific camera mode More... | |
void | SetDistance (float distance, int mode=-1) |
sets the distance from the camera position to its target More... | |
void | SetDistanceCfg (DistanceCfg newcfg) |
void | SetMaxDistance (float dist, int mode=-1) |
sets the max distance from the camera position to the target More... | |
void | SetMinDistance (float dist, int mode=-1) |
sets the min distance from the camera position to the target More... | |
void | SetPitch (float pitch, int mode=-1) |
sets the pitch (up/down) of the camera More... | |
void | SetPitchVelocity (float pitchVel) |
sets the pitch (up/down) velocity of the camera More... | |
void | SetPosition (const csVector3 &pos, int mode=-1) |
sets the current position of the camera (different for each mode) More... | |
void | SetSpringCoef (float coef, int mode=-1) |
sets the spring coefficient of the camera More... | |
void | SetSpringLength (float length, int mode=-1) |
sets the spring length of the camera More... | |
void | SetSwingCoef (float swingCoef, int mode=-1) |
sets the swing coefficient of the specific camera mode More... | |
void | SetTarget (const csVector3 &tar, int mode=-1) |
Sets the current target of the camera (different for each mode). More... | |
void | SetTransitionThreshold (float threshold) |
sets the camera transition threshold (the distance between camera position and ideal where the camera ceases to be in transition) More... | |
void | SetTurnSpeed (float speed, int mode=-1) |
sets the turning speed of the camera (ignored for most camera modes) More... | |
void | SetUp (const csVector3 &up, int mode=-1) |
Sets the current up vector of the camera (different for each mode). More... | |
void | SetUseNPCCam (bool useNPCCam) |
sets whether the npc chat camera is used or not More... | |
void | SetYaw (float yaw, int mode=-1) |
sets the yaw (left/right) of the camera More... | |
void | SetYawVelocity (float yawVel) |
sets the yaw (up/down) velocity of the camera More... | |
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 More... | |
void | UseFixedDistanceClipping (float dist) |
puts camera to fixed distance clipping mode - distance clipping will be set to constant value More... | |
virtual | ~psCamera () |
![]() | |
virtual | ~iOptionsClass () |
![]() | |
virtual void | HandleMessage (MsgEntry *msg, Client *) |
Interprets a received message and executes the command. More... | |
psCmdBase (ClientMsgHandler *mh, CmdHandler *ch, iObjectRegistry *obj) | |
void | Report (int severity, const char *msgtype, const char *description,...) |
virtual bool | Setup (ClientMsgHandler *mh, CmdHandler *ch) |
virtual bool | Verify (MsgEntry *, unsigned int, Client *&) |
virtual | ~psCmdBase () |
Additional Inherited Members | |
![]() | |
CmdHandler * | cmdsource |
ClientMsgHandler * | msgqueue |
iObjectRegistry * | objreg |
Handles camera modes like first person, thrid person, speak to npc manages collision of camera with meshes, moving, turning, ...
Definition at line 55 of file pscamera.h.
Definition at line 66 of file pscamera.h.
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 | ( | ) |
|
inline |
Definition at line 496 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
|
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 |
|
inline |
Definition at line 498 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 |
|
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
|
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 |