home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Homebrewer's Handbook / vr.iso / avril / example6.c < prev    next >
C/C++ Source or Header  |  1996-03-19  |  1KB  |  31 lines

  1. /* EXAMPLE6 -- using the configuration file to simplify setup */
  2.  
  3. /* Written by Bernie Roehl, August 1994 */
  4.  
  5. #include "avril.h"
  6.  
  7. static void object_manipulator(void)
  8.     {
  9.     extern vrl_Object *active_object;  /* defined in input.c */
  10.     vrl_Device *dev = vrl_TaskGetData();
  11.     vrl_Object *viewer = vrl_CameraGetObject(vrl_WorldGetCamera());
  12.     vrl_Vector v;
  13.     vrl_ObjectRotate(active_object, vrl_DeviceGetValue(dev, YROT), Y, VRL_COORD_OBJREL, viewer);
  14.     vrl_ObjectRotate(active_object, vrl_DeviceGetValue(dev, XROT), X, VRL_COORD_OBJREL, viewer);
  15.     vrl_ObjectRotate(active_object, vrl_DeviceGetValue(dev, ZROT), Z, VRL_COORD_OBJREL, viewer);
  16.     vrl_VectorCreate(v, vrl_DeviceGetValue(dev, X), vrl_DeviceGetValue(dev, Y), vrl_DeviceGetValue(dev, Z));
  17.     vrl_ObjectTranslate(active_object, v, VRL_COORD_OBJREL, viewer);
  18.     vrl_SystemRequestRefresh();
  19.     }
  20.  
  21. void main(int argc, char *argv[])
  22.     {
  23.     vrl_Device *dev;
  24.     vrl_ConfigStartup("example6.cfg");
  25.     vrl_SystemCommandLine(argc, argv);
  26.     dev = vrl_DeviceFind("manipulator");
  27.     if (dev)
  28.         vrl_TaskCreate(object_manipulator, dev, 0);
  29.     vrl_SystemRun();
  30.     }
  31.