summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
authorOleksandr Shcherbina <o.shcherbina@samsung.com>2015-09-21 23:41:25 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-09-21 23:41:29 +0200
commit28d69200f9bba968e51941b302869d205e2eb13c (patch)
tree0924693e8aa5fb9f5a57ef7b1a713907d3651814 /src/lib/evas/canvas
parenteeba25397f07ea044a1c4011b5c8dfcd46ccf0ea (diff)
evas_canvas3d: sets for shadow rendering
Summary: Add possibility change quality and offsets for shadow. Add mesh API's to sets size, step and bias constant. Add scene API to sets depth values. Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3056 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/evas/canvas')
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_mesh.c39
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_mesh.eo26
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_scene.c19
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_scene.eo15
-rw-r--r--src/lib/evas/canvas/evas_object_image.c2
-rw-r--r--src/lib/evas/canvas/evas_types.eot3
6 files changed, 104 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_canvas3d_mesh.c b/src/lib/evas/canvas/evas_canvas3d_mesh.c
index c6082eaeff..892ecd11f1 100644
--- a/src/lib/evas/canvas/evas_canvas3d_mesh.c
+++ b/src/lib/evas/canvas/evas_canvas3d_mesh.c
@@ -132,6 +132,9 @@ _mesh_init(Evas_Canvas3D_Mesh_Data *pd)
132 pd->color_pick_key.b = 0.0; 132 pd->color_pick_key.b = 0.0;
133#endif 133#endif
134 pd->color_pick_enabled = EINA_FALSE; 134 pd->color_pick_enabled = EINA_FALSE;
135 pd->shadows_edges_filtering_level = 4;
136 pd->shadows_edges_size = 300.0;
137 pd->shadows_constant_bias = 0.00015;
135} 138}
136 139
137static inline void 140static inline void
@@ -1078,4 +1081,40 @@ _evas_canvas3d_mesh_color_pick_enable_set(Eo *obj, Evas_Canvas3D_Mesh_Data *pd,
1078 eo_do(obj, evas_canvas3d_object_change(EVAS_CANVAS3D_STATE_MESH_COLOR_PICK, NULL)); 1081 eo_do(obj, evas_canvas3d_object_change(EVAS_CANVAS3D_STATE_MESH_COLOR_PICK, NULL));
1079} 1082}
1080 1083
1084EOLIAN static void
1085_evas_canvas3d_mesh_shadows_edges_filtering_set(Eo *obj, Evas_Canvas3D_Mesh_Data *pd,
1086 int blur_level, Evas_Real edges_size)
1087{
1088 if (blur_level > 0)
1089 pd->shadows_edges_filtering_level = blur_level;
1090 if (edges_size >= 0)
1091 pd->shadows_edges_size = edges_size;
1092 eo_do(obj, evas_canvas3d_object_change(EVAS_CANVAS3D_STATE_MESH_SHADOWS_EDGES_FILTERING, NULL));
1093}
1094
1095EOLIAN static void
1096_evas_canvas3d_mesh_shadows_edges_filtering_get(Eo *obj EINA_UNUSED, Evas_Canvas3D_Mesh_Data *pd,
1097 int *blur_level, Evas_Real *edges_size)
1098{
1099 if (blur_level) *blur_level = pd->shadows_edges_filtering_level;
1100 if (edges_size) *edges_size = pd->shadows_edges_size;
1101}
1102
1103EOLIAN static void
1104_evas_canvas3d_mesh_shadows_constant_bias_set(Eo *obj EINA_UNUSED, Evas_Canvas3D_Mesh_Data *pd,
1105 Evas_Real bias)
1106{
1107 if (pd->shadows_constant_bias != bias)
1108 {
1109 pd->shadows_constant_bias = bias;
1110 eo_do(obj, evas_canvas3d_object_change(EVAS_CANVAS3D_STATE_MESH_SHADOWS_CONSTANT_BIAS, NULL));
1111 }
1112}
1113
1114EOLIAN static Evas_Real
1115_evas_canvas3d_mesh_shadows_constant_bias_get(Eo *obj EINA_UNUSED, Evas_Canvas3D_Mesh_Data *pd)
1116{
1117 return pd->shadows_constant_bias;
1118}
1119
1081#include "canvas/evas_canvas3d_mesh.eo.c" 1120#include "canvas/evas_canvas3d_mesh.eo.c"
diff --git a/src/lib/evas/canvas/evas_canvas3d_mesh.eo b/src/lib/evas/canvas/evas_canvas3d_mesh.eo
index d0faf591fe..aa1a23e30f 100644
--- a/src/lib/evas/canvas/evas_canvas3d_mesh.eo
+++ b/src/lib/evas/canvas/evas_canvas3d_mesh.eo
@@ -360,7 +360,33 @@ class Evas.Canvas3D.Mesh (Evas.Canvas3D.Object, Evas.Common_Interface, Efl.File)
360 assembly: Evas.Canvas3D.Vertex_Assembly; [[The vertex assembly.]] 360 assembly: Evas.Canvas3D.Vertex_Assembly; [[The vertex assembly.]]
361 } 361 }
362 } 362 }
363 @property shadows_edges_filtering {
364 set {
365 [[Set the shadow edges blur parameters.
363 366
367 The averaging values in window is used for blurring.
368 User can set the size of window and num of points in window.
369 ]]
370 }
371 get {
372 [[Get the shadow edges blur parameters.]]
373 }
374 values {
375 blur_level: int; [[Number of points within a bluring radius.]]
376 edges_size: Evas.Real; [[The bluring radius.]]
377 }
378 }
379 @property shadows_constant_bias {
380 set {
381 [[Set offset shadow toward object.]]
382 }
383 get {
384 [[Get offset shadow toward object.]]
385 }
386 values {
387 bias: Evas.Real; [[Offset.]]
388 }
389 }
364 } 390 }
365 implements { 391 implements {
366 Eo.Base.constructor; 392 Eo.Base.constructor;
diff --git a/src/lib/evas/canvas/evas_canvas3d_scene.c b/src/lib/evas/canvas/evas_canvas3d_scene.c
index 518bcbe5dd..13dd68af22 100644
--- a/src/lib/evas/canvas/evas_canvas3d_scene.c
+++ b/src/lib/evas/canvas/evas_canvas3d_scene.c
@@ -74,6 +74,8 @@ _evas_canvas3d_scene_eo_base_constructor(Eo *obj, Evas_Canvas3D_Scene_Data *pd)
74 pd->color_pick_enabled = EINA_FALSE; 74 pd->color_pick_enabled = EINA_FALSE;
75 pd->node_mesh_colors = NULL; 75 pd->node_mesh_colors = NULL;
76 pd->colors_node_mesh = NULL; 76 pd->colors_node_mesh = NULL;
77 pd->depth_offset = 4.0;
78 pd->depth_constant = 100.0;
77 79
78 return obj; 80 return obj;
79} 81}
@@ -804,4 +806,21 @@ _evas_canvas3d_scene_color_pick_enable_set(Eo *obj EINA_UNUSED, Evas_Canvas3D_Sc
804 return EINA_TRUE; 806 return EINA_TRUE;
805} 807}
806 808
809EOLIAN static void
810_evas_canvas3d_scene_shadows_depth_set(Eo *obj EINA_UNUSED, Evas_Canvas3D_Scene_Data *pd,
811 Evas_Real depth_offset, Evas_Real depth_constant)
812{
813 pd->depth_offset = depth_offset;
814 pd->depth_constant = depth_constant;
815 eo_do(obj, evas_canvas3d_object_change(EVAS_CANVAS3D_STATE_SCENE_SHADOWS_DEPTH, NULL));
816}
817
818EOLIAN static void
819_evas_canvas3d_scene_shadows_depth_get(Eo *obj EINA_UNUSED, Evas_Canvas3D_Scene_Data *pd,
820 Evas_Real *depth_offset, Evas_Real *depth_constant)
821{
822 if (depth_offset) *depth_offset = pd->depth_offset;
823 if (depth_constant) *depth_constant = pd->depth_constant;
824}
825
807#include "canvas/evas_canvas3d_scene.eo.c" 826#include "canvas/evas_canvas3d_scene.eo.c"
diff --git a/src/lib/evas/canvas/evas_canvas3d_scene.eo b/src/lib/evas/canvas/evas_canvas3d_scene.eo
index a9e7aa02f5..04648094f1 100644
--- a/src/lib/evas/canvas/evas_canvas3d_scene.eo
+++ b/src/lib/evas/canvas/evas_canvas3d_scene.eo
@@ -145,6 +145,21 @@ class Evas.Canvas3D.Scene (Evas.Canvas3D.Object, Evas.Common_Interface)
145 camera node for the scene.]] 145 camera node for the scene.]]
146 } 146 }
147 } 147 }
148 @property shadows_depth {
149 set {
150 [[Set scale and units used to calculate depth values.]]
151 }
152 get {
153 [[Get scale and units used to calculate depth values.]]
154 }
155 values {
156 depth_offset: Evas.Real; [[Scale factor that is used to
157 create a variable depth offset
158 for each polygon.]]
159 depth_constant: Evas.Real; [[Value to create a constant
160 depth offset]]
161 }
162 }
148 } 163 }
149 implements { 164 implements {
150 Eo.Base.constructor; 165 Eo.Base.constructor;
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 21c94f2c70..f82d8252e0 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -2694,6 +2694,8 @@ _3d_render(Evas *eo_e, Evas_Object *eo_obj EINA_UNUSED,
2694 scene_data.bg_color = pd_scene->bg_color; 2694 scene_data.bg_color = pd_scene->bg_color;
2695 scene_data.shadows_enabled = pd_scene->shadows_enabled; 2695 scene_data.shadows_enabled = pd_scene->shadows_enabled;
2696 scene_data.camera_node = pd_scene->camera_node; 2696 scene_data.camera_node = pd_scene->camera_node;
2697 scene_data.depth_offset = pd_scene->depth_offset;
2698 scene_data.depth_constant = pd_scene->depth_constant;
2697 2699
2698 /* Phase 1 - Update scene graph tree. */ 2700 /* Phase 1 - Update scene graph tree. */
2699 eo_do(scene, evas_canvas3d_object_update()); 2701 eo_do(scene, evas_canvas3d_object_update());
diff --git a/src/lib/evas/canvas/evas_types.eot b/src/lib/evas/canvas/evas_types.eot
index 6a6b98e795..eb4b042895 100644
--- a/src/lib/evas/canvas/evas_types.eot
+++ b/src/lib/evas/canvas/evas_types.eot
@@ -264,6 +264,7 @@ enum Evas.Canvas3D.State
264 scene_size, 264 scene_size,
265 scene_shadows_enabled, 265 scene_shadows_enabled,
266 scene_updated, [[@since 1.14]] 266 scene_updated, [[@since 1.14]]
267 scene_shadows_depth,
267 268
268 texture_data = 1, 269 texture_data = 1,
269 texture_wrap, 270 texture_wrap,
@@ -285,6 +286,8 @@ enum Evas.Canvas3D.State
285 mesh_blending, 286 mesh_blending,
286 mesh_alpha_test, 287 mesh_alpha_test,
287 mesh_color_pick, 288 mesh_color_pick,
289 mesh_shadows_edges_filtering,
290 mesh_shadows_constant_bias,
288 291
289 camera_projection = 1, 292 camera_projection = 1,
290 293