text
stringlengths
0
234
begin
-- lights (which) := as;
Light (id, POSITION, as.position);
Light (id, AMBIENT, as.ambient);
Light (id, DIFFUSE, as.diffuse);
Light (id, SPECULAR, as.specular);
light_defined (which) := True;
end Define;
procedure Switch_lights (on : Boolean) is
begin
for l in Light_ident loop
Switch_light (l, on);
end loop;
end Switch_lights;
function Server_id (which : Light_ident) return GL.ServerCapabilityEnm is
begin
return GL.ServerCapabilityEnm'Val (GL.ServerCapabilityEnm'Pos (GL.LIGHT0) + which - 1);
end Server_id;
procedure Switch_light (which : Light_ident; on : Boolean) is
begin
if light_defined (which) then
if on then
GL.Enable (Server_id (which));
else
GL.Disable (Server_id (which));
end if;
end if;
end Switch_light;
function Is_light_switched (which : Light_ident) return Boolean is
begin
return Boolean'Val (GL.IsEnabled (Server_id (which)));
end Is_light_switched;
procedure Reverse_light_switch (which : Light_ident) is
begin
Switch_light (which, not Is_light_switched (which));
end Reverse_light_switch;
prec_a360 : constant := 10000;
r_prec_a360 : constant := 10000.0;
i_r_prec_a360 : constant := 1.0 / r_prec_a360;
procedure Angles_modulo_360 (v : in out Vector_3D) is
begin
for i in v'Range loop
v (i) :=
GL.Double (Integer (r_prec_a360 * v (i)) mod (360 * prec_a360))
* i_r_prec_a360;
end loop;
end Angles_modulo_360;
------------------
-- Resource I/O --
------------------
procedure Load_if_needed (zif : in out Zip.Zip_info; name : String) is
begin
if not Zip.Is_loaded (zif) then
begin
Zip.Load (zif, name);
exception
when Zip.Zip_file_open_Error => -- Try with lower case :
Zip.Load (zif, To_Lower (name));
Function Definition: procedure sort is new Ada.Containers.Generic_Array_Sort (Positive,
Function Body: Visual_Geometry,
Visual_Geometries);
use GL.Skins, GL.Geometry, GL.Skinned_Geometry;
current_Visual : p_Visual;
begin
if geometry_Count > 1 then
sort (All_Geometries (1 .. geometry_Count));
end if;
GL.PushMatrix;
for Each in 1 .. geometry_Count loop
if All_Geometries (Each).Geometry.Skin /= current_Skin then
current_Skin := All_Geometries (Each).Geometry.Skin;
Enable (current_Skin.all);
GL.Errors.log;
end if;
if All_Geometries (Each).Geometry.Veneer /= null then
Enable (All_Geometries (Each).Geometry.Veneer.all);
GL.Errors.log;