Manta Interactive Ray Tracer Development Mailing List

Text archives Help


Re: [MANTA] r398 - branches/itanium2/fox


Chronological Thread 
  • From: Steven Parker <sparker@cs.utah.edu>
  • To: James Bigler <bigler@cs.utah.edu>
  • Cc: manta@sci.utah.edu
  • Subject: Re: [MANTA] r398 - branches/itanium2/fox
  • Date: Mon, 20 Jun 2005 23:15:00 -0600

I haven't figured out how to make subversion use real e-mail addresses yet, so it just sends mail from user@sci

Steve


On Jun 20, 2005, at 11:03 PM, James Bigler wrote:

Ah. Thanks! It's weird that the checkin used an account that looked like he was at sci. No wonder I was a little confused. I wish it would tell us the full names of the person checking in code.

James

Steven Parker wrote:
Kenneth Hoff at SGI.  He came with rocky and hansong.
Steve
On Jun 20, 2005, at 10:57 PM, James Bigler wrote:
Can someone please tell me who khoff is? I don't recongnize the login.

Thanks,
James

khoff@sci.utah.edu wrote:

Author: khoff
Date: Mon Jun 20 19:11:09 2005
New Revision: 398
Modified:
   branches/itanium2/fox/FMantaImageFrame.cc
   branches/itanium2/fox/FMantaQuakeNav.cc
   branches/itanium2/fox/FMantaQuakeNav.h
   branches/itanium2/fox/FMantaWindow.cc
   branches/itanium2/fox/fox_manta.cc
Log:
implemented the quake navigation class
Modified: branches/itanium2/fox/FMantaImageFrame.cc
==================================================================== == ========
--- branches/itanium2/fox/FMantaImageFrame.cc    (original)
+++ branches/itanium2/fox/FMantaImageFrame.cc Mon Jun 20 19:11:09 2005
@@ -23,7 +23,7 @@
FXMAPFUNC(SEL_MOUSEWHEEL, FMantaImageFrame::ID_IMAGE, FMantaImageFrame::onMouseWheel ),
FXMAPFUNC(SEL_MOTION, FMantaImageFrame::ID_IMAGE, FMantaImageFrame::onMouseChange ),
- FXMAPFUNC(SEL_KEYPRESS, FMantaImageFrame::ID_IMAGE, FMantaImageFrame::onKeyPress )
+ FXMAPFUNC(SEL_KEYPRESS, FMantaImageFrame::ID_IMAGE, FMantaImageFrame::onKeyPress )
 };
FXIMPLEMENT(FMantaImageFrame,FXGLCanvas,FMantaImageFrameMap,ARRAYNUM BE R(FMantaImageFrameMap));
@@ -85,5 +85,3 @@
      return navigator->onKeyPress( sender, sel, data );
 }
-
-
Modified: branches/itanium2/fox/FMantaQuakeNav.cc
==================================================================== == ========
--- branches/itanium2/fox/FMantaQuakeNav.cc    (original)
+++ branches/itanium2/fox/FMantaQuakeNav.cc Mon Jun 20 19:11:09 2005
@@ -1,6 +1,6 @@
  #include <fox/FMantaQuakeNav.h>
-
+#include <fxkeys.h>
 #include <MantaTypes.h>
 #include <Interface/Camera.h>
 #include <Interface/Callback.h>
@@ -21,15 +21,14 @@
/////////////////////////////////////////////////////////////////// // //////////
 // Basic interaction with the class.
