[EGIT] [core/efl] master 01/01: evas: Fix possible crash in evas_model_save_eet.c

2016-09-13 Thread Oleksandr Shcherbina
hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ce1f1c9ebee84a8dcc9887e8797756c392e7235e

commit ce1f1c9ebee84a8dcc9887e8797756c392e7235e
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Tue Sep 13 15:17:53 2016 +0900

evas: Fix possible crash in evas_model_save_eet.c

Summary: @fix

Reviewers: cedric, raster, Hermet

Reviewed By: Hermet

Subscribers: artem.popov, jpeg

Differential Revision: https://phab.enlightenment.org/D4293
---
 src/modules/evas/model_savers/eet/evas_model_save_eet.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/modules/evas/model_savers/eet/evas_model_save_eet.c 
b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
index 23b396d..a5878dc 100644
--- a/src/modules/evas/model_savers/eet/evas_model_save_eet.c
+++ b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
@@ -161,6 +161,14 @@ evas_model_save_file_eet(const Evas_Canvas3D_Mesh *mesh,
 
eet_file = _evas_canvas3d_eet_file_new();
 
+   if (!eet_file)
+ {
+free(eet_mesh);
+free(eet_header);
+eet_shutdown();
+return;
+ }
+
eet_mesh->materials_count = 1;
eet_header->materials_count = 1;
eet_mesh->frames_count = 1;

-- 




[EGIT] [core/efl] master 02/11: evas: avoid calculation bounding for camera and light objects

2016-06-23 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=71c1481e57a510faaed6da54a07277cc5c7d1d50

commit 71c1481e57a510faaed6da54a07277cc5c7d1d50
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Wed Jun 22 16:53:47 2016 -0700

evas: avoid calculation bounding for camera and light objects

Summary:
Including camera and light to calculation aabb can lead to confusing in 
detemination
bounding of the whole scene (root node).
@fix

Reviewers: cedric, Hermet, raster

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4060

Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/evas/canvas/evas_canvas3d_node.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_canvas3d_node.c 
b/src/lib/evas/canvas/evas_canvas3d_node.c
index d454885..31963a2 100644
--- a/src/lib/evas/canvas/evas_canvas3d_node.c
+++ b/src/lib/evas/canvas/evas_canvas3d_node.c
@@ -501,7 +501,9 @@ node_aabb_update(Evas_Canvas3D_Node *node, void *data 
EINA_UNUSED)
Eina_List *current;
Evas_Canvas3D_Node *datanode;
const Eo_Event_Description *eo_desc = NULL;
-
+   if (pd->type != EVAS_CANVAS3D_NODE_TYPE_MESH &&
+   pd->type != EVAS_CANVAS3D_NODE_TYPE_NODE)
+ return EINA_TRUE;
_update_node_shapes(node);
EINA_LIST_FOREACH(pd->members, current, datanode)
  {

-- 




[EGIT] [core/efl] master 01/01: examples: evas3d: fix out of range array

2016-06-21 Thread Oleksandr Shcherbina
stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f5c37f6930ce5e85e79fedaeee7c220e0a19d695

commit f5c37f6930ce5e85e79fedaeee7c220e0a19d695
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Tue Jun 21 17:40:27 2016 +0200

examples: evas3d: fix out of range array

Missing parenthesis have been leading to an out of bound access here.

Summary: @fix

Reviewers: stefan_schmidt

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4069
---
 src/examples/evas/shooter/evas-3d-shooter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/examples/evas/shooter/evas-3d-shooter.c 
b/src/examples/evas/shooter/evas-3d-shooter.c
index 9dbf01e..21eafe4 100644
--- a/src/examples/evas/shooter/evas-3d-shooter.c
+++ b/src/examples/evas/shooter/evas-3d-shooter.c
@@ -1091,9 +1091,10 @@ _scene_setup(Scene_Data *data)
evas_canvas3d_node_member_add(data->root_node, data->mesh_node_snake);
 
for (i = 0; i < 4; i++)
+ {
 evas_canvas3d_node_member_add(data->root_node, 
data->mesh_node_wall[i]);
 evas_canvas3d_node_member_add(data->root_node, 
data->mesh_node_column[i]);
-
+ }
for (i = 0; i < 10; i++)
 evas_canvas3d_node_member_add(data->root_node, 
data->mesh_node_level[i]);
 }

-- 




[EGIT] [core/efl] master 04/06: evas: fix possible memory leaks in e3d_drawable_texture_rendered_pixels_get

2016-06-08 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=32d1f4b2e5bbdbb3a6bd0f391cf28a7c6ad382dd

commit 32d1f4b2e5bbdbb3a6bd0f391cf28a7c6ad382dd
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Wed Jun 8 13:58:28 2016 -0700

evas: fix possible memory leaks in e3d_drawable_texture_rendered_pixels_get

Summary:
@fix
CID: 1356243, 1356242, 1356242, 1356242

Reviewers: cedric, Hermet, raster

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4011

Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/modules/evas/engines/gl_common/evas_gl_3d.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 404750a..bb99434 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_3d.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_3d.c
@@ -1460,6 +1460,8 @@ e3d_drawable_texture_rendered_pixels_get(GLuint tex 
EINA_UNUSED, int x, int y, i
if (!datarowup || !datarowlow)
  {
 ERR("Not enough memory");
+if (datarowup) free(datarowup);
+if (datarowlow) free(datarowlow);
 return;
  }
for (j = 0; j < h / 2; j++)
@@ -1467,7 +1469,7 @@ e3d_drawable_texture_rendered_pixels_get(GLuint tex 
EINA_UNUSED, int x, int y, i
 bellow = h * w - width;
 up = w + width;
 
-for (i = w; i >= 0; i--)
+for (i = w - 1; i >= 0; i--)
   {
  pixel = buffer[bellow];
  datarowlow[i] = ((pixel & 0x00ff) << 16) +

-- 




[EGIT] [core/efl] master 03/07: evas: fix typo in description of the engine functions.

2016-06-06 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e3eb246e2ca87568453d03e611975d4c53d4efa5

commit e3eb246e2ca87568453d03e611975d4c53d4efa5
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Mon Jun 6 16:40:23 2016 -0700

evas: fix typo in description of the engine functions.

Reviewers: Hermet, raster, cedric

Reviewed By: cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4010

Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/modules/evas/engines/software_generic/evas_engine.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/evas/engines/software_generic/evas_engine.c 
b/src/modules/evas/engines/software_generic/evas_engine.c
index 399430c..4259ba1 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -4524,9 +4524,9 @@ static Evas_Func func =
  NULL, // eng_drawable_scene_render
  NULL, // eng_drawable_scene_render_to_texture
  NULL, // eng_drawable_texture_color_pick_id_get
- NULL, // end_drawable_texture_target_id_get
+ NULL, // eng_drawable_texture_target_id_get
  NULL, // eng_drawable_texture_pixel_color_get
- NULL, // end_drawable_texture_rendered_pixels_get
+ NULL, // eng_drawable_texture_rendered_pixels_get
  NULL, // eng_texture_new
  NULL, // eng_texture_free
  NULL, // eng_texture_size_get

-- 




[EGIT] [core/efl] master 02/07: evas: fix order binding attributes to gl.

2016-06-06 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6c580faad9712c15344c7531c11b6e0c4b5c822b

commit 6c580faad9712c15344c7531c11b6e0c4b5c822b
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Mon Jun 6 16:39:38 2016 -0700

evas: fix order binding attributes to gl.

Summary:
In same cases(devices) can lead to mix up attributes in shaders.
@fix

Reviewers: cedric, Hermet, raster

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4012

Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 .../evas/engines/gl_common/evas_gl_3d_shader.c | 74 +++---
 1 file changed, 37 insertions(+), 37 deletions(-)

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 7fef490..0ead38a 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
@@ -216,6 +216,42 @@ _shader_compile(GLuint shader, const char *src)
return EINA_TRUE;
 }
 
+static inline void
+_program_vertex_attrib_bind(E3D_Program *program)
+{
+   GLint index = 0;
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION)
+ glBindAttribLocation(program->prog, index++, "aPosition0");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION_BLEND)
+ glBindAttribLocation(program->prog, index++, "aPosition1");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL)
+ glBindAttribLocation(program->prog, index++, "aNormal0");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL_BLEND)
+ glBindAttribLocation(program->prog, index++, "aNormal1");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT)
+ glBindAttribLocation(program->prog, index++, "aTangent0");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT_BLEND)
+ glBindAttribLocation(program->prog, index++, "aTangent1");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR)
+ glBindAttribLocation(program->prog, index++, "aColor0");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR_BLEND)
+ glBindAttribLocation(program->prog, index++, "aColor1");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD)
+ glBindAttribLocation(program->prog, index++, "aTexCoord0");
+
+   if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD_BLEND)
+ glBindAttribLocation(program->prog, index++, "aTexCoord1");
+}
+
 static inline Eina_Bool
 _program_build(E3D_Program *program, const char *vert_src, const char 
*frag_src)
 {
@@ -246,6 +282,7 @@ _program_build(E3D_Program *program, const char *vert_src, 
const char *frag_src)
glAttachShader(program->prog, program->vert);
glAttachShader(program->prog, program->frag);
 
+   _program_vertex_attrib_bind(program);
/* Link program. */
glLinkProgram(program->prog);
 
@@ -269,42 +306,6 @@ _program_build(E3D_Program *program, const char *vert_src, 
const char *frag_src)
return EINA_TRUE;
 }
 
