text
stringlengths
0
234
end if;
end if;
-------------
-- Drawing --
-------------
case fi.last_edge is
when 3 => GL_Begin (TRIANGLES);
when 4 => GL_Begin (QUADS);
end case;
for i in 1 .. fi.last_edge loop
if is_textured (fa.skin) then
TexCoord (fi.UV_extrema (i).U, fi.UV_extrema (i).V);
end if;
Normal (o.edge_vector (fi.P_compact (i)));
Vertex (o.Point (fi.P_compact (i)));
end loop;
GL_End;
Previous_face := fa;
Previous_face_Invariant := fi;
end Display_face;
end Display_face_optimized;
procedure Display_normals is
use G3DM;
C : Vector_3D;
begin
GL.Color (0.5, 0.5, 1.0, 1.0);
-- show pseudo (average) normals at edges :
for e in o.Point'Range loop
Arrow (o.Point (e), arrow_inflator * o.edge_vector (e));
end loop;
GL.Color (1.0, 1.0, 0.5, 1.0);
-- show normals of faces :
for f in o.face'Range loop
C := (0.0, 0.0, 0.0);
for i in 1 .. o.Face_Invariant (f).last_edge loop
C := C + o.Point (o.Face_Invariant (f).P_compact (i));
end loop;
C := (1.0 / Real (o.Face_Invariant (f).last_edge)) * C;
Arrow (C, arrow_inflator * o.Face_Invariant (f).normal);
end loop;
end Display_normals;
use G3DM;
begin -- Display_one
if not o.pre_calculated then
Pre_calculate (o);
end if;
GL.BindBuffer (GL.ARRAY_BUFFER, 0); -- disable 'vertex buffer objects'
GL.BindBuffer (GL.ELEMENT_ARRAY_BUFFER, 0); -- disable 'vertex buffer objects' indices
-- gl.disableClientState (gl.TEXTURE_COORD_ARRAY);
-- gl.disable (ALPHA_TEST);
GL.Enable (LIGHTING);
GL.PushMatrix; -- 26 - May - 2006 : instead of rotating/translating back
GL.Translate (o.Centre);
Multiply_GL_Matrix (o.rotation);
-- List preparation phase
case o.List_Status is
when No_List | Is_List =>
null;
when Generate_List =>
o.List_Id := Integer (GL.GenLists (1));
GL.NewList (GL.Uint (o.List_Id), COMPILE_AND_EXECUTE);
end case;
-- Execution phase
case o.List_Status is
when No_List =>
for f in o.face'Range loop
Display_face_optimized.Display_face (True, o.face (f), o.Face_Invariant (f));
-- We mimic the old Display_face with redundant color, material, etc.
-- instructions by passing True for First_Face.
end loop;
when Generate_List =>
for f in o.face'Range loop
Display_face_optimized.Display_face (f = o.face'First, o.face (f), o.Face_Invariant (f));
end loop;
when Is_List => GL.CallList (GL.Uint (o.List_Id));
end case;
-- Close list
case o.List_Status is
when No_List | Is_List => null;