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

idSplinePosition Class Reference

#include <splines.h>

Inheritance diagram for idSplinePosition:

Inheritance graph
[legend]
Collaboration diagram for idSplinePosition:

Collaboration graph
[legend]

Public Types

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

Public Member Functions

void addControlPoint (idVec3_t &v)
void addControlPoint (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)
virtual void addPoint (const idVec3_t &v)
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)
 idSplinePosition (long time)
 idSplinePosition ()
 idSplinePosition (long time)
 idSplinePosition ()
void init ()
void init ()
int isPointSelected (int index)
int isPointSelected (int index)
virtual int numPoints ()
virtual int numPoints ()
int numSelectedPoints ()
void parse (const char *(*text))
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 (float x, float y, float z)
virtual void updateSelection (const idVec3_t &move)
virtual void updateSelection (const idVec3_t &move)
void write (fileHandle_t file, const char *name)
void write (fileHandle_t file, const char *name)
 ~idSplinePosition ()
 ~idSplinePosition ()

Protected Attributes

float baseVelocity
bool editMode
idStr name
idList< int > selectedPoints
idList< int > selectedPoints
long startTime
idSplineList target
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 [inherited]
 

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 [inherited]
 

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

idSplinePosition  )  [inline]
 

Definition at line 621 of file splines.h.

References init().

00621                        : idCameraPosition() {
00622         init();
00623     }

Here is the call graph for this function:

idSplinePosition long  time  )  [inline]
 

Definition at line 625 of file splines.h.

References init(), and time().

00625                                 : idCameraPosition(time) {
00626         init();
00627     }

Here is the call graph for this function:

~idSplinePosition  )  [inline]
 

Definition at line 629 of file splines.h.

00629                         {
00630     }

idSplinePosition  )  [inline]
 

Definition at line 628 of file splines.h.

References init().

00628                        : idCameraPosition() {
00629         init();
00630     }

Here is the call graph for this function:

idSplinePosition long  time  )  [inline]
 

Definition at line 632 of file splines.h.

References init(), and time().

00632                                 : idCameraPosition(time) {
00633         init();
00634     }

Here is the call graph for this function:

~idSplinePosition  )  [inline]
 

Definition at line 636 of file splines.h.

00636                         {
00637     }


Member Function Documentation

void addControlPoint idVec3_t v  )  [inline]
 

Definition at line 651 of file splines.h.

References idSplineList::addPoint(), target, and v.

00651                                       {
00652         target.addPoint(v);
00653     }

Here is the call graph for this function:

void addControlPoint idVec3_t v  )  [inline]
 

Definition at line 644 of file splines.h.

References idSplineList::addPoint(), target, and v.

00644                                       {
00645         target.addPoint(v);
00646     }

Here is the call graph for this function:

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

Reimplemented from idPointListInterface.

Definition at line 670 of file splines.h.

References idSplineList::addPoint(), target, x, y, and z.

00670                                                                        {
00671         target.addPoint(x, y, z);
00672     }

Here is the call graph for this function:

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

Reimplemented from idPointListInterface.

Definition at line 666 of file splines.h.

References idSplineList::addPoint(), target, and v.

00666                                              {
00667         target.addPoint(v);
00668     }

Here is the call graph for this function:

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

Reimplemented from idPointListInterface.

Definition at line 663 of file splines.h.

References idSplineList::addPoint(), target, x, y, and z.

00663                                                                        {
00664         target.addPoint(x, y, z);
00665     }

Here is the call graph for this function:

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

Reimplemented from idPointListInterface.

Definition at line 659 of file splines.h.

References idSplineList::addPoint(), target, and v.

00659                                              {
00660         target.addPoint(v);
00661     }

Here is the call graph for this function:

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

Definition at line 427 of file splines.h.

References idList::Append(), and idCameraPosition::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, inherited]
 

Definition at line 420 of file splines.h.

References idList::Append(), and idCameraPosition::velocities.

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

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

Here is the call graph for this function:

void calcVelocity float  distance  )  [inline, inherited]
 

Definition at line 464 of file splines.h.

References idCameraPosition::baseVelocity, and idCameraPosition::time.

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

void calcVelocity float  distance  )  [inline, inherited]
 

Definition at line 457 of file splines.h.

References idCameraPosition::baseVelocity, and idCameraPosition::time.

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

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

virtual void clear  )  [inline, virtual, inherited]
 

Definition at line 367 of file splines.h.

References idList::Clear(), idCameraPosition::editMode, i, idList::Num(), and idCameraPosition::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, inherited]
 

Definition at line 360 of file splines.h.

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

Referenced by idCameraPosition::~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, inherited]
 

Definition at line 458 of file splines.h.

00458 {};

virtual void draw bool  editMode  )  [inline, virtual]
 

