text stringlengths 0 234 |
|---|
or else Previous_face.skin = invisible |
or else fa.skin /= Previous_face.skin |
or else (fa.skin = Previous_face.skin |
and then fa.texture /= Previous_face.texture) then |
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; |
end if; |
----------------------------- |
-- Blending / transparency -- |
----------------------------- |
if First_Face |
or else Previous_face.skin = invisible |
or else fi.blending /= Previous_face_Invariant.blending then |
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; |
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_face (fa : Face_type; fi : in out Face_invariant_type) is |
use GL; |
blending_hint : Boolean; |
begin -- Display_face |
if fa.skin = invisible then |
return; |
end if; |
-------------- |
-- Material -- |
-------------- |
case fa.skin is |
when material_only | material_texture => |
Disable (COLOR_MATERIAL); |
Set_Material (fa.material); |
neutral_material_already_set := False; |
when others => |
-- Avoid setting again and again the neutral material |
if not neutral_material_already_set then |
Set_Material (GL.Materials.neutral_material); |
neutral_material_already_set := True; |
end if; |
end case; |
------------ |
-- Colour -- |
------------ |
case fa.skin is |
when material_only | material_texture => |
null; -- done above |
when colour_only | coloured_texture => |
Enable (COLOR_MATERIAL); |
ColorMaterial (FRONT_AND_BACK, AMBIENT_AND_DIFFUSE); |
Color ( |
red => fa.colour.red, |
green => fa.colour.green, |
blue => fa.colour.blue, |
alpha => fa.alpha |
); |
when texture_only => |
Disable (COLOR_MATERIAL); |
when invisible => |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.