text stringlengths 0 234 |
|---|
end if; |
end loop; |
-- * Face invariant : Normal of unrotated face |
N := (0.0, 0.0, 0.0); |
case fi.last_edge is |
when 3 => |
Add_Normal_of_3p (o, |
fi.P_compact (1), |
fi.P_compact (2), |
fi.P_compact (3), |
N |
); |
when 4 => |
Add_Normal_of_3p (o, fa.P (1), fa.P (2), fa.P (4), N); |
-- We sum other normals for not perfectly flat faces, |
-- in order to have a convenient average .. . |
Add_Normal_of_3p (o, fa.P (2), fa.P (3), fa.P (1), N); |
Add_Normal_of_3p (o, fa.P (3), fa.P (4), fa.P (2), N); |
Add_Normal_of_3p (o, fa.P (4), fa.P (1), fa.P (3), N); |
end case; |
length_N := Norm (N); |
if Almost_zero (length_N) then |
if strict_geometry then |
pragma Warnings (Off, "this code can never be executed and has been deleted"); |
raise zero_summed_normal; |
pragma Warnings (On, "this code can never be executed and has been deleted"); |
else |
fi.normal := N; -- 0 vector ! |
end if; |
else |
fi.normal := (1.0 / length_N) * N; |
end if; |
end Calculate_face_invariants; |
adjacent_faces : array (o.Point'Range) of Natural := (others => 0); |
pf : Natural; |
length : Real; |
begin -- Pre_calculate |
if full_check_objects then |
pragma Warnings (Off, "this code can never be executed and has been deleted"); |
Check_object (o); |
pragma Warnings (On, "this code can never be executed and has been deleted"); |
end if; |
for i in o.face'Range loop |
begin |
-- Geometry |
Calculate_face_invariants (o.face (i), o.Face_Invariant (i)); |
-- Disable blending when alphas are = 1 |
case o.face (i).skin is |
when material_only | material_texture => |
o.Face_Invariant (i).blending := Is_to_blend (o.face (i).material); |
when colour_only | coloured_texture | texture_only => |
o.Face_Invariant (i).blending := Is_to_blend (o.face (i).alpha); |
when invisible => |
o.Face_Invariant (i).blending := False; |
end case; |
o.transparent := o.transparent or else o.Face_Invariant (i).blending; |
exception |
when zero_summed_normal => |
Raise_Exception (zero_summed_normal'Identity, |
o.ID & " face =" & Integer'Image (i)); |
Function Definition: procedure Display_one (o : in out Object_3D) is |
Function Body: -- Display only this object and not connected objects |
-- out : object will be initialized if not yet |
-- |
-- |
-- Display face routine which is optimized to produce a shorter list |
-- of GL commands. Runs slower then the original Display face routine |
-- yet needs to be executed only once. |
-- |
-- Uwe R. Zimmer, July 2011 |
-- |
package Display_face_optimized is |
procedure Display_face (First_Face : Boolean; fa : Face_type; fi : in out Face_invariant_type); |
private |
Previous_face : Face_type; |
Previous_face_Invariant : Face_invariant_type; |
end Display_face_optimized; |
package body Display_face_optimized is |
use GL.Materials; |
procedure Display_face (First_Face : Boolean; fa : Face_type; fi : in out Face_invariant_type) is |
blending_hint : Boolean; |
begin -- Display_face |
if fa.skin = invisible then |
Previous_face := fa; |
Previous_face_Invariant := fi; |
return; |
end if; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.