unit bibli;

interface

procedure pave(x : integer;y:integer;z:integer; long:integer ; larg:integer; haut:integer; couleur:string; alpha:integer);
procedure disk( rayoni:integer; rayone:integer; couleur:string; alpha:integer);
{procedure lumiere (x:integer; y:integer; z:integer; couleurA:string; couleurD:string;couleurS:string);}
procedure skybox(x:integer; y:integer; z:integer; long:integer; larg:integer; haut :integer; couleursol:string; couleurmur:string;alpha:integer);




implementation
uses
  SysUtils,
  OpenGL,
  glfw;



{______________________________________________________________________________
-----------------------------pave----------------------------------------------}

procedure pave(x : integer;y:integer;z:integer; long:integer ; larg:integer; haut:integer; couleur:string; alpha:integer);

var
color : array [0..2] of integer;

begin
Randomize();
//definition de la couleur
if couleur ='rouge' then
         begin
          color[0]:= 255;
          color[1]:=20;
          color[2]:=20;
          end
  else if couleur = 'vert' then
          begin
           color[0]:=20;
           color[1]:=255;
           color[2]:=20;
          end
    else if couleur = 'bleu' then
          begin
            color[0]:=20;
            color[1]:=20;
            color[2]:=255;
          end
      else if couleur = 'jaune' then
            begin
             color[0]:=255;
             color[1]:=255;
             color[2]:=20;
           end
        else if couleur = 'blanc' then
                begin
                  color[0]:=255;
                  color[1]:=255;
                  color[2]:=255;
                end
          else if couleur = 'noir' then
                  begin
                    color[0]:=20;
                    color[1]:=20;
                    color[2]:=20;
                  end
                else begin
                      color[0] := random(255);
                      color[1] := random(255);
                      color[2] := random(255);
                     end;

   //on trace le pave suivant les parametres
  //surface du bas
  glBegin(GL_QUADS);
  glColor4ub(color[0],color[1],color[2],alpha);

    glvertex3f((x-(larg div 2)) , (y - long div 2), z);
    glvertex3f((x-(larg div 2)), (y + long div 2), z);
    glvertex3f((x+(larg div 2)), (y + long div 2), z );
    glvertex3f((x+(larg div 2)) , (y - long div 2), z);
  glend();


  //surface arriere
  glbegin(GL_QUADS);
  glColor4ub(color[0]-10,color[1]-10,color[2]-10,alpha);

    glvertex3f((x-(larg div 2)) , (y - long div 2), z);
    glvertex3f((x-(larg div 2)), (y + long div 2), z);
    glvertex3f((x-(larg div 2)), (y + long div 2), z+haut);
    glvertex3f((x-(larg div 2)), (y - long div 2), z+haut);
  glend();



  glbegin(GL_QUADS);
  glColor4ub(color[0]-20,color[1],color[2]-10,alpha);
  //surface de droite
    glvertex3f((x+(larg div 2)), (y + long div 2), z);
    glvertex3f((x-(larg div 2)), (y + long div 2), z );
    glvertex3f((x-(larg div 2)), (y + long div 2), z+haut);
    glvertex3f((x+(larg div 2)), (y + long div 2), z+haut);
   glend();




   //surface du haut
   glbegin(GL_QUADS);
   glColor4ub(color[0],color[1]-20,color[2]-10,alpha);
  
    glvertex3f((x+(larg div 2)), (y - long div 2), z+haut);
    glvertex3f((x+(larg div 2)), (y + long div 2), z+haut);
    glvertex3f((x-(larg div 2)), (y + long div 2), z+haut);
    glvertex3f((x-(larg div 2)), (y - long div 2), z+haut);

  glend();


    //surface de gauche
  glbegin(GL_QUADS);
   glColor4ub(color[0]-20,color[1]-10,color[2],alpha);

    glvertex3f((x-(larg div 2)), (y - long div 2), z);
    glvertex3f((x+(larg div 2)), (y - long div 2), z);
    glvertex3f((x+(larg div 2)), (y - long div 2), z+haut);
    glvertex3f((x-(larg div 2)), (y - long div 2), z+haut);


  glend();

  //surface de face
  glbegin(GL_QUADS);
   glColor4ub(color[0]-20,color[1]-10,color[2]-10,alpha);

    glvertex3f((x+(larg div 2)), (y - long div 2), z);
    glvertex3f((x+(larg div 2)), (y + long div 2), z);
    glvertex3f((x+(larg div 2)), (y + long div 2), z+haut);
    glvertex3f((x+(larg div 2)), (y - long div 2), z+haut);


  glend();

end;




{______________________________________________________________________________
-----------------------------DISK----------------------------------------------}


procedure disk( rayoni:integer; rayone:integer; couleur:string; alpha:integer);

var
 disk : gluQuadricObj;
 color : array [0..2] of integer;
begin
Randomize();
//definition de la couleur
if couleur ='rouge' then
         begin
          color[0]:= 255;
          color[1]:=20;
          color[2]:=20;
          end
  else if couleur = 'vert' then
          begin
           color[0]:=20;
           color[1]:=255;
           color[2]:=20;
          end
    else if couleur = 'bleu' then
          begin
            color[0]:=20;
            color[1]:=20;
            color[2]:=255;
          end
      else if couleur = 'jaune' then
            begin
             color[0]:=255;
             color[1]:=255;
             color[2]:=20;
           end
        else if couleur = 'blanc' then
                begin
                  color[0]:=255;
                  color[1]:=255;
                  color[2]:=255;
                end
          else if couleur = 'noir' then
                  begin
                    color[0]:=20;
                    color[1]:=20;
                    color[2]:=20;
                  end
                else begin
                      color[0] := random(255);
                      color[1] := random(255);
                      color[2] := random(255);
                     end;




