Back to... GLOBE_3D

Source file : vehic001.adb


--  Space vehicle #001 3D model. Copyright (c) Gautier de Montmollin 1999-2000
--  CH-2000 Neuchatel
--  SWITZERLAND
--  Permission granted to use the herein contained 3D model for any purpose,
--  provided this copyright note remains attached and unmodified.

with GL;

package body Vehic001 is

  procedure Create(
    object: in out GLOBE_3D.p_Object_3D;
    scale :        GLOBE_3D.Real;
    centre:        GLOBE_3D.Point_3D
  )
  is

    use GL, GLOBE_3D;

    -- matos: Material_type;

    polys: constant array( 1..101, 1..4) of Natural :=

      -- Here, clockwise !

      ( 1=>(2,1,3,4), 2=>(4,3,6,7), 3=>(7,6,9,10),
        4=>(10,9,11,12), 5=>(12,11,14,16), 6=>(16,14,19,15), -- zebr. hg
       --  7=>(14,13,23,21) passait devant 17
        7=>(14,17,23,21),94=>(14,13,17,0),
        8=>(14,21,22,19),
        9=>(56,49,54,57),
       -- 10=>(21,25,79,74) passait devant 22
       10=>(21,25,22,0),90=>(25,79,22,0),91=>(79,74,22,0),
       11=>(21,23,27,25),
       12=>(27,23,33,34),
       13=>(25,27,34,35), -- fusel hg
       14=>(24,25,35,29), -- aile hg
       -- 15=>(1,36,41,6) passait devant 3,5,85,40,38
       15=>(1,36,85,0),98=>(1,85,5,3),99=>(85,36,38,40),
       100=>(6,3,5,0),101=>(40,38,41,0),
       16=>(6,5,8,9), 17=>(40,41,44,43), -- appui vitre
       18=>(36,37,39,38),19=>(38,39,42,41),20=>(41,42,45,44),
       21=>(44,45,47,46),22=>(46,47,51,49),23=>(49,51,50,54),  -- zebr hd
       -- 24=>(48,49,56,58) passait devant 52
       24=>(52,49,56,58),95=>(48,49,52,0),
       25=>(61,18,78,26), -- sous 27
       26=>(20,76,78,18), -- sous 24
       27=>(56,60,62,58), 28=>(62,66,65,58),
       29=>(60,67,66,62), -- fusel hd
       30=>(35,32,87,82), -- react. g.
       31=>(17,52,58,23), -- centre h
       32=>(32,67,89,87),  -- react d.
       33=>(23,58,65,33),
       34=>(13,48,52,17),
       -- 35=>(33,30,31,34), 36=>(30,65,66,31), -- face 31 passait devant 30
       35=>(33,0,31,34), 36=>(0,65,66,31), 96=>(33,65,31,0),
       37=>(34,31,32,35), 38=>(31,66,67,32), -- arr. react h
       39=>(60,59,64,67), -- aile hd
       -- 40=>(60,56,18,61) passait devant 57
       40=>(60,56,57,0),92=>(61,60,57,0),93=>(61,57,18,0),
       41=>(14,8,96,13),42=>(13,96,97,48),43=>(97,43,49,48), -- cockpit
       44=>(68,2,4,69),45=>(69,4,7,70),46=>(70,7,10,71),
       47=>(71,10,12,72),48=>(72,12,16,73),
       49=>(73,16,15,19), -- zebr bg
       50=>(19,22,74,73),
       51=>(73,74,77,75),
       52=>(76,75,77,78),53=>(64,59,92,90),
       54=>(77,74,79,80),
       55=>(77,80,83,84),
       56=>(80,79,82,83), -- aile bg
       57=>(79,25,24,28),58=>(24,29,81,28),
       59=>(29,35,82,81),
       60=>(87,86,83,82),61=>(87,89,88,86),
       -- 62=>(86,85,84,83),63=>(86,88,91,85) face 78 passait devant 85
       62=>(86,0,84,83),63=>(86,88,91,0),97=>(84,86,91,0),
       64=>(67,64,90,89),
       65=>(60,61,92,59),
       66=>(92,61,89,90), -- aile bd
       67=>(61,26,88,89),
       68=>(18,57,54,20),
       69=>(54,50,51,20),
       70=>(20,51,47,53),
       71=>(53,47,45,55),
       72=>(45,42,93,55),73=>(42,39,94,93),
       74=>(39,37,95,94), -- zebr bd
       75=>(5,85,96,8),76=>(85,40,43,97), -- lucarnes cockpit
       77=>(82,79,28,81), -- sous aile g
       78=>(84,91,78,77), -- sous 33:rc
       79=>(91,88,26,78), -- sous 28
       80=>(75,76,20,73), -- "entree air"
       81=>(73,20,93,70), -- sous cockpit
       82=>(70,93,95,68), -- sous l'avant
       83=>( 1,2,68,30),84=>(30,68,95,63), -- nez
       85=>(63,95,37,36),86=>(63,36, 1,30),-- nez
       87=>(9,8,14,0),88=>(43,44,49,0), -- triangles plateau cockpit cf 16,17
       89=>(96,85,97,0) -- triangle pointe cockpit devant 42
       );

     coords: constant array( 1..97,0..2) of Integer:=
        ( 1=>( -10, 360,  10),
          2=>( -20, 360,   0),
          3=>( -20, 330,  12),
          4=>( -30, 330,   0),
          5=>( -10, 300,  14),
          6=>( -30, 300,  14),
          7=>( -40, 300,   0),
          8=>( -20, 270,  16),
          9=>( -30, 270,  16),
         10=>( -50, 270,   0),
         11=>( -30, 240,  18),
         12=>( -60, 240,   0),
         13=>( -20, 220,  30),
         14=>( -30, 210,  20),
         15=>( -40, 200,   0),
         16=>( -70, 210,   0),
         17=>( -20, 200,  30),
         18=>(  30, 120, -20),
         19=>( -31, 200,   0),
         20=>(  30, 210, -20),
         21=>( -30, 120,  20),
         22=>( -31, 120,   0),
         23=>( -20, 110,  30),
         24=>(-110, 110,   1),
         25=>( -50, 100,   1),
         26=>(  40,  90, -10),
         27=>( -40,  90,  10),
         28=>(-110, 110,  -1),
         29=>(-120,  50,   1),
         -- 30=>(   0,   7,  40),
         31=>(   0,   0,  20),
         32=>(   0,   0,  10),
         33=>( -20,   7,  40),
         34=>( -40,   0,  10),
         35=>( -60,   0,   2),  -- fin hg
         36=>(  10, 360,  10),
         37=>(  20, 360,   0),
         38=>(  20, 330,  12),
         39=>(  30, 330,   0),
         40=>(  10, 300,  14),
         41=>(  30, 300,  14),
         42=>(  40, 300,   0),
         43=>(  20, 270,  16),
         44=>(  30, 270,  16),
         45=>(  50, 270,   0),
         46=>(  30, 240,  18),
         47=>(  60, 240,   0),
         48=>(  20, 220,  30),
         49=>(  30, 210,  20),
         50=>(  40, 200,   0),
         51=>(  70, 210,   0),
         52=>(  20, 200,  30),
         53=>(  30, 240, -18),
         54=>(  31, 200,   0),
         55=>(  30, 270, -16),
         56=>(  30, 120,  20),
         57=>(  31, 120,   0),
         58=>(  20, 110,  30),
         59=>( 110, 110,   1),
         60=>(  50, 100,   1),
         61=>(  50, 100,  -1),
         62=>(  40,  90,  10),
         63=>(   4, 366,   0),
         64=>( 120,  50,   1),
         65=>(  20,   7,  40),
         66=>(  40,   0,  10),
         67=>(  60,   0,   2), -- fin hd
         68=>( -10, 360, -10), -- debut bas g
         69=>( -20, 330, -12),
         70=>( -30, 300, -14),
         71=>( -30, 270, -16),
         72=>( -30, 240, -18),
         73=>( -30, 210, -20),
         74=>( -30, 120, -20),
         75=>( -20, 210, -30),
         76=>(  20, 210, -30),
         77=>( -20, 110, -30),
         78=>(  20, 110, -30),
         79=>( -50, 100,  -1),
         80=>( -40,  80, -10),
         81=>(-120,  50,  -1),
         82=>( -60,   0,  -2),
         83=>( -40,   0, -10),
         84=>( -20,   7, -40),
         -- 85=>(   0,   7, -40),
         86=>(   0,   0, -20),
         87=>(   0,   0, -10),
         88=>(  40,   0, -10),
         89=>(  60,   0,  -2),
         90=>( 120,  50,  -1),
         91=>(  20,   7, -40),
         92=>( 110, 110,  -1),
         93=>(  30, 300, -14),
         94=>(  20, 330, -12),
         95=>(  10, 360, -10),
         96=>( -10, 270,  17),
         97=>(  10, 270,  17),
         30=>(  -4, 366,   0),
         85=>(   0, 300,  14)
        );

    colour : GL.RGB_Color;
    corr: constant Vector_3D:= (0.0,160.0,0.0);
    face_0 : Face_type; -- takes defaults values
  begin
    face_0.skin    := colour_only;

    object:=
      new Object_3D( Max_points=> 97,
                     Max_faces => polys'Length(1) );

    for i in coords'Range loop
      for d in Point_3D'Range loop
        object.point(i)(d):= scale * 0.1 * (Real(coords(i,d))-corr(d));
      end loop;
    end loop;

    for i in polys'Range(1) loop
      case i is
       when 2|4|6|19|21|23|44|46|48|70|72|74 =>
               colour:= (1.0,1.0,0.1); -- jaune
               --matos:= very_bright;
       when 1|3|5|18|20|22|45|47|49|69|71|73 =>
               colour:= (0.1,0.1,0.5); -- bleu f.
               --matos:= very_bright;
       when 34 =>
               colour:= (0.3,0.11,0.11); -- rouge
               --matos:= neutral;
       when 41..43|75|76|89 =>
               colour:= (0.13,0.2,0.2); -- vitre cockpit
               --matos:= very_bright;
       when 30|32 =>
               colour:= (1.0,0.8,0.1);  -- orange
               --matos:= neutral;
       when 83..86=>
               colour:= (0.1,0.2,0.4);  -- museau
               --matos:= neutral;
       when others =>
               colour:= (0.8,0.8,1.0);  -- caisse
               --matos:= bright;
      end case;
      face_0.colour  := colour;
      face_0.P:= (polys(i,1),polys(i,4),polys(i,3),polys(i,2));
      object.face(i):= face_0;
    end loop;

    object.centre:= centre;
    Set_name(object.all, "vehicle_001");
  end Create;

end Vehic001;

GLOBE_3D: Ada library for real-time 3D rendering. Ada programming.