Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

idCameraPosition Class Reference

#include <splines.h>

Inheritance diagram for idCameraPosition:

Inheritance graph
[legend]
Collaboration diagram for idCameraPosition:

Collaboration graph
[legend]

Public Types

enum  positionType { FIXED = 0x00, INTERPOLATED, SPLINE, POSITION_COUNT }
enum  positionType { FIXED = 0x00, INTERPOLATED, SPLINE, POSITION_COUNT }

Public Member Functions

virtual void addPoint (const idVec3_t &v)
virtual void addPoint (const float x, const float y, const float z)
virtual void addPoint (const idVec3_t &v)
virtual void addPoint (const float x, const float y, const float z)
void addVelocity (long start, long duration, float speed)
void addVelocity (long start, long duration, float speed)
void calcVelocity (float distance)
void calcVelocity (float distance)
virtual void clear ()
virtual void clear ()
void deselectAll ()
void deselectAll ()
virtual void draw ()
virtual void draw (bool editMode)
void drawSelection ()
const char * getName ()
const char * getName ()
virtual idVec3_tgetPoint (int index)
virtual idVec3_tgetPoint (int index)
virtual const idVec3_tgetPosition (long t)
virtual const idVec3_tgetPosition (long t)
idVec3_tgetSelectedPoint (int index)
long getTime ()
long getTime ()
float getVelocity (long t)
float getVelocity (long t)
 idCameraPosition (long t)
 idCameraPosition ()
 idCameraPosition (const char *p)
 idCameraPosition (long t)
 idCameraPosition ()
 idCameraPosition (const char *p)
int isPointSelected (int index)
int isPointSelected (int index)
virtual int numPoints ()
virtual int numPoints ()
int numSelectedPoints ()
virtual void parse (const char *(*text))
virtual void parse (const char *(*text))
virtual bool parseToken (const char *key, const char *(*text))
virtual bool parseToken (const char *key, const char *(*text))
virtual void removePoint (int index)
virtual void removePoint (int index)
void selectAll ()
void selectAll ()
int selectPoint (int index, bool single)
int selectPoint (int index, bool single)
int selectPointByRay (const idVec3_t origin, const idVec3_t direction, bool single)
int selectPointByRay (float ox, float oy, float oz, float dx, float dy, float dz, bool single)
int selectPointByRay (const idVec3_t origin, const idVec3_t direction, bool single)
int selectPointByRay (float ox, float oy, float oz, float dx, float dy, float dz, bool single)
void setName (const char *p)
void setName (const char *p)
virtual void setTime (long t)
virtual void setTime (long t)
virtual void start (long t)
virtual void start (long t)
virtual startEdit ()
virtual void startEdit ()
virtual stopEdit ()
virtual void stopEdit ()
const char * typeStr ()
const char * typeStr ()
virtual void updateSelection (const idVec3_t &move)
virtual void updateSelection (float x, float y, float z)
virtual void updateSelection (const idVec3_t &move)
virtual void updateSelection (float x, float y, float z)
virtual void write (fileHandle_t file, const char *name)
virtual void write (fileHandle_t file, const char *name)
virtual ~idCameraPosition ()
virtual ~idCameraPosition ()

Protected Attributes

float baseVelocity
bool editMode
idStr name
idList< int > selectedPoints
idList< int > selectedPoints
long startTime
long time
idCameraPosition::positionType type
idList< idVelocity * > velocities
idList< idVelocity * > velocities

Static Protected Attributes

const char * positionStr [POSITION_COUNT]
const char * positionStr [POSITION_COUNT]

Member Enumeration Documentation

enum positionType
 

Enumeration values:
FIXED 
INTERPOLATED 
SPLINE 
POSITION_COUNT 

Definition at line 397 of file splines.h.

00397                       {
00398         FIXED = 0x00,
00399         INTERPOLATED,
00400         SPLINE,
00401         POSITION_COUNT
00402     };

enum positionType
 

Enumeration values:
FIXED 
INTERPOLATED 
SPLINE 
POSITION_COUNT 

Definition at line 390 of file splines.h.

00390                       {
00391         FIXED = 0x00,
00392         INTERPOLATED,
00393         SPLINE,
00394         POSITION_COUNT
00395     };


Constructor & Destructor Documentation

idCameraPosition const char *  p  )  [inline]
 

Definition at line 369 of file splines.h.

References name.

