text
stringlengths
0
234
null;
end case;
-------------
-- Texture --
-------------
case fa.skin is
when texture_only | coloured_texture | material_texture =>
Enable (TEXTURE_2D);
G3DT.Check_2D_texture (fa.texture, blending_hint);
GL.BindTexture (GL.TEXTURE_2D, GL.Uint (Image_id'Pos (fa.texture) + 1));
-- ^ superfluous ?!!
if blending_hint then
fi.blending := True;
-- 13 - Oct - 2006 : override decision made at Pre_calculate
-- if texture data contains an alpha layer
end if;
when colour_only | material_only =>
Disable (TEXTURE_2D);
when invisible =>
null;
end case;
-----------------------------
-- Blending / transparency --
-----------------------------
if fi.blending then
Enable (BLEND); -- See 4.1.7 Blending
BlendFunc (sfactor => SRC_ALPHA,
dfactor => ONE_MINUS_SRC_ALPHA);
-- Disable (DEPTH_TEST);
-- Disable (CULL_FACE);
else
Disable (BLEND);
-- Enable (DEPTH_TEST);
-- Enable (CULL_FACE);
-- CullFace (BACK);
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;
end Display_face;
procedure Display_normals is
use GL, 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 GL, 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 := List_Id_Generator.New_List_Id;
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 (o.face (f), o.face_invariant (f));
end loop;
when Generate_List =>
for f in o.face'Range loop