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

  1.                                                // Example: 131 from Library Reference
  2. #include "..\3D-Ware\dddware.h"
  3. short    Xpos=0, Ypos=0, Zpos=800;
  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.  
  10. void     setup(void);                          // Declare the 'setup' function prototype.
  11.  
  12. short  main(void)
  13. {
  14.   dddInitAll();
  15.   ShapeHandle = (dddShapeLoad("EXAMPLE.3D"));  // Load the .3D data file.
  16.   dddSetViewPos16(VXpos,VYpos,VZpos);          // Set the viewers angles in the 3D world.
  17.   setup();
  18.   setup();
  19.   
  20.   while  (!dddkeycode)                         // Keep looping until a key is pressed.
  21.   {
  22.                                                //  First, we will produce the left hand side window.
  23.     dddSetClipArea(50,149,50,149);             // Set up clipping boundaries for left box.
  24.     dddSetCenter(100,100,149,149);             // Set centre for left hand side box.
  25.     dddBox(0,50,50,149,149);                   // Just clear the area we need to use.
  26.     dddClearObjects();                         // Clear the viewing table.
  27.     Xangle += 0x80;                            // Rotate the shape in the Y plane.
  28.     Yangle += 0x200;                           // Rotate the shape in the Y plane.
  29.     Zangle += 0x100;                           // Rotate the shape in the Z plane.
  30.     dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers angles.
  31.     dddInsertObject16(DRW_MOBILE,ShapeHandle,Semaphores,Xpos,Ypos,Zpos,Xangle,Yangle,Zangle);
  32.                                                // Insert an object to be rendered.
  33.     dddDrawObjects();                          // Render all 3D objects we have inserted.
  34.                                                //  Now we will produce the right hand side window.
  35.     dddSetClipArea(161,199,50,149);            // Set up clipping boundaries for right box.
  36.     dddSetCenter(180,100,199,149);             // Set centre for right hand side  box.
  37.     dddBox(0,161,50,199,149);                  // Just clear the area we need to use.
  38.     dddClearObjects();                         // Clear the viewing table.
  39.     dddInsertObject16(DRW_MOBILE,ShapeHandle,Semaphores,Xpos,Ypos,Zpos,Xangle,Yangle,Zangle);
  40.                                                // Insert an object to be rendered.
  41.     dddDrawObjects();                          // Render all 3D objects we have inserted.
  42.     dddScreenSwap();                           // Flip the real screen and the dummy screen.
  43.   }
  44.   dddRestoreAll();
  45.   return 0;                                    // Bye.
  46. }
  47. void  setup(void)
  48. {
  49. //  dddPrint7(2,18,40,"PRESS ANY KEY TO EXIT.");
  50.                                                // Draw the left box boundaries first.
  51.  
  52.   dddLineBox(234,49,49,150,150);
  53.                                                // Draw the right box boundaries last.
  54.   dddLineBox(234,160,49,200,150);
  55.  
  56.   dddScreenSwap();                             // Flip the real screen and the dummy screen.
  57. }
  58.