00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __SPLINES_H
00023 #define __SPLINES_H
00024
00025 extern "C" {
00026 #ifdef Q3RADIANT
00027 #include "../qgl.h"
00028 #else
00029
00030 #endif
00031 }
00032 #include "util_list.h"
00033 #include "util_str.h"
00034 #include "math_vector.h"
00035
00036 typedef int fileHandle_t;
00037
00038
00039
00040
00041 static vec4_t blue(0, 0, 1, 1);
00042 static vec4_t red(1, 0, 0, 1);
00043
00044 class idPointListInterface {
00045 public:
00046 idPointListInterface() {
00047 selectedPoints.Clear();
00048 }
00049 virtual ~idPointListInterface() {}
00050
00051 virtual int numPoints() {
00052 return 0;
00053 }
00054
00055 virtual void addPoint(const float x, const float y, const float z) {}
00056 virtual void addPoint(const idVec3_t &v) {}
00057 virtual void removePoint(int index) {}
00058 virtual idVec3_t *getPoint(int index) { return NULL; }
00059
00060 int selectPointByRay(float ox, float oy, float oz, float dx, float dy, float dz, bool single) {
00061 idVec3_t origin(ox, oy, oz);
00062 idVec3_t dir(dx, dy, dz);
00063 return selectPointByRay(origin, dir, single);
00064 }
00065
00066 int selectPointByRay(const idVec3_t origin, const idVec3_t direction, bool single) {
00067 int i, besti, count;
00068 float d, bestd;
00069 idVec3_t temp, temp2;
00070
00071
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, direction, temp);
00082 temp2 -= temp;
00083 d = temp2.Length();
00084 if (d <= bestd) {
00085 bestd = d;
00086 besti = i;
00087 }
00088 }
00089
00090 if (besti >= 0) {
00091 selectPoint(besti, single);
00092 }
00093
00094 return besti;
00095 }
00096
00097 int isPointSelected(int index) {
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 }
00106
00107 int selectPoint(int index, bool single) {
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 }
00120
00121 void selectAll() {
00122 selectedPoints.Clear();
00123 for (int i = 0; i < numPoints(); i++) {
00124 selectedPoints.Append(i);
00125 }
00126 }
00127
00128 void deselectAll() {
00129 selectedPoints.Clear();
00130 }
00131
00132 virtual void updateSelection(float x, float y, float z) {
00133 idVec3_t move(x, y, z);
00134 updateSelection(move);
00135 }
00136
00137 virtual void updateSelection(const idVec3_t &move) {
00138 int count = selectedPoints.Num();
00139 for (int i = 0; i < count; i++) {
00140 *getPoint(selectedPoints[i]) += move;
00141 }
00142 }
00143
00144
00145
00146
00147
00148
00149
00150
00151 protected:
00152 idList<int> selectedPoints;
00153
00154 };
00155
00156
00157 class idSplineList {
00158
00159 public:
00160
00161 idSplineList() {
00162 clear();
00163 }
00164
00165 idSplineList(const char *p) {
00166 clear();
00167 name = p;
00168 };
00169
00170 ~idSplineList() {
00171 clear();
00172 };
00173
00174 void clearControl() {
00175 for (int i = 0; i < controlPoints.Num(); i++) {
00176 delete controlPoints[i];
00177 }
00178 controlPoints.Clear();
00179 }
00180
00181 void clearSpline() {
00182 for (int i = 0; i < splinePoints.Num(); i++) {
00183 delete splinePoints[i];
00184 }
00185 splinePoints.Clear();
00186 }
00187
00188 void parse(const char *(*text));
00189 void write(fileHandle_t file, const char *name);
00190
00191 void clear() {
00192 clearControl();
00193 clearSpline();
00194 splineTime.Clear();
00195 selected = NULL;
00196 dirty = true;
00197 activeSegment = 0;
00198 granularity = 0.025;
00199 pathColor.set(1.0, 0.5, 0.0);
00200 controlColor.set(0.7, 0.0, 1.0);
00201 segmentColor.set(0.0, 0.0, 1.0);
00202 activeColor.set(1.0, 0.0, 0.0);
00203 }
00204
00205 void initPosition(long startTime, long totalTime);
00206 const idVec3_t *getPosition(long time);
00207
00208
00209
00210 void addToRenderer();
00211
00212 void setSelectedPoint(idVec3_t *p);
00213 idVec3_t *getSelectedPoint() {
00214 return selected;
00215 }
00216
00217 void addPoint(const idVec3_t &v) {
00218 controlPoints.Append(new idVec3_t(v));
00219 dirty = true;
00220 }
00221
00222 void addPoint(float x, float y, float z) {
00223 controlPoints.Append(new idVec3_t(x, y, z));
00224 dirty = true;
00225 }
00226
00227 void updateSelection(const idVec3_t &move);
00228
00229 void startEdit() {
00230 editMode = true;
00231 }
00232
00233 void stopEdit() {
00234 editMode = false;
00235 }
00236
00237 void buildSpline();
00238
00239 void setGranularity(float f) {
00240 granularity = f;
00241 }
00242
00243 float getGranularity() {
00244 return granularity;
00245 }
00246
00247 int numPoints() {
00248 return controlPoints.Num();
00249 }
00250
00251 idVec3_t *getPoint(int index) {
00252 assert(index >= 0 && index < controlPoints.Num());
00253 return controlPoints[index];
00254 }
00255
00256 idVec3_t *getSegmentPoint(int index) {
00257 assert(index >= 0 && index < splinePoints.Num());
00258 return splinePoints[index];
00259 }
00260
00261
00262 void setSegmentTime(int index, int time) {
00263 assert(index >= 0 && index < splinePoints.Num());
00264 splineTime[index] = time;
00265 }
00266
00267 double getSegmentTime(int index) {
00268 assert(index >= 0 && index < splinePoints.Num());
00269 return splineTime[index];
00270 }
00271 void addSegmentTime(int index, int time) {
00272 assert(index >= 0 && index < splinePoints.Num());
00273 splineTime[index] += time;
00274 }
00275
00276 float totalDistance();
00277
00278 static idVec3_t zero;
00279
00280 int getActiveSegment() {
00281 return activeSegment;
00282 }
00283
00284 void setActiveSegment(int i) {
00285
00286 activeSegment = i;
00287 }
00288
00289 int numSegments() {
00290 return splinePoints.Num();
00291 }
00292
00293 void setColors(idVec3_t &path, idVec3_t &segment, idVec3_t &control, idVec3_t &active) {
00294 pathColor = path;
00295 segmentColor = segment;
00296 controlColor = control;
00297 activeColor = active;
00298 }
00299
00300 const char *getName() {
00301 return name.c_str();
00302 }
00303
00304 void setName(const char *p) {
00305 name = p;
00306 }
00307
00308 bool validTime() {
00309 if (dirty) {
00310 buildSpline();
00311 }
00312
00313
00314 return (bool)(splineTime.Num() > 0 && splineTime.Num() == splinePoints.Num());
00315 }
00316
00317 void setTime(long t) {
00318 time = t;
00319 }
00320
00321 void setBaseTime(long t) {
00322 baseTime = t;
00323 }
00324
00325 protected:
00326 idStr name;
00327 float calcSpline(int step, float tension);
00328 idList<idVec3_t*> controlPoints;
00329 idList<idVec3_t*> splinePoints;
00330 idList<double> splineTime;
00331 idVec3_t *selected;
00332 idVec3_t pathColor, segmentColor, controlColor, activeColor;
00333 float granularity;
00334 bool editMode;
00335 bool dirty;
00336 int activeSegment;
00337 long baseTime;
00338 long time;
00339 friend class idCamera;
00340 };
00341
00342
00343
00344 struct idVelocity {
00345 idVelocity(long start, long duration, float s) {
00346 startTime = start;
00347 time = duration;
00348 speed = s;
00349 }
00350 long startTime;
00351 long time;
00352 float speed;
00353 };
00354
00355
00356
00357 class idCameraPosition : public idPointListInterface {
00358 public:
00359
00360 virtual void clear() {
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 }
00368
00369 idCameraPosition(const char *p) {
00370 name = p;
00371 }
00372
00373 idCameraPosition() {
00374 time = 0;
00375 name = "position";
00376 }
00377
00378 idCameraPosition(long t) {
00379 time = t;
00380 }
00381
00382 virtual ~idCameraPosition() {
00383 clear();
00384 }
00385
00386
00387
00388
00389
00390 enum positionType {
00391 FIXED = 0x00,
00392 INTERPOLATED,
00393 SPLINE,
00394 POSITION_COUNT
00395 };
00396
00397
00398 virtual void start(long t) {
00399 startTime = t;
00400 }
00401
00402 long getTime() {
00403 return time;
00404 }
00405
00406 virtual void setTime(long t) {
00407 time = t;
00408 }
00409
00410 float getVelocity(long t) {
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 }
00419
00420 void addVelocity(long start, long duration, float speed) {
00421 velocities.Append(new idVelocity(start, duration, speed));
00422 }
00423
00424 virtual const idVec3_t *getPosition(long t) {
00425 assert(true);
00426 return NULL;
00427 }
00428
00429
00430
00431 virtual void parse(const char *(*text)) {};
00432 virtual void write(fileHandle_t file, const char *name);
00433 virtual bool parseToken(const char *key, const char *(*text));
00434
00435 const char *getName() {
00436 return name.c_str();
00437 }
00438
00439 void setName(const char *p) {
00440 name = p;
00441 }
00442
00443 virtual void startEdit() {
00444 editMode = true;
00445 }
00446
00447 virtual void stopEdit() {
00448 editMode = false;
00449 }
00450
00451
00452
00453 const char *typeStr() {
00454 return positionStr[static_cast<int>(type)];
00455 }
00456
00457 void calcVelocity(float distance) {
00458 float secs = (float)time / 1000;
00459 baseVelocity = distance / secs;
00460 }
00461
00462 protected:
00463 static const char* positionStr[POSITION_COUNT];
00464 long startTime;
00465 long time;
00466 idCameraPosition::positionType type;
00467 idStr name;
00468 bool editMode;
00469 idList<idVelocity*> velocities;
00470 float baseVelocity;
00471 };
00472
00473 class idFixedPosition : public idCameraPosition {
00474 public:
00475
00476 void init() {
00477 pos.Zero();
00478 type = idCameraPosition::FIXED;
00479 }
00480
00481 idFixedPosition() : idCameraPosition() {
00482 init();
00483 }
00484
00485 idFixedPosition(idVec3_t p) : idCameraPosition() {
00486 init();
00487 pos = p;
00488 }
00489
00490 virtual void addPoint(const idVec3_t &v) {
00491 pos = v;
00492 }
00493
00494 virtual void addPoint(const float x, const float y, const float z) {
00495 pos.set(x, y, z);
00496 }
00497
00498
00499 ~idFixedPosition() {
00500 }
00501
00502 virtual const idVec3_t *getPosition(long t) {
00503 return &pos;
00504 }
00505
00506 void parse(const char *(*text));
00507 void write(fileHandle_t file, const char *name);
00508
00509 virtual int numPoints() {
00510 return 1;
00511 }
00512
00513 virtual idVec3_t *getPoint(int index) {
00514 if (index != 0) {
00515 assert(true);
00516 };
00517 return &pos;
00518 }
00519
00520
00521
00522
00523
00524 protected:
00525 idVec3_t pos;
00526 };
00527
00528 class idInterpolatedPosition : public idCameraPosition {
00529 public:
00530
00531 void init() {
00532 type = idCameraPosition::INTERPOLATED;
00533 first = true;
00534 startPos.Zero();
00535 endPos.Zero();
00536 }
00537
00538 idInterpolatedPosition() : idCameraPosition() {
00539 init();
00540 }
00541
00542 idInterpolatedPosition(idVec3_t start, idVec3_t end, long time) : idCameraPosition(time) {
00543 init();
00544 startPos = start;
00545 endPos = end;
00546 }
00547
00548 ~idInterpolatedPosition() {
00549 }
00550
00551 virtual const idVec3_t *getPosition(long t);
00552
00553 void parse(const char *(*text));
00554 void write(fileHandle_t file, const char *name);
00555
00556 virtual int numPoints() {
00557 return 2;
00558 }
00559
00560 virtual idVec3_t *getPoint(int index) {
00561 assert(index >= 0 && index < 2);
00562 if (index == 0) {
00563 return &startPos;
00564 }
00565 return &endPos;
00566 }
00567
00568 virtual void addPoint(const float x, const float y, const float z) {
00569 if (first) {
00570 startPos.set(x, y, z);
00571 first = false;
00572 } else {
00573 endPos.set(x, y, z);
00574 first = true;
00575 }
00576 }
00577
00578 virtual void addPoint(const idVec3_t &v) {
00579 if (first) {
00580 startPos = v;
00581 first = false;
00582 } else {
00583 endPos = v;
00584 first = true;
00585 }
00586 }
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597 virtual void start(long t) {
00598 idCameraPosition::start(t);
00599 lastTime = startTime;
00600 distSoFar = 0.0;
00601 idVec3_t temp = startPos;
00602 temp -= endPos;
00603 calcVelocity(temp.Length());
00604 }
00605
00606 protected:
00607 bool first;
00608 idVec3_t startPos;
00609 idVec3_t endPos;
00610 long lastTime;
00611 float distSoFar;
00612 };
00613
00614 class idSplinePosition : public idCameraPosition {
00615 public:
00616
00617 void init() {
00618 type = idCameraPosition::SPLINE;
00619 }
00620
00621 idSplinePosition() : idCameraPosition() {
00622 init();
00623 }
00624
00625 idSplinePosition(long time) : idCameraPosition(time) {
00626 init();
00627 }
00628
00629 ~idSplinePosition() {
00630 }
00631
00632 virtual void start(long t) {
00633 idCameraPosition::start(t);
00634 target.initPosition(t, time);
00635 calcVelocity(target.totalDistance());
00636 }
00637
00638 virtual const idVec3_t *getPosition(long t) {
00639 return target.getPosition(t);
00640 }
00641
00642
00643
00644 void addControlPoint(idVec3_t &v) {
00645 target.addPoint(v);
00646 }
00647
00648 void parse(const char *(*text));
00649 void write(fileHandle_t file, const char *name);
00650
00651 virtual int numPoints() {
00652 return target.numPoints();
00653 }
00654
00655 virtual idVec3_t *getPoint(int index) {
00656 return target.getPoint(index);
00657 }
00658
00659 virtual void addPoint(const idVec3_t &v) {
00660 target.addPoint(v);
00661 }
00662
00663 virtual void addPoint(const float x, const float y, const float z) {
00664 target.addPoint(x, y, z);
00665 }
00666
00667
00668
00669
00670
00671 virtual void updateSelection(const idVec3_t &move) {
00672 idCameraPosition::updateSelection(move);
00673 target.buildSpline();
00674 }
00675
00676 protected:
00677 idSplineList target;
00678 };
00679
00680 class idCameraFOV {
00681 public:
00682
00683 idCameraFOV() {
00684 time = 0;
00685 fov = 90;
00686 }
00687
00688 idCameraFOV(int v) {
00689 time = 0;
00690 fov = v;
00691 }
00692
00693 idCameraFOV(int s, int e, long t) {
00694 startFOV = s;
00695 endFOV = e;
00696 time = t;
00697 }
00698
00699
00700 ~idCameraFOV(){}
00701
00702 void setFOV(float f) {
00703 fov = f;
00704 }
00705
00706 float getFOV(long t) {
00707 if (time) {
00708 assert(startTime);
00709 float percent = t / startTime;
00710 float temp = startFOV - endFOV;
00711 temp *= percent;
00712 fov = startFOV + temp;
00713 }
00714 return fov;
00715 }
00716
00717 void start(long t) {
00718 startTime = t;
00719 }
00720
00721 void parse(const char *(*text));
00722 void write(fileHandle_t file, const char *name);
00723
00724 protected:
00725 float fov;
00726 float startFOV;
00727 float endFOV;
00728 int startTime;
00729 int time;
00730 };
00731
00732
00733
00734
00735 class idCameraEvent {
00736 public:
00737 enum eventType {
00738 EVENT_NA = 0x00,
00739 EVENT_WAIT,
00740 EVENT_TARGETWAIT,
00741 EVENT_SPEED,
00742 EVENT_TARGET,
00743 EVENT_SNAPTARGET,
00744 EVENT_FOV,
00745 EVENT_SCRIPT,
00746 EVENT_TRIGGER,
00747 EVENT_STOP,
00748 EVENT_COUNT
00749 };
00750
00751 static const char* eventStr[EVENT_COUNT];
00752
00753 idCameraEvent() {
00754 paramStr = "";
00755 type = EVENT_NA;
00756 time = 0;
00757 }
00758
00759 idCameraEvent(eventType t, const char *param, long n) {
00760 type = t;
00761 paramStr = param;
00762 time = n;
00763 }
00764
00765 ~idCameraEvent() {};
00766
00767 eventType getType() {
00768 return type;
00769 }
00770
00771 const char *typeStr() {
00772 return eventStr[static_cast<int>(type)];
00773 }
00774
00775 const char *getParam() {
00776 return paramStr.c_str();
00777 }
00778
00779 long getTime() {
00780 return time;
00781 }
00782
00783 void setTime(long n) {
00784 time = n;
00785 }
00786
00787 void parse(const char *(*text));
00788 void write(fileHandle_t file, const char *name);
00789
00790 void setTriggered(bool b) {
00791 triggered = b;
00792 }
00793
00794 bool getTriggered() {
00795 return triggered;
00796 }
00797
00798 protected:
00799 eventType type;
00800 idStr paramStr;
00801 long time;
00802 bool triggered;
00803
00804 };
00805
00806 class idCameraDef {
00807 public:
00808
00809 void clear() {
00810 currentCameraPosition = 0;
00811 cameraRunning = false;
00812 lastDirection.Zero();
00813 baseTime = 30;
00814 activeTarget = 0;
00815 name = "camera01";
00816 fov.setFOV(90);
00817 int i;
00818 for (i = 0; i < targetPositions.Num(); i++) {
00819 delete targetPositions[i];
00820 }
00821 for (i = 0; i < events.Num(); i++) {
00822 delete events[i];
00823 }
00824 delete cameraPosition;
00825 cameraPosition = NULL;
00826 events.Clear();
00827 targetPositions.Clear();
00828 }
00829
00830 idCameraPosition *startNewCamera(idCameraPosition::positionType type) {
00831 clear();
00832 if (type == idCameraPosition::SPLINE) {
00833 cameraPosition = new idSplinePosition();
00834 } else if (type == idCameraPosition::INTERPOLATED) {
00835 cameraPosition = new idInterpolatedPosition();
00836 } else {
00837 cameraPosition = new idFixedPosition();
00838 }
00839 return cameraPosition;
00840 }
00841
00842 idCameraDef() {
00843 clear();
00844 }
00845
00846 ~idCameraDef() {
00847 clear();
00848 }
00849
00850 void addEvent(idCameraEvent::eventType t, const char *param, long time);
00851
00852 void addEvent(idCameraEvent *event);
00853
00854 static int sortEvents(const void *p1, const void *p2);
00855
00856 int numEvents() {
00857 return events.Num();
00858 }
00859
00860 idCameraEvent *getEvent(int index) {
00861 assert(index >= 0 && index < events.Num());
00862 return events[index];
00863 }
00864
00865 void parse(const char *(*text));
00866 qboolean load(const char *filename);
00867 void save(const char *filename);
00868
00869 void buildCamera();
00870
00871
00872
00873
00874
00875 static idCameraPosition *newFromType(idCameraPosition::positionType t) {
00876 switch (t) {
00877 case idCameraPosition::FIXED : return new idFixedPosition();
00878 case idCameraPosition::INTERPOLATED : return new idInterpolatedPosition();
00879 case idCameraPosition::SPLINE : return new idSplinePosition();
00880 default:
00881 break;
00882 };
00883 return NULL;
00884 }
00885
00886 void addTarget(const char *name, idCameraPosition::positionType type);
00887
00888 idCameraPosition *getActiveTarget() {
00889 if (targetPositions.Num() == 0) {
00890 addTarget(NULL, idCameraPosition::FIXED);
00891 }
00892 return targetPositions[activeTarget];
00893 }
00894
00895 idCameraPosition *getActiveTarget(int index) {
00896 if (targetPositions.Num() == 0) {
00897 addTarget(NULL, idCameraPosition::FIXED);
00898 return targetPositions[0];
00899 }
00900 return targetPositions[index];
00901 }
00902
00903 int numTargets() {
00904 return targetPositions.Num();
00905 }
00906
00907
00908 void setActiveTargetByName(const char *name) {
00909 for (int i = 0; i < targetPositions.Num(); i++) {
00910 if (Q_stricmp(name, targetPositions[i]->getName()) == 0) {
00911 setActiveTarget(i);
00912 return;
00913 }
00914 }
00915 }
00916
00917 void setActiveTarget(int index) {
00918 assert(index >= 0 && index < targetPositions.Num());
00919 activeTarget = index;
00920 }
00921
00922 void setRunning(bool b) {
00923 cameraRunning = b;
00924 }
00925
00926 void setBaseTime(float f) {
00927 baseTime = f;
00928 }
00929
00930 float getBaseTime() {
00931 return baseTime;
00932 }
00933
00934 float getTotalTime() {
00935 return totalTime;
00936 }
00937
00938 void startCamera(long t);
00939 void stopCamera() {
00940 cameraRunning = true;
00941 }
00942 void getActiveSegmentInfo(int segment, idVec3_t &origin, idVec3_t &direction, float *fv);
00943
00944 bool getCameraInfo(long time, idVec3_t &origin, idVec3_t &direction, float *fv);
00945 bool getCameraInfo(long time, float *origin, float *direction, float *fv) {
00946 idVec3_t org, dir;
00947 org[0] = origin[0];
00948 org[1] = origin[1];
00949 org[2] = origin[2];
00950 dir[0] = direction[0];
00951 dir[1] = direction[1];
00952 dir[2] = direction[2];
00953 bool b = getCameraInfo(time, org, dir, fv);
00954 origin[0] = org[0];
00955 origin[1] = org[1];
00956 origin[2] = org[2];
00957 direction[0] = dir[0];
00958 direction[1] = dir[1];
00959 direction[2] = dir[2];
00960 return b;
00961 }
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998 int numPoints() {
00999 if (cameraEdit) {
01000 return cameraPosition->numPoints();
01001 }
01002 return getActiveTarget()->numPoints();
01003 }
01004
01005 const idVec3_t *getPoint(int index) {
01006 if (cameraEdit) {
01007 return cameraPosition->getPoint(index);
01008 }
01009 return getActiveTarget()->getPoint(index);
01010 }
01011
01012 void stopEdit() {
01013 editMode = false;
01014 if (cameraEdit) {
01015 cameraPosition->stopEdit();
01016 } else {
01017 getActiveTarget()->stopEdit();
01018 }
01019 }
01020
01021 void startEdit(bool camera) {
01022 cameraEdit = camera;
01023 if (camera) {
01024 cameraPosition->startEdit();
01025 for (int i = 0; i < targetPositions.Num(); i++) {
01026 targetPositions[i]->stopEdit();
01027 }
01028 } else {
01029 getActiveTarget()->startEdit();
01030 cameraPosition->stopEdit();
01031 }
01032 editMode = true;
01033 }
01034
01035 bool waitEvent(int index);
01036
01037 const char *getName() {
01038 return name.c_str();
01039 }
01040
01041 void setName(const char *p) {
01042 name = p;
01043 }
01044
01045 idCameraPosition *getPositionObj() {
01046 if (cameraPosition == NULL) {
01047 cameraPosition = new idFixedPosition();
01048 }
01049 return cameraPosition;
01050 }
01051
01052 protected:
01053 idStr name;
01054 int currentCameraPosition;
01055 idVec3_t lastDirection;
01056 bool cameraRunning;
01057 idCameraPosition *cameraPosition;
01058 idList<idCameraPosition*> targetPositions;
01059 idList<idCameraEvent*> events;
01060 idCameraFOV fov;
01061 int activeTarget;
01062 float totalTime;
01063 float baseTime;
01064 long startTime;
01065
01066 bool cameraEdit;
01067 bool editMode;
01068 };
01069
01070 extern bool g_splineMode;
01071
01072 extern idCameraDef *g_splineList;
01073
01074
01075 #endif