00369                                     {
00370         name = p;
00371     }

idCameraPosition  )  [inline]
 

Definition at line 373 of file splines.h.

References name, and time.

00373                        {
00374         time = 0;
00375         name = "position";
00376     }

idCameraPosition long  t  )  [inline]
 

Definition at line 378 of file splines.h.

References time.

00378                              {
00379         time = t;
00380     }

virtual ~idCameraPosition  )  [inline, virtual]
 

Definition at line 382 of file splines.h.

References clear().

00382                                 {
00383         clear();
00384     }

Here is the call graph for this function:

idCameraPosition const char *  p  )  [inline]
 

Definition at line 376 of file splines.h.

References name.

00376                                     {
00377         name = p;
00378     }

idCameraPosition  )  [inline]
 

Definition at line 380 of file splines.h.

References name, and time.

00380                        {
00381         time = 0;
00382         name = "position";
00383     }

idCameraPosition long  t  )  [inline]
 

Definition at line 385 of file splines.h.

References time.

00385                              {
00386         time = t;
00387     }

virtual ~idCameraPosition  )  [inline, virtual]
 

Definition at line 389 of file splines.h.

References clear().

00389                                 {
00390         clear();
00391     }

Here is the call graph for this function:


Member Function Documentation

virtual void addPoint const idVec3_t v  )  [inline, virtual, inherited]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 56 of file splines.h.

00056 {}

virtual void addPoint const float  x,
const float  y,
const float  z
[inline, virtual, inherited]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 55 of file splines.h.

00055 {}

virtual void addPoint const idVec3_t v  )  [inline, virtual, inherited]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 56 of file splines.h.

00056 {}

virtual void addPoint const float  x,
const float  y,
const float  z
[inline, virtual, inherited]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 55 of file splines.h.

Referenced by Drag_Setup(), and CXYWnd::XY_MouseDown().

00055 {}

void addVelocity long  start,
long  duration,
float  speed
[inline]
 

Definition at line 427 of file splines.h.

References idList::Append(), and velocities.

00427                                                              {
00428         velocities.Append(new idVelocity(start, duration, speed));
00429     }

Here is the call graph for this function:

void addVelocity long  start,
long  duration,
float  speed
[inline]
 

Definition at line 420 of file splines.h.

References idList::Append(), and velocities.

Referenced by idCameraDef::buildCamera(), and parseToken().

00420                                                              {
00421         velocities.Append(new idVelocity(start, duration, speed));
00422     }

Here is the call graph for this function:

void calcVelocity float  distance  )  [inline]
 

Definition at line 464 of file splines.h.

References baseVelocity, and time.

00464                                       {
00465         float secs = (float)time / 1000;
00466         baseVelocity = distance / secs;
00467     }

void calcVelocity float  distance  )  [inline]
 

Definition at line 457 of file splines.h.

References baseVelocity, and time.

Referenced by idSplinePosition::start(), and idInterpolatedPosition::start().

00457                                       {
00458         float secs = (float)time / 1000;
00459         baseVelocity = distance / secs;
00460     }

virtual void clear  )  [inline, virtual]
 

Definition at line 367 of file splines.h.

References idList::Clear(), editMode, i, idList::Num(), and velocities.

00367                          {
00368         editMode = false;
00369         for (int i = 0; i < velocities.Num(); i++) {
00370             delete velocities[i];
00371             velocities[i] = NULL;
00372         }
00373         velocities.Clear();
00374     }

Here is the call graph for this function:

virtual void clear  )  [inline, virtual]
 

Definition at line 360 of file splines.h.

References idList::Clear(), editMode, i, idList::Num(), and velocities.

Referenced by ~idCameraPosition().

00360                          {
00361         editMode = false;
00362         for (int i = 0; i < velocities.Num(); i++) {
00363             delete velocities[i];
00364             velocities[i] = NULL;
00365         }
00366         velocities.Clear();
00367     }

Here is the call graph for this function:

void deselectAll  )  [inline, inherited]
 

Definition at line 128 of file splines.h.

00128                        {
00129         selectedPoints.Clear();
00130     }

void deselectAll  )  [inline, inherited]
 

Definition at line 128 of file splines.h.

00128                        {
00129         selectedPoints.Clear();
00130     }

virtual void draw  )  [inline, virtual]
 

Definition at line 458 of file splines.h.

00458 {};