-static inline void
-_program_vertex_attrib_bind(E3D_Program *program)
-{
-   GLint index = 0;
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION)
- glBindAttribLocation(program->prog, index++, "aPosition0");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION_BLEND)
- glBindAttribLocation(program->prog, index++, "aPosition1");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL)
- glBindAttribLocation(program->prog, index++, "aNormal0");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL_BLEND)
- glBindAttribLocation(program->prog, index++, "aNormal1");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT)
- glBindAttribLocation(program->prog, index++, "aTangent0");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT_BLEND)
- glBindAttribLocation(program->prog, index++, "aTangent1");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR)
- glBindAttribLocation(program->prog, index++, "aColor0");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR_BLEND)
- glBindAttribLocation(program->prog, index++, "aColor1");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD)
- glBindAttribLocation(program->prog, index++, "aTexCoord0");
-
-   if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD_BLEND)
- glBindAttribLocation(program->prog, index++, "aTexCoord1");
-}
-
 static const char *uniform_names[] =
 {
"uMatrixMvp",
@@ -696,7 +697,6 @@ e3d_program_new(Evas_Canvas3D_Shader_Mode mode, 
E3D_Shader_Flag flags)
if (! _program_build(program, vert.str, frag.str))
  goto error;
 
-   _program_vertex_attrib_bind(program);
_program_uniform_init(program);
 
_shader_string_fini();

-- 




[EGIT] [core/efl] master 01/01: evas: Get pixels from rendered 3D scene

2016-06-03 Thread Oleksandr Shcherbina
nikawhite pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7e0601c98027a710e273fc2abe1dc2278a54a093

commit 7e0601c98027a710e273fc2abe1dc2278a54a093
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Fri Jun 3 14:22:33 2016 +0300

evas: Get pixels from rendered 3D scene

Summary:
Implemented interface Efl.Gfx.Buffer functions bufer_map/unmap for 
Efl.Canvas3D.Scene.
Added function e3d_drawable_texture_rendered_pixels_get to module evas_gl_3d
to getting pixels from FBO. Added wrappers for functions
e3d_drawable_texture_rendered_pixels_get and e3d_drawable_texture_id_get
to have possibility call it through engine functions.

Reviewers: cedric, Hermet, raster, jpeg

Reviewed By: jpeg

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3978
---
 src/lib/evas/canvas/efl_canvas_scene3d.c   | 73 ++
 src/lib/evas/canvas/efl_canvas_scene3d.eo  |  6 +-
 src/lib/evas/include/evas_private.h|  3 +-
 src/modules/evas/engines/gl_common/evas_gl_3d.c| 47 ++
 .../evas/engines/gl_common/evas_gl_3d_common.h |  5 +-
 src/modules/evas/engines/gl_generic/evas_engine.c  | 15 -
 .../evas/engines/software_generic/evas_engine.c|  2 +
 7 files changed, 146 insertions(+), 5 deletions(-)

diff --git a/src/lib/evas/canvas/efl_canvas_scene3d.c 
b/src/lib/evas/canvas/efl_canvas_scene3d.c
index d0623fe..c8ce097 100644
--- a/src/lib/evas/canvas/efl_canvas_scene3d.c
+++ b/src/lib/evas/canvas/efl_canvas_scene3d.c
@@ -208,4 +208,77 @@ _evas_image_3d_unset(Evas_Object *eo_obj EINA_UNUSED, 
Evas_Object_Protected_Data
EINA_COW_WRITE_END(evas_object_3d_cow, obj->data_3d, data);
 }
 
+EOLIAN static void *
+_efl_canvas_scene3d_efl_gfx_buffer_buffer_map(Eo *eo_obj, void *_pd 
EINA_UNUSED,
+int *length EINA_UNUSED,
+Efl_Gfx_Buffer_Access_Mode mode,
+int x, int y, int w, int h,
+Efl_Gfx_Colorspace cspace, int 
*stride EINA_UNUSED)
+{
+   Evas_Image_Data *o = eo_data_scope_get(eo_obj, EVAS_IMAGE_CLASS);
+   Evas_Public_Data *e;
+   Evas_Canvas3D_Object_Data *pd_parent;
+   Evas_Canvas3D_Scene_Data *pd_scene;
+   int width = -1, height = -1, ntex = -1;
+   unsigned char *pixels = NULL;
+
+   if (!o->cur->scene)
+ {
+ERR("invalid scene data");
+return NULL;
+ }
+   if (mode & EFL_GFX_BUFFER_ACCESS_MODE_WRITE)
+ {
+ERR("invalid map access mode");
+return NULL;
+ }
+   if (cspace != EFL_GFX_COLORSPACE_ARGB)
+ {
+ERR("invalid map colorspace. Only ARGB is supported");
+return NULL;
+ }
+
+   pd_parent = eo_data_scope_get(o->cur->scene, EVAS_CANVAS3D_OBJECT_CLASS);
+   e = eo_data_scope_get(pd_parent->evas, EVAS_CANVAS_CLASS);
+   pd_scene = eo_data_scope_get(o->cur->scene, EVAS_CANVAS3D_SCENE_CLASS);
+
+   if (e->engine.func->drawable_size_get)
+  {
+ e->engine.func->drawable_size_get(e->engine.data.output,
+   pd_scene->surface, , );
+  }
+
+   if ((x < 0) || (y < 0) || ((x + w) > width) || ((y + h) > height))
+ {
+ERR("Invalid map dimensions : %dx%d +%d,%d. Image is %dx%d.",
+w, h, x, y, width, height);
+return NULL;
+ }
+
+   if (e->engine.func->drawable_texture_target_id_get)
+ {
+ntex = 
e->engine.func->drawable_texture_target_id_get(pd_scene->surface);
+
+if (e->engine.func->drawable_texture_rendered_pixels_get)
+  {
+ pixels = malloc(w * h * sizeof(DATA32)); //four component texture
+ e->engine.func->drawable_texture_rendered_pixels_get(ntex, x, y, 
w, h,
+  
pd_scene->surface, pixels);
+  }
+else
+  return NULL;
+ }
+   else
+ return NULL;
+
+   return pixels;
+}
+EOLIAN static Eina_Bool
+_efl_canvas_scene3d_efl_gfx_buffer_buffer_unmap(Eo *eo_obj EINA_UNUSED, void 
*_pd EINA_UNUSED,
+void *data, int length 
EINA_UNUSED)
+{
+   free(data);
+   return EINA_TRUE;
+}
+
 #include "efl_canvas_scene3d.eo.c"
diff --git a/src/lib/evas/canvas/efl_canvas_scene3d.eo 
b/src/lib/evas/canvas/efl_canvas_scene3d.eo
index b157587..4df2239 100644
--- a/src/lib/evas/canvas/efl_canvas_scene3d.eo
+++ b/src/lib/evas/canvas/efl_canvas_scene3d.eo
@@ -1,4 +1,4 @@
-class Efl.Canvas.Scene3d (Evas.Image)
+class Efl.Canvas.Scene3d (Evas.Image, Efl.Gfx.Buffer)
 {
[[A UI view for EFL Canvas 3D.]]
data: null;
@@ -15,4 +15,8 @@ class Efl.Canvas.Scene3d (Evas.Image)
  }

[EGIT] [core/efl] master 05/07: evas: avoid useless manipulation during pick object from scene in Evas.Canvas3d

2016-05-31 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=c6ce60c44efbff98b396847472588930d25c066b

commit c6ce60c44efbff98b396847472588930d25c066b
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Tue May 31 14:40:04 2016 -0700

evas: avoid useless manipulation during pick object from scene in 
Evas.Canvas3d

Summary:
It is logically break cycle in case object is found. In case need pick all 
objects
that lay in screen ray, we should use 
evas_canvas3d_scene_pick_member_list_get
function.

Reviewers: Hermet, raster, cedric

Reviewed By: cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3975

Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/evas/canvas/evas_canvas3d_scene.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/lib/evas/canvas/evas_canvas3d_scene.c 
b/src/lib/evas/canvas/evas_canvas3d_scene.c
index 5800bce..97c67a3 100644
--- a/src/lib/evas/canvas/evas_canvas3d_scene.c
+++ b/src/lib/evas/canvas/evas_canvas3d_scene.c
@@ -282,7 +282,7 @@ _pick_data_texcoord_update(Evas_Canvas3D_Pick_Data *data,
 }
 
 
-static inline void
+static inline Eina_Bool
 _pick_data_mesh_add(Evas_Canvas3D_Pick_Data *data, const Evas_Ray3 *ray,
 Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Node 
*node)
 {
@@ -333,6 +333,7 @@ _pick_data_mesh_add(Evas_Canvas3D_Pick_Data *data, const 
Evas_Ray3 *ray,
  _pick_data_texcoord_update(data, , , 
tex_weight, i0, i1, i2);
data->mesh = mesh;
data->node = node;
+   return EINA_TRUE;
 }
}
   }
@@ -381,6 +382,7 @@ _pick_data_mesh_add(Evas_Canvas3D_Pick_Data *data, const 
Evas_Ray3 *ray,
  _pick_data_texcoord_update(data, , , 
tex_weight, i0, i1, i2);
data->mesh = mesh;
data->node = node;
+   return EINA_TRUE;
 }
}
   }
@@ -524,6 +526,7 @@ _pick_data_mesh_add(Evas_Canvas3D_Pick_Data *data, const 
Evas_Ray3 *ray,
 _pick_data_texcoord_update(data, , , 
tex_weight, i, i + 1, i + 2);
data->mesh = mesh;
data->node = node;
+   return EINA_TRUE;
 }
}
   }
@@ -544,10 +547,12 @@ _pick_data_mesh_add(Evas_Canvas3D_Pick_Data *data, const 
Evas_Ray3 *ray,
  _pick_data_texcoord_update(data, , , 
tex_weight, 0, i, i + 1);
data->mesh = mesh;
data->node = node;
+   return EINA_TRUE;
 }
}
   }
  }
+   return EINA_FALSE;
 }
 
 Eina_Bool
@@ -581,7 +586,8 @@ _node_pick(Evas_Canvas3D_Node *node, void *data)
 while (eina_iterator_next(itr, ))
   {
  Evas_Canvas3D_Node_Mesh *nm = (Evas_Canvas3D_Node_Mesh *)ptr;
- _pick_data_mesh_add(pick, , nm->mesh, nm->frame, node);
+ if(_pick_data_mesh_add(pick, , nm->mesh, nm->frame, node))
+   break;
   }
  }
 

-- 




[EGIT] [core/efl] master 06/07: evas: fix recalculation coordinates for pick object from scene in Evas.Canvas3d

2016-05-31 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=b43a7f51879ec86d959784e898857b95c8c24ce3

commit b43a7f51879ec86d959784e898857b95c8c24ce3
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Tue May 31 14:42:11 2016 -0700

evas: fix recalculation coordinates for pick object from scene in 
Evas.Canvas3d

Summary:
We did the same for evas_canvas3d_scene_pick(see 
c850cc0d80b754be851576083eba27a72b58b9f2),
but forget for evas_canvas3d_scene_exist.

Reviewers: Hermet, raster, cedric

Reviewed By: cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3973

Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/evas/canvas/evas_canvas3d_scene.c | 36 ---
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/lib/evas/canvas/evas_canvas3d_scene.c 
b/src/lib/evas/canvas/evas_canvas3d_scene.c
index 97c67a3..8d980f3 100644
--- a/src/lib/evas/canvas/evas_canvas3d_scene.c
+++ b/src/lib/evas/canvas/evas_canvas3d_scene.c
@@ -599,6 +599,19 @@ static void _node_mesh_colors_free_cb(void *data)
if (data) free(data);
 }
 
+static inline void
+_pick_data_init(Evas_Canvas3D_Pick_Data *data, Evas_Public_Data *e, Evas_Real 
x, Evas_Real y)
+{
+   data->x  = ((x * 2.0) / ((Evas_Real)e->viewport.w)) - 1.0;
+   data->y  = Evas_Real)e->viewport.h - y - 1) * 2.0) / 
((Evas_Real)e->viewport.h)) - 1.0;
+   data->picked = EINA_FALSE;
+   data->z  = 1.0;
+   data->node   = NULL;
+   data->mesh   = NULL;
+   data->s  = 0.0;
+   data->t  = 0.0;
+}
+
 EOLIAN static Eina_Bool
 _evas_canvas3d_scene_pick(const Eo *obj, Evas_Canvas3D_Scene_Data *pd, 
Evas_Real x, Evas_Real y,
 Evas_Canvas3D_Node **node, Evas_Canvas3D_Mesh **mesh,
@@ -620,15 +633,7 @@ _evas_canvas3d_scene_pick(const Eo *obj, 
Evas_Canvas3D_Scene_Data *pd, Evas_Real
pd_parent = eo_data_scope_get(obj, EVAS_CANVAS3D_OBJECT_CLASS);
e = eo_data_scope_get(pd_parent->evas, EVAS_CANVAS_CLASS);
 
-   data.x  = ((x * 2.0) / ((Evas_Real)e->viewport.w)) - 1.0;
-   data.y  = Evas_Real)e->viewport.h - y - 1) * 2.0) / 
((Evas_Real)e->viewport.h)) - 1.0;
-   data.picked = EINA_FALSE;
-   data.z  = 1.0;
-   data.node   = NULL;
-   data.mesh   = NULL;
-   data.s  = 0.0;
-   data.t  = 0.0;
-
+   _pick_data_init(, e, x, y);
px = round(x * pd->w / e->viewport.w);
py = round((pd->h - (y * pd->h / e->viewport.h) - 1));
 
@@ -732,16 +737,13 @@ _evas_canvas3d_scene_exist(const Eo *obj, 
Evas_Canvas3D_Scene_Data *pd, Evas_Rea
Evas_Canvas3D_Pick_Data data;
Evas_Canvas3D_Node_Data *pd_camera_node;
Evas_Canvas3D_Camera_Data *pd_camera;
+   Evas_Canvas3D_Object_Data *pd_parent;
+   Evas_Public_Data *e;
 
-   data.x  = ((x * 2.0) / (Evas_Real)pd->w) - 1.0;
-   data.y  = Evas_Real)pd->h - y - 1.0) * 2.0) / ((Evas_Real)pd->h)) - 
1.0;
+   pd_parent = eo_data_scope_get(obj, EVAS_CANVAS3D_OBJECT_CLASS);
+   e = eo_data_scope_get(pd_parent->evas, EVAS_CANVAS_CLASS);
 
