text
stringlengths
0
234
-- but going more than once through the same portal is wrong
then
o.Face_Invariant (f).portal_seen := True;
Try_portal (f);
-- ^ recursively calls Display_clipped for
-- objects visible through face f.
end if;
end loop;
end if;
-- b/ Display the object itself
if (not filter_portal_depth) or else -- filter_portal_depth : test/debug
(portal_depth = 1 or else portal_depth = 5)
then
-- The graphical clipping (Scissor) gives various effects
-- - almost no speedup on the ATI Radeon 9600 Pro (hardware)
-- - factor : ~ Sqrt (clipped surface ratio) with software GL
if portal_depth > 0 then
GL.Enable (GL.SCISSOR_TEST);
GL.Scissor (x => GL.Int (clip_area.X1),
y => GL.Int (clip_area.Y1),
width => GL.Sizei (clip_area.X2 - clip_area.X1 + 1),
height => GL.Sizei (clip_area.Y2 - clip_area.Y1 + 1));
else
GL.Disable (GL.SCISSOR_TEST);
end if;
info_b_ntl2 := info_b_ntl2 + 1;
info_b_ntl3 := Natural'Max (portal_depth, info_b_ntl3);
Display_one (o);
end if;
if show_portals and then portal_depth > 0 then
pragma Warnings (Off, "this code can never be executed and has been deleted");
Draw_boundary (clip.main_clipping, clip_area);
pragma Warnings (On, "this code can never be executed and has been deleted");
end if;
end Display_clipped;
procedure Reset_portal_seen (o : in out Object_3D'Class) is
begin
for f in o.face'Range loop
if o.Face_Invariant (f).portal_seen then
o.Face_Invariant (f).portal_seen := False;
Reset_portal_seen (o.face (f).connecting.all);
end if;
end loop;
end Reset_portal_seen;
begin
info_b_ntl2 := 0; -- count amount of objects displayed, not distinct
info_b_ntl3 := 0; -- records max depth
Display_clipped (o, clip_area => clip.main_clipping, portal_depth => 0);
Reset_portal_seen (o);
end Display;
overriding procedure Destroy (o : in out Object_3D) is
ol : p_Object_3D_list := o.sub_objects;
begin
while ol /= null loop
Free (p_Visual (ol.all.objc));
ol := ol.all.next;
end loop;
end Destroy;
overriding procedure set_Alpha (o : in out Object_3D; Alpha : GL.Double) is
begin
for f in o.face'Range loop
o.face (f).alpha := Alpha;
end loop;
end set_Alpha;
overriding function is_Transparent (o : Object_3D) return Boolean is
begin
return o.transparent;
end is_Transparent;
overriding function face_Count (o : Object_3D) return Natural is
begin
return o.Max_faces;
end face_Count;
overriding function Bounds (o : Object_3D) return GL.Geometry.Bounds_record is
begin
return o.Bounds;
end Bounds;
-- Lighting support.
--
-- lights : array (Light_ident) of Light_definition;
light_defined : array (Light_ident) of Boolean := (others => False);
procedure Define (which : Light_ident; as : Light_definition) is
id : constant GL.LightIDEnm := GL.LightIDEnm'Val (which - 1);