home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / graphic / 3d_textu.pas < prev    next >
Pascal/Delphi Source File  |  1995-08-03  |  2KB  |  74 lines

  1. Uses Crt,ModeXLib,Gif,var_3d;
  2.  
  3. Const
  4.     worldlen=8*3;               {Point-Array}
  5.     Worldconst:Array[0..worldlen-1] of Integer =
  6.     (-200,-200,-200,
  7.     -200,-200,200,
  8.     -200,200,-200,
  9.     -200,200,200,
  10.     200,-200,-200,
  11.     200,-200,200,
  12.     200,200,-200,
  13.     200,200,200);
  14.     surfclen=38;                {Surface-Array}
  15.     surfcconst:Array[0..surfclen-1] of Word=
  16.     ($ff00,4, 0,2,6,4,
  17.      $ff01,4, 0,1,3,2,
  18.      $ff02,4, 4,6,7,5,
  19.      $ff00,4, 1,5,7,3,
  20.      $ff03,4, 2,3,7,6,
  21.      $ff04,4, 0,4,5,1,0,0);
  22.  
  23.     { $ff = use textures, number in the low-byte}
  24.  
  25. Var
  26.     i,j:Word;
  27.  
  28. Procedure Prep_Textures;
  29. {load texture variables}
  30. Begin
  31.   LoadGif('Texture');           {load texture image}
  32.   GetMem(Txt_Pic,64000);        {get memory for this}
  33.   Move(VScreen^,Txt_Pic^,64000);{and copy to memory}
  34.   For i:=0 to Txt_Number-1 do Begin
  35.     Txt_Data[i]:=Txt_Pic;       {load pointer to data}
  36.     Txt_Offs[i]:=i*64;          {determine offset}
  37.   End;
  38. End;
  39.  
  40. procedure drawworld;external;   {draws the world on current video page}
  41. {$l 3dasm.obj}
  42. {$l poly.obj}
  43. {$l bres.obj}
  44. {$l root.obj}
  45.  
  46. Begin
  47.   vz:=1000;                     {solid is located at 1000 unit depth}
  48.   vpage:=0;                     {start with page 0}
  49.   init_modex;                   {enable ModeX}
  50.   Prep_Textures;
  51.   LoadGif('logo.gif');          {load wallpaper}
  52.   rotx:=0;                      {initial values for rotation}
  53.   roty:=0;
  54.   rotz:=0;
  55.   Fill:=true;                   {SurfaceFill on}
  56.   sf_sort:=true;                {SurfaceSort on}
  57.   sf_shift:=true;               {SurfaceShift suppression on}
  58.   Glass:=false;                 {glass surfaces off}
  59.   p13_2_modex(16000*2,16000);   {Wallpaper to VGA page 2}
  60.   repeat
  61.     CopyScreen(vpage,16000*2);  {wallpaper to current page}
  62.     DrawWorld;                  {draw world}
  63.     switch;                     {switch to finished picture}
  64.     WaitRetrace;                {wait for next retrace}
  65.     Inc(rotx);                  {continue rotating ... }
  66.     If rotx=120 Then rotx:=0;
  67.     Inc(rotz);
  68.     If rotz=120 Then rotz:=0;
  69.     inc(roty);
  70.     if roty=120 Then roty:=0;
  71.   Until KeyPressed;             { ... until key}
  72.   TextMode(3);
  73. End.
  74.