-   data.picked = EINA_FALSE;
-   data.z  = 1.0;
-   data.node   = NULL;
-   data.mesh   = NULL;
-   data.s  = 0.0;
-   data.t  = 0.0;
+   _pick_data_init(, e, x, y);
 
/* Update the scene graph. */
evas_canvas3d_object_update((Eo *) obj);

-- 




[EGIT] [core/efl] master 01/01: Revert Evas 3D: Fix shadow map shader

2015-04-05 Thread Oleksandr Shcherbina
hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e2f11bf4cb82ed2264a90da4bde31688e3d7b12f

commit e2f11bf4cb82ed2264a90da4bde31688e3d7b12f
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Mon Apr 6 10:45:42 2015 +0900

Revert Evas 3D: Fix shadow map shader

Summary:
This reverts commit 4af7a947a6fe1834d3fb5a8af3cd73196d237f74.
There is more convenient way remove noise in vector gl_Fragcolor at 
shadow_map
shader, because current decision lead to useless issue with shadow effect.
Need just add default initialize at the begining in shader file smth like 
that
gl_FragColor = vec4(1);
I suppose do that after this patch.

Reviewers: cedric, raster, Hermet

Reviewed By: Hermet

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2290
---
 src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x | 2 +-
 src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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 2987ff3..eaf7ece 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
@@ -1188,7 +1188,7 @@ static const char const shadow_map_frag_glsl[] =
#endif //DIFFUSE_TEXTURE\n
#endif //DIFFUSE_TEXTURE_BLEND\n
#endif //ALPHA_TEST_ENABLED\n
-  gl_FragColor = vec4(gl_FragCoord.z);\n
+  gl_FragColor.r = gl_FragCoord.z;\n
}\n;
 
 static const char const color_pick_vert_glsl[] =
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 babc448..66a88ad 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
@@ -36,5 +36,5 @@ void main() {
 
 #endif //ALPHA_TEST_ENABLED
 
-   gl_FragColor = vec4(gl_FragCoord.z);
+   gl_FragColor.r = gl_FragCoord.z;
 }

-- 




[EGIT] [core/efl] master 01/01: [evas/evas_3D] Billboard mechanism

2015-04-05 Thread Oleksandr Shcherbina
hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=bc8dfbb1ef88127f61a86d4a8719e33275fb4629

commit bc8dfbb1ef88127f61a86d4a8719e33275fb4629
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Mon Apr 6 14:10:28 2015 +0900

[evas/evas_3D] Billboard mechanism

Summary:
Add pointer to target billboard node in Evas_3D_Node
Skip set flags change orientation for billboard node
Add method node_billboard_update to use it for change orientation during 
traverse
by nodes
Split API evas_3d_node_look_at_set to have possibility change orientation 
of node
without set flags

Reviewers: cedric, Hermet

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2245
---
 src/examples/evas/Makefile.am|   1 +
 src/examples/evas/evas-3d-shadows.c  | 150 ---
 src/examples/evas/resources/images/billboard.png | Bin 0 - 26403 bytes
 src/lib/evas/Evas_Eo.h   |   1 +
 src/lib/evas/canvas/evas_3d_node.c   | 179 ---
 src/lib/evas/canvas/evas_3d_node.eo  |  29 
 src/lib/evas/include/evas_private.h  |   1 +
 7 files changed, 285 insertions(+), 76 deletions(-)

diff --git a/src/examples/evas/Makefile.am b/src/examples/evas/Makefile.am
index 0218472..6a47303 100644
--- a/src/examples/evas/Makefile.am
+++ b/src/examples/evas/Makefile.am
@@ -359,6 +359,7 @@ resources/images/four_NM_height.tga \
 resources/images/rocks_NM_height.tga \
 resources/images/grid.png \
 resources/images/grid_n.png \
+resources/images/billboard.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 c1eb087..701a474 100644
--- a/src/examples/evas/evas-3d-shadows.c
+++ b/src/examples/evas/evas-3d-shadows.c
@@ -1,9 +1,11 @@
 /**
- * This example illustrating use of shadows in the scene and 
callbacks(clicked, collision).
+ * This example illustrating use of shadows, callbacks(clicked, collision),
+ * and technic of the billboard.
  * Model and cube are clickable. Model detects collision with sphere.
  * Cube detects collision with sphere, model and cone.
  * @see evas_3d_scene_shadows_enable_set(Eina_Bool _shadows_enabled)
  * @see evas_3d_object_callback_register
+ * @see evas_3d_billboard_set/get
  *
  * @verbatim
  * 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
@@ -37,7 +39,8 @@
 #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 char *b_image_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER 
/billboard.png;
 static const vec2 tex_scale = {1, 1};
 static const vec2 fence_tex_scale = {80, 6};
 
@@ -89,6 +92,7 @@ typedef struct _Body_3D
Eo *material;
Eo *mesh;
Eo *node;
+   Eo *texture;
 } Body_3D;
 
 typedef struct _Scene_Data
@@ -99,6 +103,7 @@ typedef struct _Scene_Data
Eo *camera;
Eo *light_node;
Eo *light;
+   Eo *mediator;
 
Body_3D sphere;
Body_3D cube;
@@ -107,6 +112,9 @@ typedef struct _Scene_Data
Body_3D model;
Body_3D cone;
Body_3D fence;
+   Body_3D billboard;
+
+   Eina_Bool   init;
 } Scene_Data;
 
 static void
@@ -114,23 +122,37 @@ _show_help()
 {
fprintf(stdout, Press 'w'/'s' key to move up/down object\n);
fprintf(stdout, Press 'a'/'d' key to move left/right object\n);
-   fprintf(stdout, Press 'q'/'e' key to to move near/far object\n);
+   fprintf(stdout, Press 'q'/'e' key to move near/far object\n);
fprintf(stdout, Cude and model can be moved.\n);
fprintf(stdout, Cube detects intersection with model, sphere, cone\n);
fprintf(stdout, Model detects intersection with sphere\n);
+   fprintf(stdout, Press '1'/'2' key to change kind of node - 
billboard/normal model\n);
+   fprintf(stdout, Press Up/Down key to change position of camera\n);
+   fprintf(stdout, Press 'i' key to return initial view of scene\n);
 }
 
 static Eina_Bool
 _animate_scene(void *data)
 {
-   static int frame = 0;
-   Body_3D *body = (Body_3D *)data;
-
-   eo_do(body-node, evas_3d_node_mesh_frame_set(body-mesh, frame));
-
-   /*frame += 32;*/
-
-   if (frame  256 * 20) frame = 0;
+   static float angle = 0;
+   Evas_Real x, y, z;
+   Scene_Data *scene = (Scene_Data *)data;
+   if (scene-init)
+ {
+eo_do(scene-mediator,
+  evas_3d_node_position_get(EVAS_3D_SPACE_PARENT, x, y, z));
+eo_do(scene-mediator,
+  evas_3d_node_position_set(sin(angle) * 20 , y , cos(angle) * 20),
+  evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 3.0, 0.0

[EGIT] [core/efl] master 01/01: Evas 3D: Fix shadow map shader

2015-03-30 Thread Oleksandr Shcherbina
jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=4af7a947a6fe1834d3fb5a8af3cd73196d237f74

commit 4af7a947a6fe1834d3fb5a8af3cd73196d237f74
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Tue Mar 31 08:34:32 2015 +0900

Evas 3D: Fix shadow map shader

Summary:
Silly mistake after this b9b5ced501f4642f03d8bcc8441fd3f7b55a7f52 commit.
Seems uninitialized components of vector gl_FragColor

Reviewers: cedric, Hermet, jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2258
---
 src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x | 2 +-
 src/modules/evas/engines/gl_common/shader_3d/shadow_map_frag.shd  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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 eaf7ece..2987ff3 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
@@ -1188,7 +1188,7 @@ static const char const shadow_map_frag_glsl[] =
#endif //DIFFUSE_TEXTURE\n
#endif //DIFFUSE_TEXTURE_BLEND\n
#endif //ALPHA_TEST_ENABLED\n
-  gl_FragColor.r = gl_FragCoord.z;\n
+  gl_FragColor = vec4(gl_FragCoord.z);\n
}\n;
 
 static const char const color_pick_vert_glsl[] =
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 66a88ad..babc448 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
@@ -36,5 +36,5 @@ void main() {
 
 #endif //ALPHA_TEST_ENABLED
 
-   gl_FragColor.r = gl_FragCoord.z;
+   gl_FragColor = vec4(gl_FragCoord.z);
 }

-- 




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

2015-03-19 Thread Oleksandr Shcherbina

   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 Zaouidaniel.za...@samsung.com Sr. Engineer/SRIL-Advanced
   RD 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 

Re: [E-devel] [EGIT] [core/efl] master 03/07: evas: Evas_3D - improve Shooter example.

2015-02-23 Thread Oleksandr Shcherbina

   Sorry guys,

   capital letters will be changed asap.

   Also we plan reduce quality of resources.

   It example useful for testing, because gathers features together.

   Can you advice acceptable size for 3d models and images for textures?


   Can you advice acceptable size for 3d models and images for textures?

   --- Original Message ---

   Sender : Cedric BAILcedric.b...@free.fr

   Date : Feb 23, 2015 18:40 (GMT+03:00)

   Title  : Re: [E-devel] [EGIT] [core/efl] master 03/07: evas: Evas_3D -
   improve Shooter example.


   On Mon, Feb 23, 2015 at 4:23 PM, Tom Hacohen wrote:
On 23/02/15 15:16, Daniel Kolesa wrote:
On Wed, Feb 18, 2015 at 9:43 PM, perepelits.m
wrote:
   
cedric pushed a commit to branch master.
   
   
   
   http://git.enlightenment.org/core/efl.git/commit/?id=2e2145b5945c94587e5a115
   02432ea2e8f75d2bd
   
commit 2e2145b5945c94587e5a11502432ea2e8f75d2bd
Author: perepelits.m
Date:   Wed Feb 18 22:00:58 2015 +0100
   
 evas: Evas_3D - improve Shooter example.
   
 Summary: This example includes some previous developments to create
3d-world mechanics.
   
 Reviewers: cedric, raster, Hermet
   
 Subscribers: cedric, artem.popov
   
 Differential Revision: https://phab.enlightenment.org/D1991
   
   
Dude, what the hell? One does *NOT* simply commit 50MB of worthless (and
mostly binary) assets into a Git repository (the space in the directory
name is the least bad thing about this), *ESPECIALLY* our primary EFL
repository; this is really bad (especially as the example looks like
   shit).
I would say this deserves a revert, but sadly, it's forever written in
   our
history and now *everyone* will be pulling the extra fucking 50MB... i
   hope
you're happy.
   
Do *NOT* do this kind of shit again.
   
Yeah, Cedric, this is crazy! We've talked about it before with relation
to exactness! Pushing this amount of crazy useless data just for the
sake of better examples is crazy and stupid. As Daniel said, the space
in the directory name and the use of capital letters, while major
offences on their own, are nothing in comparison to this shit. Have you
even reviewed this crazy patch before pushing it?!
   
It's still worth reverting this, as at least people doing shallow clones
won't have to suffer this craziness. Cedric, please revert this and
never do this shit again. :( Make a 3d examples repo if you are so keen
to have one. **Please revert this**
   
Just to repeat this again: while nothing in comparison to the massive
binary dump, the space in the filename and the use of caps is enough to
reject this. What's the point of even reviewing patches if you don't
stop obvious craziness at the door?
   I only reviewed the code. I didn't see nor noticed the size of the
   asset. As an example, it is a quite complete example of what you can
   do with Evas_3D and how to use it. As for the asset, they should
   indeed be reduced and renamed.
   --
   Cedric BAIL
   
   --
   Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
   from Actuate! Instantly Supercharge Your Business Reports and Dashboards
   with Interactivity, Sharing, Native Excel Exports, App Integration  more
   Get technology previously reserved for billion-dollar corporations, FREE
   http://pubads.g.doubleclick.net/gampad/clk?id=190641631iu=/4140/ostg.clktrk
   ___
   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 RD Institute

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

   Mob.: +380 (66) 1297544

   o.shcherb...@samsung.com




   [cid:T9SZN3WZA6X7@namo.co.kr]

   [SeenTimeChecker?do=0966c73de79aa046489c19e3ca1e8f0b6a5ce2d3ebd3b38628d6023d
   ffbae032ba777c355c197185c465c2cf80a2b7ef9aba4bb3b2b5ca43ddd7e184e0604d958075
   b6b33f32d245be7a12499853ada082afa00ff4b36e9acf878f9a26ce15a0]
--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration  more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631iu=/4140/ostg.clktrk___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] [EGIT] [core/efl] master 25/27: evas: Evas_3D - mechanism for finding node by color pick.

2015-02-23 Thread Oleksandr Shcherbina

   [1]https://phab.enlightenment.org/D1811

   [2]https://phab.enlightenment.org/D1956

   Do you really see here broken  indentation?


   --- Original Message ---

   Sender : Tom Hacohentom.haco...@samsung.com Senior Engineer/SRUK-Open
   Source/Samsung Electronics

   Date : Feb 23, 2015 18:52 (GMT+03:00)

   Title  : Re: [E-devel] [EGIT] [core/efl] master 25/27: evas: Evas_3D -
   mechanism for finding node by color pick.


   CODING CONVENTIONS AND COMMIT GUIDELINES!!!
   Commit message should be:
   evas 3d: mechanism...
   Lines are too long.
   Indentation is completely broken for this patch.
   Please start rejecting patches.
   --
   Tom.
   On 11/02/15 17:50, Oleksandr Shcherbina wrote:
cedric pushed a commit to branch master.
   
   
   http://git.enlightenment.org/core/efl.git/commit/?id=dc0b144cf09deba3a5a6fe7
   46f0130b67b5bf64b
   
commit dc0b144cf09deba3a5a6fe746f0130b67b5bf64b
Author: Oleksandr Shcherbina
Date:   Wed Feb 11 17:44:42 2015 +0100
   
 evas: Evas_3D - mechanism for finding node by color pick.
   
 Summary:
 See first part https://phab.enlightenment.org/D1811 (backend, gl)
   
 Add get/set for color pick mode at evas_3d_mesh and evas_3d_scene
 Add evas_3d_node_color_node_mesh_collect function to collect data at
   force rendering
 Add state flag for scene to avoid useless force rendering in case
   scene wasn't changed
 Add functionality for color pick in evas_3d_scene_pick method
   
 Reviewers: Hermet, raster, cedric
   
 Reviewed By: cedric
   
 Subscribers: cedric
   
 Differential Revision: https://phab.enlightenment.org/D1956
   
 Signed-off-by: Cedric BAIL
---
  src/lib/evas/Evas_Eo.h   |   1 +
  src/lib/evas/canvas/evas_3d_mesh.c   |  17 ++
  src/lib/evas/canvas/evas_3d_mesh.eo  |  21 +++
  src/lib/evas/canvas/evas_3d_node.c   |  71 +++
  src/lib/evas/canvas/evas_3d_scene.c  | 109
   +--
  src/lib/evas/canvas/evas_3d_scene.eo |  21 +++
  src/lib/evas/include/evas_private.h  |   8 ++-
  7 files changed, 242 insertions(+), 6 deletions(-)
   
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 8fa89b3..033ada2 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -468,6 +468,7 @@ typedef enum _Evas_3D_State
 EVAS_3D_STATE_SCENE_BACKGROUND_COLOR,
 EVAS_3D_STATE_SCENE_SIZE,
 EVAS_3D_STATE_SCENE_SHADOWS_ENABLED,
+   EVAS_3D_STATE_SCENE_UPDATED,
   
 EVAS_3D_STATE_TEXTURE_DATA = 1,
 EVAS_3D_STATE_TEXTURE_WRAP,
   diff--gita/src/lib/evas/canvas/evas_3d_mesh.c
   b/src/lib/evas/canvas/evas_3d_mesh.c
index ddbf619..44304380 100644
--- a/src/lib/evas/canvas/evas_3d_mesh.c
+++ b/src/lib/evas/canvas/evas_3d_mesh.c
@@ -120,6 +120,9 @@ _mesh_init(Evas_3D_Mesh_Data *pd)
 pd-blend_sfactor = EVAS_3D_BLEND_ONE;
 pd-blend_dfactor = EVAS_3D_BLEND_ZERO;
 pd-blending = EINA_FALSE;
+
+   pd-color_pick_key = -1.0;
+   pd-color_pick_enabled = EINA_FALSE;
  }
   
  static inline void
