Simple viewer...

New Message Reply Date view Thread view Subject view Author view

abrend++at++idt.unit.no
Sun, 12 Mar 1995 13:17:35 +0100


I'm new programming Performer. I'm trying to make a simple viewer for
an application I'm going to make later. For the time being I'm just
interested in a viewer that moves around in the model using the
arrowkeys and the mouse. I made a viewer containing the code bellow,
the problem is that this is a very slow solution (it moves to slow).
The 'step' variable is set to 0.5. Should I use the routines from the
pfutil to make this ? In that case, how (examples) ?

   /* Initialize keys */
   qdevice(LEFTMOUSE);
   qdevice(WINQUIT);
   qdevice(LEFTARROWKEY);
   qdevice(RIGHTARROWKEY);
   qdevice(DOWNARROWKEY);
   qdevice(UPARROWKEY);
   qdevice(PAGEUPKEY);
   qdevice(PAGEDOWNKEY);

   /* Simulate for twenty seconds. */
   while (!done)
       
   {
      /* Go to sleep until next frame time. */
      pfSync();
       
      while (qtest())
      {
         short arg;
         switch (qread(&arg))
         {
         case (PAGEUPKEY):
            zDirection += step;
            break;
             
         case (PAGEDOWNKEY):
            zDirection -= step;
            break;

         case LEFTARROWKEY:
            hDirection += step;
            break;
             
         case RIGHTARROWKEY:
            hDirection -= step;
            break;
             
         case DOWNARROWKEY:
            yDirection -= step;
            break;
             
         case UPARROWKEY:
            yDirection += step;
            break;
             
         case WINQUIT:
         case LEFTMOUSE:
            done = TRUE;
            break;
         }
      }
          
      /* Compute new view position. */
      pfSetVec3(viewDirection, xDirection, yDirection, zDirection);
      pfSetVec3(viewAngles, hDirection, pDirection, rDirection);
      pfChanView(chan, viewDirection, viewAngles);
  
      /* Initiate cull/draw for this frame. */
      pfFrame();
   }

        /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
        /* WWW page : http://www.idt.unit.no:80/~abrend/ *
        /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*

email___________________________________________________
|
                                                        V
        _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
       _/ Andreas Brendstuen _/ abrend++at++stud.unit.no _/
      _/ Festningsgata 11 _/ abrend++at++idt.unit.no _/
     _/ 7014 Trondheim, Norway _/ +47 61 29 44 34 _/
    _/ +47 73 51 48 06 _/ (when visiting hometown) _/
   _/ (don't call at saturday mornings) _/ _/
   _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:03 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.