20 #ifndef PS_CAMERA_HEADER    21 #define PS_CAMERA_HEADER    25 #include <csutil/csstring.h>    26 #include <csutil/ref.h>    27 #include <iutil/virtclk.h>    39 #define NPC_MODE_DISTANCE 5.0f    43 struct iPerspectiveCamera;
    45 struct iCollideSystem;
   131     bool LoadFromFile(
bool useDefault=
false, 
bool overrideCurrent=
true);
   147     void SetPosition(
const csVector3& pos, 
int mode = -1);
   161     void SetTarget(
const csVector3& tar, 
int mode = -1);
   167     csVector3 
GetTarget(
int mode = -1) 
const;
   175     void SetUp(
const csVector3& up, 
int mode = -1);
   183     csVector3 
GetUp(
int mode = -1) 
const;
   226     iMeshWrapper * 
Get3DPointFrom2D(
int x, 
int y, csVector3 * worldCoord=0, csVector3 * untransfCoord=0);
   237     iMeshWrapper* 
FindMeshUnder2D(
int x, 
int y, csVector3  * pos = NULL, 
int *poly = NULL);
   243     void SetPitch(
float pitch, 
int mode = -1);
   249     void MovePitch(
float deltaPitch, 
int mode = -1);
   255     float GetPitch(
int mode = -1) 
const;
   271     void SetYaw(
float yaw, 
int mode = -1);
   277     void MoveYaw(
float deltaYaw, 
int mode = -1);
   283     float GetYaw(
int mode = -1) 
const;
   523         float InertialDampeningCoef;
   531             worldPos.Set(0.0f,0.0f,0.0f);
   532             worldTar.Set(0.0f,0.0f,0.0f);
   533             worldUp.Set(0.0f,0.0f,0.0f);
   534             pitch = yaw = roll = 0;
   535             defaultPitch = defaultYaw = defaultRoll = 0.0f;
   536             distance = minDistance = maxDistance = 0.0f;
   538             springCoef = InertialDampeningCoef = springLength = 0.0f;
   543     float CalcSpringCoef(
float springyness, 
float scale) 
const;
   544     float CalcInertialDampeningCoef(
float springyness, 
float scale) 
const;
   545     float EstimateSpringyness(
size_t camMode) 
const;
   553     void DoCameraIdealCalcs(
const csTicks elapsedTicks, 
const csVector3& actorPos, 
const csVector3& actorEye, 
const float actorYRot);
   562     csVector3 CalcCollisionPos(
const csVector3& pseudoTarget, 
const csVector3& pseudoPosition, iSector*& sector);
   566     void DoCameraTransition();
   576     void DoElasticPhysics(
bool isElastic, 
const csTicks elapsedTicks, 
const CameraData& deltaIdeal, iSector* sector);
   581     void EnsureActorVisibility();
   596     csVector3 CalcElasticPos(csVector3 currPos, csVector3 idealPos, csVector3 deltaIdealPos,
   597                              float deltaTime, 
float springCoef, 
float dampCoef, 
float springLength) 
const;
   613     float CalcElasticFloat(
float curr, 
float ideal, 
float deltaIdeal,
   614                            float deltaTime, 
float springCoef, 
float dampCoef, 
float springLength) 
const;
   620     void CalculateFromYawPitchRoll(
int mode = -1);
   625     void CalculateNewYawPitchRoll(
int mode = -1);
   630     void CalculatePositionFromYawPitchRoll(
int mode = -1);
   636     float CalculateNewYaw(csVector3 dir);
   641     void EnsureCameraDistance(
int mode = -1);
   647     bool IsActorVisible(
int mode = -1) 
const;
   653     float SaturateAngle(
float angle) 
const;
   660     bool CloneCameraModeData(
int fromMode, 
int toMode = -1);
   665     void SetDistanceClipping(
float dist);
   666     float GetDistanceClipping();
   671     void AdaptDistanceClipping();
   685     csVector3 firstPersonPositionOffset;
   686     csVector3 thirdPersonPositionOffset;
   691     float transitionThresholdSquared;
   692     bool inTransitionPhase;
   698     bool cameraHasBeenPositioned;
   707     bool cameraInitialized;
   710     bool lockedCameraMode;
   712     csWeakRef<iSector> lastTargetSector;
   720     csRef<iVirtualClock> vc;
   723     csRef<iCollideSystem> cdsys;
   740     csVector3 npcModePosition;
 void SetCameraCD(bool useCD)
sets whether the camera is performing CD or not 
 
void SetTarget(const csVector3 &tar, int mode=-1)
Sets the current target of the camera (different for each mode). 
 
void MoveDistance(float deltaDistance, int mode=-1)
moves the distance from the camera position to its target 
 
void ResetActualCameraData()
resets the actual camera data to the player position and stuff 
 
void MoveYaw(float deltaYaw, int mode=-1)
moves the yaw (left/right) of the camera 
 
This is a player or another 'alive' entity on the client. 
 
iMeshWrapper * FindMeshUnder2D(int x, int y, csVector3 *pos=NULL, int *poly=NULL)
Returns the mesh under the 2D point. 
 
void SetUp(const csVector3 &up, int mode=-1)
Sets the current up vector of the camera (different for each mode). 
 
void ResetCameraPositioning()
flags the camera positioning as bad so that it will reset it next update loop 
 
csVector3 GetTarget(int mode=-1) const 
returns the current position of the camera (different for each mode) 
 
bool Draw()
applies the camera data to the viewport and renders the 3D scene 
 
int GetLastCameraMode()
gets the last used camera mode 
 
void SetSpringCoef(float coef, int mode=-1)
sets the spring coefficient of the camera 
 