@@ -963,4 +966,18 @@
   evas_3d_mesh_interpolate_vertex_buffer_get(Evas_3D_Mesh *mesh, int frame,
   }
  }
   
+EOLIAN static Eina_Bool
+_evas_3d_mesh_color_pick_enable_get(Eo *objEINA_UNUSED,
   Evas_3D_Mesh_Data *pd)
+{
+   return pd-color_pick_enabled;
+}
+EOLIAN static Eina_Bool
+_evas_3d_mesh_color_pick_enable_set(Eo *obj, Evas_3D_Mesh_Data *pd,
   Eina_Bool _enabled)
+{
+   if (pd-color_pick_enabled != _enabled)
+ pd-color_pick_enabled = _enabled;
 +   eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_MESH_COLOR_PICK,
   NULL));
+   return EINA_TRUE;
+}
+
  #include canvas/evas_3d_mesh.eo.c
   diff--git   a/src/lib/evas/canvas/evas_3d_mesh.eo
   b/src/lib/evas/canvas/evas_3d_mesh.eo
index 5657b32..a23654a 100644
--- a/src/lib/evas/canvas/evas_3d_mesh.eo
+++ b/src/lib/evas/canvas/evas_3d_mesh.eo
  @@   -352,6   +352,27   @@   class  Evas_3D_Mesh  (Evas_3D_Object,
   Evas.Common_Interface, Efl.File)
   params {
   }
}
+  color_pick_enable_get @const {
+ /*
+   Get status of color picking of the mesh.
+
+   @ingroup Evas_3D_Mesh
+  */
+ return: bool;
+ params {
+ }
+  }
+  color_pick_enable_set {
+ /*
+   Set posibility color picking.
+
+   @ingroup Evas_3D_Mesh
+  */
+ return: bool;
+ params {
+@in bool _enabled;  /*@ Posibility flag */
+ }
+  }
 }
 properties {
shade_mode

[EGIT] [core/efl] master 02/07: evas: Evas_3D - callbacks for Evas 3D.

2015-02-18 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d28b82be45451c08cb993d2f835675d8b5dcbe24

commit d28b82be45451c08cb993d2f835675d8b5dcbe24
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Wed Feb 18 21:43:23 2015 +0100

evas: Evas_3D - callbacks for Evas 3D.

Summary:
Add class and type Evas_3D_Callback like wrapper under smart object
Incapsulate Evas_3D_Callback in Evas_3D_Object
Add virtual function register and unregister in Evas_3D_Object
Add function evas_3d_callback_call
Add callbacks clicked and collision for Evas_3D_Node

@feature

Reviewers: raster, Hermet, cedric

Reviewed By: cedric

Subscribers: artem.popov, cedric

Differential Revision: https://phab.enlightenment.org/D1914

Signed-off-by: Cedric BAIL ced...@osg.samsung.com
---
 src/Makefile_Evas.am|   2 +-
 src/examples/evas/evas-3d-shadows.c | 179 ++--
 src/lib/evas/Evas_Eo.h  |   1 +
 src/lib/evas/canvas/evas_3d_node.c  |  73 
 src/lib/evas/canvas/evas_3d_node.eo |   2 +
 src/lib/evas/canvas/evas_3d_node_callback.h |  38 ++
 src/lib/evas/canvas/evas_3d_object.c|  23 +++-
 src/lib/evas/canvas/evas_3d_object.eo   |  26 +++-
 src/lib/evas/canvas/evas_3d_scene.c |  17 ++-
 src/lib/evas/include/evas_3d_utils.h|  12 ++
 src/lib/evas/include/evas_private.h |   1 -
 11 files changed, 359 insertions(+), 15 deletions(-)

diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 3cfbced..c646751 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -188,7 +188,7 @@ lib/evas/canvas/evas_3d_camera.c \
 lib/evas/canvas/evas_3d_light.c \
 lib/evas/canvas/evas_3d_mesh.c \
 lib/evas/canvas/evas_3d_texture.c \
-lib/evas/canvas/evas_3d_material.c 
+lib/evas/canvas/evas_3d_material.c
 
 # Model savers/loaders (will be replaced to modules in next commits)
 lib_evas_libevas_la_SOURCES += \
diff --git a/src/examples/evas/evas-3d-shadows.c 
b/src/examples/evas/evas-3d-shadows.c
index b66da8f..960186d 100644
--- a/src/examples/evas/evas-3d-shadows.c
+++ b/src/examples/evas/evas-3d-shadows.c
@@ -1,9 +1,11 @@
-/*
- * This example illustrating use of shadows in the scene.
- *
+/*
+ * This example illustrating use of shadows in the scene and 
callbacks(clicked, collision).
+ * Model and cube are clickable. Model detects collision with sphere.
+ * Cube detects collision with sphere, model and cone.
  * @see evas_3d_scene_shadows_enable_set(Eina_Bool _shadows_enabled)
+ * @see evas_3d_object_callback_register
  *
- * Compile with gcc -o evas-3d-shadows evas-3d-shadows.c `pkg-config --libs 
--cflags efl evas ecore ecore-evas eo` -lm
+ * Compile with gcc -o evas-3d-shadows evas-3d-shadows.c `pkg-config --libs 
--cflags efl evas ecore ecore-evas eo eina` -lm
  */
 
 #define EFL_EO_API_SUPPORT
@@ -13,12 +15,14 @@
 #include Evas.h
 #include Ecore.h
 #include Ecore_Evas.h
+#include Eina.h
 #include math.h
 #include evas-3d-primitives.c
 
 #define  WIDTH 1024
 #define  HEIGHT 1024
 
+#define STEP 0.1
 #define BG_COLOR 0.2, 0.2, 0.2
 #define AMBIENT_LIGHT 0.2, 0.2, 0.2
 #define DIFFUSE_LIGHT 1.0, 1.0, 1.0
@@ -28,6 +32,7 @@ Ecore_Evas *ecore_evas = NULL;
 Evas *evas = NULL;
 Eo *background = NULL;
 Eo *image = NULL;
+Evas_3D_Node *choosed_node = NULL;
 
 typedef struct _Body_3D
 {
@@ -53,6 +58,51 @@ typedef struct _Scene_Data
Body_3D cone;
 } Scene_Data;
 
+Eina_Bool
+_cb_clicked(void *data, Eo *obj, const Eo_Event_Description *desc, void 
*event_info)
+{
+   Eina_List *meshes = NULL, *l;
+   Evas_3D_Mesh *m;
+   eo_do((Evas_3D_Node *)event_info, meshes = (Eina_List 
*)evas_3d_node_mesh_list_get());
+   EINA_LIST_FOREACH(meshes, l, m)
+ {
+eo_do(m, evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE));
+ }
+   if (choosed_node != (Evas_3D_Node *)event_info)
+ {
+eo_do(choosed_node, meshes = (Eina_List 
*)evas_3d_node_mesh_list_get());
+EINA_LIST_FOREACH(meshes, l, m)
+  {
+ eo_do(m, evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG));
+  }
+choosed_node = (Evas_3D_Node *)event_info;
+ }
+
+}
+
+Eina_Bool
+_cb_collision(void *data, Eo *obj, const Eo_Event_Description *desc, void 
*event_info)
+{
+   Eina_List *meshes = NULL, *l;
+   Evas_3D_Mesh *m;
+   eo_do((Evas_3D_Node *)event_info, meshes = (Eina_List 
*)evas_3d_node_mesh_list_get());
+   EINA_LIST_FOREACH(meshes, l, m)
+ {
+eo_do(m, evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE));
+ }
+}
+
+static void
+_show_help()
+{
+   fprintf(stdout, Press 'w'/'s' key to move up/down object\n);
+   fprintf(stdout, Press 'a'/'d' key to move left/right object\n);
+   fprintf(stdout, Press 'q'/'e' key to to move near/far object\n);
+   fprintf(stdout, Cude and model can be moved.\n);
+   fprintf(stdout, Cube detects intersection

[EGIT] [core/elementary] master 01/01: elementary: example showing Evas_3D with elementary widgets and testing some of its feature.

2015-02-17 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=862f7cd104200e08c12bcda9239734231c374af4

commit 862f7cd104200e08c12bcda9239734231c374af4
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Tue Feb 17 12:51:14 2015 +0100

elementary: example showing Evas_3D with elementary widgets and testing 
some of its feature.

Summary:
This small application for quick testing main features and changes in Evas 
3D.
Main features: effects shadow, fog, measuring fps, load 3D model, panel for 
change
sets light and camera.

Reviewers: Hermet, raster, cedric

Differential Revision: https://phab.enlightenment.org/D1953

Signed-off-by: Cedric BAIL ced...@osg.samsung.com
---
 configure.ac   |   1 +
 src/examples/Makefile.am   |   1 +
 src/examples/perfomance/HowTo  |  13 +
 src/examples/perfomance/Makefile.am|  44 ++
 src/examples/perfomance/Tools.h|  19 +
 src/examples/perfomance/backgroung.png | Bin 0 - 177255 bytes
 src/examples/perfomance/camera_light.c | 351 +++
 src/examples/perfomance/graphical.c| 680 
 src/examples/perfomance/graphical_struct.h |  90 +++
 src/examples/perfomance/initial_config.xml |  11 +
 src/examples/perfomance/layout.edc | 170 +
 src/examples/perfomance/perfomance.c   | 972 +
 src/examples/perfomance/target_texture.png | Bin 0 - 2123166 bytes
 src/examples/perfomance/tools_private.h|  50 ++
 14 files changed, 2402 insertions(+)

diff --git a/configure.ac b/configure.ac
index d688119..8c63e11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -501,6 +501,7 @@ src/modules/test_map/Makefile
 src/edje_externals/Makefile
 src/examples/Makefile
 src/examples/sphere_hunter/Makefile
+src/examples/perfomance/Makefile
 src/tests/Makefile
 src/imported/Makefile
 src/imported/atspi/Makefile
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 3a36f90..0fc5492 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -1,6 +1,7 @@
 MAINTAINERCLEANFILES = Makefile.in
 
 SUBDIRS = sphere_hunter
+SUBDIRS += perfomance
 
 include ../../Makefile_Elm_Helpers.am
 
diff --git a/src/examples/perfomance/HowTo b/src/examples/perfomance/HowTo
new file mode 100644
index 000..8417fa0
--- /dev/null
+++ b/src/examples/perfomance/HowTo
@@ -0,0 +1,13 @@
+It is application for quick checking changes in Evas 3D.
+
+Dependences (tested on):
+   efl = 1.13.0   elementary = 1.13.0
+   xserver-xorg-video-nouveau driver
+   OpenGL rendering acceleration for elemenatry
+Main features:
+   effects shadow, fog, colorpick
+   fps (Be careful, don't use changing speed animation and stop animation 
during measuring).
+   load 3D models
+   navigation panel (by right click)
+
+Warnings: Until 3D destructor work properly, you can have lags after set a lot 
of 3D models or spheres with precision =50
diff --git a/src/examples/perfomance/Makefile.am 
b/src/examples/perfomance/Makefile.am
new file mode 100644
index 000..2fea32d
--- /dev/null
+++ b/src/examples/perfomance/Makefile.am
@@ -0,0 +1,44 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+include ../../../Makefile_Elm_Helpers.am
+
+examplesdir = $(pkgdatadir)/examples/perfomance
+filesdir = $(pkgdatadir)/examples/perfomance
+files_DATA =
+
+AM_CPPFLAGS = \
+-Wno-unused-parameter \
+-I. \
+-I$(top_srcdir)/src/lib \
+-I$(top_builddir)/src/lib \
+-DPACKAGE_DATA_DIR=\$(pkgdatadir)\ \
+-DPACKAGE_BIN_DIR=\$(bindir)\ \
+-DPACKAGE_LIB_DIR=\$(libdir)\ \
+@ELEMENTARY_CFLAGS@
+
+LDADD = \
+@ELEMENTARY_LIBS@ \
+$(top_builddir)/src/lib/libelementary.la
+
+SRCS = perfomance.c camera_light.c graphical.c
+
+.edc.edj:
+   $(AM_V_EDJ)$(EDJE_CC) $(EDJE_CC_FLAGS) $ $@
+
+if EFL_BUILD_EXAMPLES
+files_DATA += $(SRCS) layout.edc layout.edj
+
+perfomance_SOURCES = \
+   perfomance.c \
+   camera_light.c \
+   graphical.c
+
+clean-local:
+   rm -f *.edj
+
+examples_PROGRAMS = \
+   perfomance
+
+endif
+
+EXTRA_DIST = layout.edc backgroud.png target_texture.png
diff --git a/src/examples/perfomance/Tools.h b/src/examples/perfomance/Tools.h
new file mode 100644
index 000..c3cf8ca
--- /dev/null
+++ b/src/examples/perfomance/Tools.h
@@ -0,0 +1,19 @@
+
+/*initialization navigation panel*/
+Evas_Object *
+init_panel_camera_light(Evas_Object *win, Eo* camera_node, Eo* light_node, 
double posX, double posY);
+/*free resources*/
+void
+panel_camera_light_fini(Evas_Object *navigation);
+/*initialization graphical objects*/
+Evas_Object *
+init_graphical_window(Evas_Object *image);
+/*Set step of range*/
+Eina_Bool
+panel_camera_coord_step_set(Evas_Object *navigation, int step);
+Eina_Bool
+panel_camera_angle_step_set(Evas_Object *navigation, int step);
+Eina_Bool
+panel_light_coord_step_set(Evas_Object *navigation, int step);
+Eina_Bool
+panel_light_angle_step_set

[EGIT] [core/efl] master 25/27: evas: Evas_3D - mechanism for finding node by color pick.

2015-02-11 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=dc0b144cf09deba3a5a6fe746f0130b67b5bf64b

commit dc0b144cf09deba3a5a6fe746f0130b67b5bf64b
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Wed Feb 11 17:44:42 2015 +0100

evas: Evas_3D - mechanism for finding node by color pick.

Summary:
See first part https://phab.enlightenment.org/D1811 (backend, gl)

Add get/set for color pick mode at evas_3d_mesh and evas_3d_scene
Add evas_3d_node_color_node_mesh_collect function to collect data at force 
rendering
Add state flag for scene to avoid useless force rendering in case scene 
wasn't changed
Add functionality for color pick in evas_3d_scene_pick method

Reviewers: Hermet, raster, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1956

Signed-off-by: Cedric BAIL ced...@osg.samsung.com
---
 src/lib/evas/Evas_Eo.h   |   1 +
 src/lib/evas/canvas/evas_3d_mesh.c   |  17 ++
 src/lib/evas/canvas/evas_3d_mesh.eo  |  21 +++
 src/lib/evas/canvas/evas_3d_node.c   |  71 +++
 src/lib/evas/canvas/evas_3d_scene.c  | 109 +--
 src/lib/evas/canvas/evas_3d_scene.eo |  21 +++
 src/lib/evas/include/evas_private.h  |   8 ++-
 7 files changed, 242 insertions(+), 6 deletions(-)

diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 8fa89b3..033ada2 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -468,6 +468,7 @@ typedef enum _Evas_3D_State
EVAS_3D_STATE_SCENE_BACKGROUND_COLOR,
EVAS_3D_STATE_SCENE_SIZE,
EVAS_3D_STATE_SCENE_SHADOWS_ENABLED,
+   EVAS_3D_STATE_SCENE_UPDATED,
 
EVAS_3D_STATE_TEXTURE_DATA = 1,
EVAS_3D_STATE_TEXTURE_WRAP,
diff --git a/src/lib/evas/canvas/evas_3d_mesh.c 
b/src/lib/evas/canvas/evas_3d_mesh.c
index ddbf619..44304380 100644
--- a/src/lib/evas/canvas/evas_3d_mesh.c
+++ b/src/lib/evas/canvas/evas_3d_mesh.c
@@ -120,6 +120,9 @@ _mesh_init(Evas_3D_Mesh_Data *pd)
pd-blend_sfactor = EVAS_3D_BLEND_ONE;
pd-blend_dfactor = EVAS_3D_BLEND_ZERO;
pd-blending = EINA_FALSE;
+
+   pd-color_pick_key = -1.0;
+   pd-color_pick_enabled = EINA_FALSE;
 }
 
 static inline void
@@ -963,4 +966,18 @@ evas_3d_mesh_interpolate_vertex_buffer_get(Evas_3D_Mesh 
*mesh, int frame,
  }
 }
 
