text
stringlengths
0
234
--------------
-- Material --
--------------
if First_Face
or else Previous_face.skin = invisible
or else fa.skin /= Previous_face.skin
or else (fa.skin = Previous_face.skin
and then fa.material /= Previous_face.material)
then
case fa.skin is
when material_only | material_texture =>
Disable (COLOR_MATERIAL);
Set_Material (fa.material);
when others =>
Set_Material (GL.Materials.neutral_material);
end case;
end if;
------------
-- Colour --
------------
if First_Face
or else Previous_face.skin = invisible
or else fa.skin /= Previous_face.skin
or else (fa.skin = Previous_face.skin
and then (fa.colour /= Previous_face.colour
or else fa.alpha /= Previous_face.alpha))
then
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 =>
null;
end case;
end if;
-------------
-- Texture --
-------------
if is_textured (fa.skin) then
G3DT.Check_2D_texture (fa.texture, blending_hint);
if blending_hint then
fi.blending := True;
-- 13 - Oct - 2006 : override the decision made at Pre_calculate.
-- If texture data contains an alpha layer, we switch
-- on transparency.
end if;
end if;
if First_Face
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);
GL.BindTexture (GL.TEXTURE_2D, GL.Uint (Image_ID'Pos (fa.texture) + 1));
-- ^ superfluous ?!!
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);