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

  1.                                               // Example: 079 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. short  main(void)
  10. {
  11.   dddLoadColors("EXAMPLE.COL");               // Load in the color palette called 'example.col'
  12.   dddInitVideo();                             // Sets up video to mode 19 VGA 320*200 256 cols.
  13.   dddSetPal(dddstandardpal);                  // Set up the palette.
  14.   dddInit3d();                                // MUST be before any calls to 3D-Ware libraries
  15.   dddInitKeybd();
  16.   ShapeHandle = (dddShapeLoad("EXAMPLE.3D")); // Load the .3D data file.
  17.   VXangle = VYangle = VZangle = 0;            // Set viewers angles to 0,0,0
  18.   VXpos = VYpos = VZpos = 0;                  // Set viewer to centre of 3D world scene.
  19.   dddSetViewPos16(VXpos,VYpos,VZpos);         // Set the viewers angles in the 3D world.
  20.   dddSetViewAngles(VXangle,VYangle,VZangle);  // Set the viewers position in the 3D world.
  21.   while  (!dddkeycode)                        // Loop until the user hits a key.
  22.   {
  23.     dddCls();                                 // Clear the graphics screen.
  24.     dddPrint6(1,20,2,"PRESS ANY KEY TO QUIT.");
  25.     dddClearObjects();                        // Clear the viewing table.
  26.     Yangle += 0x80;                           // Rotate the shape in the Y plane.
  27.     dddInsertObject16(DRW_MOBILE,ShapeHandle,Semaphores,Xpos,Ypos,Zpos,Xangle,Yangle,Zangle);
  28.                                               // Insert on object to be rendered.
  29.     dddDrawObjects();                         // Render all 3D objects we have inserted.
  30.     dddScreenSwap();                          // Flip the real screen and the dummy screen.
  31.   }
  32.   dddRestoreKeybd();
  33.   dddRestoreVideo();                          // Reset video mode to original.
  34.   dddClose3d();                               // Clean up behind ourselves.
  35.   return 0;                                   // Bye.
  36. }
  37.