home *** CD-ROM | disk | FTP | other *** search
- (*
- ──────────────────────
- Tshade-Demo unit v1.0
- ──────────────────────
- (c)1994 Rsc Research
-
- Write me at: or on Compuserve
- ──────────── ────────────────
- Cédric Rime 100340,2736
- Dixence 21
- 1950 Sion
- Switzerland
-
-
- This program is entered as Shareware.
- If you find it useful, a small donation would be appreciated.(then i can take some English lessons!!!)
-
- Feel free to incorporate the code into your own programs.
-
- *)
-
- {$m 32768,0,600000}
- {$F-}
- {$N-}
- {$E-}
- {$D-}
- {$L-}
- {$Y-}
-
-
- USES crt,dos,DrawPoly,Tshade,tools;
-
- VAR ee,gag,modif,qq,q,w,e,r,t:INTEGER;
- ax,ay,az,zoom,dist:real;
- px,py,pz:real;(*gravity*)
- re:registers;
- focus,distance:real;
- s:ARRAY[0..199,0..319] OF BYTE ABSOLUTE $a000:0;
- out:BYTE;
-
-
-
- PROCEDURE InitGraphics;
- BEGIN
- vsinit;
- END;
-
-
- BEGIN
- out:=0;
- initgraphics;directvideo:=FALSE; (*Init graphic mode 320x200x256*)
- shadepalette(100,100,100,0,0,0); (*Build a smooth gray palette, with 100% or RGB, with 0=base color*)
-
- qq:=0;
-
-
- clear; (*Clean*)
- loadmesh('face.msh',0.1,0.1,0.1,235);(*Load MeshFile: name,scaleXYZ,color*)
-
- Gravity(px,py,pz); (*Find gravity*)
- move_center(px,py,pz); (*Center=gravity*)
-
- (*AddLight;*) (*Addlight Vector*)
- LightFactor:=0.01; (*From 100 to 0.01... try it*)
- LightAmbient:=30; (*Ambient color*)
- ee:=0;
- modif:=0;
- ax:=1;ay:=6;
- midx:=160;midy:=100; (*Display center*)
- xshade(40,20,20); (*Shade from 40°X,20°Y,20°Z*)
- distance:=60;focus:=179; (*Distance & focus*)
- REPEAT
- calc(ax,ay,distance,focus); (*Rotation around X and Y angle*)
- redraw; (*Redraw*)
- re.ax:=3;Intr($33,re); (*Get mouse*)
- FOR q:=-2 TO 2 DO s[re.dx+q,re.cx]:=255-s[re.dx+q,re.cx]; (*Draw a nice mouse cursor*)
- FOR q:=-2 TO 2 DO s[re.dx,re.cx+q]:=255-s[re.dx,re.cx+q];
- IF re.bx=1 THEN (*Button 1=rotate*)
- BEGIN
- ax:=re.cx*2;
- ay:=re.dx*2;
- END;
- IF re.bx=4 THEN (*Button 1&2=move center*)
- BEGIN
- midx:=re.cx;
- midy:=re.dx;
- END;
- IF re.bx=3 THEN (*Button 3=Distance & Focus*)
- BEGIN
- distance:=re.cx;
- focus:= re.dx*10;
- END;
- IF re.bx=2 THEN (*Button 2=Shading*)
- BEGIN
- xshade(re.cx-midx,re.cx-midx,re.dx-midy);
- END;
-
- IF KeyPressed THEN
- CASE UpCase(ReadKey) OF
- #27:out:=1;
- '-':LightFactor:=LightFactor-1;
- '+':LightFactor:=LightFactor+1;
- '8':move_center(0,0,-1);
- '2':move_center(0,0,1);
- '4':move_center(-1,0,0);
- '6':move_center(1,0,0);
- 'I':distance:=distance-2.01;
- 'O':distance:=distance+2.01;
- 'N':focus:=focus-2.01;
- 'M':focus:=focus+2.01;
- END;
- (*ax:=ax+1;ay:=ay+1;*) (*Try this...*)
- UNTIL out=1;
- vsdone; (*Restore Display*)
- END.
-
-
-
-