virtual void draw bool  editMode  )  [inline, virtual]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 436 of file splines.h.

00436 {};

void drawSelection  )  [inline, inherited]
 

Definition at line 151 of file splines.h.

References glBox(), i, and red.

Referenced by CCamWnd::Cam_Draw().

00151                          {
00152         int count = selectedPoints.Num();
00153         for (int i = 0; i < count; i++) {
00154             glBox(red, *getPoint(selectedPoints[i]), 4);
00155         }
00156     }

Here is the call graph for this function:

const char* getName  )  [inline]
 

Definition at line 442 of file splines.h.

References idStr::c_str(), and name.

00442                           {
00443         return name.c_str();
00444     }

Here is the call graph for this function:

const char* getName  )  [inline]
 

Definition at line 435 of file splines.h.

References idStr::c_str(), and name.

Referenced by CDlgCamera::setupFromCamera().

00435                           {
00436         return name.c_str();
00437     }

Here is the call graph for this function:

virtual idVec3_t* getPoint int  index  )  [inline, virtual, inherited]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 58 of file splines.h.

00058 { return NULL; }

virtual idVec3_t* getPoint int  index  )  [inline, virtual, inherited]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 58 of file splines.h.

00058 { return NULL; }

virtual const idVec3_t* getPosition long  t  )  [inline, virtual]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 431 of file splines.h.

References assert.

00431                                                 { 
00432         assert(true);
00433         return NULL;
00434     }

virtual const idVec3_t* getPosition long  t  )  [inline, virtual]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 424 of file splines.h.

References assert.

Referenced by idCameraDef::getCameraInfo().

00424                                                 { 
00425         assert(true);
00426         return NULL;
00427     }

idVec3_t* getSelectedPoint int  index  )  [inline, inherited]
 

Definition at line 134 of file splines.h.

References assert.

00134                                           {
00135         assert(index >= 0 && index < numSelectedPoints());
00136         return getPoint(selectedPoints[index]);
00137     }

long getTime  )  [inline]
 

Definition at line 409 of file splines.h.

00409                    {
00410         return time;
00411     }

long getTime  )  [inline]
 

Definition at line 402 of file splines.h.

00402                    {
00403         return time;
00404     }

float getVelocity long  t  )  [inline]
 

Definition at line 417 of file splines.h.

References check(), i, idList::Num(), t, and velocities.

00417                               {
00418         long check = t - startTime;
00419         for (int i = 0; i < velocities.Num(); i++) {
00420             if (check >= velocities[i]->startTime && check <= velocities[i]->startTime + velocities[i]->time) {
00421                 return velocities[i]->speed;
00422             }
00423         }
00424         return baseVelocity;
00425     }

Here is the call graph for this function:

float getVelocity long  t  )  [inline]
 

Definition at line 410 of file splines.h.

References check(), i, idList::Num(), t, and velocities.

Referenced by idInterpolatedPosition::getPosition().

00410                               {
00411         long check = t - startTime;
00412         for (int i = 0; i < velocities.Num(); i++) {
00413             if (check >= velocities[i]->startTime && check <= velocities[i]->startTime + velocities[i]->time) {
00414                 return velocities[i]->speed;
00415             }
00416         }
00417         return baseVelocity;
00418     }

Here is the call graph for this function:

int isPointSelected int  index  )  [inline, inherited]
 

Definition at line 97 of file splines.h.

References i.

00097                                    {
00098         int count = selectedPoints.Num();
00099         for (int i = 0; i < count; i++) {
00100             if (selectedPoints[i] == index) {
00101                 return i;
00102             }
00103         }
00104         return -1;
00105     }

int isPointSelected int  index  )  [inline, inherited]
 

Definition at line 97 of file splines.h.

References i.

00097                                    {
00098         int count = selectedPoints.Num();
00099         for (int i = 0; i < count; i++) {
00100             if (selectedPoints[i] == index) {
00101                 return i;
00102             }
00103         }
00104         return -1;
00105     }

virtual int numPoints  )  [inline, virtual, inherited]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 51 of file splines.h.

00051                             {
00052         return 0;
00053     }

virtual int numPoints  )  [inline, virtual, inherited]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 51 of file splines.h.

00051                             {
00052         return 0;
00053     }

int numSelectedPoints  )  [inherited]
 

virtual void parse const char **  text  )  [inline, virtual]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 438 of file splines.h.

00438 {};