Reimplemented from idCameraPosition.

Definition at line 674 of file splines.h.

References idSplineList::draw(), and target.

00674                                      {
00675         target.draw(editMode);
00676     }

Here is the call graph for this function:

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, inherited]
 

Definition at line 442 of file splines.h.

References idStr::c_str(), and idCameraPosition::name.

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

Here is the call graph for this function:

const char* getName  )  [inline, inherited]
 

Definition at line 435 of file splines.h.

References idStr::c_str(), and idCameraPosition::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]
 

Reimplemented from idPointListInterface.

Definition at line 662 of file splines.h.

References idSplineList::getPoint(), and target.

00662                                           {
00663         return target.getPoint(index);
00664     }

Here is the call graph for this function:

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

Reimplemented from idPointListInterface.

Definition at line 655 of file splines.h.

References idSplineList::getPoint(), and target.

00655                                           {
00656         return target.getPoint(index);
00657     }

Here is the call graph for this function:

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

Reimplemented from idCameraPosition.

Definition at line 645 of file splines.h.

References idSplineList::getPosition(), t, and target.

00645                                                 { 
00646         return target.getPosition(t);
00647     }

Here is the call graph for this function:

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

Reimplemented from idCameraPosition.

Definition at line 638 of file splines.h.

References idSplineList::getPosition(), t, and target.

00638                                                 { 
00639         return target.getPosition(t);
00640     }

Here is the call graph for this function:

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, inherited]
 

Definition at line 409 of file splines.h.

00409                    {
00410         return time;
00411     }

long getTime  )  [inline, inherited]
 

Definition at line 402 of file splines.h.

00402                    {
00403         return time;
00404     }

float getVelocity long  t  )  [inline, inherited]
 

Definition at line 417 of file splines.h.

References check(), i, idList::Num(), t, and idCameraPosition::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, inherited]
 

Definition at line 410 of file splines.h.

References check(), i, idList::Num(), t, and idCameraPosition::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:

void init  )  [inline]
 

Definition at line 624 of file splines.h.

00624                 {
00625         type = idCameraPosition::SPLINE;
00626     }

void init  )  [inline]
 

Definition at line 617 of file splines.h.

Referenced by idSplinePosition().

00617                 {
00618         type = idCameraPosition::SPLINE;
00619     }

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]
 

Reimplemented from idPointListInterface.

Definition at line 658 of file splines.h.

References idSplineList::numPoints(), and target.

00658                             {
00659         return target.numPoints();
00660     }

Here is the call graph for this function:

virtual int numPoints  )  [inline, virtual]
 

Reimplemented from idPointListInterface.

Definition at line 651 of file splines.h.

References idSplineList::numPoints(), and target.

00651                             {
00652         return target.numPoints();
00653     }

Here is the call graph for this function:

int numSelectedPoints  )  [inherited]
 

void parse const char **  text  )  [virtual]
 

Reimplemented from idCameraPosition.

void parse const char **  text  )  [virtual]
 

Reimplemented from idCameraPosition.

Definition at line 1084 of file splines.cpp.

References idStr::c_str(), Com_MatchToken(), Com_Parse(), Com_ParseOnLine(), Com_UngetToken(), idSplineList::parse(), idCameraPosition::parseToken(), Q_stricmp(), strcmp(), target, and token.

Referenced by idCameraDef::parse().

01084                                                   {
01085     const char *token;
01086     Com_MatchToken( text, "{" );
01087     do {
01088         token = Com_Parse( text );
01089     
01090         if ( !token[0] ) {
01091             break;
01092         }
01093         if ( !strcmp (token, "}") ) {
01094             break;
01095         }
01096 
01097         // here we may have to jump over brush epairs ( only used in editor )
01098         do {
01099             // if token is not a brace, it is a key for a key/value pair
01100             if ( !token[0] || !strcmp (token, "(") || !strcmp(token, "}")) {
01101                 break;
01102             }
01103 
01104             Com_UngetToken();
01105             idStr key = Com_ParseOnLine(text);
01106             
01107             const char *token = Com_Parse(text);
01108             if (Q_stricmp(key.c_str(), "target") == 0) {
01109                 target.parse(text);
01110             } else {
01111                 Com_UngetToken();
01112                 idCameraPosition::parseToken(key.c_str(), text);    
01113             }
01114             token = Com_Parse(text);
01115 
01116         } while (1);
01117 
01118         if ( !strcmp (token, "}") ) {
01119             break;
01120         }
01121 
01122     } while (1);
01123  
01124     Com_UngetToken();
01125     Com_MatchToken( text, "}" );
01126 }

Here is the call graph for this function:

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

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

Definition at line 958 of file splines.cpp.

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

Referenced by 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: