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

  1.                                                // Example: 036 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. char     palette[768*3];                       // A buffer for the new palette.
  10.  
  11. void rotate_shape(void);                       // Prototype definition.
  12.  
  13. short  main(void)
  14. {
  15.   dddInitAll();
  16.   ShapeHandle = (dddShapeLoad("EXAMPLE.3D"));  // Load the .3D data file.
  17.   dddSetViewPos16(VXpos,VYpos,VZpos);          // Set the viewers angles in the 3D engine.
  18.   rotate_shape();                              // Rotate a shape in the first palette.
  19.   dddkeycode = 0;
  20.   dddOpenReadClose("EXAMPLE1.COL",palette);
  21.   dddFadeTo(palette);                          // Fade from the old palette to the new palette.
  22.   rotate_shape();                              // Rotate a shape in the new palette.
  23.   dddRestoreAll();
  24.   return 0;                                    // Bye.
  25. }
  26. void  rotate_shape(void)
  27. {
  28.   while  (!dddkeycode)
  29.   {
  30.     dddClearObjects();                         // Clear the viewing table.
  31.     dddHoriFade(VXangle, VZangle);
  32.     dddPrint6(15,40,2,"PRESS ANY KEY.");
  33.     Yangle += 0x100;                           // Rotate the shape in the Y plane.
  34.     Zangle += 0x200;                           // Rotate the shape in the Z plane.
  35.     dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers angles.
  36.     dddInsertObject16(DRW_MOBILE,ShapeHandle,Semaphores,Xpos,Ypos,Zpos,Xangle,Yangle,Zangle);
  37.                                                // Insert an object to be rendered.
  38.     dddDrawObjects();                          // Render all 3D objects we have inserted.
  39.     dddScreenSwap();                           // Flip the real screen and the dummy screen.
  40.   }
  41. }
  42.