home *** CD-ROM | disk | FTP | other *** search
- // Example: 134 from Library Reference
- #include "..\3D-Ware\dddware.h"
- #include <stdio.h>
- short Xpos=0, Ypos=0, Zpos=800;
- short Xangle=0, Yangle=0, Zangle=0;
- short VXangle=0, VYangle=0, VZangle=0;
- short ShapeHandle;
- char Semaphores;
- short fade_shift=1;
- char string[80];
- short main(void)
- {
- dddInitAll();
- ShapeHandle = (dddShapeLoad("EXAMPLE.3D")); // Load the .3D data file.
- VXangle = VYangle = VZangle = 0; // Set viewers angles to 0,0,0
- dddSetViewPos16(0,0,0); // Set the viewers angles in the 3D engine.
- dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers position in the 3D engine.
- while(dddkeycode!=_ESC)
- {
- if(dddkeypressed[_UP_ARROW])
- {
- if(fade_shift > 1) fade_shift--;
- }
- if(dddkeypressed[_DN_ARROW])
- {
- if(fade_shift < 15) fade_shift++;
- }
- dddSetDepthFade(fade_shift);
- dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers angles.
- dddCls(); // Clear the graphics screen.
- dddClearObjects(); // Clear the viewing table.
- Yangle += 0x200; // Rotate the shape in the Y plane.
- Zangle += 0x100; // Rotate the shape in the Z plane.
- 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.
- sprintf(string,"FADE SHIFT IS SET TO %d",fade_shift);
- dddPrint7(11,0,0,string);
- dddScreenSwap(); // Flip the real screen and the dummy screen.
- }
- dddRestoreAll();
- return 0; // Bye.
- }
-