void FMantaQuakeNav::move( Real d ) { - - posY -= (cos(viewDirAngle) * cos(viewElevAngle)) * d;
-    posX += (sin(viewDirAngle) * cos(viewElevAngle)) * d;
- if (allowFly) height += sin(viewElevAngle) * d; + posX += (float)cos(viewDirAngle*TORADS) * (float)cos(viewElevAngle*TORADS) * d;
+ posY += (float)sin(viewDirAngle*TORADS) * (float)cos(viewElevAngle*TORADS) * d;
+  if (allowFly) height += (float)sin(viewElevAngle*TORADS) * d;  };
void FMantaQuakeNav::strafe( Real d ) { - posX += sin( viewDirAngle ) * d; - posY += cos( viewDirAngle ) * d; + posX -= (float)sin(viewDirAngle*TORADS) * d;
+  posY += (float)cos(viewDirAngle*TORADS) * d;
 };
  void FMantaQuakeNav::turn( Real d ) { @@ -38,6 +37,8 @@
void FMantaQuakeNav::tilt( Real d ) { viewElevAngle += d; + if (viewElevAngle>90) viewElevAngle=90;
+  else if (viewElevAngle<-90) viewElevAngle=-90;
 };
/////////////////////////////////////////////////////////////////// // //////////
@@ -45,19 +46,23 @@
long FMantaQuakeNav::onKeyPress ( FXObject *sender, FXSelector sel, void *data ) {
         FXEvent *event = (FXEvent *)data;
-   -    if (event->text[0] == key_map[UP])
+ +// float DeltaTime = (float)(event->click_time - event->time)/1000000.0;
+//std::cout << DeltaTime << std::endl;
+//std::cout << event->time << std::endl;
+
+    if (event->text[0]==key_map[UP] || event->code==KEY_Up)
         move( translateStepSize );
 -    else if (event->text[0] == key_map[DOWN])
+ else if (event->text[0]==key_map[DOWN] || event->code==KEY_Down)
         move( -translateStepSize );
        -    else if (event->text[0] == key_map[LEFT])
-        strafe( -translateStepSize );
-       -    else if (event->text[0] == key_map[RIGHT])
+ else if (event->text[0]==key_map[LEFT] || event->code==KEY_Left)
         strafe( translateStepSize );
+ else if (event->text[0]==key_map[RIGHT] || event->code==KEY_Right)
+        strafe( -translateStepSize );
+            else          return 1;
    @@ -72,10 +77,10 @@
     FXEvent *event = (FXEvent *)data;
     FXushort sel_type = FXSELTYPE( sel );
    -    if (sel_type == SEL_LEFTBUTTONPRESS) {
+    if (sel_type == SEL_RIGHTBUTTONPRESS) {
         mouse_down = true;
     }
-    else if (sel_type == SEL_LEFTBUTTONRELEASE) {
+    else if (sel_type == SEL_RIGHTBUTTONRELEASE) {
         mouse_down = false;
     }
     else if (sel_type == SEL_MOTION && mouse_down) {
@@ -83,10 +88,8 @@
         Real delta_x = event->win_x - event->last_x;
         Real delta_y = event->win_y - event->last_y;
- std::cerr << "delta " << delta_x << " " << delta_y << std::endl;
-       -        turn( delta_x * rotateStepSize );
-        tilt( delta_y * rotateStepSize );
+        turn( -delta_x * rotateStepSize );
+        tilt( -delta_y * rotateStepSize );
          mantaAddTransaction();
     }
@@ -99,27 +102,23 @@
 // THIS FUNCTION IS NOT CALLED BY THE FOX THREAD.
 void FMantaQuakeNav::mantaThreadCallback() const {
 -    // Create a transformation.
-    AffineTransform affine_transform;
-    affine_transform.initWithIdentity();
- affine_transform.rotate ( Vector(1.0,0.0,0.0), viewElevAngle );
- affine_transform.rotate ( Vector(0.0,1.0,0.0), viewDirAngle );
-    affine_transform.translate( Vector( posX, height, posY ) );
-
     // Get a pointer to the camera.
Camera *manta_camera = manta_interface->getCamera( manta_channel );
      // Transform a default eye, up, and lookat.
-    Point eye   ( 0.0, 0.0, 0.0 );
-    Point lookat( 0.0, -1.0, 0.0 );
-    Vector up   ( 0.0, 0.0, 1.0 );
-
-    eye    = affine_transform * eye;
-    lookat = affine_transform * lookat;
-    up     = affine_transform * up;
+  double Azi=viewDirAngle*TORADS , Elev=viewElevAngle*TORADS;
+ float dX=(float)(cos(Azi)*cos(Elev)), + dY=(float)(sin(Azi)*cos(Elev)),
+        dZ=(float)sin(Elev);
+  Point eye   ( posX, posY, height );
+  Point lookat( posX+dX, posY+dY, height+dZ );
+  Vector up   ( 0.0, 0.0, 1.0 );
+/* for y-up
+Point eye   ( posX, posY, height );
+Point lookat( posX+dX, -(height+dZ), posY+dY );
+Vector up   ( 0.0, 1.0, 0.0 );
+*/
      // Apply it to the camera.
     manta_camera->reset( eye, up, lookat );
 }
-
-
Modified: branches/itanium2/fox/FMantaQuakeNav.h
==================================================================== == ========
--- branches/itanium2/fox/FMantaQuakeNav.h    (original)
+++ branches/itanium2/fox/FMantaQuakeNav.h Mon Jun 20 19:11:09 2005
@@ -12,6 +12,8 @@
  namespace fox_manta {
 +  const float TORADS=0.0174532925199433;
+
     using namespace Manta;
// This class contains attributes used to move a "Quake" style viewer around
@@ -38,6 +40,10 @@
                 // State.
         bool mouse_down;
+ + // Timer between movement key polling (zero value means timer hasn't started)
+    bool timerStarted;
+    FXuint lastTime;
                 // Basic movement.
         void move  ( Real d );
@@ -50,9 +56,9 @@
             public:
         // Constructor with default options.
-        FMantaQuakeNav() : allowFly( false ),
-                           translateStepSize( 1.0 ),
- rotateStepSize ( 1.0 ),
+        FMantaQuakeNav() : allowFly( true ),
+                           translateStepSize( 0.2 ),
+ rotateStepSize ( 0.2 ),
                                              posX( 0 ),
                                              posY( 0 ),
                                              viewDirAngle( 0.0 ),
@@ -84,7 +90,9 @@
           { key_map[0] = 'w';
                 key_map[1] = 's';
                 key_map[2] = 'a';
- key_map[3] = 'd'; }; + key_map[3] = 'd';
+        lastTime = 0;
+        timerStarted = false; };                      // Accessors.
         void setKeyMap( int map, char k ) { key_map[map] = k; };
@@ -101,4 +109,4 @@
     };
 };
 -#endif
\ No newline at end of file
+#endif
Modified: branches/itanium2/fox/FMantaWindow.cc
==================================================================== == ========
--- branches/itanium2/fox/FMantaWindow.cc    (original)
+++ branches/itanium2/fox/FMantaWindow.cc Mon Jun 20 19:11:09 2005
@@ -51,7 +51,7 @@
         // Control speed.
speed_slider = new FXRealSlider( left_controls, this, ID_SPEED_SLIDER, REALSLIDER_VERTICAL|LAYOUT_FILL_Y );
-    speed_slider->setRange( 0.01, 100.0 );
+    speed_slider->setRange( 0.001, 5.0 );
         // Camera bookmarks.
camera_bookmark_list = new FXListBox( viewers, this, ID_BOOKMARK_LIST, LAYOUT_FILL_X|LAYOUT_BOTTOM|COMBOBOX_REPLACE,0,0,0,20 );
Modified: branches/itanium2/fox/fox_manta.cc
==================================================================== == ========
--- branches/itanium2/fox/fox_manta.cc    (original)
+++ branches/itanium2/fox/fox_manta.cc    Mon Jun 20 19:11:09 2005
@@ -96,7 +96,7 @@
     uniform_nav->setMantaInterface( manta_interface );
     uniform_nav->setMantaChannel( 0 );
    -    FMantaNavigator *nav = uniform_nav;
+    FMantaNavigator *nav = quake_nav;
     manta_window.setNavigator( nav );
             // Create manta channel for the interface.






Archive powered by MHonArc 2.6.16.

Top of page