Sorry, we haven't possibility testing our code under GLES 2.0

   Now we wrap it with define GL_ES.

   Some time after we will add software implementation glAlphaFunc.

   Thank you.

   ------- Original Message -------

   Sender : Daniel Zaoui<daniel.za...@samsung.com> Sr. Engineer/SRIL-Advanced
   R&D Lab/Samsung Electronics

   Date : Mar 19, 2015 14:29 (GMT+03:00)

   Title : Re: [E-devel] [EGIT] [core/efl] master 11/17: evas: Evas_3D - add
   alpha testing.


   Hi,
   I have a compilation issue due to that patch:
   modules/evas/engines/gl_common/evas_gl_3d_renderer.c: In function
   'e3d_renderer_draw':
   modules/evas/engines/gl_common/evas_gl_3d_renderer.c:353:18: error:
   'GL_ALPHA_TEST' undeclared (first use in this function)
   glEnable(GL_ALPHA_TEST); ^
   modules/evas/engines/gl_common/evas_gl_3d_renderer.c:353:18: note: each
   undeclared identifier is reported only once for each function it
   appears in modules/evas/engines/gl_common/evas_gl_3d_renderer.c:354:9:
   warning: implicit declaration of function
   'glAlphaFunc' [-Wimplicit-function-declaration]
   glAlphaFunc(_gl_comparison_func_get(data->alpha_comparison),
   Maybe this is due to the fact that GL_ALPHA_TEST and glAlphaFunc are
   deprecated now.
   This is my autogen:
   autogen.sh --enable-systemd --enable-drm --enable-wayland --enable-egl
   --with-opengl=es --enable-libinput --prefix=/opt/e/
   JackDanielZ
   On Wed, 18 Mar 2015 08:22:07 -0700
   Dmytro Dadyka wrote:
   > cedric pushed a commit to branch master.
   >
   >
   http://git.enlightenment.org/core/efl.git/commit/?id=31651a88424744054c41b35
   44937991488f032ef
   >
   > commit 31651a88424744054c41b3544937991488f032ef
   > Author: Dmytro Dadyka
   > Date:   Wed Mar 18 14:40:05 2015 +0100
   >
   >     evas: Evas_3D - add alpha testing.
   >
   >     Reviewers: Hermet, cedric
   >
   >     Reviewed By: cedric
   >
   >     Subscribers: Ievgen, cedric
   >
   >     Differential Revision: https://phab.enlightenment.org/D2046
   > ---
   >  src/examples/evas/Makefile.am                      |   2 +
   >  src/examples/evas/evas-3d-shadows.c                | 123
   > +++++++++++++++------
   > src/examples/evas/resources/images/grid.png        | Bin 0 -> 45870
   > bytes src/examples/evas/resources/images/grid_n.png      | Bin 0 ->
   > 51868 bytes src/lib/evas/Evas_Eo.h                             |  27
   > +++++ src/lib/evas/canvas/evas_3d_mesh.c                 |  37
   > +++++++ src/lib/evas/canvas/evas_3d_mesh.eo                |  50
   > +++++++++ src/lib/evas/include/evas_private.h                |   4 +
   > src/modules/evas/engines/gl_common/evas_gl_3d.c    |  13
   > +++ .../evas/engines/gl_common/evas_gl_3d_private.h    |   9
   > +- .../evas/engines/gl_common/evas_gl_3d_renderer.c   |  35
   > +++++- .../evas/engines/gl_common/evas_gl_3d_shader.c     |   1
   > + .../gl_common/shader_3d/evas_gl_3d_shaders.x       |  52
   > ++++++++- .../gl_common/shader_3d/shadow_map_frag.shd        |  43
   > ++++++- .../gl_common/shader_3d/shadow_map_vert.shd        |  32
   > ++++++ 15 files changed, 385 insertions(+), 43 deletions(-)
   >
   > diff --git a/src/examples/evas/Makefile.am
   > b/src/examples/evas/Makefile.am index 98a4a7f..5e27afa 100644
   > --- a/src/examples/evas/Makefile.am
   > +++ b/src/examples/evas/Makefile.am
   > @@ -338,6 +338,8 @@ resources/images/wood.jpg \
   >  resources/images/rocks.jpg \
   >  resources/images/four_NM_height.tga \
   >  resources/images/rocks_NM_height.tga \
   > +resources/images/grid.png \
   > +resources/images/grid_n.png \
   >  resources/models/mesh_for_mmap.eet \
   >  resources/models/mesh_for_mmap.md2 \
   >  resources/models/mesh_for_mmap.obj \
   > diff --git a/src/examples/evas/evas-3d-shadows.c
   > b/src/examples/evas/evas-3d-shadows.c index f58e8b8..d53f435 100644
   > --- a/src/examples/evas/evas-3d-shadows.c
   > +++ b/src/examples/evas/evas-3d-shadows.c
   > @@ -6,7 +6,7 @@
   >   * @see evas_3d_object_callback_register
   >   *
   >   * @verbatim
   > - * gcc -o gcc -o evas-3d-shadows evas-3d-shadows.c
   > evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore
   > ecore-evas eo eina` -lm
   > + * gcc -o evas-3d-shadows evas-3d-shadows.c evas-3d-primitives.c
   > `pkg-config --libs --cflags efl evas ecore ecore-evas eo eina` -lm
   >   * @endverbatim
   >   */
   >
   > @@ -37,8 +37,9 @@
   >  #define SPECULAR_LIGHT 1.0, 1.0, 1.0
   >
   >  static const char *model_path = PACKAGE_EXAMPLES_DIR
   > EVAS_MODEL_FOLDER "/sonic.md2"; -static const char *image_path =
   > PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/sonic.png"; +
   >  static const vec2 tex_scale = {1, 1};
   > +static const vec2 fence_tex_scale = {80, 6};
   >
   >  Ecore_Evas *ecore_evas = NULL;
   >  Evas *evas = NULL;
   > @@ -46,30 +47,6 @@ Eo *background = NULL;
   >  Eo *image = NULL;
   >  Evas_3D_Node *choosed_node = NULL;
   >
   > -typedef struct _Body_3D
   > -{
   > -   Eo     *material;
   > -   Eo     *mesh;
   > -   Eo     *node;
   > -} Body_3D;
   > -
   > -typedef struct _Scene_Data
   > -{
   > -   Eo     *scene;
   > -   Eo     *root_node;
   > -   Eo     *camera_node;
   > -   Eo     *camera;
   > -   Eo     *light_node;
   > -   Eo     *light;
   > -
   > -   Body_3D     sphere;
   > -   Body_3D     cube;
   > -   Body_3D     square;
   > -   Body_3D     cylinder;
   > -   Body_3D     model;
   > -   Body_3D     cone;
   > -} Scene_Data;
   > -
   >  Eina_Bool
   >  _cb_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const
   > Eo_Event_Description *desc EINA_UNUSED, void *event_info) {
   > @@ -107,6 +84,31 @@ _cb_collision(void *data EINA_UNUSED, Eo *obj
   > EINA_UNUSED, const Eo_Event_Descri return EINA_TRUE;
   >  }
   >
   > +typedef struct _Body_3D
   > +{
   > +   Eo     *material;
   > +   Eo     *mesh;
   > +   Eo     *node;
   > +} Body_3D;
   > +
   > +typedef struct _Scene_Data
   > +{
   > +   Eo     *scene;
   > +   Eo     *root_node;
   > +   Eo     *camera_node;
   > +   Eo     *camera;
   > +   Eo     *light_node;
   > +   Eo     *light;
   > +
   > +   Body_3D     sphere;
   > +   Body_3D     cube;
   > +   Body_3D     square;
   > +   Body_3D     cylinder;
   > +   Body_3D     model;
   > +   Body_3D     cone;
   > +   Body_3D     fence;
   > +} Scene_Data;
   > +
   >  static void
   >  _show_help()
   >  {
   > @@ -212,6 +214,51 @@ _cylinder_setup(Body_3D *cylinder)
   >  }
   >
   >  static void
   > +_fence_setup(Body_3D *fence)
   > +{
   > +
   > +   Eo *texture = eo_add(EVAS_3D_TEXTURE_CLASS, evas);
   > +   eo_do(texture,
   > +         evas_3d_texture_file_set(PACKAGE_EXAMPLES_DIR
   > EVAS_IMAGE_FOLDER "/grid.png", NULL),
   > +         evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST,
   > +                                    EVAS_3D_TEXTURE_FILTER_NEAREST),
   > +         evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT,
   > +                                  EVAS_3D_WRAP_MODE_REPEAT));
   > +   Eo *texture1 = eo_add(EVAS_3D_TEXTURE_CLASS, evas);
   > +   eo_do(texture1,
   > +         evas_3d_texture_file_set(PACKAGE_EXAMPLES_DIR
   > EVAS_IMAGE_FOLDER "/grid_n.png", NULL),
   > +         evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST,
   > +                                    EVAS_3D_TEXTURE_FILTER_NEAREST),
   > +         evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT,
   > +                                  EVAS_3D_WRAP_MODE_REPEAT));
   > +   fence->material = eo_add(EVAS_3D_MATERIAL_CLASS, evas);
   > +
   > +   eo_do(fence->material,
   > +         evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE,
   > texture),
   > +         evas_3d_material_texture_set(EVAS_3D_MATERIAL_AMBIENT,
   > texture),
   > +         evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT,
   > EINA_TRUE),
   > +         evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE,
   > EINA_TRUE),
   > +         evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR,
   > EINA_TRUE),
   > +         evas_3d_material_enable_set(EVAS_3D_MATERIAL_NORMAL,
   > EINA_TRUE),
   > +         evas_3d_material_texture_set(EVAS_3D_MATERIAL_NORMAL,
   > texture1),
   > +         evas_3d_material_shininess_set(100.0));
   > +   fence->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
   > +   evas_3d_add_cylinder_frame(fence->mesh, 0, 50, fence_tex_scale);
   > +
   > +   eo_do(fence->mesh,
   > +         evas_3d_mesh_frame_material_set(0, fence->material),
   > +         evas_3d_mesh_alpha_func_set(EVAS_3D_COMPARISON_GREATER, 0),
   > +         evas_3d_mesh_alpha_test_enable_set(EINA_TRUE),
   > +         evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_NORMAL_MAP));
   > +   fence->node =
   > +      eo_add(EVAS_3D_NODE_CLASS, evas,
   > +
   > evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH));
   > +   eo_do(fence->node, evas_3d_node_mesh_add(fence->mesh),
   > +         evas_3d_node_scale_set(7.0, 3.0, 7.0),
   > +         evas_3d_node_position_set(0.0, 0.5, -5.0));
   > +}
   > +
   > +static void
   >  _square_setup(Body_3D *square)
   >  {
   >     square->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
   > @@ -247,7 +294,7 @@ _model_setup(Body_3D *model)
   >  {
   >     Eo *texture = eo_add(EVAS_3D_TEXTURE_CLASS, evas);
   >     eo_do(texture,
   > -         evas_3d_texture_file_set(image_path, NULL),
   > +         evas_3d_texture_file_set(PACKAGE_EXAMPLES_DIR
   > EVAS_IMAGE_FOLDER "/sonic.png", NULL),
   > evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST,
   > EVAS_3D_TEXTURE_FILTER_NEAREST),
   > evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT, @@ -307,7 +354,8
   > @@ _light_setup(Scene_Data *data)
   > evas_3d_light_ambient_set(AMBIENT_LIGHT, 1.0),
   > evas_3d_light_diffuse_set(DIFFUSE_LIGHT, 1.0),
   > evas_3d_light_specular_set(SPECULAR_LIGHT, 1.0),
   > -         evas_3d_light_projection_perspective_set(45.0, 1.0, 2.0,
   > 1000.0));
   > +         evas_3d_light_spot_cutoff_set(20),
   > +         evas_3d_light_projection_perspective_set(40.0, 1.0, 2.0,
   > 1000.0));
   >     data->light_node =
   >        eo_add(EVAS_3D_NODE_CLASS, evas,
   > @@ -315,7 +363,7 @@ _light_setup(Scene_Data *data)
   >     eo_do(data->light_node,
   >           evas_3d_node_light_set(data->light),
   >           evas_3d_node_position_set(50.0, 50.0, 20.0),
   > -         evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0,
   > 20.0,
   > +         evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 15.0, 0.0,
   > -5.0, EVAS_3D_SPACE_PARENT, 0.0, 0.0, 1.0));
   >     eo_do(data->root_node, evas_3d_node_member_add(data->light_node));
   >  }
   > @@ -343,13 +391,16 @@ _scene_setup(Scene_Data *data)
   >     _square_setup(&data->square);
   >     _model_setup(&data->model);
   >     _cone_setup(&data->cone);
   > -
   > -   eo_do(data->root_node,
   > evas_3d_node_member_add(data->sphere.node));
   > -   eo_do(data->root_node, evas_3d_node_member_add(data->cube.node));
   > -   eo_do(data->root_node,
   > evas_3d_node_member_add(data->cylinder.node));
   > -   eo_do(data->root_node,
   > evas_3d_node_member_add(data->square.node));
   > -   eo_do(data->root_node, evas_3d_node_member_add(data->model.node));
   > -   eo_do(data->root_node, evas_3d_node_member_add(data->cone.node));
   > +   _fence_setup(&data->fence);
   > +
   > +   eo_do(data->root_node,
   > +         evas_3d_node_member_add(data->sphere.node),
   > +         evas_3d_node_member_add(data->cube.node),
   > +         evas_3d_node_member_add(data->cylinder.node),
   > +         evas_3d_node_member_add(data->square.node),
   > +         evas_3d_node_member_add(data->model.node),
   > +         evas_3d_node_member_add(data->cone.node),
   > +         evas_3d_node_member_add(data->fence.node));
   >
   >     eo_do(data->scene,
   >           evas_3d_scene_root_node_set(data->root_node),
   > diff --git a/src/examples/evas/resources/images/grid.png
   > b/src/examples/evas/resources/images/grid.png new file mode 100644
   > index 0000000..60d1036
   > Binary files /dev/null and
   > b/src/examples/evas/resources/images/grid.png differ diff --git
   > a/src/examples/evas/resources/images/grid_n.png
   > b/src/examples/evas/resources/images/grid_n.png new file mode 100644
   > index 0000000..7b9236e Binary files /dev/null and
   > b/src/examples/evas/resources/images/grid_n.png differ diff --git
   > a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index
   > f82dbed..34ab6a4 100644 --- a/src/lib/evas/Evas_Eo.h
   > +++ b/src/lib/evas/Evas_Eo.h
   > @@ -488,6 +488,7 @@ typedef enum _Evas_3D_State
   >     EVAS_3D_STATE_MESH_SHADE_MODE,
   >     EVAS_3D_STATE_MESH_FOG,
   >     EVAS_3D_STATE_MESH_BLENDING,
   > +   EVAS_3D_STATE_MESH_ALPHA_TEST,
   >     EVAS_3D_STATE_MESH_COLOR_PICK,
   >
   >     EVAS_3D_STATE_CAMERA_PROJECTION = 1,
   > @@ -670,6 +671,32 @@ typedef enum _Evas_3D_Blend_Func
   >  } Evas_3D_Blend_Func;
   >
   >  /**
   > + * Comparsion functions for testing(alpha, depth, stencil) in
   > fragment shader.
   > + *
   > + * @since 1.14
   > + * @ingroup Evas_3D_Types
   > + */
   > +typedef enum _Evas_3D_Comparison
   > +{
   > +   /**< Never passes.*/
   > +   EVAS_3D_COMPARISON_NEVER,
   > +   /**< Passes if the incoming value is less than the reference
   > value.*/
   > +   EVAS_3D_COMPARISON_LESS,
   > +   /**< Passes if the incoming value is equal to the reference
   > value.*/
   > +   EVAS_3D_COMPARISON_EQUAL,
   > +   /**< Passes if the incoming value is less than or equal to the
   > reference value.*/
   > +   EVAS_3D_COMPARISON_LEQUAL,
   > +   /**< Passes if the incoming value is greater than the reference
   > value.*/
   > +   EVAS_3D_COMPARISON_GREATER,
   > +   /**< Passes if the incoming value is not equal to the reference
   > value.*/
   > +   EVAS_3D_COMPARISON_NOTEQUAL,
   > +   /**< Passes if the incoming value is greater than or equal to the
   > reference value.*/
   > +   EVAS_3D_COMPARISON_GEQUAL,
   > +   /**< Always passes (initial value).*/
   > +   EVAS_3D_COMPARISON_ALWAYS,
   > +} Evas_3D_Comparison;
   > +
   > +/**
   >   * Color formats of pixel data
   >   *
   >   * @since 1.10
   > diff --git a/src/lib/evas/canvas/evas_3d_mesh.c
   > b/src/lib/evas/canvas/evas_3d_mesh.c index 5e6253f..52a71f2 100644
   > --- a/src/lib/evas/canvas/evas_3d_mesh.c
   > +++ b/src/lib/evas/canvas/evas_3d_mesh.c
   > @@ -121,6 +121,10 @@ _mesh_init(Evas_3D_Mesh_Data *pd)
   >     pd->blend_dfactor = EVAS_3D_BLEND_ZERO;
   >     pd->blending = EINA_FALSE;
   >
   > +   pd->alpha_comparison = EVAS_3D_COMPARISON_ALWAYS;
   > +   pd->alpha_ref_value = 0.0f;
   > +   pd->alpha_test_enabled = EINA_FALSE;
   > +
   >     pd->color_pick_key = -1.0;
   >     pd->color_pick_enabled = EINA_FALSE;
   >  }
   > @@ -804,6 +808,39 @@ _evas_3d_mesh_blending_func_get(Eo *obj
   > EINA_UNUSED, Evas_3D_Mesh_Data *pd, }
   >
   >  EOLIAN static void
   > +_evas_3d_mesh_alpha_func_set(Eo *obj, Evas_3D_Mesh_Data *pd,
   > Evas_3D_Comparison comparison,
   > +                                    Evas_Real ref_value)
   > +{
   > +   if (pd->alpha_comparison == comparison && pd->alpha_ref_value ==
   > ref_value)
   > +     return;
   > +   pd->alpha_comparison = comparison;
   > +   pd->alpha_ref_value = ref_value;
   > +   eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_MESH_ALPHA_TEST,
   > NULL)); +}
   > +
   > +EOLIAN static void
   > +_evas_3d_mesh_alpha_func_get(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data
   > *pd,
   > +                                   Evas_3D_Comparison *comparison,
   > +                                   Evas_Real *ref_value)
   > +{
   > +   if (comparison) *comparison = pd->alpha_comparison;
   > +   if (ref_value) *ref_value = pd->alpha_ref_value;
   > +}
   > +
   > +EOLIAN static void
   > +_evas_3d_mesh_alpha_test_enable_set(Eo *obj, Evas_3D_Mesh_Data *pd,
   > Eina_Bool enabled) +{
   > +   pd->alpha_test_enabled = enabled;
   > +   eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_MESH_ALPHA_TEST,
   > NULL)); +}
   > +
   > +EOLIAN static Eina_Bool
   > +_evas_3d_mesh_alpha_test_enable_get(Eo *obj EINA_UNUSED,
   > Evas_3D_Mesh_Data *pd) +{
   > +   return pd->alpha_test_enabled;
   > +}
   > +
   > +EOLIAN static void
   >  _evas_3d_mesh_mmap_set(Eo *obj, Evas_3D_Mesh_Data *pd,
   >                         Eina_File *file, const char *key EINA_UNUSED)
   >  {
   > diff --git a/src/lib/evas/canvas/evas_3d_mesh.eo
   > b/src/lib/evas/canvas/evas_3d_mesh.eo index 7965cd6..784f91a 100644
   > --- a/src/lib/evas/canvas/evas_3d_mesh.eo
   > +++ b/src/lib/evas/canvas/evas_3d_mesh.eo
   > @@ -402,6 +402,56 @@ class Evas_3D_Mesh (Evas_3D_Object,
   > Evas.Common_Interface, Efl.File) Eina_Bool enabled; /*@ Fog enabled
   > status.*/ }
   >        }
   > +
   > +      alpha_test_enable {
   > +        set {
   > +            /**
   > +             * Get the enable status of alpha test for given mesh
   > +             *
   > +             * Default alpha test disabled.
   > +             *
   > +             * @ingroup Evas_3D_Mesh
   > +             */
   > +         }
   > +         get {
   > +             /**
   > +              * Get the enable status of alpha test for given mesh
   > +              *
   > +              * @see alpha_test_enable_set()
   > +              *
   > +              * @ingroup Evas_3D_Mesh
   > +              */
   > +         }
   > +         values {
   > +            Eina_Bool enabled; /*@ Alpha test status.*/
   > +         }
   > +      }
   > +
   > +      alpha_func {
   > +        set {
   > +            /*
   > +             * The alpha test discards fragments depending on the
   > outcome of a comparison
   > +             * between an incoming fragment's alpha value and a
   > constant reference value
   > +             * This func specifies the reference value and the
   > comparison function.
   > +             *
   > +             * @ingroup Evas_3D_Mesh
   > +             */
   > +        }
   > +        get {
   > +            /*
   > +             * Get the reference value and the comparison function
   > for alpha testing
   > +             *
   > +             * @see eavs_3d_mesh_alpha_test_param_set()
   > +             *
   > +             * @ingroup Evas_3D_Mesh
   > +             */
   > +        }
   > +        values {
   > +           Evas_3D_Comparison comparison_func; /*@ Specifies the
   > alpha comparison function.*/
   > +           Evas_Real ref_value; /*@ Specifies the reference value
   > that incoming alpha values are compared to.*/
   > +        }
   > +      }
   > +
   >        blending_enable {
   >          set {
   >              /**
   > diff --git a/src/lib/evas/include/evas_private.h
   > b/src/lib/evas/include/evas_private.h index 7471ae6..a3f06e1 100644
   > --- a/src/lib/evas/include/evas_private.h
   > +++ b/src/lib/evas/include/evas_private.h
   > @@ -344,6 +344,10 @@ struct _Evas_3D_Mesh
   >     Evas_3D_Blend_Func      blend_sfactor;
   >     Evas_3D_Blend_Func      blend_dfactor;
   >
   > +   Evas_3D_Comparison      alpha_comparison;
   > +   Evas_Real               alpha_ref_value;
   > +   Eina_Bool               alpha_test_enabled :1;
   > +
   >     Evas_Color              fog_color;
   >     Eina_Bool               fog_enabled :1;
   >
   > diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d.c
   > b/src/modules/evas/engines/gl_common/evas_gl_3d.c index
   > 9e7dfd0..6ee2697 100644 ---
   > a/src/modules/evas/engines/gl_common/evas_gl_3d.c +++
   > b/src/modules/evas/engines/gl_common/evas_gl_3d.c @@ -1142,6 +1142,8
   > @@ _mesh_draw_data_build(E3D_Draw_Data *data, data->flags |=
   > E3D_SHADER_FLAG_FOG_ENABLED; data->fog_color = pdmesh->fog_color;
   >       }
   > +   if (pdmesh->alpha_test_enabled)
   > +     data->flags |= E3D_SHADER_FLAG_ALPHA_TEST_ENABLED;
   >
   >     if (pdmesh->shadowed)
   >       data->flags |= E3D_SHADER_FLAG_SHADOWED;
   > @@ -1149,6 +1151,10 @@ _mesh_draw_data_build(E3D_Draw_Data *data,
   >     if (pdmesh->color_pick_enabled)
   >       data->color_pick_key = pdmesh->color_pick_key;
   >
   > +   data->alpha_comparison = pdmesh->alpha_comparison;
   > +   data->alpha_ref_value = pdmesh->alpha_ref_value;
   > +   data->alpha_test_enabled =pdmesh->alpha_test_enabled;
   > +
   >     data->blending = pdmesh->blending;
   >     data->blend_sfactor = pdmesh->blend_sfactor;
   >     data->blend_dfactor = pdmesh->blend_dfactor;
   > @@ -1184,6 +1190,13 @@ _mesh_draw_data_build(E3D_Draw_Data *data,
   >     else if (pdmesh->shade_mode ==
   > EVAS_3D_SHADE_MODE_SHADOW_MAP_RENDER) {
   >          BUILD(vertex_attrib,     VERTEX_POSITION,     EINA_TRUE);
   > +        if (pdmesh->alpha_test_enabled)
   > +          {
   > +             BUILD(material_texture,  MATERIAL_DIFFUSE,
   > EINA_FALSE); +
   > +             if (_flags_need_tex_coord(data->flags))
   > +               BUILD(vertex_attrib,     VERTEX_TEXCOORD,
   > EINA_FALSE);
   > +          }
   >       }
   >     else if (pdmesh->shade_mode == EVAS_3D_SHADE_MODE_COLOR_PICK)
   >       {
   > diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d_private.h
   > b/src/modules/evas/engines/gl_common/evas_gl_3d_private.h index
   > 78ddc42..948ec7b 100644 ---
   > a/src/modules/evas/engines/gl_common/evas_gl_3d_private.h +++
   > b/src/modules/evas/engines/gl_common/evas_gl_3d_private.h @@ -37,8
   > +37,9 @@ typedef unsigned long         E3D_Shader_Flag; #define
   > E3D_SHADER_FLAG_EMISSION_TEXTURE_BLEND  (1 << 26) #define
   > E3D_SHADER_FLAG_NORMAL_TEXTURE_BLEND    (1 << 27) #define
   > E3D_SHADER_FLAG_FOG_ENABLED             (1 << 28) -#define
   > E3D_SHADER_FLAG_SHADOWED                (1 << 29) -#define
   > E3D_SHADER_FLAG_COUNT                    30 +#define
   > E3D_SHADER_FLAG_ALPHA_TEST_ENABLED      (1 << 29) +#define
   > E3D_SHADER_FLAG_SHADOWED                (1 << 30) +#define
   > E3D_SHADER_FLAG_COUNT                    31
   >  static inline Eina_Bool
   >  _flags_need_tex_coord(E3D_Shader_Flag flags)
   > @@ -90,6 +91,10 @@ struct _E3D_Draw_Data
   >     Evas_3D_Blend_Func      blend_dfactor;
   >     Eina_Bool               blending : 1;
   >
   > +   Evas_3D_Comparison      alpha_comparison;
   > +   Evas_Real               alpha_ref_value;
   > +   Eina_Bool               alpha_test_enabled :1;
   > +
   >     struct {
   >          Evas_Vec4   position;
   >          Evas_Vec3   spot_dir;
   > diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c
   > b/src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c index
   > f522881..0c8410e 100644 ---
   > a/src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c +++
   > b/src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c @@ -82,6
   > +82,32 @@ _gl_blend_func_get(Evas_3D_Blend_Func blend_func) }
   >  }
   >
   > +static inline GLenum
   > +_gl_comparison_func_get(Evas_3D_Comparison comparison_func)
   > +{
   > +   switch (comparison_func)
   > +     {
   > +      case EVAS_3D_COMPARISON_NEVER:
   > +         return GL_NEVER;
   > +      case EVAS_3D_COMPARISON_LESS:
   > +         return GL_LESS;
   > +      case EVAS_3D_COMPARISON_EQUAL:
   > +         return GL_EQUAL;
   > +      case EVAS_3D_COMPARISON_LEQUAL:
   > +         return GL_LEQUAL;
   > +      case EVAS_3D_COMPARISON_GREATER:
   > +         return GL_GREATER;
   > +      case EVAS_3D_COMPARISON_NOTEQUAL:
   > +         return GL_NOTEQUAL;
   > +      case EVAS_3D_COMPARISON_GEQUAL:
   > +         return GL_GEQUAL;
   > +      case EVAS_3D_COMPARISON_ALWAYS:
   > +         return GL_ALWAYS;
   > +      default:
   > +         return GL_ALWAYS;
   > +     }
   > +}
   > +
   >  static inline void
   >  _renderer_vertex_attrib_array_enable(E3D_Renderer *renderer, int
   > index) {
   > @@ -284,7 +310,6 @@ e3d_renderer_draw(E3D_Renderer *renderer,
   > E3D_Draw_Data *data)
   >     _renderer_program_use(renderer, program);
   >     e3d_program_uniform_upload(program, data);
   > -   if (data->mode != EVAS_3D_SHADE_MODE_SHADOW_MAP_RENDER)
   >     _renderer_texture_bind(renderer, data);
   >
   >     /* Set up vertex attrib pointers. */
   > @@ -323,6 +348,14 @@ e3d_renderer_draw(E3D_Renderer *renderer,
   > E3D_Draw_Data *data) }
   >     else glDisable(GL_BLEND);
   >
   > +   if (data->alpha_test_enabled)
   > +     {
   > +        glEnable(GL_ALPHA_TEST);
   > +        glAlphaFunc(_gl_comparison_func_get(data->alpha_comparison),
   > +                    (GLclampf)data->alpha_ref_value);
   > +     }
   > +   else glDisable(GL_ALPHA_TEST);
   > +
   >     if (data->indices)
   >       {
   >          _renderer_elements_draw(renderer, data->assembly,
   > data->index_count, diff --git
   > a/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c
   > b/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c index
   > 4f8fced..9d858aa 100644 ---
   > a/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c +++
   > b/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c @@ -86,6
   > +86,7 @@ static const char *shader_flag_names[] =
   > "EMISSION_TEXTURE_BLEND", "NORMAL_TEXTURE_BLEND", "FOG_ENABLED",
   > +   "ALPHA_TEST_ENABLED",
   >     "SHADOWED"
   >  };
   >
   > diff --git
   > a/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x
   > b/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x
   > index cae8825..1247673 100644 ---
   > a/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x
   > +++
   > b/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x
   > @@ -1055,6 +1055,18 @@ static const char const shadow_map_vert_glsl[]
   > = "attribute   vec4  aPosition1;\n" "uniform     float
   > uPositionWeight;\n" "#endif //VERTEX_POSITION_BLEND\n"
   > +   "#ifdef ALPHA_TEST_ENABLED\n"
   > +   "#ifdef VERTEX_TEXCOORD\n"
   > +   "attribute   vec4  aTexCoord0;\n"
   > +   "#endif //VERTEX_TEXCOORD\n"
   > +   "#ifdef VERTEX_TEXCOORD_BLEND\n"
   > +   "attribute   vec4  aTexCoord1;\n"
   > +   "uniform     float uTexCoordWeight;\n"
   > +   "#endif //VERTEX_TEXCOORD_BLEND\n"
   > +   "#ifdef NEED_TEX_COORD\n"
   > +   "varying vec2   vTexCoord;\n"
   > +   "#endif //TEX_COORD\n"
   > +   "#endif //ALPHA_TEST_ENABLED\n"
   >     "void main()\n"
   >     "{\n"
   >     "#ifdef VERTEX_POSITION_BLEND\n"
   > @@ -1066,12 +1078,48 @@ static const char const
   > shadow_map_vert_glsl[] = "   vec4 position = vec4(aPosition0.xyz,
   > 1.0);\n" "#endif // VERTEX_POSITION\n"
   >     "#endif //VERTEX_POSITION_BLEND\n"
   > +   "#ifdef ALPHA_TEST_ENABLED\n"
   > +   "#ifdef VERTEX_TEXCOORD_BLEND\n"
   > +   "   vTexCoord = aTexCoord0.st * uTexCoordWeight +\n"
   > +   "   aTexCoord1.st * (1.0 - uTexCoordWeight);\n"
   > +   "#else\n"
   > +   "#ifdef VERTEX_TEXCOORD\n"
   > +   "   vTexCoord = aTexCoord0.st;\n"
   > +   "#endif //VERTEX_TEXCOORD\n"
   > +   "#endif //VERTEX_TEXCOORD_BLEND\n"
   > +   "#endif //ALPHA_TEST_ENABLED\n"
   >     "   gl_Position = uMatrixMvp * position;\n"
   >     "}\n";
   >
   >  static const char const shadow_map_frag_glsl[] =
   > -   "void main()\n"
   > -   "{\n"
   > +   "#ifdef ALPHA_TEST_ENABLED\n"
   > +   "#ifdef NEED_TEX_COORD\n"
   > +   "varying vec2   vTexCoord;\n"
   > +   "#endif //TEX_COORD\n"
   > +   "#ifdef DIFFUSE\n"
   > +   "#ifdef DIFFUSE_TEXTURE\n"
   > +   "uniform sampler2D  uTextureDiffuse0;\n"
   > +   "#endif //DIFFUSE_TEXTURE\n"
   > +   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
   > +   "uniform sampler2D  uTextureDiffuse1;\n"
   > +   "uniform float      uTextureDiffuseWeight;\n"
   > +   "#endif //DIFFUSE_TEXTURE_BLEND\n"
   > +   "#endif //DIFFUSE\n"
   > +   "#endif //ALPHA_TEST_ENABLED\n"
   > +   "void main() {\n"
   > +   "#ifdef ALPHA_TEST_ENABLED\n"
   > +   "#ifdef DIFFUSE_TEXTURE_BLEND\n"
   > +   "   gl_FragColor = (texture2D(uTextureDiffuse0, vTexCoord) *\n"
   > +   "   uTextureDiffuseWeight + texture2D(uTextureDiffuse1,
   > vTexCoord) *\n"
   > +   "   (1.0 - uTextureDiffuseWeight));\n"
   > +   "#else\n"
   > +   "#ifdef DIFFUSE_TEXTURE\n"
   > +   "   gl_FragColor = texture2D(uTextureDiffuse0, vTexCoord) ;\n"
   > +   "#else\n"
   > +   "   gl_FragColor = vec4(1);\n"
   > +   "#endif //DIFFUSE_TEXTURE\n"
   > +   "#endif //DIFFUSE_TEXTURE_BLEND\n"
   > +   "#endif //ALPHA_TEST_ENABLED\n"
   >     "   gl_FragColor.r = gl_FragCoord.z;\n"
   >     "}\n";
   >
   > diff --git
   > a/src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd
   > b/src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd
   > index 84a586a..6bfbcc7 100644 ---
   > a/src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd
   > +++
   > b/src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd @@
   > -1,4 +1,43 @@ -void main() -{ +#ifdef ALPHA_TEST_ENABLED
   > +
   > +#ifdef NEED_TEX_COORD
   > +varying vec2   vTexCoord;
   > +#endif //TEX_COORD
   > +
   > +#ifdef DIFFUSE
   > +
   > +#ifdef DIFFUSE_TEXTURE
   > +uniform sampler2D  uTextureDiffuse0;
   > +#endif //DIFFUSE_TEXTURE
   > +
   > +#ifdef DIFFUSE_TEXTURE_BLEND
   > +uniform sampler2D  uTextureDiffuse1;
   > +uniform float      uTextureDiffuseWeight;
   > +#endif //DIFFUSE_TEXTURE_BLEND
   > +
   > +#endif //DIFFUSE
   > +
   > +#endif //ALPHA_TEST_ENABLED
   > +
   > +void main() {
   > +
   > +#ifdef ALPHA_TEST_ENABLED
   > +
   > +#ifdef DIFFUSE_TEXTURE_BLEND
   > +   gl_FragColor = (texture2D(uTextureDiffuse0, vTexCoord) *
   > +   uTextureDiffuseWeight + texture2D(uTextureDiffuse1, vTexCoord) *
   > +   (1.0 - uTextureDiffuseWeight));
   > +#else
   > +
   > +#ifdef DIFFUSE_TEXTURE
   > +   gl_FragColor = texture2D(uTextureDiffuse0, vTexCoord) ;
   > +#else
   > +   gl_FragColor = vec4(1);
   > +#endif //DIFFUSE_TEXTURE
   > +
   > +#endif //DIFFUSE_TEXTURE_BLEND
   > +
   > +#endif //ALPHA_TEST_ENABLED
   > +
   >     gl_FragColor.r = gl_FragCoord.z;
   >  }
   > diff --git
   > a/src/modules/evas/engines/gl_common/shader_3d/shadow_map_vert.shd
   > b/src/modules/evas/engines/gl_common/shader_3d/shadow_map_vert.shd
   > index 3f12a69..be92999 100644 ---
   > a/src/modules/evas/engines/gl_common/shader_3d/shadow_map_vert.shd
   > +++
   > b/src/modules/evas/engines/gl_common/shader_3d/shadow_map_vert.shd @@
   > -9,6 +9,23 @@ attribute   vec4  aPosition1; uniform     float
   > uPositionWeight; #endif //VERTEX_POSITION_BLEND +#ifdef
   > ALPHA_TEST_ENABLED +
   > +#ifdef VERTEX_TEXCOORD
   > +attribute   vec4  aTexCoord0;
   > +#endif //VERTEX_TEXCOORD
   > +
   > +#ifdef VERTEX_TEXCOORD_BLEND
   > +attribute   vec4  aTexCoord1;
   > +uniform     float uTexCoordWeight;
   > +#endif //VERTEX_TEXCOORD_BLEND
   > +
   > +#ifdef NEED_TEX_COORD
   > +varying vec2   vTexCoord;
   > +#endif //TEX_COORD
   > +
   > +#endif //ALPHA_TEST_ENABLED
   > +
   >  void main()
   >  {
   >
   > @@ -24,5 +41,20 @@ void main()
   >
   >  #endif //VERTEX_POSITION_BLEND
   >
   > +#ifdef ALPHA_TEST_ENABLED
   > +
   > +#ifdef VERTEX_TEXCOORD_BLEND
   > +   vTexCoord = aTexCoord0.st * uTexCoordWeight +
   > +   aTexCoord1.st * (1.0 - uTexCoordWeight);
   > +#else
   > +
   > +#ifdef VERTEX_TEXCOORD
   > +   vTexCoord = aTexCoord0.st;
   > +#endif //VERTEX_TEXCOORD
   > +
   > +#endif //VERTEX_TEXCOORD_BLEND
   > +
   > +#endif //ALPHA_TEST_ENABLED
   > +
   >     gl_Position = uMatrixMvp * position;
   >  }
   >
   ----------------------------------------------------------------------------
   --
   Dive  into  the World of Parallel Programming The Go Parallel Website,
   sponsored
   by Intel and developed in partnership with Slashdot Media, is your hub for
   all
   things parallel software development, from weekly thought leadership blogs
   to
   news, videos, case studies, tutorials and more. Take a look and join the
   conversation now. http://goparallel.sourceforge.net/
   _______________________________________________
   enlightenment-devel mailing list
   enlightenment-devel@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


   With best regards,

   Oleksander Shcherbina

   SRK-Tizen Platform Lab

   Samsung Ukraine R&D Institute

   57 L'va Tolstogo Str., Kyiv 01032, Ukraine

   Mob.: +380 (66) 1297544

   o.shcherb...@samsung.com




   [cid:T9SZN3WZA6X7@namo.co.kr]

   [SeenTimeChecker?do=66776f433ea48075717d8c8e6484d724418915c6ebee336628d6023d
   ffbae032ba777c355c197185c465c2cf80a2b7ef9aba4bb3b2b5ca43ddd7e184e0604d958075
   b6b33f32d245be7a12499853ada082afa00ff4b36e9acf878f9a26ce15a0]
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to