+EOLIAN static Eina_Bool
+_evas_3d_mesh_color_pick_enable_get(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd)
+{
+   return pd-color_pick_enabled;
+}
+EOLIAN static Eina_Bool
+_evas_3d_mesh_color_pick_enable_set(Eo *obj, Evas_3D_Mesh_Data *pd, Eina_Bool 
_enabled)
+{
+   if (pd-color_pick_enabled != _enabled)
+ pd-color_pick_enabled = _enabled;
+   eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_MESH_COLOR_PICK, NULL));
+   return EINA_TRUE;
+}
+
 #include canvas/evas_3d_mesh.eo.c
diff --git a/src/lib/evas/canvas/evas_3d_mesh.eo 
b/src/lib/evas/canvas/evas_3d_mesh.eo
index 5657b32..a23654a 100644
--- a/src/lib/evas/canvas/evas_3d_mesh.eo
+++ b/src/lib/evas/canvas/evas_3d_mesh.eo
@@ -352,6 +352,27 @@ class Evas_3D_Mesh (Evas_3D_Object, Evas.Common_Interface, 
Efl.File)
  params {
  }
   }
+  color_pick_enable_get @const {
+ /*
+   Get status of color picking of the mesh.
+
+   @ingroup Evas_3D_Mesh
+  */
+ return: bool;
+ params {
+ }
+  }
+  color_pick_enable_set {
+ /*
+   Set posibility color picking.
+
+   @ingroup Evas_3D_Mesh
+  */
+ return: bool;
+ params {
+@in bool _enabled;  /*@ Posibility flag */
+ }
+  }
}
properties {
   shade_mode {
diff --git a/src/lib/evas/canvas/evas_3d_node.c 
b/src/lib/evas/canvas/evas_3d_node.c
index a5355ed..62e2c1c 100644
--- a/src/lib/evas/canvas/evas_3d_node.c
+++ b/src/lib/evas/canvas/evas_3d_node.c
@@ -6,6 +6,27 @@
 
 Evas_3D_Mesh_Frame *evas_3d_mesh_frame_find(Evas_3D_Mesh_Data *pd, int frame);
 
+static Eina_Stringshare *
+_generate_unic_color_key(Evas_Color *color, Evas_Color *bg_color, Evas_3D_Node 
*node, Evas_3D_Mesh *mesh,
+ Eina_Bool init)
+{
+   static unsigned short red = USHRT_MAX;
+
+   if (init) red = USHRT_MAX;
+
+   if (fabs(bg_color-r - (double)red) = DBL_EPSILON) red--;
+
+   color-r = (double)red / USHRT_MAX;
+   color-g = 0.0;
+   color-b = 0.0;
+
+   red--;
+
+   if (red  1) red = USHRT_MAX;
+
+   return eina_stringshare_printf(%p %p, node, mesh);
+}
+
 static inline Evas_3D_Node_Mesh *
 _node_mesh_new(Evas_3D_Node *node, Evas_3D_Mesh *mesh)
 {
@@ -795,6 +816,56 @@ evas_3d_node_mesh_collect(Evas_3D_Node *node, void *data)
 }
 
 Eina_Bool
+evas_3d_node_color_node_mesh_collect(Evas_3D_Node *node, void *data)
+{
+   Evas_3D_Scene_Public_Data *scene_data = (Evas_3D_Scene_Public_Data *)data;
+   Evas_3D_Node_Data *pd = eo_data_scope_get(node, MY_CLASS);
+   Evas_3D_Node_Data

[EGIT] [core/efl] master 04/07: evas: Evas_3D - ColorPick mechanism finding node and mesh in scene.

2015-02-09 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=00c2451656167dc4a42dfa1ef84fa7f21e5dc48e

commit 00c2451656167dc4a42dfa1ef84fa7f21e5dc48e
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Thu Feb 5 15:34:25 2015 +0100

evas: Evas_3D - ColorPick mechanism finding node and mesh in scene.

Summary:
Added additional texture and framebuffer for rendering meshes to it.
Added function that return OpenGL id additional texture
Added function that return color from target texture by mouse pick 
coordinates
Added function that render need meshes to target texture
Added engine wrappers for possibility force render to texture

@feature

Reviewers: Hermet, raster, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1811

Signed-off-by: Cedric BAIL ced...@osg.samsung.com
---
 src/lib/evas/Evas_Eo.h |   4 +-
 src/lib/evas/include/evas_private.h|  10 ++
 src/modules/evas/engines/gl_common/evas_gl_3d.c| 166 ++---
 .../evas/engines/gl_common/evas_gl_3d_common.h |   3 +
 .../evas/engines/gl_common/evas_gl_3d_private.h|   6 +-
 .../evas/engines/gl_common/evas_gl_3d_shader.c |  15 +-
 src/modules/evas/engines/gl_generic/evas_engine.c  |  33 
 7 files changed, 216 insertions(+), 21 deletions(-)

diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 39c568b..8fa89b3 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -487,6 +487,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_COLOR_PICK,
 
EVAS_3D_STATE_CAMERA_PROJECTION = 1,
 
@@ -777,7 +778,8 @@ typedef enum _Evas_3D_Shade_Mode
EVAS_3D_SHADE_MODE_NORMAL_MAP,
/** fragment color is defined by its z-coord*/
EVAS_3D_SHADE_MODE_SHADOW_MAP_RENDER,
-
+   /** rendering to additional frame bufer*/
+   EVAS_3D_SHADE_MODE_COLOR_PICK,
 } Evas_3D_Shade_Mode;
 
 /**
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index 673b6aa..e0f8171 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -340,6 +340,9 @@ struct _Evas_3D_Mesh
 
Evas_Color  fog_color;
Eina_Bool   fog_enabled :1;
+
+   double  color_pick_key;
+   Eina_Bool   color_pick_enabled :1;
 };
 
 struct _Evas_3D_Texture
@@ -376,6 +379,9 @@ struct _Evas_3D_Scene_Public_Data
Eina_List*light_nodes;
Eina_List*mesh_nodes;
Eina_Boolshadows_enabled :1;
+   Eina_Boolcolor_pick_enabled :1;
+   Eina_Hash*node_mesh_colors;
+   Eina_Hash*colors_node_mesh;
 };
 
 struct _Evas_3D_Pick_Data
@@ -1319,6 +1325,10 @@ struct _Evas_Func
void *(*image_drawable_set)   (void *data, void *image, void 
*drawable);
 
void  (*drawable_scene_render)(void *data, void *drawable, void 
*scene_data);
+   Eina_Bool (*drawable_scene_render_to_texture) (void *data, void *drawable, 
void *scene_data);
+
+   int (*drawable_texture_color_pick_id_get) (void *drawable);
+   double (*drawable_texture_pixel_color_get) (unsigned int tex EINA_UNUSED, 
int x, int y, void *drawable);
 
void *(*texture_new)  (void *data);
void  (*texture_free) (void *data, void *texture);
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 4f045d2..ee464f4 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_3d.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_3d.c
@@ -1,6 +1,23 @@
 #include evas_gl_private.h
 #include evas_gl_3d_private.h
 
+#define RENDER_MESH_NODE_ITERATE_BEGIN(param)  
\
+   Evas_Mat4  matrix_mv;   
\
+   Evas_Mat4  matrix_mvp;  
\
+   Eina_Iterator *it;  
\
+   void  *ptr; 
\
+   evas_mat4_multiply(matrix_mv, matrix_##param, 
pd_mesh_node-data.mesh.matrix_local_to_world); \
+   evas_mat4_multiply(matrix_mvp, pd-projection, matrix_mv);   
\
+   it = eina_hash_iterator_data_new(pd_mesh_node-data.mesh.node_meshes);  
\
+   while (eina_iterator_next(it, ptr))
\
+ { 
\
+Evas_3D_Node_Mesh *nm = (Evas_3D_Node_Mesh *)ptr;  
\
+Evas_3D_Mesh_Data *pdmesh

[EGIT] [core/efl] master 06/06: evas: Evas_3D - fix order of transformation while updating bounding object.

2015-02-05 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=8802ce20516f02cb1db9cb8768ba3f14791236f9

commit 8802ce20516f02cb1db9cb8768ba3f14791236f9
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Thu Feb 5 15:25:29 2015 +0100

evas: Evas_3D - fix order of transformation while updating bounding object.

Summary:
The order of tranformation changed to scale, orientation, position as
in some cases it can lead to incorrect value for the bounding box.

@fix

Reviewers: cedric, Hermet, raster

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1942

Signed-off-by: Cedric BAIL ced...@osg.samsung.com
---
 src/lib/evas/canvas/evas_3d_node.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/lib/evas/canvas/evas_3d_node.c 
b/src/lib/evas/canvas/evas_3d_node.c
index b013e63..ed47791 100644
--- a/src/lib/evas/canvas/evas_3d_node.c
+++ b/src/lib/evas/canvas/evas_3d_node.c
@@ -345,11 +345,6 @@ _node_aabb_update(Evas_3D_Node *node, void *data 
EINA_UNUSED)
 
  if (frame_found)
{
-  if (is_change_orientation)
-{
-   evas_vec3_quaternion_rotate(pd-obb.p0, pd-obb.p0, 
orientation);
-   evas_vec3_quaternion_rotate(pd-obb.p1, pd-obb.p1, 
orientation);
-}
   if ((pd-scale_world.x != 1 || pd-scale_world.y != 1 || 
pd-scale_world.z != 1))
 {
Evas_Vec3 scale;
@@ -359,6 +354,11 @@ _node_aabb_update(Evas_3D_Node *node, void *data 
EINA_UNUSED)
evas_vec3_multiply(pd-aabb.p0, scale, pd-aabb.p0);
evas_vec3_multiply(pd-aabb.p1, scale, pd-aabb.p1);
 }
+  if (is_change_orientation)
+{
+   evas_vec3_quaternion_rotate(pd-obb.p0, pd-obb.p0, 
orientation);
+   evas_vec3_quaternion_rotate(pd-obb.p1, pd-obb.p1, 
orientation);
+}
   if ((pd-position_world.x || pd-position_world.y || 
pd-position_world.z))
 {
Evas_Vec3 position;

-- 




[EGIT] [core/efl] master 05/06: evas: Evas_3D - fix evas_3d_scene_pick when trying to get empty texcoords from mesh.

2015-02-05 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0c4de0235c0a0ff14896c6e1ba49c1664f908999

commit 0c4de0235c0a0ff14896c6e1ba49c1664f908999
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Thu Feb 5 15:17:43 2015 +0100

evas: Evas_3D - fix evas_3d_scene_pick when trying to get empty texcoords 
from mesh.

Summary:
During filling evas pick public data by API evas_3d_scene_pick
segfault can occur if mesh was created without texcoords.
See functions - _pick_data_mesh_add, _pick_data_texcoord_update

@fix

Reviewers: cedric, Hermet, raster

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1941

Signed-off-by: Cedric BAIL ced...@osg.samsung.com
---
 src/lib/evas/canvas/evas_3d_scene.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/lib/evas/canvas/evas_3d_scene.c 
b/src/lib/evas/canvas/evas_3d_scene.c
index c8a2c67..0e177a7 100644
--- a/src/lib/evas/canvas/evas_3d_scene.c
+++ b/src/lib/evas/canvas/evas_3d_scene.c
@@ -352,7 +352,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const 
Evas_Ray3 *ray,
 
   if (_pick_data_triangle_add(data, ray, tri))
 {
-   _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i0, i1, i2);
+   if (tex0.data)
+ _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i0, i1, i2);
data-mesh = mesh;
data-node = node;
 }
@@ -399,7 +400,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const 
Evas_Ray3 *ray,
 i1 = ((unsigned char *)pdmesh-indices)[i + 1];
  }
 
-   _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i0, i1, i2);
+   if (tex0.data)
+ _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i0, i1, i2);
data-mesh = mesh;
data-node = node;
 }
@@ -439,7 +441,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const 
Evas_Ray3 *ray,
else
  i1 = ((unsigned char *)pdmesh-indices)[i];
 
-   _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i0, i1, i2);
+   if (tex0.data)
+ _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i0, i1, i2);
data-mesh = mesh;
data-node = node;
 }
@@ -458,7 +461,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const 
Evas_Ray3 *ray,
 
   if (_pick_data_triangle_add(data, ray, tri))
 {
-   _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i, i + 1, i + 2);
+   if (tex0.data)
+ _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i, i + 1, i + 2);
data-mesh = mesh;
data-node = node;
 }
@@ -478,7 +482,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const 
Evas_Ray3 *ray,
 
   if (_pick_data_triangle_add(data, ray, tri))
 {
-   _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i, i + 1, i + 2);
+   if (tex0.data)
+ _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i, i + 1, i + 2);
data-mesh = mesh;
data-node = node;
 }
@@ -497,7 +502,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const 
Evas_Ray3 *ray,
 
   if (_pick_data_triangle_add(data, ray, tri))
 {
-   _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, 0, i, i + 1);
+  if (tex0.data)
+_pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, 0, i, i + 1);
data-mesh = mesh;
data-node = node;
 }
@@ -516,7 +522,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const 
Evas_Ray3 *ray,
 
   if (_pick_data_triangle_add(data, ray, tri))
 {
-   _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i, i + 1, i + 2);
+   if (tex0.data)
+ _pick_data_texcoord_update(data, tex0, tex1, 
tex_weight, i, i + 1, i + 2);
data-mesh = mesh;
data-node = node;
 }
@@ -536,7 +543,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const 
Evas_Ray3 *ray,
 
   if (_pick_data_triangle_add(data, ray, tri

[EGIT] [core/efl] master 03/04: evas: Evas_3D - example which show frustum culing feature

2014-12-01 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=30a44d91006ca7dbcce3f00b5ebd4192ebfa40ef

commit 30a44d91006ca7dbcce3f00b5ebd4192ebfa40ef
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Thu Oct 9 11:41:23 2014 +0300

evas: Evas_3D - example which show frustum culing feature

Signed-off-by: Cedric BAIL ced...@osg.samsung.com
---
 src/examples/evas/evas-3d-frustum.c | 471 +++-
 1 file changed, 413 insertions(+), 58 deletions(-)

diff --git a/src/examples/evas/evas-3d-frustum.c 
b/src/examples/evas/evas-3d-frustum.c
index be81add..3e88bd8 100644
--- a/src/examples/evas/evas-3d-frustum.c
+++ b/src/examples/evas/evas-3d-frustum.c
@@ -1,11 +1,14 @@
-/*
+/*
  * This example shows how to work frustum culling.
- * Use keys Up/Down for moving far plane of frustum.
- * Use keys Left/Right for changing camera view.
- * See in terminal output value of z coordinate of far plane of frustum
- * and check OBB's points inside frustum.
- * @see evas_3d_node_obb_frustum_check.
- * Compile with gcc -o evas-3d-frustum evas-3d-frustum.c `pkg-config --libs 
--cflags evas ecore ecore-evas eo`
+ * Use 'w'/'s' key to move far frustum plane from/to the camera.
+ * Use 't'/'g' key to move near frustum plane from/to the camera.
+ * Use '1'/'2' key to set camera to the first/second position.
+ * Use '3'/'4'/'5' key to set bounding sphere/aabb/central point mode.
+ * Use 'i', 'k', 'j', 'l', 'u' and 'o' keys to move mesh node in 3D.
+ * Use 'z', 'x', 'c', 'Z', 'X' and 'C' keys to change scaling constants of 
mesh.
+ * See in terminal output value distance to far plane of frustum and value of 
visibility of node
+ * @see evas_3d_camera_node_visible_get.
+ * Compile with gcc -o evas-3d-frustum evas-3d-frustum.c `pkg-config --libs 
--cflags evas ecore ecore-evas eo eina` -lm
  */
 
 #define EFL_EO_API_SUPPORT
@@ -15,6 +18,7 @@
 #include Ecore_Evas.h
 #include Evas.h
 #include Eo.h
+#include math.h
 
 #define  WIDTH  800
 #define  HEIGHT 600
@@ -25,17 +29,47 @@ typedef struct _Scene_Data
Eo *camera_node;
Eo *light_node;
Eo *mesh_node_model;
+   Eo *mesh_node;
Eo *scene;
Eo *camera;
Eo *light;
Eo *mesh_model;
+   Eo *mesh;
Eo *material_model;
+   Eo *material;
Eo *texture_model;
 } Scene_Data;
 
 Evas *evas;
 Evas_Object *background,*image;
-Evas_Real fleft = -5, fright = 5, fbottom = -5, fup = 5, fnear = 20, ffar = 40;
+Evas_Real obj_x = 0.0, obj_y = 0.0, obj_z = 0.0, obj_sc_x = 1.0, obj_sc_y = 
1.0, obj_sc_z = 1.0;
+Evas_Real fleft = -5, fright = 5, fbottom = -5, fup = 5, fnear = 20, ffar = 
1000;
+Evas_Real radius = 0;
+Evas_3D_Frustum_Mode key = EVAS_3D_FRUSTUM_MODE_BSPHERE;
+
+typedef struct _vec3
+{
+float   x;
+float   y;
+float   z;
+} vec3;
+
+static void
+_set_ball(Eo *mesh, double r, double x, double y, double z, int p, 
Evas_3D_Material *material);
+
+static void
+_mesh_aabb(Eo *mesh_b, Eo *mesh_node);
+
+static void
+_show_help()
+{
+   fprintf(stdout, Press 'w'/'s' key to move far frustum plane from/to the 
camera\n);
+   fprintf(stdout, Press 't'/'g' key to move near frustum plane from/to the 
camera\n);
+   fprintf(stdout, Press '1'/'2' key to set camera to the first/second 
position\n);
+   fprintf(stdout, Press '3'/'4'/'5' key to set bounding sphere/aabb/central 
point mode\n);
+   fprintf(stdout, Press 'i', 'k', 'j', 'l', 'u' and 'o' keys to move mesh 
node in 3D\n);
+   fprintf(stdout, Press 'z', 'x', 'c', 'Z', 'X' and 'C' keys to change 
scaling constants of mesh\n);
+}
 
 static void
 _on_delete(Ecore_Evas *ee EINA_UNUSED)
@@ -55,66 +89,216 @@ _on_canvas_resize(Ecore_Evas *ee)
evas_object_move(image, 0, 0);
 }
 
