[Gcblue-commits] gcb_wx/src/sim tcDirector.cpp,1.3,1.4 tcDirectorEvent.cpp,1.2,1.3
Status: Alpha
Brought to you by:
ddcforge
From: <ddc...@us...> - 2003-12-31 17:34:13
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1:/tmp/cvs-serv30143/src/sim Modified Files: tcDirector.cpp tcDirectorEvent.cpp Log Message: FlybyCamera event Index: tcDirector.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcDirector.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcDirector.cpp 31 Dec 2003 00:23:23 -0000 1.3 --- tcDirector.cpp 31 Dec 2003 17:34:10 -0000 1.4 *************** *** 114,117 **** --- 114,118 ---- tcConsoleTextEvent::AttachConsole(console); tcDirectorEvent::AttachEventHandler(win); + tcCameraEvent::AttachViewer(viewer); events.clear(); startTime = 0; Index: tcDirectorEvent.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcDirectorEvent.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcDirectorEvent.cpp 22 Dec 2003 02:32:37 -0000 1.2 --- tcDirectorEvent.cpp 31 Dec 2003 17:34:10 -0000 1.3 *************** *** 34,37 **** --- 34,39 ---- #include "tcSound.h" #include "tcConsole.h" + #include "tc3DViewer.h" + #include "math_constants.h" using MapView::tcMapView; *************** *** 78,120 **** - /********** tcCameraEvent ****************/ - - Producer::Vec3 tcCameraEvent::GetPosition(double lon_zero, double lat_zero, double t) - { - return cameraStartPosition; - } - - void tcCameraEvent::SetDatum(double lon_rad, double lat_rad) - { - longitudeDatum = lon_rad; - latitudeDatum = lat_rad; - } - - void tcCameraEvent::SetEndPosition(float x, float y, float z) - { - cameraEndPosition = Producer::Vec3(x,y,z); - } - - void tcCameraEvent::SetTargetPosition(float x, float y, float z) - { - cameraTargetPosition = Producer::Vec3(x,y,z); - } - - void tcCameraEvent::SetStartPosition(float x, float y, float z) - { - cameraStartPosition = Producer::Vec3(x,y,z); - } - - void tcCameraEvent::Update(double t) - { - } - - tcCameraEvent::tcCameraEvent() - { - } - tcCameraEvent::~tcCameraEvent() - { - } --- 80,84 ---- *************** *** 344,346 **** --- 308,377 ---- + /********** tcCameraEvent ****************/ + + tc3DViewer* tcCameraEvent::viewer = NULL; + + void tcCameraEvent::Update(double t) + { + if (t < eventStart) return; + if (triggered) return; + + viewer->SetCameraMode(lookAtTarget, moveWithTarget); + viewer->SetHookID(targetID); + + triggered = true; + } + tcCameraEvent::tcCameraEvent(double tStart, double tStop) + : tcDirectorEvent(tStart, tStop) + { + } + + tcCameraEvent::~tcCameraEvent() + { + } + + /********** tcFlybyCameraEvent *****************/ + void tcFlybyCameraEvent::Update(double t) + { + tcCameraEvent::Update(t); + + if (!triggered) return; + if (t > eventStop) return; + + float k = (eventStart == eventStop) ? 0 : (t - eventStart)/(eventStop - eventStart); + float daz = stopAz - startAz; + if (daz < -C_PI) daz += C_TWOPI; + else if (daz > C_PI) daz -= C_TWOPI; + float az = startAz + k*daz; + + float del = stopEl - startEl; + if (del < -C_PI) del += C_TWOPI; + else if (del > C_PI) del -= C_TWOPI; + float el = startEl + k*del; + + float range = startRange + k*(stopRange - startRange); + + viewer->SetMoveWithVector(az, el, range); + } + + tcFlybyCameraEvent::tcFlybyCameraEvent(double tStart, double tStop, long targID, + float az1, float az2, float el1, float el2, + float r1, float r2) + : tcCameraEvent(tStart,tStop) + { + targetID = targID; + moveWithTarget = true; + lookAtTarget = true; + + startAz = az1; + startEl = el1; + startRange = r1; + stopAz = az2; + stopEl = el2; + stopRange = r2; + } + + tcFlybyCameraEvent::~tcFlybyCameraEvent() + { + } \ No newline at end of file |