home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Madness / VRMAD96_ONE.ISO / virtek / libex / libex134.c < prev    next >
C/C++ Source or Header  |  1995-08-24  |  2KB  |  44 lines

  1.                                                // Example: 134 from Library Reference
  2. #include "..\3D-Ware\dddware.h"
  3. #include <stdio.h>
  4. short    Xpos=0, Ypos=0, Zpos=800;
  5. short    Xangle=0, Yangle=0, Zangle=0;
  6. short    VXangle=0, VYangle=0, VZangle=0;
  7. short    ShapeHandle;
  8. char     Semaphores;
  9. short    fade_shift=1;
  10. char     string[80];
  11. short  main(void)
  12. {
  13.   dddInitAll();
  14.   ShapeHandle = (dddShapeLoad("EXAMPLE.3D"));  // Load the .3D data file.
  15.   VXangle = VYangle = VZangle = 0;             // Set viewers angles to 0,0,0
  16.   dddSetViewPos16(0,0,0);                      // Set the viewers angles in the 3D engine.
  17.   dddSetViewAngles(VXangle,VYangle,VZangle);   // Set the viewers position in the 3D engine.
  18.   while(dddkeycode!=_ESC)
  19.   {
  20.     if(dddkeypressed[_UP_ARROW])
  21.     {
  22.       if(fade_shift > 1) fade_shift--;
  23.     }
  24.     if(dddkeypressed[_DN_ARROW])
  25.     {
  26.       if(fade_shift < 15) fade_shift++;
  27.     }
  28.     dddSetDepthFade(fade_shift);
  29.     dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers angles.
  30.     dddCls();                                  // Clear the graphics screen.
  31.     dddClearObjects();                         // Clear the viewing table.
  32.     Yangle += 0x200;                           // Rotate the shape in the Y plane.
  33.     Zangle += 0x100;                           // Rotate the shape in the Z plane.
  34.     dddInsertObject16(DRW_MOBILE,ShapeHandle,Semaphores,Xpos,Ypos,Zpos,Xangle,Yangle,Zangle);
  35.                                                // Insert an object to be rendered.
  36.     dddDrawObjects();                          // Render all 3D objects we have inserted.
  37.     sprintf(string,"FADE SHIFT IS SET TO %d",fade_shift);
  38.     dddPrint7(11,0,0,string);
  39.     dddScreenSwap();                           // Flip the real screen and the dummy screen.
  40.   }
  41.   dddRestoreAll();
  42.   return 0;                                    // Bye.
  43. }
  44.