virtual void parse const char **  text  )  [inline, virtual]
 

Reimplemented in idFixedPosition, idInterpolatedPosition, idSplinePosition, idFixedPosition, idInterpolatedPosition, and idSplinePosition.

Definition at line 431 of file splines.h.

Referenced by idCameraDef::parse().

00431 {};

virtual bool parseToken const char *  key,
const char **  text
[virtual]
 

bool parseToken const char *  key,
const char **  text
[virtual]
 

Definition at line 958 of file splines.cpp.

References addVelocity(), atof(), atoi, atol(), baseVelocity, Com_Parse(), Com_UngetToken(), d, name, Q_stricmp(), s, t, time, and token.

Referenced by idSplinePosition::parse(), idInterpolatedPosition::parse(), and idFixedPosition::parse().

00958                                                                       {
00959     const char *token = Com_Parse(text);
00960     if (Q_stricmp(key, "time") == 0) {
00961         time = atol(token);
00962         return true;
00963     } else if (Q_stricmp(key, "type") == 0) {
00964         type = static_cast<idCameraPosition::positionType>(atoi(token));
00965         return true;
00966     } else if (Q_stricmp(key, "velocity") == 0) {
00967         long t = atol(token);
00968         token = Com_Parse(text);
00969         long d = atol(token);
00970         token = Com_Parse(text);
00971         float s = atof(token);
00972         addVelocity(t, d, s);
00973         return true;
00974     } else if (Q_stricmp(key, "baseVelocity") == 0) {
00975         baseVelocity = atof(token);
00976         return true;
00977     } else if (Q_stricmp(key, "name") == 0) {
00978         name = token;
00979         return true;
00980     } else if (Q_stricmp(key, "time") == 0) {
00981         time = atoi(token);
00982         return true;
00983     }
00984     Com_UngetToken();
00985     return false;
00986 }

Here is the call graph for this function:

virtual void removePoint int  index  )  [inline, virtual, inherited]
 

Definition at line 57 of file splines.h.

00057 {}

virtual void removePoint int  index  )  [inline, virtual, inherited]
 

Definition at line 57 of file splines.h.

00057 {}

void selectAll  )  [inline, inherited]
 

Definition at line 121 of file splines.h.

References i.

00121                      {
00122         selectedPoints.Clear();
00123         for (int i = 0; i < numPoints(); i++) {
00124             selectedPoints.Append(i);
00125         }
00126     }

void selectAll  )  [inline, inherited]
 

Definition at line 121 of file splines.h.

References i.

00121                      {
00122         selectedPoints.Clear();
00123         for (int i = 0; i < numPoints(); i++) {
00124             selectedPoints.Append(i);
00125         }
00126     }

int selectPoint int  index,
bool  single
[inline, inherited]
 

Definition at line 107 of file splines.h.

00107                                             {
00108         if (index >= 0 && index < numPoints()) {
00109             if (single) {
00110                 deselectAll();
00111             } else {
00112                 if (isPointSelected(index) >= 0) {
00113                     selectedPoints.Remove(index);
00114                 }
00115             }
00116             return selectedPoints.Append(index);
00117         }
00118         return -1;
00119     }

int selectPoint int  index,
bool  single
[inline, inherited]
 

Definition at line 107 of file splines.h.

00107                                             {
00108         if (index >= 0 && index < numPoints()) {
00109             if (single) {
00110                 deselectAll();
00111             } else {
00112                 if (isPointSelected(index) >= 0) {
00113                     selectedPoints.Remove(index);
00114                 }
00115             }
00116             return selectedPoints.Append(index);
00117         }
00118         return -1;
00119     }

int selectPointByRay const idVec3_t  origin,
const idVec3_t  direction,
bool  single
[inline, inherited]
 

Definition at line 66 of file splines.h.

References __VectorMA, count, d, DotProduct, i, and idVec3_t::Length().

00066                                                                                        {
00067         int     i, besti, count;
00068         float   d, bestd;
00069         idVec3_t    temp, temp2;
00070 
00071         // find the point closest to the ray
00072         besti = -1;
00073         bestd = 8;
00074         count = numPoints();
00075 
00076         for (i=0; i < count; i++) {
00077             temp = *getPoint(i);
00078             temp2 = temp;
00079             temp -= origin;
00080             d = DotProduct(temp, direction);
00081             __VectorMA (origin, d, dir