summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-02-09 22:16:51 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-09 22:16:51 +0100
commit6f3f92b72a2e600718eadead399346ede47de199 (patch)
tree3b709ecaf9c41243f22360c948f3f970532e2122 /src/lib/evas
parent2d403151270d074cb10367232ef7109d65e6be00 (diff)
parentd5496b09ad51ebcfaa541335bb89477682e038d1 (diff)
Merge branch 'devs/cedric/next'
Just merging patch that did come during the end of our last release cycle and couldn't get in as they were to much of a new feature.
Diffstat (limited to '')
-rw-r--r--src/lib/evas/Evas_Eo.h12
-rw-r--r--src/lib/evas/canvas/evas_3d_node.c80
-rw-r--r--src/lib/evas/include/evas_private.h10
3 files changed, 77 insertions, 25 deletions
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 088f15fb6b..8fa89b30ba 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -487,6 +487,7 @@ typedef enum _Evas_3D_State
487 EVAS_3D_STATE_MESH_SHADE_MODE, 487 EVAS_3D_STATE_MESH_SHADE_MODE,
488 EVAS_3D_STATE_MESH_FOG, 488 EVAS_3D_STATE_MESH_FOG,
489 EVAS_3D_STATE_MESH_BLENDING, 489 EVAS_3D_STATE_MESH_BLENDING,
490 EVAS_3D_STATE_MESH_COLOR_PICK,
490 491
491 EVAS_3D_STATE_CAMERA_PROJECTION = 1, 492 EVAS_3D_STATE_CAMERA_PROJECTION = 1,
492 493
@@ -499,7 +500,9 @@ typedef enum _Evas_3D_State
499 EVAS_3D_STATE_LIGHT_ATTENUATION, 500 EVAS_3D_STATE_LIGHT_ATTENUATION,
500 EVAS_3D_STATE_LIGHT_PROJECTION, 501 EVAS_3D_STATE_LIGHT_PROJECTION,
501 502
502 EVAS_3D_STATE_NODE_TRANSFORM = 1, 503 EVAS_3D_STATE_NODE_TRANSFORM_POSITION = 1,
504 EVAS_3D_STATE_NODE_TRANSFORM_ORIENTATION,
505 EVAS_3D_STATE_NODE_TRANSFORM_SCALE,
503 EVAS_3D_STATE_NODE_MESH_GEOMETRY, 506 EVAS_3D_STATE_NODE_MESH_GEOMETRY,
504 EVAS_3D_STATE_NODE_MESH_MATERIAL, 507 EVAS_3D_STATE_NODE_MESH_MATERIAL,
505 EVAS_3D_STATE_NODE_MESH_FRAME, 508 EVAS_3D_STATE_NODE_MESH_FRAME,
@@ -507,7 +510,9 @@ typedef enum _Evas_3D_State
507 EVAS_3D_STATE_NODE_MESH_MATERIAL_ID, 510 EVAS_3D_STATE_NODE_MESH_MATERIAL_ID,
508 EVAS_3D_STATE_NODE_LIGHT, 511 EVAS_3D_STATE_NODE_LIGHT,
509 EVAS_3D_STATE_NODE_CAMERA, 512 EVAS_3D_STATE_NODE_CAMERA,
510 EVAS_3D_STATE_NODE_PARENT, 513 EVAS_3D_STATE_NODE_PARENT_POSITION,
514 EVAS_3D_STATE_NODE_PARENT_ORIENTATION,
515 EVAS_3D_STATE_NODE_PARENT_SCALE,
511 EVAS_3D_STATE_NODE_MEMBER, 516 EVAS_3D_STATE_NODE_MEMBER,
512} Evas_3D_State; 517} Evas_3D_State;
513 518
@@ -773,7 +778,8 @@ typedef enum _Evas_3D_Shade_Mode
773 EVAS_3D_SHADE_MODE_NORMAL_MAP, 778 EVAS_3D_SHADE_MODE_NORMAL_MAP,
774 /**< fragment color is defined by its z-coord*/ 779 /**< fragment color is defined by its z-coord*/
775 EVAS_3D_SHADE_MODE_SHADOW_MAP_RENDER, 780 EVAS_3D_SHADE_MODE_SHADOW_MAP_RENDER,
776 781 /**< rendering to additional frame bufer*/
782 EVAS_3D_SHADE_MODE_COLOR_PICK,
777} Evas_3D_Shade_Mode; 783} Evas_3D_Shade_Mode;
778 784
779/** 785/**
diff --git a/src/lib/evas/canvas/evas_3d_node.c b/src/lib/evas/canvas/evas_3d_node.c
index ed47791ad5..a5355ed4ec 100644
--- a/src/lib/evas/canvas/evas_3d_node.c
+++ b/src/lib/evas/canvas/evas_3d_node.c
@@ -59,6 +59,10 @@ _evas_3d_node_evas_3d_object_change_notify(Eo *obj, Evas_3D_Node_Data *pd, Evas_
59{ 59{
60 Eina_List *l; 60 Eina_List *l;
61 Evas_3D_Node *n; 61 Evas_3D_Node *n;
62 Eina_Bool orientation;
63 Eina_Bool position;
64 Eina_Bool scale;
65 Eina_Bool parent_change;
62 66
63 /* Notify all scenes using this node that it has changed. */ 67 /* Notify all scenes using this node that it has changed. */
64 if (pd->scenes_root) 68 if (pd->scenes_root)
@@ -67,17 +71,39 @@ _evas_3d_node_evas_3d_object_change_notify(Eo *obj, Evas_3D_Node_Data *pd, Evas_
67 if (pd->scenes_camera) 71 if (pd->scenes_camera)
68 eina_hash_foreach(pd->scenes_camera, _node_scene_camera_change_notify, obj); 72 eina_hash_foreach(pd->scenes_camera, _node_scene_camera_change_notify, obj);
69 73
74 parent_change = (state == EVAS_3D_STATE_NODE_PARENT_ORIENTATION)
75 || (state == EVAS_3D_STATE_NODE_PARENT_POSITION)
76 || (state == EVAS_3D_STATE_NODE_PARENT_SCALE);
77
70 /* Notify parent that a member has changed. */ 78 /* Notify parent that a member has changed. */
71 if (pd->parent) 79 if (pd->parent && !parent_change)
72 { 80 {
73 eo_do(pd->parent, evas_3d_object_change(EVAS_3D_STATE_NODE_MEMBER, obj)); 81 eo_do(pd->parent, evas_3d_object_change(EVAS_3D_STATE_NODE_MEMBER, obj));
74 } 82 }
75 83
84 orientation = (state == EVAS_3D_STATE_NODE_TRANSFORM_ORIENTATION)
85 || (state == EVAS_3D_STATE_NODE_PARENT_ORIENTATION);
86 position = (state == EVAS_3D_STATE_NODE_TRANSFORM_POSITION)
87 || (state == EVAS_3D_STATE_NODE_PARENT_POSITION);
88 scale = (state == EVAS_3D_STATE_NODE_TRANSFORM_SCALE)
89 || (state == EVAS_3D_STATE_NODE_PARENT_SCALE);
90
76 /* Notify members that the parent has changed. */ 91 /* Notify members that the parent has changed. */
77 EINA_LIST_FOREACH(pd->members, l, n) 92 if (scale)
78 { 93 EINA_LIST_FOREACH(pd->members, l, n)
79 eo_do(n, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT, obj)); 94 {
80 } 95 eo_do(n, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_SCALE, obj));
96 }
97 if (orientation)
98 EINA_LIST_FOREACH(pd->members, l, n)
99 {
100 eo_do(n, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_ORIENTATION, obj));
101 }
102 if (position)
103 EINA_LIST_FOREACH(pd->members, l, n)
104 {
105 eo_do(n, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_POSITION, obj));
106 }
81} 107}
82 108
83static Eina_Bool 109static Eina_Bool
@@ -87,8 +113,12 @@ _node_transform_update(Evas_3D_Node *node, void *data EINA_UNUSED)
87 Eina_Bool transform_dirty = EINA_FALSE, parent_dirty = EINA_FALSE; 113 Eina_Bool transform_dirty = EINA_FALSE, parent_dirty = EINA_FALSE;
88 114
89 eo_do(node, 115 eo_do(node,
90 transform_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_TRANSFORM), 116 transform_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_TRANSFORM_ORIENTATION),
91 parent_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_PARENT)); 117 transform_dirty|= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_TRANSFORM_POSITION),
118 transform_dirty|= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_TRANSFORM_SCALE),
119 parent_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_PARENT_ORIENTATION),
120 parent_dirty |= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_PARENT_POSITION),
121 parent_dirty |= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_PARENT_SCALE));
92 122
93 if (transform_dirty || parent_dirty) 123 if (transform_dirty || parent_dirty)
94 { 124 {
@@ -204,7 +234,6 @@ _node_aabb_update(Evas_3D_Node *node, void *data EINA_UNUSED)
204 Eina_Bool transform_dirty = EINA_FALSE, mesh_geom_dirty = EINA_FALSE; 234 Eina_Bool transform_dirty = EINA_FALSE, mesh_geom_dirty = EINA_FALSE;
205 Eina_Bool mesh_frame_dirty = EINA_FALSE, member_dirty = EINA_FALSE; 235 Eina_Bool mesh_frame_dirty = EINA_FALSE, member_dirty = EINA_FALSE;
206 Eina_Bool frame_found = EINA_FALSE, is_change_orientation = EINA_FALSE; 236 Eina_Bool frame_found = EINA_FALSE, is_change_orientation = EINA_FALSE;
207 Eina_Bool parent_dirty = EINA_FALSE;
208 const Eina_List *m, *l; 237 const Eina_List *m, *l;
209 Evas_3D_Mesh *mesh; 238 Evas_3D_Mesh *mesh;
210 int frame, count, size, i, j; 239 int frame, count, size, i, j;
@@ -215,17 +244,20 @@ _node_aabb_update(Evas_3D_Node *node, void *data EINA_UNUSED)
215 Evas_Box3 box3; 244 Evas_Box3 box3;
216 245
217 eo_do(node, 246 eo_do(node,
218 transform_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_TRANSFORM), 247 transform_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_TRANSFORM_POSITION),
248 transform_dirty |= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_TRANSFORM_ORIENTATION),
249 transform_dirty |= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_TRANSFORM_SCALE),
250 transform_dirty |= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_PARENT_ORIENTATION),
251 transform_dirty |= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_PARENT_POSITION),
252 transform_dirty |= evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_PARENT_SCALE),
219 mesh_geom_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_MESH_GEOMETRY), 253 mesh_geom_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_MESH_GEOMETRY),
220 mesh_frame_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_MESH_FRAME), 254 mesh_frame_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_MESH_FRAME),
221 parent_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_PARENT),
222 member_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_MEMBER)); 255 member_dirty = evas_3d_object_dirty_get(EVAS_3D_STATE_NODE_MEMBER));
223 256
224 if (transform_dirty || 257 if (transform_dirty ||
225 mesh_geom_dirty || 258 mesh_geom_dirty ||
226 mesh_frame_dirty || 259 mesh_frame_dirty ||
227 member_dirty || 260 member_dirty)
228 parent_dirty)
229 { 261 {
230 if (pd->type == EVAS_3D_NODE_TYPE_MESH) 262 if (pd->type == EVAS_3D_NODE_TYPE_MESH)
231 { 263 {
@@ -854,8 +886,10 @@ _evas_3d_node_member_add(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node *member)
854 pdmember->parent = obj; 886 pdmember->parent = obj;
855 887
856 /* Mark changed. */ 888 /* Mark changed. */
857 eo_do(member, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT, NULL));
858 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_MEMBER, NULL)); 889 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_MEMBER, NULL));
890 eo_do(member, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_ORIENTATION, NULL));
891 eo_do(member, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_POSITION, NULL));
892 eo_do(member, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_SCALE, NULL));
859} 893}
860 894
861EOLIAN static void 895EOLIAN static void
@@ -874,7 +908,9 @@ _evas_3d_node_member_del(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node *member)
874 908
875 /* Mark modified object as changed. */ 909 /* Mark modified object as changed. */
876 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_MEMBER, NULL)); 910 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_MEMBER, NULL));
877 eo_do(member, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT, NULL)); 911 eo_do(member, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_ORIENTATION, NULL));
912 eo_do(member, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_POSITION, NULL));
913 eo_do(member, evas_3d_object_change(EVAS_3D_STATE_NODE_PARENT_SCALE, NULL));
878 914
879 /* Decrease reference count. */ 915 /* Decrease reference count. */
880 eo_unref(member); 916 eo_unref(member);
@@ -899,7 +935,7 @@ _evas_3d_node_position_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_Real x, Evas_Rea
899 pd->position.y = y; 935 pd->position.y = y;
900 pd->position.z = z; 936 pd->position.z = z;
901 937
902 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM, NULL)); 938 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM_POSITION, NULL));
903} 939}
904 940
905EOLIAN static void 941EOLIAN static void
@@ -910,7 +946,7 @@ _evas_3d_node_orientation_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_Real x, Evas_
910 pd->orientation.z = z; 946 pd->orientation.z = z;
911 pd->orientation.w = w; 947 pd->orientation.w = w;
912 948
913 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM, NULL)); 949 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM_ORIENTATION, NULL));
914} 950}
915 951
916EOLIAN static void 952EOLIAN static void
@@ -929,7 +965,7 @@ _evas_3d_node_orientation_angle_axis_set(Eo *obj, Evas_3D_Node_Data *pd,
929 pd->orientation.y = s * axis.y; 965 pd->orientation.y = s * axis.y;
930 pd->orientation.z = s * axis.z; 966 pd->orientation.z = s * axis.z;
931 967
932 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM, NULL)); 968 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM_ORIENTATION, NULL));
933} 969}
934 970
935EOLIAN static void 971EOLIAN static void
@@ -939,7 +975,7 @@ _evas_3d_node_scale_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_Real x, Evas_Real y
939 pd->scale.y = y; 975 pd->scale.y = y;
940 pd->scale.z = z; 976 pd->scale.z = z;
941 977
942 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM, NULL)); 978 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM_SCALE, NULL));
943} 979}
944 980
945EOLIAN static void 981EOLIAN static void
@@ -1028,21 +1064,21 @@ EOLIAN static void
1028_evas_3d_node_position_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit) 1064_evas_3d_node_position_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit)
1029{ 1065{
1030 pd->position_inherit = inherit; 1066 pd->position_inherit = inherit;
1031 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM, NULL)); 1067 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM_POSITION, NULL));
1032} 1068}
1033 1069
1034EOLIAN static void 1070EOLIAN static void
1035_evas_3d_node_orientation_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit) 1071_evas_3d_node_orientation_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit)
1036{ 1072{
1037 pd->orientation_inherit = inherit; 1073 pd->orientation_inherit = inherit;
1038 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM, NULL)); 1074 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM_ORIENTATION, NULL));
1039} 1075}
1040 1076
1041EOLIAN static void 1077EOLIAN static void
1042_evas_3d_node_scale_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit) 1078_evas_3d_node_scale_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit)
1043{ 1079{
1044 pd->scale_inherit = inherit; 1080 pd->scale_inherit = inherit;
1045 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM, NULL)); 1081 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM_SCALE, NULL));
1046} 1082}
1047 1083
1048EOLIAN static Eina_Bool 1084EOLIAN static Eina_Bool
@@ -1170,7 +1206,7 @@ _evas_3d_node_look_at_set(Eo *obj, Evas_3D_Node_Data *pd,
1170 pd->orientation.y = (y.z + z.y) * s; 1206 pd->orientation.y = (y.z + z.y) * s;
1171 } 1207 }
1172 1208
1173 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM, NULL)); 1209 eo_do(obj, evas_3d_object_change(EVAS_3D_STATE_NODE_TRANSFORM_ORIENTATION, NULL));
1174} 1210}
1175 1211
1176EOLIAN static void 1212EOLIAN static void
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 673b6aab77..e0f8171e26 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
340 340
341 Evas_Color fog_color; 341 Evas_Color fog_color;
342 Eina_Bool fog_enabled :1; 342 Eina_Bool fog_enabled :1;
343
344 double color_pick_key;
345 Eina_Bool color_pick_enabled :1;
343}; 346};
344 347
345struct _Evas_3D_Texture 348struct _Evas_3D_Texture
@@ -376,6 +379,9 @@ struct _Evas_3D_Scene_Public_Data
376 Eina_List *light_nodes; 379 Eina_List *light_nodes;
377 Eina_List *mesh_nodes; 380 Eina_List *mesh_nodes;
378 Eina_Bool shadows_enabled :1; 381 Eina_Bool shadows_enabled :1;
382 Eina_Bool color_pick_enabled :1;
383 Eina_Hash *node_mesh_colors;
384 Eina_Hash *colors_node_mesh;
379}; 385};
380 386
381struct _Evas_3D_Pick_Data 387struct _Evas_3D_Pick_Data
@@ -1319,6 +1325,10 @@ struct _Evas_Func
1319 void *(*image_drawable_set) (void *data, void *image, void *drawable); 1325 void *(*image_drawable_set) (void *data, void *image, void *drawable);
1320 1326
1321 void (*drawable_scene_render) (void *data, void *drawable, void *scene_data); 1327 void (*drawable_scene_render) (void *data, void *drawable, void *scene_data);
1328 Eina_Bool (*drawable_scene_render_to_texture) (void *data, void *drawable, void *scene_data);
1329
1330 int (*drawable_texture_color_pick_id_get) (void *drawable);
1331 double (*drawable_texture_pixel_color_get) (unsigned int tex EINA_UNUSED, int x, int y, void *drawable);
1322 1332
1323 void *(*texture_new) (void *data); 1333 void *(*texture_new) (void *data);
1324 void (*texture_free) (void *data, void *texture); 1334 void (*texture_free) (void *data, void *texture);