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

idFixedPosition Class Reference

#include <splines.h>

Inheritance diagram for idFixedPosition:

Inheritance graph
[legend]
Collaboration diagram for idFixedPosition:

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 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)
 idFixedPosition (idVec3_t p)
 idFixedPosition ()
 idFixedPosition (idVec3_t p)
 idFixedPosition ()
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 (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)
void write (fileHandle_t file, const char *name)
void write (fileHandle_t file, const char *name)
 ~idFixedPosition ()
 ~idFixedPosition ()

Protected Attributes

float baseVelocity
bool editMode
idStr name
idVec3_t pos
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 [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

idFixedPosition  )  [inline]
 

Definition at line 481 of file splines.h.

References init().

00481                       : idCameraPosition() {
00482         init();
00483     }

Here is the call graph for this function:

idFixedPosition idVec3_t  p  )  [inline]
 

Definition at line 485 of file splines.h.

References init(), and pos.

00485                                 : idCameraPosition() {
00486         init();
00487         pos = p;
00488     }

Here is the call graph for this function:

~idFixedPosition  )  [inline]
 

Definition at line 499 of file splines.h.

00499                        {
00500     }

idFixedPosition  )  [inline]
 

Definition at line 488 of file splines.h.

References init().

00488                       : idCameraPosition() {
00489         init();
00490     }

Here is the call graph for this function:

idFixedPosition idVec3_t  p  )  [inline]
 

Definition at line 492 of file splines.h.

References init(), and pos.

00492                                 : idCameraPosition() {
00493         init();
00494         pos = p;
00495     }

Here is the call graph for this function:

~idFixedPosition  )  [inline]
 

Definition at line 506 of file splines.h.

00506                        {
00507     }


Member Function Documentation

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

Reimplemented from idPointListInterface.

Definition at line 501 of file splines.h.

References pos, idVec3_t::set(), x, y, and z.

00501                                                                        {
00502         pos.set(x, y, z);
00503     }

Here is the call graph for this function:

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

Reimplemented from idPointListInterface.

Definition at line 497 of file splines.h.

References pos.

00497                                              {
00498         pos = v;
00499     }

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

Reimplemented from idPointListInterface.

Definition at line 494 of file splines.h.

References pos, idVec3_t::set(), x, y, and z.

00494                                                                        {
00495         pos.set(x, y, z);
00496     }

Here is the call graph for this function:

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

Reimplemented from idPointListInterface.

Definition at line 490 of file splines.h.

References pos.

00490                                              {
00491         pos = v;
00492     }

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 idSplinePosition::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 527 of file splines.h.

References blue, glLabeledPoint(), and pos.

00527                                      {
00528         glLabeledPoint(blue, pos, (editMode) ? 5 : 3, "Fixed point");
00529     }

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 520 of file splines.h.

References assert.

00520                                           {
00521         if (index != 0) {
00522             assert(true);
00523         };
00524         return &pos;
00525     }

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

Reimplemented from idPointListInterface.

Definition at line 513 of file splines.h.

References assert.

00513                                           {
00514         if (index != 0) {
00515             assert(true);
00516         };
00517         return &pos;
00518     }

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

Reimplemented from idCameraPosition.

Definition at line 509 of file splines.h.

00509                                                 { 
00510         return &pos;
00511     }

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

Reimplemented from idCameraPosition.

Definition at line 502 of file splines.h.

00502                                                 { 
00503         return &pos;
00504     }

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 483 of file splines.h.

References pos, and idVec3_t::Zero().

00483                 {
00484         pos.Zero();
00485         type = idCameraPosition::FIXED;
00486     }

Here is the call graph for this function:

void init  )  [inline]
 

Definition at line 476 of file splines.h.

References pos, and idVec3_t::Zero().

Referenced by idFixedPosition().

00476                 {
00477         pos.Zero();
00478         type = idCameraPosition::FIXED;
00479     }

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]
 

Reimplemented from idPointListInterface.

Definition at line 516 of file splines.h.

00516                             {
00517         return 1;
00518     }

virtual int numPoints  )  [inline, virtual]
 

Reimplemented from idPointListInterface.

Definition at line 509 of file splines.h.

00509                             {
00510         return 1;
00511     }

int numSelectedPoints  )  [inherited]
 

void parse const char **  text  )  [virtual]
 

Reimplemented from idCameraPosition.

void parse const char **  text  )  [virtual]
 

Reimplemented from idCameraPosition.

Definition at line 990 of file splines.cpp.

References idStr::c_str(), Com_MatchToken(), Com_Parse(), Com_Parse1DMatrix(), Com_ParseOnLine(), Com_UngetToken(), idCameraPosition::parseToken(), pos, Q_stricmp(), strcmp(), and token.

Referenced by idCameraDef::parse().

00990                                                  {
00991     const char *token;
00992     Com_MatchToken( text, "{" );
00993     do {
00994         token = Com_Parse( text );
00995     
00996         if ( !token[0] ) {
00997             break;
00998         }
00999         if ( !strcmp (token, "}") ) {
01000             break;
01001         }
01002 
01003         // here we may have to jump over brush epairs ( only used in editor )
01004         do {
01005             // if token is not a brace, it is a key for a key/value pair
01006             if ( !token[0] || !strcmp (token, "(") || !strcmp(token, "}")) {
01007                 break;
01008             }
01009 
01010             Com_UngetToken();
01011             idStr key = Com_ParseOnLine(text);
01012             
01013             const char *token = Com_Parse(text);
01014             if (Q_stricmp(key.c_str(), "pos") == 0) {
01015                 Com_UngetToken();
01016                 Com_Parse1DMatrix( text, 3, pos );
01017             } else {
01018                 Com_UngetToken();
01019                 idCameraPosition::parseToken(key.c_str(), text);    
01020             }
01021             token = Com_Parse(text);
01022 
01023         } while (1);
01024 
01025         if ( !strcmp (token, "}") ) {
01026             break;
01027         }
01028 
01029     } while (1);
01030  
01031     Com_UngetToken();
01032     Com_MatchToken( text, "}" );
01033 }

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 idSplinePosition::parse(), idInterpolatedPosition::parse(), and 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