flCamera.h File Reference

#include "flGlobal.h"

Go to the source code of this file.

Classes

struct  Camera
 This structure holds all information about the cameras position and orientation. More...

Defines

#define camRotateYaw(inCam, inAngle)   ((inCam)->camRot.y += (inAngle))
 Rotate the cameras yaw.
#define camRotatePitch(inCam, inAngle)   ((inCam)->camRot.x += (inAngle))
 Rotate the cameras pitch.
#define camRotateRoll(inCam, inAngle)   ((inCam)->camRot.z += (inAngle))
 Rotate the cameras roll.

Functions

CameracamCreate ()
 Create a valid initialized Camera struct.
void camFree (Camera *inCam)
 Free a camera struct from memory.
void camReset (Camera *inCam)
 Reset the camera to its home position.
void camView (Camera *inCam)
 Set the view matrix to the cameras view.
void camMove (Camera *inCam, vect3f inMove)
 Move a Camera relative to it's current position.
void camMoveTo (Camera *inCam, vect3f inTarget)
 Move a Camera to a specific location.
void camMoveForward (Camera *inCam, float inSize)
 Move a Camera forward in the direction it is pointing in.
void camMoveStrafe (Camera *inCam, float inSize)
 Move a Camera horizontally with respect to the direction it is pointing.


Define Documentation

#define camRotatePitch ( inCam,
inAngle   )     ((inCam)->camRot.x += (inAngle))

Rotate the cameras pitch.

Parameters:
inCam The Camera to be moved.
inAngle The amount the Cameras pitch should be modified by.
Warning:
This is a macro and as such is not type safe, inCam is expected to be a Camera* and inAngle a float.

Definition at line 118 of file flCamera.h.

#define camRotateRoll ( inCam,
inAngle   )     ((inCam)->camRot.z += (inAngle))

Rotate the cameras roll.

Parameters:
inCam The Camera to be moved.
inAngle The amount the Cameras roll should be modified by.
Warning:
This is a macro and as such is not type safe, inCam is expected to be a Camera* and inAngle a float.

Definition at line 126 of file flCamera.h.

#define camRotateYaw ( inCam,
inAngle   )     ((inCam)->camRot.y += (inAngle))

Rotate the cameras yaw.

Parameters:
inCam The Camera to be moved.
inAngle The amount the Cameras yaw should be modified by.
Warning:
This is a macro and as such is not type safe, inCam is expected to be a Camera* and inAngle a float.

Definition at line 110 of file flCamera.h.


Function Documentation

Camera* camCreate (  ) 

Create a valid initialized Camera struct.

Returns:
An initialized Camera struct.
See also:
camFree()
Note:
This uses memAlloc() internally so it needs to be free'd using camFree() when finished.

Definition at line 44 of file flCamera.c.

References camReset(), debugWarning, memAlloc, and NULL.

void camFree ( Camera inCam  ) 

Free a camera struct from memory.

Parameters:
inCam The camera struct to be free'd.
See also:
camCreate()
Note:
This uses memFree() internally.

Definition at line 56 of file flCamera.c.

References memFree.

void camMove ( Camera inCam,
vect3f  inMove 
)

Move a Camera relative to it's current position.

Parameters:
inCam The Camera to be moved.
inMove A vector representing the amount to be moved in each dimension relative to it's current position.

Definition at line 85 of file flCamera.c.

References Camera::camPos, and vect3f_Add.

Referenced by camMoveForward(), camMoveStrafe(), and camMoveTo().

void camMoveForward ( Camera inCam,
float  inSize 
)

Move a Camera forward in the direction it is pointing in.

Parameters:
inCam The Camera to be moved.
inSize The amount the camera should be moved forward.

Definition at line 98 of file flCamera.c.

References camMove(), Camera::camView, and camViewCalc().

void camMoveStrafe ( Camera inCam,
float  inSize 
)

Move a Camera horizontally with respect to the direction it is pointing.

Parameters:
inCam The Camera to be moved.
inSize The amount the camera should be strafed right by.
Warning:
There is an error in this function which means it may not strafe correctly when the cameras roll isn't default.

Definition at line 109 of file flCamera.c.

References camMove(), Camera::camRot, camViewCalc(), mathCosf(), and mathSinf().

void camMoveTo ( Camera inCam,
vect3f  inTarget 
)

Move a Camera to a specific location.

Parameters:
inCam The Camera to be moved.
inTarget A vector representing the destination that the Camera will be moved to.

Definition at line 91 of file flCamera.c.

References camMove(), Camera::camPos, and vect3f_Sub.

void camReset ( Camera inCam  ) 

Reset the camera to its home position.

Parameters:
inCam The Camera to be reset.
See also:
camCreate()
Note:
This resets the camera so that it looks down the Y axis with Z being up, as does camCreate().

Definition at line 64 of file flCamera.c.

References Camera::camPos, Camera::camRot, Camera::camUp, and Camera::camView.

Referenced by camCreate().

void camView ( Camera inCam  ) 

Set the view matrix to the cameras view.

Parameters:
inCam The Camera to be viewed.
Note:
This should be called every frame that the camera is in use.

Definition at line 71 of file flCamera.c.

References Camera::camPos, Camera::camUp, Camera::camView, camViewCalc(), and vect3f_Add.


Generated on Wed Sep 5 19:04:01 2007 for funcLib by  doxygen 1.5.1