home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Virtual Reality Homebrewer's Handbook
/
vr.iso
/
vroom
/
viewer.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-03-19
|
2KB
|
96 lines
program viewer;
uses vroom,crt,dos,cyberman;
var object1 : file_object3d;
ch : char;
ok, junk, mouse, cyber : boolean;
myname : string;
procedure directory;
var dirinfo : searchrec;
count : integer;
begin
count:=1;
findfirst('*.3d',anyfile,dirinfo);
while doserror=0 do
begin
write(dirinfo.name : 13);
inc(count);
if count=6 then
begin
writeln;
count:=1;
end;
findnext(dirinfo);
end;
end;
function file_exists(filename : string) : boolean;
var dirinfo : searchrec;
begin
findfirst(filename,anyfile,dirinfo);
file_exists:=(doserror=0);
end;
{$F+}
function MyKeyProc(ch : char) : boolean;
var ok : boolean;
begin
ok:=true;
case ch of
'o': object1.RotateY(-10);
'l': object1.RotateY(10);
',': object1.RotateZ(-10);
'.': object1.RotateZ(10);
'n': object1.RotateX(10);
'm': object1.RotateX(-10);
else
ok:=false;
end;
MyKeyProc:=ok;
end;
{$F-}
begin
directory;
writeln;
repeat
write('Enter the name of your object file : ');
readln(myname);
if myname='quit' then halt;
if not(file_exists(myname)) then writeln('Incorrect filename - please re-enter (''quit'' to quit)');
until file_exists(myname);
mouse:=false;
cyber:=false;
if cyberman_available then cyber:=true else if mouse_available then mouse:=true;
Init_System;
Set_Ambient_Intensity(0.5);
Set_Light(0.75,0,-1,-0.75);
User_KeyCheck_Proc(MyKeyProc);
object1.Init(myname);
object1.Set_Reference_Point(0,0,0);
Set_View(200,0,0,0,0,0);
Set_Window(-20,-15,20,15);
Store_Settings;
Redraw_Scene;
repeat
junk:=false;
if cyber then junk:=cyberman_check else if mouse then junk:=mouse_check;
if keyboard_check or junk then redraw_scene;
until false;
stop_graphics;
end.