home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Madness
/
VRMAD96_ONE.ISO
/
virtek
/
libex
/
libex098.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-24
|
2KB
|
53 lines
// Example: 098 from Library Reference
#include "..\3D-Ware\dddware.h"
short Xpos=0, Ypos=0, Zpos=2000;
short Xangle=0, Yangle=0, Zangle=0;
short VXangle=0, VYangle=0, VZangle=0;
short ShapeHandle;
char Semaphores;
struct mypos{
long x;
long y;
long z;
};
struct myangles{
short xangle;
short yangle;
};
struct mypos proj_posns;
struct myangles proj_angles;
short main(void)
{
proj_posns.x = proj_posns.y = proj_posns.z = 0;
proj_posns.y = -100;
proj_angles.xangle = proj_angles.yangle = 0;
dddInitAll();
ShapeHandle = (dddShapeLoad("EXAMPLE.3D")); // Load the .3D data file.
VXangle = VYangle = VZangle = 0; // Set viewers angles to 0,0,0
while (dddkeycode!=_ESC)
{
dddHorizon(0,0);
dddDotGrid();
dddClearObjects(); // Clear the viewing table.
dddProjectForward(&proj_posns, &proj_angles, 40); // Project forward 40 units per time.
dddSetViewPos16((short)proj_posns.x, (short)proj_posns.y, (short)proj_posns.z);
// Set the viewers angles in the 3D engine.
if (dddkeypressed[_LF_ARROW])
{
VYangle -= 0x100;
}
if (dddkeypressed[_RT_ARROW])
{
VYangle += 0x100;
}
proj_angles.yangle = VYangle;
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.
dddScreenSwap(); // Flip the real screen and the dummy screen.
}
dddRestoreAll();
return 0; // Bye.
}