home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Madness
/
VRMAD96_ONE.ISO
/
virtek
/
libex
/
libex054.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-24
|
2KB
|
51 lines
// Example: 054 from Library Reference
#include "..\3D-Ware\dddware.h"
#include <stdio.h>
short Xpos=0, Ypos=0, Zpos=300;
short Xangle=0, Yangle=0, Zangle=0;
short VXangle=0, VYangle=0, VZangle=0;
short ShapeHandle;
char Semaphores;
char buffer[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.
while (dddkeycode!=_ESC) // Loop until Escape key is pressed.
{
if (dddkeypressed[_LF_ARROW])
{
VYangle += 0x80; // Rotate the viewer in the Y plane.
}
if (dddkeypressed[_RT_ARROW])
{
VYangle -= 0x80; // Rotate the viewer in the Y plane.
}
if (dddkeypressed[_UP_ARROW])
{
Zpos += 0x80; // Move in the Z direction.
}
if (dddkeypressed[_DN_ARROW])
{
Zpos -= 0x80; // Move in the Z direction.
}
dddHorizon(0,0); // Clear the graphics screen.
dddDotGrid();
dddClearObjects();
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.
dddGetRelXYZ(Xpos,Ypos,Zpos); // Get relative position of object to viewpoint.
sprintf(buffer,"THE RELATIVE X CO-ORD IS :- %d",dddUserXpos);
dddPrint7(1,0,0,buffer);
sprintf(buffer,"THE RELATIVE Z CO-ORD IS :- %d",dddUserZpos);
dddPrint7(1,0,10,buffer);
dddDrawObjects(); // Render all 3D objects we have inserted.
dddScreenSwap(); // Flip the real screen and the dummy screen.
}
dddRestoreAll();
return 0; // Bye.
}