summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorOleksandr Shcherbina <o.shcherbina@samsung.com>2016-04-15 11:19:20 -0700
committerCedric Bail <cedric@osg.samsung.com>2016-04-15 11:20:14 -0700
commitb090763a1a25f3bff457473884181eef7bba63f8 (patch)
treefd00dfcea9af54fedc099264f1923c0dbf329aa5 /src/examples
parent974daa5f9813b1e2a43a45215859906b74ab4225 (diff)
evas: update evas-3d-shadow example
Summary: Add possibility turn on/off rendering scene with/without post processing Reviewers: cedric, raster, Hermet Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D3881 Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/evas/evas-3d-shadows.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/examples/evas/evas-3d-shadows.c b/src/examples/evas/evas-3d-shadows.c
index 7c48122ed1..6f3563be96 100644
--- a/src/examples/evas/evas-3d-shadows.c
+++ b/src/examples/evas/evas-3d-shadows.c
@@ -1,12 +1,23 @@
1/** 1/**
2 * This example illustrating use of shadows, callbacks(clicked, collision), 2 * This example illustrating use of shadows, callbacks(clicked, collision),
3 * and technic of the billboard. 3 * technic of the billboard and post proccesing render with anti-aliasing.
4 * Model and cube are clickable. Model detects collision with sphere. 4 * Model and cube are clickable. Model detects collision with sphere.
5 * Cube detects collision with sphere, model and cone. 5 * Cube detects collision with sphere, model and cone. Model and cude are moveable.
6 * @see evas_canvas3d_scene_shadows_enable_set(Eina_Bool _shadows_enabled) 6 * @see evas_canvas3d_scene_shadows_enable_set(Eina_Bool _shadows_enabled)
7 * @see evas_canvas3d_object_callback_register 7 * @see evas_canvas3d_object_callback_register
8 * @see evas_canvas3d_billboard_set/get 8 * @see evas_canvas3d_billboard_set/get
9 * @see evas_object_anti_alias_set/get
9 * 10 *
11 * Control keys and description:
12 * 'w'/'s' key to move up/down object;
13 * 'a'/'d' key to move left/right object;
14 * 'q'/'e' key to move near/far object;
15 * '1'/'2' key to change kind of node - billboard/normal model\n");
16 * '3'/'4' key to enable/disable post proccesing render;
17 * '5'/'6' key to enable/disable shadow effect;
18 * Up/Down key to change position of camera;
19 * 'i' key to return initial view of scene;
20
10 * @verbatim 21 * @verbatim
11 * gcc -o evas-3d-shadows evas-3d-shadows.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo eina` -lm 22 * gcc -o evas-3d-shadows evas-3d-shadows.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo eina` -lm
12 * @endverbatim 23 * @endverbatim
@@ -130,6 +141,8 @@ _show_help()
130 fprintf(stdout, "Cube detects intersection with model, sphere, cone\n"); 141 fprintf(stdout, "Cube detects intersection with model, sphere, cone\n");
131 fprintf(stdout, "Model detects intersection with sphere\n"); 142 fprintf(stdout, "Model detects intersection with sphere\n");
132 fprintf(stdout, "Press '1'/'2' key to change kind of node - billboard/normal model\n"); 143 fprintf(stdout, "Press '1'/'2' key to change kind of node - billboard/normal model\n");
144 fprintf(stdout, "Press '3'/'4' key to enable/disable post render with anti-aliasing\n");
145 fprintf(stdout, "Press '5'/'6' key to enable/disable shadow effect\n");
133 fprintf(stdout, "Press Up/Down key to change position of camera\n"); 146 fprintf(stdout, "Press Up/Down key to change position of camera\n");
134 fprintf(stdout, "Press 'i' key to return initial view of scene\n"); 147 fprintf(stdout, "Press 'i' key to return initial view of scene\n");
135} 148}
@@ -517,6 +530,22 @@ _on_key_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *eo EINA_U
517 evas_canvas3d_node_member_add(scene->root_node, scene->model.node); 530 evas_canvas3d_node_member_add(scene->root_node, scene->model.node);
518 evas_canvas3d_node_member_del(scene->root_node, scene->billboard.node); 531 evas_canvas3d_node_member_del(scene->root_node, scene->billboard.node);
519 } 532 }
533 else if(!strcmp("3", ev->key))
534 {
535 evas_object_anti_alias_set(image, EINA_TRUE);
536 }
537 else if(!strcmp("4", ev->key))
538 {
539 evas_object_anti_alias_set(image, EINA_FALSE);
540 }
541 else if(!strcmp("5", ev->key))
542 {
543 evas_canvas3d_scene_shadows_enable_set(scene->scene, EINA_TRUE);
544 }
545 else if(!strcmp("6", ev->key))
546 {
547 evas_canvas3d_scene_shadows_enable_set(scene->scene, EINA_FALSE);
548 }
520 else if(!strcmp("Up", ev->key)) 549 else if(!strcmp("Up", ev->key))
521 { 550 {
522 Evas_Real x, y, z; 551 Evas_Real x, y, z;
@@ -619,7 +648,7 @@ main(void)
619 image = eo_add(EFL_CANVAS_SCENE3D_CLASS, evas); 648 image = eo_add(EFL_CANVAS_SCENE3D_CLASS, evas);
620 efl_gfx_size_set(image, WIDTH, HEIGHT); 649 efl_gfx_size_set(image, WIDTH, HEIGHT);
621 efl_gfx_visible_set(image, EINA_TRUE); 650 efl_gfx_visible_set(image, EINA_TRUE);
622 651 evas_object_anti_alias_set(image, EINA_TRUE);
623 evas_object_focus_set(image, EINA_TRUE); 652 evas_object_focus_set(image, EINA_TRUE);
624 /* Set the image object as render target for 3D scene. */ 653 /* Set the image object as render target for 3D scene. */
625 efl_canvas_scene3d_set(image, data.scene); 654 efl_canvas_scene3d_set(image, data.scene);