text stringlengths 0 234 |
|---|
when Generate_List => |
GL.EndList; |
if GL.Get_Error = OUT_OF_MEMORY then |
o.List_Status := No_List; |
else |
o.List_Status := Is_List; |
end if; |
end case; |
if show_normals then |
pragma Warnings (Off, "this code can never be executed and has been deleted"); |
GL.Disable (GL.LIGHTING); |
GL.Disable (GL.TEXTURE_2D); |
Display_normals; |
GL.Enable (GL.LIGHTING); -- mmmh .. . |
pragma Warnings (On, "this code can never be executed and has been deleted"); |
end if; |
GL.PopMatrix; -- 26 - May - 2006 : instead of rotating/translating back |
-- GL.Rotate (o.auto_rotation (2), 0.0, 0.0, - 1.0); |
-- GL.Rotate (o.auto_rotation (1), 0.0, - 1.0, 0.0); |
-- GL.Rotate (o.auto_rotation (0), - 1.0, 0.0, 0.0); |
-- GL.Translate ( - o.centre); |
end Display_one; |
overriding procedure Display (o : in out Object_3D; |
clip : Clipping_data) is |
use GLOBE_3D.Portals; |
procedure Display_clipped (o : in out Object_3D'Class; |
clip_area : Clipping_area; |
portal_depth : Natural) is |
procedure Try_portal (f : Positive) is |
use G3DM; |
dp : Real; |
plane_to_eye : Vector_3D; -- vector from any point in plane to the eye |
bounding_of_face, intersection_clip_and_face : Clipping_area; |
success, non_empty_intersection : Boolean; |
begin |
-- Culling #1 : check if portal is in vield of view's "dead angle" |
dp := o.Face_Invariant (f).normal * clip.view_direction; |
if dp < clip.max_dot_product then |
-- Culling #2 : check if we are on the right side of the portal |
-- NB : ignores o.auto_rotation ! |
plane_to_eye := |
clip.Eye_Position - |
(o.Point (o.Face_Invariant (f).P_compact (1)) + o.Centre) |
; |
dp := plane_to_eye * o.Face_Invariant (f).normal; |
-- dp = signed distance to the plane |
if dp > 0.0 then |
-- Culling #3 : clipping rectangle |
Find_bounding_box (o, f, bounding_of_face, success); |
if success then |
Intersect (clip_area, bounding_of_face, |
intersection_clip_and_face, non_empty_intersection); |
else |
-- in doubt, draw with the present clipping |
intersection_clip_and_face := clip_area; |
non_empty_intersection := True; |
end if; |
if non_empty_intersection then |
-- Recursion here : |
Display_clipped ( |
o => o.face (f).connecting.all, |
clip_area => intersection_clip_and_face, |
portal_depth => portal_depth + 1 |
); |
end if; |
end if; |
end if; |
end Try_portal; |
begin -- Display_clipped |
if not o.pre_calculated then |
Pre_calculate (o); |
end if; |
-- |
-- a/ Display connected objects which are visible through o's faces |
-- This is where recursion happens |
if (not filter_portal_depth) or else -- filter_portal_depth : test/debug |
portal_depth <= 6 |
then |
for f in o.face'Range loop |
if o.face (f).connecting /= null and then |
not o.Face_Invariant (f).portal_seen |
-- ^ prevents infinite recursion on rare cases where |
-- object A or B is not convex, and A and B see each other |
-- and the culling by clipping cannot stop the recursion |
-- (e.g. origin2.proc, tomb.proc) |
-- |
-- NB : drawing [different parts of] the same object several times |
-- is right, since portions can be seen through different portals, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.