text stringlengths 0 234 |
|---|
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 |
use GL; |
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_geometrys); |
use GL.Skins, GL.Geometry, GL.Skinned_Geometry; |
current_Visual : p_Visual; |
begin |
if geometry_Count > 1 then |
sort (all_Geometrys (1 .. geometry_Count)); |
end if; |
GL.PushMatrix; |
for Each in 1 .. geometry_Count loop |
if all_Geometrys (Each).Geometry.Skin /= current_Skin then |
current_Skin := all_Geometrys (Each).Geometry.Skin; |
enable (current_Skin.all); |
GL.Errors.log; |
end if; |
if all_Geometrys (Each).Geometry.Veneer /= null then |
enable (all_Geometrys (Each).Geometry.Veneer.all); |
GL.Errors.log; |
end if; |
if all_Geometrys (Each).Visual = current_Visual then |
draw (all_Geometrys (Each).Geometry.Geometry.all); |
GL.Errors.log; |
else |
GL.PopMatrix; |
GL.PushMatrix; |
GL.Translate (all_Geometrys (Each).Visual.centre); |
Multiply_GL_Matrix (all_Geometrys (Each).Visual.rotation); |
draw (all_Geometrys (Each).Geometry.Geometry.all); |
GL.Errors.log; |
current_Visual := all_Geometrys (Each).Visual; |
end if; |
end loop; |
GL.PopMatrix; |
Function Definition: --procedure sort is new Ada.Containers.Generic_Array_Sort (Positive, |
Function Body: procedure sort is new Ada.Containers.Generic_Array_Sort (Positive, |
globe_3d.p_Visual, |
globe_3d.Visual_array); |
begin |
for Each in 1 .. transparent_Count loop -- pre - calculate each visuals Centre in camera space. |
all_Transparents (Each).Centre_camera_space := the_Camera.world_Rotation |
* (all_Transparents (Each).Centre - the_Camera.Clipper.eye_Position); |
end loop; |
if transparent_Count > 1 then |
sort (all_Transparents (1 .. transparent_Count)); |
end if; |
GL.depthMask (gl_False); -- make depth buffer read - only, for correct transparency |
Enable (LIGHTING); -- ensure lighting is enabled for G3D.Display of transparents (obsolete). |
Enable (BLEND); |
BlendFunc (sfactor => ONE, |
dfactor => ONE_MINUS_SRC_ALPHA); |
for Each in 1 .. transparent_Count loop |
declare |
the_Visual : Visual'Class renames all_Transparents (Each).all; |
visual_Geometrys : constant GL.skinned_geometry.skinned_Geometrys := skinned_Geometrys (the_visual); -- tbd : apply ogl state sorting here ? |
begin |
display (the_Visual, the_Camera.clipper); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.