1. package GLOBE_3D.Textures is 
  2.  
  3.   -- The textures are stored by GL in that way: 
  4.   -- 
  5.   --   an image < - > a number (Image_ID) 
  6.   -- 
  7.   -- To complete this, and facilitate things, GLOBE_3D adds the 
  8.   -- following associations: 
  9.   -- 
  10.   --   a number (Image_ID) - > 
  11.   --      a record (Texture_info) with an image name 
  12.   --      and whether the image was already stored into GL 
  13.   --      (images can be loaded on first use, or preloaded) 
  14.   --      and other infos 
  15.   -- 
  16.   --   an image name - > a number (Image_ID) 
  17.   -- 
  18.   -- Names are case insensitive! 
  19.  
  20.   ------------------------------------------------------------------------ 
  21.   -- Here are three ways of registering the texture names that GLOBE_3D -- 
  22.   -- will find in the resource files. You can use any mix of these      -- 
  23.   -- methods at your convenience.                                       -- 
  24.   ------------------------------------------------------------------------ 
  25.  
  26.   -------------------------------------------- 
  27.   -- a) Texture - by - texture name association -- 
  28.   -------------------------------------------- 
  29.   -- 
  30.   -- Free way of associating names. E.g., the texture name list could be 
  31.   -- simply stored on a text file, or obtained by a "dir"- like operation. 
  32.   -- The system associates a name to a texture id that it finds itself. 
  33.  
  34.   procedure Add_texture_name (name : String; id : out Image_ID); 
  35.  
  36.   ------------------------------------------------------------ 
  37.   -- b) Texture name association by searching the .zip data -- 
  38.   --    resource files for images                           -- 
  39.   ------------------------------------------------------------ 
  40.   -- 
  41.   -- For "real life" programs which don't know of the data. 
  42.   -- Allows subdirectories in resource ('/' or '\' in names) 
  43.   -- and a flexible management. 
  44.   -- 
  45.   -- The texture name list is obtained by traversing the directory of 
  46.   -- both .zip data resource files, searching for images (anyway, the 
  47.   -- textures are read from there!). 
  48.   -- 
  49.   -- The zip name (s) must be set first with 
  50.   -- GLOBE_3D.Set_level_data_name, GLOBE_3D.Set_global_data_name 
  51.  
  52.   procedure Register_textures_from_resources; 
  53.  
  54.   ------------------------------------------------------------ 
  55.   -- c) Texture name association through an enumarated type -- 
  56.   ------------------------------------------------------------ 
  57.   -- 
  58.   -- For test or demo programs. 
  59.   -- Easy, reliable, but : static, hard - coded and disallowing a 
  60.   -- directory structure. 
  61.  
  62.   generic 
  63.     type Texture_enum is (<>); 
  64.   procedure Associate_textures; 
  65.  
  66.   --------------------------------------------------------------------- 
  67.   -- When texture names are registered, you have the following tools -- 
  68.   --------------------------------------------------------------------- 
  69.  
  70.   -- - Recall a texture's ID - you need it to define objects' faces. 
  71.   function Texture_ID (name : String) return Image_ID; 
  72.   Texture_name_not_found : exception; 
  73.  
  74.   -- - Recall a texture's name 
  75.   function Texture_name (id : Image_ID; Trim_Flag : Boolean) return Ident; 
  76.  
  77.   -- Check if the texture image has been loaded and load it if needed. 
  78.   -- This is done automatically, but you may want to force the loading 
  79.   -- of the images before beginning to display. 
  80.   procedure Check_2D_texture (id : Image_ID; blending_hint : out Boolean); 
  81.   -- variant for situations where the blending information doesn't matter: 
  82.   procedure Check_2D_texture (id : Image_ID); 
  83.   -- same, but for all textures. 
  84.   procedure Check_all_textures; 
  85.  
  86.   function Valid_texture_ID (id : Image_ID) return Boolean; 
  87.  
  88.   -- >= 16 - apr - 2008 : no more need to reserve anything; unbounded collection 
  89.   -- 
  90.   --  Textures_not_reserved : exception; 
  91.   --  Texture_out_of_range : exception; 
  92.  
  93.   Undefined_texture_ID   : exception; 
  94.   Undefined_texture_name : exception; 
  95.  
  96.   -- - Erase the present texture collection 
  97.   --   (names, GL ID's, evenutally loaded images) 
  98.   procedure Reset_textures; 
  99.  
  100. end GLOBE_3D.Textures;