+static Eina_Bool
+_redraw_bounding_object(void *data)
+{
+   Evas_Real x, y, z;
+   vec3 center, ref, temp;
+   Scene_Data *scene = (Scene_Data *)data;
+
+   eo_do(scene-mesh_node_model, evas_3d_node_bounding_sphere_get(x, y, z, 
radius));
+   if (key == EVAS_3D_FRUSTUM_MODE_BSPHERE)
+ _set_ball(scene-mesh, radius, x, y, z, 100, scene-material);
+   else if (key == EVAS_3D_FRUSTUM_MODE_AABB)
+ _mesh_aabb(scene-mesh, scene-mesh_node_model);
+   else if (key == EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT)
+ _set_ball(scene-mesh, 1, x, y, z, 1, scene-material);
+
+   return ECORE_CALLBACK_RENEW;
+}
+
 static void
 _on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *eo EINA_UNUSED, 
void *event_info)
 {
-
Scene_Data *scene = (Scene_Data *)data;
Evas_Event_Key_Down *ev = event_info;
-   int frustum;
+   Eina_Bool frustum;
+   Evas_Real x, y, z;
 
-   if (!strcmp(Up, ev-key))
+   if (!strcmp(w, ev-key))
+ {
+ffar += 20;
+eo_do(scene-camera, evas_3d_camera_projection_frustum_set(fleft, 
fright, fbottom, fup, fnear, ffar),
+ frustum = 
evas_3d_camera_node_visible_get(scene-camera_node, scene-mesh_node_model, 
key));
+fprintf(stdout, far - %f frustum - %d radius - %f\n, ffar

[EGIT] [core/efl] master 02/04: evas: Evas_3D - add bounding sphere, revision frustum culling

2014-12-01 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=54c1667d4e4dfc160fa8a7ce6118d6032645314a

commit 54c1667d4e4dfc160fa8a7ce6118d6032645314a
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Mon Dec 1 06:26:28 2014 +0100

evas: Evas_3D - add bounding sphere, revision frustum culling

Summary:
Move check visibility of node from evas_3d_node to evas_3d_camera
Move functionality (normalize, check distance, calculate frustum)
in evas_3d_utils.h (we are planing use evas_is_sphere_in_frustum in 
evas_gl_3d.c -
don't render mesh if it non visible)
Add possibility check frustum by box, aabb, central point
Refactor example frustum culling

@feature

Reviewers: Hermet, raster, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1420

Signed-off-by: Cedric BAIL ced...@osg.samsung.com
---
 src/lib/evas/Evas_Eo.h|  14 ++
 src/lib/evas/canvas/evas_3d_camera.c  |  44 ++
 src/lib/evas/canvas/evas_3d_camera.eo |  19 +++
 src/lib/evas/canvas/evas_3d_node.c| 120 +++-
 src/lib/evas/canvas/evas_3d_node.eo   |  33 ++---
 src/lib/evas/include/evas_3d_utils.h  | 264 ++
 src/lib/evas/include/evas_private.h   |   1 +
 7 files changed, 378 insertions(+), 117 deletions(-)

diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index fd48f74..9d8e93f 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -566,6 +566,20 @@ typedef enum _Evas_3D_Index_Format
 } Evas_3D_Index_Format;
 
 /**
+ * Frustum modes
+ *
+ * @since 1.12
+ * @ingroup Evas_3D_Types
+ */
+typedef enum _Evas_3D_Frustum_Mode
+{
+   EVAS_3D_FRUSTUM_MODE_BSPHERE,
+   EVAS_3D_FRUSTUM_MODE_AABB,
+   EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT
+} Evas_3D_Frustum_Mode;
+
+
+/**
  * Vertex assembly modes
  *
  * Vertex assembly represents how the vertices are organized into geometric
diff --git a/src/lib/evas/canvas/evas_3d_camera.c 
b/src/lib/evas/canvas/evas_3d_camera.c
index d8a7d24..c6da2d3 100644
--- a/src/lib/evas/canvas/evas_3d_camera.c
+++ b/src/lib/evas/canvas/evas_3d_camera.c
@@ -140,5 +140,49 @@ _evas_3d_camera_projection_ortho_set(Eo *obj, 
Evas_3D_Camera_Data *pd,
eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_CAMERA_PROJECTION, NULL));
 }
 
+EOLIAN static Eina_Bool
+_evas_3d_camera_node_visible_get(Eo *obj EINA_UNUSED, Evas_3D_Camera_Data *pd, 
Evas_3D_Node *camera_node, Evas_3D_Node *node, Evas_3D_Frustum_Mode key)
+{
+   Evas_Mat4 matrix_vp;
+   Evas_Vec4 planes[6];
+   Evas_3D_Node_Data *pd_node = eo_data_scope_get(node, EVAS_3D_NODE_CLASS);
+   Evas_3D_Node_Data *pd_camera = eo_data_scope_get(camera_node, 
EVAS_3D_NODE_CLASS);
+   Evas_Vec3 central_point;
+
+   if (!node || pd_node-type != EVAS_3D_NODE_TYPE_MESH)
+ {
+ERR(Mesh node %p type mismatch., node);
+return EINA_FALSE;
+ }
+
+   if (!camera_node || pd_camera-type != EVAS_3D_NODE_TYPE_CAMERA)
+ {
+ERR(Camera node %p type mismatch., camera_node);
+return EINA_FALSE;
+ }
+
+   /*get need matrix like multiply projection matrix with view matrix*/
+   evas_mat4_multiply(matrix_vp, pd-projection, 
pd_camera-data.camera.matrix_world_to_eye);
+
+   evas_frustum_calculate(planes, matrix_vp);
+
+   if (key == EVAS_3D_FRUSTUM_MODE_BSPHERE)
+ return evas_is_sphere_in_frustum(pd_node-bsphere, planes);
+   else if (key == EVAS_3D_FRUSTUM_MODE_AABB)
+ return evas_is_box_in_frustum(pd_node-aabb, planes);
+   else if (key == EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT)
+ {
+central_point.x = (pd_node-aabb.p0.x + pd_node-aabb.p1.x) / 2;
+central_point.y = (pd_node-aabb.p0.y + pd_node-aabb.p1.y) / 2;
+central_point.z = (pd_node-aabb.p0.z + pd_node-aabb.p1.z) / 2;
+return evas_is_point_in_frustum(central_point, planes);
+ }
+   else
+ {
+ERR(Unknown frustun mode.);
+return EINA_TRUE;
+ }
+}
+
 #include canvas/evas_3d_camera.eo.c
 
diff --git a/src/lib/evas/canvas/evas_3d_camera.eo 
b/src/lib/evas/canvas/evas_3d_camera.eo
index 4b4d95e..45e9e9a 100644
--- a/src/lib/evas/canvas/evas_3d_camera.eo
+++ b/src/lib/evas/canvas/evas_3d_camera.eo
@@ -96,6 +96,25 @@ class Evas_3D_Camera (Evas_3D_Object, Evas.Common_Interface)
 Evas_Real dfar; /*@ Distance to far clipping plane. */
  }
   }
