home *** CD-ROM | disk | FTP | other *** search
- // Example: 109 from Library Reference
- #include "..\3D-Ware\dddware.h"
- short Xpos=0, Ypos=0, Zpos=800;
- short Xangle=0, Yangle=0, Zangle=0;
- short VXpos=0, VYpos=0, VZpos=0;
- short VXangle=0, VYangle=0, VZangle=0;
- short ShapeHandle, x, y;
- char Semaphores, palette_color;
-
- void setup(void); // Declare the function prototype.
-
- short main(void)
- {
- dddInitAll(); // Initialise 3D-Ware.
- dddLoadColors("EXAMPLE.COL"); // Load in the color palette called 'example.col' to 'standardpal'.
- dddSetPal(dddstandardpal); // Set up the palette.
- ShapeHandle = (dddShapeLoad("EXAMPLE.3D")); // Load the .3D data file.
- dddSetViewPos16(VXpos,VYpos,VZpos); // Set the viewers angles in the 3D engine.
- dddScreenSwap(); // Setup the screen swapping.
- setup(); // Setup the first screen buffer.
- setup(); // Setup the second screen buffer.
- while (!dddkeycode) // Loop until a key is pressed.
- {
- dddSetClipArea(50,149,50,149); // Set up clipping boundaries for left box.
- dddSetCenter(100,100,149,149); // Set centre for left box.
- dddBox(0,50,50,149,149); // Just clear the area we need to use.
- dddClearObjects(); // Clear the viewing table.
- Xangle += 0x80; // Rotate the shape in the Y plane.
- Yangle += 0x200; // Rotate the shape in the Y plane.
- Zangle += 0x100; // Rotate the shape in the Z plane.
- dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers angles.
- dddInsertObject16(DRW_MOBILE,ShapeHandle,Semaphores,Xpos,Ypos,Zpos,Xangle,Yangle,Zangle);
- // Insert an object to be rendered.
- dddDrawObjects(); // Render all 3D objects we have inserted.
- // The next few lines copy the block of image data that
- // has just been rendered to the right hand side of the
- // screen.
- for (y=50; y<150; y++)
- {
- for (x=50; x<150; x++)
- {
- palette_color = dddReadPix(x,y); // Read the color of the pixel.
- dddPlot(palette_color,x+111,y); // Plot a pixel in the same color.
- }
- }
- dddScreenSwap(); // Flip the real screen and the dummy screen.
- }
- dddRestoreAll();
- return 0; // Bye.
- }
- void setup(void)
- {
- dddPrint7(2,78,40,"PRESS ANY KEY TO EXIT.");
- // Draw the left box boundaries first.
- dddLineBox(234,49,49,150,150);
- // Draw the right box boundaries last.
- dddLineBox(234,160,49,261,150);
-
- dddScreenSwap(); // Flip the real screen and the dummy screen.
- }
-