text
stringlengths
0
234
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 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
Draw_boundary (clip.main_clipping, clip_area);
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;
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.objc));
ol := ol.next;
end loop;
end Destroy;
procedure set_Alpha (o : in out Object_3D; Alpha : in GL.Double) is
begin
for f in o.face'Range loop
o.face (f).alpha := Alpha;
end loop;
end set_Alpha;
function is_Transparent (o : in Object_3D) return Boolean is
begin
return o.transparent;
end is_Transparent;
function face_Count (o : in Object_3D) return Natural is
begin
return o.Max_faces;
end face_Count;
function Bounds (o : in 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);
use GL;
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;