+  node_visible_get {
+ /*@
+Check is bounding sphere of given node inside frustum of camera 
node.
+  *
+  * @param camera  The given camera node.
+  * @param nodeThe given node.
+  * @return@c EINA_TRUE in frustum, @c EINA_FALSE 
otherwise
+
+  * If the nodes are @ NULL or nodes type mismatch error wrong type of 
nodes will be generated and returned @ EINA_FALSE.
+
+  * @ingroup Evas_3D_Camera
+  */
+ return: bool;
+ params

[EGIT] [core/efl] master 03/03: evas: Evas_3D - Revision frustum culling.

2014-06-04 Thread Oleksandr Shcherbina
cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a25aa1aa1a71102cb20c7280bd0d46eb462d7517

commit a25aa1aa1a71102cb20c7280bd0d46eb462d7517
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Wed Jun 4 19:46:55 2014 +0200

evas: Evas_3D - Revision frustum culling.

Summary:
Add API that checks OBB's points of node are inside frustum of camera.
Add example with frustum culling.

@feature

Reviewers: Hermet, cedric, raster

CC: cedric

Differential Revision: https://phab.enlightenment.org/D942

Signed-off-by: Cedric BAIL c.b...@partner.samsung.com
---
 src/examples/evas/.gitignore|   3 +-
 src/examples/evas/Makefile.am   |   5 +
 src/examples/evas/eagle.md2 | Bin 0 - 62528 bytes
 src/examples/evas/eagle.png | Bin 0 - 587296 bytes
 src/examples/evas/evas-3d-frustum.c | 256 
 src/lib/evas/canvas/evas_3d_node.c  |  95 +
 src/lib/evas/canvas/evas_3d_node.eo |  20 +++
 7 files changed, 378 insertions(+), 1 deletion(-)

diff --git a/src/examples/evas/.gitignore b/src/examples/evas/.gitignore
index 405e5bb..879b07d 100644
--- a/src/examples/evas/.gitignore
+++ b/src/examples/evas/.gitignore
@@ -22,4 +22,5 @@
 /evas_3d_pick
 /evas_3d_proxy
 /evas_cxx_rectangle
-/evas_3d_aabb
\ No newline at end of file
+/evas_3d_aabb
+/evas_3d_frustum
diff --git a/src/examples/evas/Makefile.am b/src/examples/evas/Makefile.am
index 1f2aade..861d8ed 100644
--- a/src/examples/evas/Makefile.am
+++ b/src/examples/evas/Makefile.am
@@ -197,6 +197,11 @@ evas_3d_md2_SOURCES = evas-3d-md2.c
 evas_3d_md2_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
 evas_3d_md2_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
 
+EXTRA_PROGRAMS += evas_3d_frustum
+evas_3d_frustum_SOURCES = evas-3d-frustum.c
+evas_3d_frustum_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
+evas_3d_frustum_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
+
 EXTRA_PROGRAMS += evas_3d_aabb
 evas_3d_aabb_SOURCES = evas-3d-aabb.c
 evas_3d_aabb_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
diff --git a/src/examples/evas/eagle.md2 b/src/examples/evas/eagle.md2
new file mode 100644
index 000..c72647a
Binary files /dev/null and b/src/examples/evas/eagle.md2 differ
diff --git a/src/examples/evas/eagle.png b/src/examples/evas/eagle.png
new file mode 100644
index 000..503ca1f
Binary files /dev/null and b/src/examples/evas/eagle.png differ
diff --git a/src/examples/evas/evas-3d-frustum.c 
b/src/examples/evas/evas-3d-frustum.c
new file mode 100644
index 000..d5c67ef
--- /dev/null
+++ b/src/examples/evas/evas-3d-frustum.c
@@ -0,0 +1,256 @@
+/*
+ * This example shows how to work frustum culling.
+ * Use keys Up/Down for moving far plane of frustum.
+ * Use keys Left/Right for changing camera view.
+ * See in terminal output value of z coordinate of far plane of frustum
+ * and check OBB's points inside frustum.
+ * @see evas_3d_node_obb_frustum_check.
+ * Compile with gcc -o evas-3d-frustum evas-3d-frustum.c `pkg-config --libs 
--cflags evas ecore ecore-evas eo`
+ */
+
+#define EFL_EO_API_SUPPORT
+#define EFL_BETA_API_SUPPORT
+
+#include Ecore.h
+#include Ecore_Evas.h
+#include Evas.h
+#include Eo.h
+
+#define  WIDTH  800
+#define  HEIGHT 600
+
+typedef struct _Scene_Data
+{
+   Eo *root_node;
+   Eo *camera_node;
+   Eo *light_node;
+   Eo *mesh_node_model;
+   Eo *scene;
+   Eo *camera;
+   Eo *light;
+   Eo *mesh_model;
+   Eo *material_model;
+   Eo *texture_model;
+} Scene_Data;
+
+Evas *evas;
+Evas_Object *background,*image;
+Evas_Real fleft = -5, fright = 5, fbottom = -5, fup = 5, fnear = 20, ffar = 40;
+
+static void
+_on_delete(Ecore_Evas *ee EINA_UNUSED)
+{
+   ecore_main_loop_quit();
+}
+
+static void
+_on_canvas_resize(Ecore_Evas *ee)
+{
+   int w, h;
+
+   ecore_evas_geometry_get(ee, NULL, NULL, w, h);
+
+   evas_object_resize(background, w, h);
+   evas_object_resize(image, w, h);
+   evas_object_move(image, 0, 0);
+}
+
+static void
+_on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *eo EINA_UNUSED, 
void *event_info)
+{
+
+   Scene_Data *scene = (Scene_Data *)data;
+   Evas_Event_Key_Down *ev = event_info;
+   int frustum;
+
+   if (!strcmp(Up, ev-key))
+ {
+ffar += 5;
+eo_do(scene-camera, evas_3d_camera_projection_frustum_set(fleft, 
fright, fbottom, fup, fnear, ffar));
+eo_do(scene-mesh_node_model,
+  frustum = evas_3d_node_obb_frustum_check(scene-camera_node));
+fprintf(stdout, far - %f frustum - %d \n, ffar, frustum);
+ }
+   else if(!strcmp(Down, ev-key))
+ {
+ffar -= 5;
+eo_do(scene-camera, evas_3d_camera_projection_frustum_set(fleft, 
fright, fbottom, fup, fnear, ffar));
+eo_do(scene-mesh_node_model,
+  frustum = evas_3d_node_obb_frustum_check(scene-camera_node));
+fprintf(stdout, far - %f frustum - %d \n, ffar, frustum);
+ }
+   else

[EGIT] [core/efl] master 01/02: [evas/evas-3d] Add OBB and AABB.

2014-05-27 Thread Oleksandr Shcherbina
hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e47373aee1fd516d3436220ed4f1489baa04f502

commit e47373aee1fd516d3436220ed4f1489baa04f502
Author: Oleksandr Shcherbina o.shcherb...@samsung.com
Date:   Tue May 27 22:07:28 2014 +0900

[evas/evas-3d] Add OBB and AABB.

Summary: Add axis-aligned bounding box (AABB) to frame. Set and update AABB 
and oriented bounding box (OBB) in node.

Reviewers: Hermet, cedric, raster

CC: cedric

Differential Revision: https://phab.enlightenment.org/D881
---
 src/examples/evas/evas-3d-aabb.c  | 308 ++
 src/lib/evas/canvas/evas_3d_mesh.c|  80 ++-
 src/lib/evas/canvas/evas_3d_mesh_loader_md2.c |   8 +
 src/lib/evas/canvas/evas_3d_node.c| 191 ++--
 src/lib/evas/canvas/evas_3d_node.eo   |  24 ++
 src/lib/evas/include/evas_private.h   |   1 +
 6 files changed, 598 insertions(+), 14 deletions(-)

diff --git a/src/examples/evas/evas-3d-aabb.c b/src/examples/evas/evas-3d-aabb.c
new file mode 100644
index 000..c1ced0d
--- /dev/null
+++ b/src/examples/evas/evas-3d-aabb.c
@@ -0,0 +1,308 @@
+/*
+ * This example shows how to get and draw axis-aligned bounding box.
+
+ * @see _mesh_aabb(Evas_3D_Mesh **mesh_b, const Evas_3D_Node *node);
+ * Rotate axises (keys 1-4) for model and bounding box view from another angle.
+ * Compile with gcc -o evas-3d-aabb evas-3d-aabb.c `pkg-config --libs 
--cflags evas ecore ecore-evas eo`
+ */
+
+#define EFL_EO_API_SUPPORT
+#define EFL_BETA_API_SUPPORT
+
+#include Eo.h
+#include Evas.h
+#include Ecore.h
+#include Ecore_Evas.h
+
+#define  WIDTH 400
+#define  HEIGHT 400
+
+Ecore_Evas *ecore_evas = NULL;
+Evas *evas = NULL;
+Eo *background = NULL;
+Eo *image = NULL;
+
+Eo *scene = NULL;
+Eo *root_node = NULL;
+Eo *camera_node = NULL;
+Eo *light_node = NULL;
+Eo *camera = NULL;
+Eo *mesh_node = NULL;
+Eo *mesh_box_node = NULL;
+Eo *mesh = NULL;
+Eo *mesh_box = NULL;
+Eo *material_box = NULL;
+Eo *material = NULL;
+Eo *texture = NULL;
+Eo *light = NULL;
+
+
+static Eina_Bool
+_mesh_aabb(Evas_3D_Mesh **mesh_b, const Evas_3D_Node *node);
+
+static Eina_Bool
+_animate_scene(void *data)
+{
+   static int frame = 0;
+
+   eo_do((Evas_3D_Node *)data, evas_3d_node_mesh_frame_set(mesh, frame));
+
+   _mesh_aabb(mesh_box, mesh_box_node);
+
+   frame += 32;
+
+   if (frame  256 * 50) frame = 0;
+
+   return EINA_TRUE;
+}
+
+static void
+_on_delete(Ecore_Evas *ee EINA_UNUSED)
+{
+   ecore_main_loop_quit();
+}
+
+static void
+_on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *eo EINA_UNUSED, 
void *event_info)
+{
+   Evas_Event_Key_Down *ev = event_info;
+   Evas_3D_Node *node = (Evas_3D_Node *)data;
+
+   switch(atoi(ev-key))
+ {
+  case 1:
+{
+   eo_do(node, evas_3d_node_orientation_angle_axis_set(90, 1.0, 0.0, 
0.0));
+   break;
+}
+  case 2:
+{
+   eo_do(node, evas_3d_node_orientation_angle_axis_set(90, 0.0, 1.0, 
0.0));
+   break;
+}
+  case 3:
+{
+   eo_do(node, evas_3d_node_orientation_angle_axis_set(90, 0.0, 0.0, 
1.0));
+   break;
+}
+  case 4:
+{
+   eo_do(node, evas_3d_node_orientation_angle_axis_set(90, 1.0, 1.0, 
0.0));
+   break;
+}
+ }
+}
+
+static void
+_on_canvas_resize(Ecore_Evas *ee)
+{
+   int w, h;
+
+   ecore_evas_geometry_get(ee, NULL, NULL, w, h);
+   eo_do(background, evas_obj_size_set(w, h));
+   eo_do(image, evas_obj_size_set(w, h));
+}
+
+static Eina_Bool
+_mesh_aabb(Evas_3D_Mesh **mesh_b, const Evas_3D_Node *node)
+{
+   Evas_Real x0, y0, z0, x1, y1, z1;
+
+   eo_do(mesh_node, evas_3d_node_bounding_box_get(x0, y0, z0, x1, y1, 
z1));
+
+   float vertices[] =
+   {
+   x0,  y0,  z1,
+   x0,  y1,  z1,
+   x1,  y1,  z1,
+   x1,  y0,  z1,
+
+   x0,  y0,  z0,
+   x1,  y0,  z0,
+   x0,  y1,  z0,
+   x1,  y1,  z0,
+
+   x0,  y0,  z0,
+   x0,  y1,  z0,
+   x0,  y0,  z1,
+   x0,  y1,  z1,
+
+   x1,  y0,  z0,
+   x1,  y1,  z0,
+   x1,  y1,  z1,
+   x1,  y0,  z1,
+
+   x0,  y1,  z0,
+   x1,  y1,  z0,
+   x0,  y1,  z1,
+   x1,  y1,  z1,
+
+   x0,  y0,  z0,
+   x1,  y0,  z0,
+   x1,  y0,  z1,
+   x0,  y0,  z1
+   };
+
+   unsigned short indices[] =
+   {
+  0,  1,  2,  3,  1,  2,  0,  3,
+  4,  5,  5,  7,  7,  6,  6,  4,
+  8,  9,  9,  11, 11, 10, 10, 8,
+  12, 13, 13, 14, 14, 15, 15, 12,
+  16, 17, 17, 19, 19, 18, 18, 16,
+  20, 21, 21, 22, 22, 23, 23, 20
+   };
+
+   float *cube_vertices = (float *) malloc(1 * sizeof(vertices));
+   unsigned short *cube_indices = (unsigned short *) malloc(1 * 
sizeof(indices));
+   memcpy(cube_vertices, vertices, sizeof(vertices));
+   memcpy(cube_indices, indices, sizeof(indices));
+
+   eo_do(*mesh_b,
+ evas_3d_mesh_vertex_count_set(24