unit Material;

interface
uses
  quod_A, Forms, Loader, SysUtils;

procedure LoadJPG;

var
  K, U : word;

implementation

procedure loadnebo;
var
  I : byte;
begin
  UnZ('\Data\nebo1\n.zip');
  SetCurrentDir(ExtractFilePath(Application.ExeName)+'\Data\temp\');
  with quod_A.ML2 do
    begin
      AddTextureMaterial('2',  'top.jpg');
      AddTextureMaterial('3',  'right.jpg');
      AddTextureMaterial('4',  'back.jpg');
      AddTextureMaterial('5',  'front.jpg');
      AddTextureMaterial('6',  'left.jpg');
    end;
  with quod_A.Sky do
    begin
      MaterialLibrary:=quod_A.ML2;
      MatNameTop:='1';
      MatNameBottom:='2';
      MatNameLeft:='3';
      MatNameRight:='4';
      MatNameFront:='5';
      MatNameBack:='6';
    end;

{  for I:=0 to 5 do
  quod_A.ML2.Materials[i].Material.Texture.disabled:=false;   }
end;

procedure LoadJPG;
var
  stop: boolean;
  FN : string;
begin
  stop:=false;
  K:=0;
  UnZ('\Data\tiles\t.zip');
  while not stop do
  begin
    FN:=extractfilepath(Application.ExeName)+'\Data\temp\'+inttostr(K+1)+'.JPG';
    if FileExists(FN) then
    with quod_A.ML1 do
      begin
        AddTextureMaterial(inttostr(K+1),FN);
        Materials[K].TextureOffset.X:=0.5;
        Materials[K].TextureOffset.Y:=0.5;
        Materials[K].TextureScale.X:=0.5;
        Materials[K].TextureScale.Y:=0.5;
        K:=K+1;
        U:=1;
      end
    else
    stop:=true;
  end;
  loadnebo;
end;

end.