void HandleMessage(MsgEntry *msg)
 
void SetTransitionThreshold(float threshold)
sets the camera transition threshold (the distance between camera position and ideal where the camera...
 
void SetMinDistance(float dist, int mode=-1)
sets the min distance from the camera position to the target 
 
csVector3 GetUp(int mode=-1) const 
Returns the current up vector of the camera (different for each mode). 
 
float GetSwingCoef(int mode=-1) const 
returns the swing coefficient of the specific camera mode 
 
The structure of 1 queue entry (pointer to a message) 
 
void SetDefaultYaw(float yaw, int mode=-1)
sets the default (starting) yaw for the specific camera mode 
 
void SetCameraMode(int mode)
sets the current camera mode 
 
void MovePitch(float deltaPitch, int mode=-1)
moves the pitch (up/down) of the camera 
 
float GetYawVelocity() const 
gets the yaw (up/down) velocity of the camera 
 
float GetPitchVelocity() const 
gets the pitch (up/down) velocity of the camera 
 
float GetDefaultYaw(int mode=-1) const 
returns the default (starting) yaw of the specific camera mode 
 
void SetPosition(const csVector3 &pos, int mode=-1)
sets the current position of the camera (different for each mode) 
 
float GetDefaultPitch(int mode=-1) const 
returns the default (starting) pitch of the specific camera mode 
 
void SetPitchVelocity(float pitchVel)
sets the pitch (up/down) velocity of the camera 
 
void SetMaxDistance(float dist, int mode=-1)
sets the max distance from the camera position to the target 
 
float GetYaw(int mode=-1) const 
returns the yaw (left/right) of the camera 
 
void npcTargetReplaceIfEqual(GEMClientObject *currentEntity, GEMClientObject *replacementEntity)
Replace the actor the camera is targeting when in npc camera mode. 
 
csString GetCameraModeVerbose() const 
returns the current camera mode (text description) 
 
Handles camera modes like first person, thrid person, speak to npc manages collision of camera with m...
 
void SetTurnSpeed(float speed, int mode=-1)
sets the turning speed of the camera (ignored for most camera modes) 
 
const char * HandleCommand(const char *cmd)
Interprets a received message and executes the command. 
 
float GetMinDistance(int mode=-1) const 
returns the min distance from the camera position to the target 
 
void NextCameraMode()
changes the current camera mode to the next available camera mode 
 
void LoadOptions()
This function is called when the options system has been issued a Save() call. 
 
csVector3 GetForwardVector(int mode=-1) const 
returns the forward vector of the camera 
 
void LockCameraMode(bool state)
locks the current camera mode so it cannot be changed 
 
float GetTurnSpeed(int mode=-1) const 
returns the turning speed of the camera (ignored for most camera modes) 
 
float GetDampeningCoef(int mode=-1) const 
returns the dampening coefficient of the camera 
 
iPerspectiveCamera * GetICamera()
returns the camera that CS use 
 
An object that the client knows about. 
 
void SetSwingCoef(float swingCoef, int mode=-1)
sets the swing coefficient of the specific camera mode 
 
void SetDistanceCfg(DistanceCfg newcfg)
 
float GetTransitionThreshold() const 
gets the camera transition threshold (the distance between camera position and ideal where the camera...
 
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 ...
 
void UseAdaptiveDistanceClipping(int minFPS, int maxFPS, int minDist)
puts camera to adaptive distance clipping mode - camera will automatically adjust the distance to sta...
 
bool SaveToFile()
saves the camera settings to a file 
 
float GetPitch(int mode=-1) const 
returns the pitch (up/down) of the camera 
 
float GetDistance(int mode=-1) const 
returns the distance from the camera position to its target 
 
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 
 
bool InitializeView(GEMClientActor *entity)
creates the viewport 
 
void SetYawVelocity(float yawVel)
sets the yaw (up/down) velocity of the camera 
 
void SetActor(GEMClientActor *entity)
Set the actor the camera is following. 
 
void SetDampeningCoef(float coef, int mode=-1)
sets the dampening coefficient of the camera 
 
float GetSpringCoef(int mode=-1) const 
returns the spring coefficient of the camera 
 
void UseFixedDistanceClipping(float dist)
puts camera to fixed distance clipping mode - distance clipping will be set to constant value ...
 
int GetCameraMode() const 
returns the current camera mode (as integer) 
 
csVector3 GetRightVector(int mode=-1) const 
returns the forward vector of the camera 
 
bool CheckCameraCD() const 
returns whether the camera is performing CD or not 
 
csVector3 GetPosition(int mode=-1) const 
returns the current position of the camera (different for each mode) 
 
float GetSpringLength(int mode=-1) const 
returns the spring length of the camera 
 
iView * GetView()
returns the CS viewport 
 
DistanceCfg GetDistanceCfg()
 
void SaveOptions()
This function is called whenever the options system needs the options class to give it its options va...
 
bool GetUseNPCCam()
returns whether the npc chat camera is used or not 
 
void SetSpringLength(float length, int mode=-1)
sets the spring length of the camera 
 
void SetPitch(float pitch, int mode=-1)
sets the pitch (up/down) of the camera 
 
bool LoadFromFile(bool useDefault=false, bool overrideCurrent=true)
loads the camera settings from a file 
 
float GetMaxDistance(int mode=-1) const 
returns the max distance from the camera position to the target 
 
void SetDistance(float distance, int mode=-1)
sets the distance from the camera position to its target 
 
bool RotateCameraWithPlayer() const 
moves decides, based on the camera mode, whether the camera should be rotated along-side the player ...
 
void SetDefaultPitch(float pitch, int mode=-1)
sets the default (starting) pitch for the specific camera mode