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

  1.                                                // Example: 009 from Library Reference
  2. #include "..\3D-Ware\dddware.h"
  3. short    Xpos=0, Ypos=0, Zpos=400;
  4. short    Xangle=0, Yangle=0, Zangle=0;
  5. short    VXpos=0, VYpos=0, VZpos=0;
  6. short    VXangle=0, VYangle=0, VZangle=0;
  7. short    ShapeHandle;
  8. char     Semaphores;
  9. void   main(void)
  10. {
  11.   dddInitAll();                                // Initialise all the 3D code.
  12.   ShapeHandle = (dddShapeLoad("EXAMPLE.3D"));  // Load the .3D data file.
  13.   dddSetViewPos16(VXpos,VYpos,VZpos);          // Set the viewers angles in the 3D engine.
  14.   while  (dddkeycode !=_ESC)                   // Run until ESC key is pressed.
  15.   {
  16.     dddCls();                                  // Clear the graphics screen.
  17.     dddClearObjects();                         // Clear the viewing table.
  18.     Yangle += 0x200;                           // Rotate the shape in the Y plane.
  19.     Zangle += 0x200;                           // Rotate the shape in the Z plane.
  20.     dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers angles.
  21.     dddInsertObject16(DRW_MOBILE,ShapeHandle,Semaphores,Xpos,Ypos,Zpos,Xangle,Yangle,Zangle);
  22.                                                // Insert an object to be rendered.
  23.     dddDrawObjects();                          // Render all 3D objects we have inserted.
  24.     dddCopyLogbase2ScreenBuffer2();            // Copy the screen we have just rendered to the
  25.                                                //   second Screenbuffer.
  26.     if (dddkeypressed[_SPACE])                 // If the spacebar is pressed clear the 2nd screen buffer.
  27.     {
  28.       dddClearScreenBuffer2();                 // Clear the second screen buffer.
  29.     }
  30.     dddCopyScreenBuffer22Logbase();            // Copy whatever is on the second screen buffer to the
  31.                                                //   workscreen.
  32.                                                // Print some instructions for the user.
  33.     dddPrint7(2,0,2,"SPACE TO CLEAR SCREEN BUFFER 2.");
  34.     dddPrint7(2,0,9,"ESC KEY TO QUIT.");
  35.     dddScreenSwap();                           // Flip the real screen and the dummy screen.
  36.   }
  37.   dddRestoreAll();                             // Clean up behind ourselves.
  38. }
  39.