text
stringlengths
0
234
end if;
if All_Geometries (Each).Visual = current_Visual then
Draw (All_Geometries (Each).Geometry.Geometry.all);
GL.Errors.log;
else
GL.PopMatrix;
GL.PushMatrix;
GL.Translate (All_Geometries (Each).Visual.all.Centre);
Multiply_GL_Matrix (All_Geometries (Each).Visual.all.rotation);
Draw (All_Geometries (Each).Geometry.Geometry.all);
GL.Errors.log;
current_Visual := All_Geometries (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).all.Centre_Camera_Space := the_Camera.World_Rotation
* (all_Transparents (Each).all.Centre - the_Camera.Clipper.Eye_Position);
end loop;
if transparent_Count > 1 then
sort (all_Transparents (1 .. transparent_Count));
end if;
GL.Depth_Mask (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_Transparency in 1 .. transparent_Count loop
declare
the_Visual : Visual'Class renames all_Transparents (Each_Transparency).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);
GL.Errors.log;
for Each_Geometry in visual_Geometrys'Range loop
declare
use GL.Skins, GL.Geometry;
the_Geometry : GL.Skinned_Geometry.Skinned_Geometry_t renames visual_Geometrys (Each_Geometry);
begin
if the_Geometry.Skin /= current_Skin then
current_Skin := the_Geometry.Skin;
Enable (current_Skin.all);
GL.Errors.log;
end if;
if the_Geometry.Veneer /= null then
Enable (the_Geometry.Veneer.all);
GL.Errors.log;
end if;
GL.PushMatrix;
GL.Translate (the_Visual.Centre);
Multiply_GL_Matrix (the_Visual.rotation);
Draw (the_Geometry.Geometry.all);
GL.Errors.log;
GL.PopMatrix;
Function Definition: function to_Window is new Ada.Unchecked_Conversion (System.Address, GLOBE_3D.p_Window);
Function Body: begin
return GLUT.Windows.Window_view (to_Window (GetWindowData));
end current_Window;
procedure Name_is (Self : in out Window; Now : String) is
begin
Self.Name := To_Unbounded_String (Now);
end Name_is;
function Name (Self : Window) return String is (To_String (Self.Name));
function is_Closed (Self : Window) return Boolean is (Self.is_Closed);
procedure Prepare_default_lighting (Self : in out Window;
fact : GL.C_Float) is
proto_light : G3D.Light_definition := (position => (0.0, 500.0, 0.0, 1.0),
ambient => (0.3, 0.3, 0.3, fact),
diffuse => (0.9, 0.9, 0.9, fact),
specular => (0.05, 0.05, 0.01, fact));
begin