unit Material;

interface
uses
  Otshelm_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 Otshelm_A.ML2 do
    begin
      AddTextureMaterial('1',  'Dawn.jpg');
      AddTextureMaterial('2',  'top.jpg');
      AddTextureMaterial('3',  'right.jpg');
      AddTextureMaterial('4',  'back.jpg');
      AddTextureMaterial('5',  'front.jpg');
      AddTextureMaterial('6',  'left.jpg');
    end;

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

  with Otshelm_A.Sky do
    begin
      MaterialLibrary:=Otshelm_A.ML2;
      MatNameTop:='1';
      MatNameBottom:='2';
      MatNameLeft:='3';
      MatNameRight:='4';
      MatNameFront:='5';
      MatNameBack:='6';
    end;


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 Otshelm_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.