disk:=gluNewQuadric();
glcolor4ub(color[0],color[1],color[2],alpha);
gluDisk(disk,rayoni,rayone,30,1);





end;



{__________________________________________________________________________________________________
--------------------------------------SKYBOX------------------------------------------------------}
procedure skybox(x:integer; y:integer; z:integer; long:integer; larg:integer; haut :integer; couleursol:string; couleurmur:string; alpha:integer);

var
color : array [0..2] of integer;
color2: array[0..2] of integer;

begin
Randomize();
//definition de la couleur du sol
if couleursol ='rouge' then
         begin
          color[0]:= 255;
          color[1]:=20;
          color[2]:=20;
          end
  else if couleursol = 'vert' then
          begin
           color[0]:=20;
           color[1]:=255;
           color[2]:=20;
          end
    else if couleursol = 'bleu' then
          begin
            color[0]:=20;
            color[1]:=20;
            color[2]:=255;
          end
      else if couleursol = 'jaune' then
            begin
             color[0]:=255;
             color[1]:=255;
             color[2]:=20;
           end
        else if couleursol = 'blanc' then
                begin
                  color[0]:=255;
                  color[1]:=255;
                  color[2]:=255;
                end
          else if couleursol = 'noir' then
                  begin
                    color[0]:=10;
                    color[1]:=40;
                    color[2]:=10;
                  end
                else begin
                      color[0] := random(255);
                      color[1] := random(255);
                      color[2] := random(255);
                     end;

//definition de la couleur des mur

if couleurmur ='bleu' then
         begin
          color2[0]:= 168;
          color2[1]:=224;
          color2[2]:=251;
          end
  else if couleurmur = 'vert' then
          begin
           color2[0]:=20;
           color2[1]:=255;
           color2[2]:=20;
          end
    else if couleurmur = 'rouge' then
          begin
            color2[0]:=248;
            color2[1]:=70;
            color2[2]:=70;
          end
      else if couleurmur = 'jaune' then
            begin
             color2[0]:=251;
             color2[1]:=215;
             color2[2]:=110;
           end
        else if couleurmur = 'blanc' then
                begin
                  color2[0]:=255;
                  color2[1]:=255;
                  color2[2]:=255;
                end
          else if couleurmur = 'noir' then
                  begin
                    color2[0]:=10;
                    color2[1]:=10;
                    color2[2]:=60;
                  end
                else begin
                      color2[0] := random(255);
                      color2[1] := random(255);
                      color2[2] := random(255);
                     end;
   //on trace la skybox suivant les parametres
  //surface du bas
  glBegin(GL_QUADS);
  glColor4ub(color[0],color[1],color[2],alpha);

    glvertex3f((x-(larg div 2)) , (y - long div 2), z);
    glvertex3f((x-(larg div 2)), (y + long div 2), z);
    glvertex3f((x+(larg div 2)), (y + long div 2), z );
    glvertex3f((x+(larg div 2)) , (y - long div 2), z);
  glend();


  //surface arriere
  glbegin(GL_QUADS);
  glColor4ub(color2[0]-10,color2[1]-10,color2[2]-10,alpha);

    glvertex3f((x-(larg div 2)) , (y - long div 2), z);
    glvertex3f((x-(larg div 2)), (y + long div 2), z);
    glColor4ub(color2[0]-10,color2[1]-10,color2[2]-10,alpha);
    glvertex3f((x-(larg div 2)), (y + long div 2), z+haut);
    glvertex3f((x-(larg div 2)), (y - long div 2), z+haut);
  glend();



  glbegin(GL_QUADS);
  glColor4ub(color2[0]-10,color2[1],color2[2]-10,alpha);
  //surface de droite
    glvertex3f((x+(larg div 2)), (y + long div 2), z);
    glvertex3f((x-(larg div 2)), (y + long div 2), z );
    glColor4ub(color2[0]-20,color2[1]-10,color2[2]-10,alpha);
    glvertex3f((x-(larg div 2)), (y + long div 2), z+haut);
    glvertex3f((x+(larg div 2)), (y + long div 2), z+haut);
   glend();

    //surface de gauche
  glbegin(GL_QUADS);
   glColor4ub(color2[0]-10,color2[1]-10,color2[2]-10,alpha);

    glvertex3f((x-(larg div 2)), (y - long div 2), z);
    glvertex3f((x+(larg div 2)), (y - long div 2), z);
    glColor4ub(color2[0]-10,color2[1]-10,color2[2],alpha);
    glvertex3f((x+(larg div 2)), (y - long div 2), z+haut);
    glvertex3f((x-(larg div 2)), (y - long div 2), z+haut);


  glend();

  //surface de face
  glbegin(GL_QUADS);
   glColor4ub(color2[0],color2[1],color2[2],alpha);

    glvertex3f((x+(larg div 2)), (y - long div 2), z);
    glvertex3f((x+(larg div 2)), (y + long div 2), z);
    glColor4ub(color2[0]-10,color2[1]-10,color2[2]-10,alpha);
    glvertex3f((x+(larg div 2)), (y + long div 2), z+haut);
    glvertex3f((x+(larg div 2)), (y - long div 2), z+haut);


  glend();

end;






end.
 