home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Madness
/
VRMAD96_ONE.ISO
/
virtek
/
libex
/
libex006.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-24
|
2KB
|
71 lines
// Example: 006 from Library Reference
#include "..\3D-Ware\dddware.h"
short Xpos=0, Ypos=0, Zpos=400;
short Xangle=0, Yangle=0, Zangle=0;
short VXpos=0, VYpos=0, VZpos=0;
short VXangle=0, VYangle=0, VZangle=0;
short ShapeHandle;
char Semaphores;
short clipx=100, clipy=60;
short main(void)
{
dddInitAll();
ShapeHandle = (dddShapeLoad("EXAMPLE.3D")); // Load the .3D data file.
VXangle = VYangle = VZangle = 0; // Set viewers angles to 0,0,0
VXpos = VYpos = VZpos = 0; // Set viewer to centre of 3D world scene.
dddSetViewPos16(VXpos,VYpos,VZpos); // Set the viewers angles in the 3D engine.
dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers position in the 3D engine.
dddSetClipArea(0,319,0,199); // Set up clipping boundaries.
while (dddkeycode!=_ESC)
{
dddCls();
if (dddkeypressed[ _DN_ARROW ])
{
if (clipy<100)
{
clipy++;
}
}
if (dddkeypressed[ _UP_ARROW ])
{
if (clipy>2)
{
clipy--;
}
}
if (dddkeypressed[ _RT_ARROW ])
{
if (clipx<160)
{
clipx++;
}
}
if (dddkeypressed[ _LF_ARROW ])
{
if (clipx>2)
{
clipx--;
}
}
dddFillScreen(2);
dddSetClipArea(160-clipx,159+clipx,100-clipy,99+clipy);
// Set up clipping boundaries.
dddClearClipArea();
dddSetViewAngles(VXangle,VYangle,VZangle); // Set the viewers angles.
dddClearObjects(); // Clear the viewing table.
Yangle += 0x200; // Rotate the shape in the Y plane.
Zangle += 0x200; // Rotate the shape in the Z plane.
dddInsertObject16(DRW_MOBILE,ShapeHandle,Semaphores,Xpos,Ypos,Zpos,Xangle,Yangle,Zangle);
// Insert on object to be rendered.
dddMedPrintC(11,0,"Use Cursor Keys to change clip area.");
dddDrawObjects(); // Render all 3D objects we have inserted.
dddScreenSwap(); // Flip the real screen and the dummy screen.
}
dddRestoreAll();
return 0; // Bye.
}