summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorBogdan Devichev <b.devichev@samsung.com>2015-05-29 18:14:08 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-05-29 18:22:09 +0200
commit0972211144adcf09170d41ceacb62788fb954651 (patch)
tree40145801fa2b10b0b59daddb28b12871f891fbf7 /src/examples
parent9dcb827d12c58ea24d1ad2ce0f6aacb1f57b1146 (diff)
evas: Evas_3D examples use new API for creating primitives.
Summary: Examples changed due to D2516 Reviewers: Oleksander, Hermet, raster, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2517 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/evas/Makefile.am22
-rw-r--r--src/examples/evas/evas-3d-aabb.c17
-rw-r--r--src/examples/evas/evas-3d-blending.c26
-rw-r--r--src/examples/evas/evas-3d-colorpick.c11
-rw-r--r--src/examples/evas/evas-3d-cube-rotate.c14
-rw-r--r--src/examples/evas/evas-3d-cube2.c11
-rw-r--r--src/examples/evas/evas-3d-fog.c27
-rw-r--r--src/examples/evas/evas-3d-frustum.c31
-rw-r--r--src/examples/evas/evas-3d-parallax-occlusion.c14
-rw-r--r--src/examples/evas/evas-3d-pick.c12
-rw-r--r--src/examples/evas/evas-3d-primitives.c620
-rw-r--r--src/examples/evas/evas-3d-primitives.h59
-rw-r--r--src/examples/evas/evas-3d-proxy.c11
-rw-r--r--src/examples/evas/evas-3d-shadows.c72
-rw-r--r--src/examples/evas/shooter/evas-3d-shooter-header.h2
-rw-r--r--src/examples/evas/shooter/evas-3d-shooter-macros.h12
-rw-r--r--src/examples/evas/shooter/evas-3d-shooter.c16
17 files changed, 197 insertions, 780 deletions
diff --git a/src/examples/evas/Makefile.am b/src/examples/evas/Makefile.am
index 986ad9a..522345c 100644
--- a/src/examples/evas/Makefile.am
+++ b/src/examples/evas/Makefile.am
@@ -205,17 +205,17 @@ evas_3d_cube_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
205evas_3d_cube_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 205evas_3d_cube_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
206 206
207EXTRA_PROGRAMS += evas_3d_cube2 207EXTRA_PROGRAMS += evas_3d_cube2
208evas_3d_cube2_SOURCES = evas-3d-cube2.c evas-3d-primitives.c evas-3d-primitives.h 208evas_3d_cube2_SOURCES = evas-3d-cube2.c
209evas_3d_cube2_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 209evas_3d_cube2_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
210evas_3d_cube2_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 210evas_3d_cube2_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
211 211
212EXTRA_PROGRAMS += evas_3d_proxy 212EXTRA_PROGRAMS += evas_3d_proxy
213evas_3d_proxy_SOURCES = evas-3d-proxy.c evas-3d-primitives.c evas-3d-primitives.h 213evas_3d_proxy_SOURCES = evas-3d-proxy.c
214evas_3d_proxy_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 214evas_3d_proxy_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
215evas_3d_proxy_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 215evas_3d_proxy_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
216 216
217EXTRA_PROGRAMS += evas_3d_pick 217EXTRA_PROGRAMS += evas_3d_pick
218evas_3d_pick_SOURCES = evas-3d-pick.c evas-3d-primitives.c evas-3d-primitives.h 218evas_3d_pick_SOURCES = evas-3d-pick.c
219evas_3d_pick_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 219evas_3d_pick_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
220evas_3d_pick_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 220evas_3d_pick_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
221 221
@@ -235,27 +235,27 @@ evas_3d_ply_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
235evas_3d_ply_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 235evas_3d_ply_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
236 236
237EXTRA_PROGRAMS += evas_3d_frustum 237EXTRA_PROGRAMS += evas_3d_frustum
238evas_3d_frustum_SOURCES = evas-3d-frustum.c evas-3d-primitives.c evas-3d-primitives.h 238evas_3d_frustum_SOURCES = evas-3d-frustum.c
239evas_3d_frustum_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 239evas_3d_frustum_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
240evas_3d_frustum_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 240evas_3d_frustum_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
241 241
242EXTRA_PROGRAMS += evas_3d_aabb 242EXTRA_PROGRAMS += evas_3d_aabb
243evas_3d_aabb_SOURCES = evas-3d-aabb.c evas-3d-primitives.c evas-3d-primitives.h 243evas_3d_aabb_SOURCES = evas-3d-aabb.c
244evas_3d_aabb_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 244evas_3d_aabb_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
245evas_3d_aabb_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 245evas_3d_aabb_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
246 246
247EXTRA_PROGRAMS += evas_3d_cube_rotate 247EXTRA_PROGRAMS += evas_3d_cube_rotate
248evas_3d_cube_rotate_SOURCES = evas-3d-cube-rotate.c evas-3d-primitives.c evas-3d-primitives.h 248evas_3d_cube_rotate_SOURCES = evas-3d-cube-rotate.c
249evas_3d_cube_rotate_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 249evas_3d_cube_rotate_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
250evas_3d_cube_rotate_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 250evas_3d_cube_rotate_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
251 251
252EXTRA_PROGRAMS += evas_3d_shadows 252EXTRA_PROGRAMS += evas_3d_shadows
253evas_3d_shadows_SOURCES = evas-3d-shadows.c evas-3d-primitives.c evas-3d-primitives.h 253evas_3d_shadows_SOURCES = evas-3d-shadows.c
254evas_3d_shadows_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 254evas_3d_shadows_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
255evas_3d_shadows_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 255evas_3d_shadows_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
256 256
257EXTRA_PROGRAMS += evas_3d_shooter 257EXTRA_PROGRAMS += evas_3d_shooter
258evas_3d_shooter_SOURCES = shooter/evas-3d-shooter.c shooter/evas-3d-shooter-header.c evas-3d-primitives.c evas-3d-primitives.h 258evas_3d_shooter_SOURCES = shooter/evas-3d-shooter.c shooter/evas-3d-shooter-header.c
259evas_3d_shooter_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 259evas_3d_shooter_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
260evas_3d_shooter_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 260evas_3d_shooter_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
261 261
@@ -265,7 +265,7 @@ evas_3d_obj_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
265evas_3d_obj_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 265evas_3d_obj_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
266 266
267EXTRA_PROGRAMS += evas_3d_blending 267EXTRA_PROGRAMS += evas_3d_blending
268evas_3d_blending_SOURCES = evas-3d-blending.c evas-3d-primitives.c 268evas_3d_blending_SOURCES = evas-3d-blending.c
269evas_3d_blending_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 269evas_3d_blending_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
270evas_3d_blending_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 270evas_3d_blending_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
271 271
@@ -275,12 +275,12 @@ evas_3d_mmap_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
275evas_3d_mmap_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 275evas_3d_mmap_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
276 276
277EXTRA_PROGRAMS += evas_3d_colorpick 277EXTRA_PROGRAMS += evas_3d_colorpick
278evas_3d_colorpick_SOURCES = evas-3d-colorpick.c evas-3d-primitives.c 278evas_3d_colorpick_SOURCES = evas-3d-colorpick.c
279evas_3d_colorpick_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 279evas_3d_colorpick_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
280evas_3d_colorpick_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 280evas_3d_colorpick_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
281 281
282EXTRA_PROGRAMS += evas_3d_parallax_occlusion 282EXTRA_PROGRAMS += evas_3d_parallax_occlusion
283evas_3d_parallax_occlusion_SOURCES = evas-3d-parallax-occlusion.c evas-3d-primitives.c 283evas_3d_parallax_occlusion_SOURCES = evas-3d-parallax-occlusion.c
284evas_3d_parallax_occlusion_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@ 284evas_3d_parallax_occlusion_LDADD = $(ECORE_EVAS_COMMON_LDADD) @EFL_PTHREAD_LIBS@
285evas_3d_parallax_occlusion_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS) 285evas_3d_parallax_occlusion_CPPFLAGS = $(ECORE_EVAS_COMMON_CPPFLAGS)
286 286
diff --git a/src/examples/evas/evas-3d-aabb.c b/src/examples/evas/evas-3d-aabb.c
index 9f9488a..6a9d905 100644
--- a/src/examples/evas/evas-3d-aabb.c
+++ b/src/examples/evas/evas-3d-aabb.c
@@ -5,7 +5,7 @@
5 * Rotate axises (keys 1-4) for model and bounding box view from another angle. 5 * Rotate axises (keys 1-4) for model and bounding box view from another angle.
6 * 6 *
7 * @verbatim 7 * @verbatim
8 * gcc -o evas-3d-aabb evas-3d-aabb.c evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm 8 * gcc -o evas-3d-aabb evas-3d-aabb.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm
9 * @endverbatim 9 * @endverbatim
10 */ 10 */
11 11
@@ -22,7 +22,6 @@
22#include <Ecore.h> 22#include <Ecore.h>
23#include <Ecore_Evas.h> 23#include <Ecore_Evas.h>
24#include "evas-common.h" 24#include "evas-common.h"
25#include "evas-3d-primitives.h"
26 25
27#define WIDTH 400 26#define WIDTH 400
28#define HEIGHT 400 27#define HEIGHT 400
@@ -34,7 +33,7 @@ Ecore_Evas *ecore_evas = NULL;
34Evas *evas = NULL; 33Evas *evas = NULL;
35Eo *background = NULL; 34Eo *background = NULL;
36Eo *image = NULL; 35Eo *image = NULL;
37 36Eo *cube = NULL;
38Eo *scene = NULL; 37Eo *scene = NULL;
39Eo *root_node = NULL; 38Eo *root_node = NULL;
40Eo *camera_node = NULL; 39Eo *camera_node = NULL;
@@ -218,12 +217,16 @@ main(void)
218 material_box = eo_add(EVAS_3D_MATERIAL_CLASS, evas); 217 material_box = eo_add(EVAS_3D_MATERIAL_CLASS, evas);
219 eo_do(material_box, evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE)); 218 eo_do(material_box, evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE));
220 219
220 cube = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
221 eo_do(cube,
222 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE));
223
221 mesh_box = eo_add(EVAS_3D_MESH_CLASS, evas); 224 mesh_box = eo_add(EVAS_3D_MESH_CLASS, evas);
222 evas_3d_add_cube_frame(mesh_box, 0);
223 eo_do(mesh_box, 225 eo_do(mesh_box,
224 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_LINES), 226 evas_3d_mesh_from_primitive_set(0, cube),
225 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE), 227 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_LINES),
226 evas_3d_mesh_frame_material_set(0, material_box)); 228 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_VERTEX_COLOR),
229 evas_3d_mesh_frame_material_set(0, material_box));
227 _redraw_aabb(); 230 _redraw_aabb();
228 231
229 eo_do(root_node, 232 eo_do(root_node,
diff --git a/src/examples/evas/evas-3d-blending.c b/src/examples/evas/evas-3d-blending.c
index b40be0c..790ba44 100644
--- a/src/examples/evas/evas-3d-blending.c
+++ b/src/examples/evas/evas-3d-blending.c
@@ -4,7 +4,7 @@
4 * For more detailes see https://www.opengl.org/sdk/docs/man2/xhtml/glBlendFunc.xml 4 * For more detailes see https://www.opengl.org/sdk/docs/man2/xhtml/glBlendFunc.xml
5 * 5 *
6 * @verbatim 6 * @verbatim
7 * gcc -o evas-3d-blending evas-3d-blending.c evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo`-lm 7 * gcc -o evas-3d-blending evas-3d-blending.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo`-lm
8 * @endverbatim 8 * @endverbatim
9 */ 9 */
10 10
@@ -15,7 +15,6 @@
15#include <Evas.h> 15#include <Evas.h>
16#include <Ecore.h> 16#include <Ecore.h>
17#include <Ecore_Evas.h> 17#include <Ecore_Evas.h>
18#include "evas-3d-primitives.h"
19 18
20#define WIDTH 1024 19#define WIDTH 1024
21#define HEIGHT 1024 20#define HEIGHT 1024
@@ -67,12 +66,11 @@ typedef struct _Scene_Data
67 Eo *light; 66 Eo *light;
68 Eo *mesh; 67 Eo *mesh;
69 Eo *mesh1; 68 Eo *mesh1;
69 Eo *sphere;
70 Eo *material; 70 Eo *material;
71 Eo *material1; 71 Eo *material1;
72} Scene_Data; 72} Scene_Data;
73 73
74static const vec2 tex_scale = {1, 1};
75
76Evas *evas = NULL; 74Evas *evas = NULL;
77Eo *background = NULL; 75Eo *background = NULL;
78Eo *image = NULL; 76Eo *image = NULL;
@@ -185,11 +183,10 @@ _light_setup(Scene_Data *data)
185} 183}
186 184
187static void 185static void
188_set_ball(Eo *mesh, int p, Evas_3D_Material *material) 186_set_ball(Eo *mesh, Eo *sphere, Evas_3D_Material *material)
189{ 187{
190
191 evas_3d_add_sphere_frame(mesh, 0, p, tex_scale);
192 eo_do(mesh, 188 eo_do(mesh,
189 evas_3d_mesh_from_primitive_set(0, sphere),
193 evas_3d_mesh_frame_material_set(0, material), 190 evas_3d_mesh_frame_material_set(0, material),
194 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG)); 191 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG));
195} 192}
@@ -221,11 +218,16 @@ _mesh_setup(Scene_Data *data)
221 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 0.2), 218 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 0.2),
222 evas_3d_material_shininess_set(100.0)); 219 evas_3d_material_shininess_set(100.0));
223 220
221 data->sphere = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
222 eo_do(data->sphere,
223 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_SPHERE),
224 evas_3d_primitive_precision_set(50));
225
224 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 226 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
225 data->mesh1 = eo_add(EVAS_3D_MESH_CLASS, evas); 227 data->mesh1 = eo_add(EVAS_3D_MESH_CLASS, evas);
226 228
227 _set_ball(data->mesh, 50, data->material); 229 _set_ball(data->mesh, data->sphere, data->material);
228 _set_ball(data->mesh1, 50, data->material1); 230 _set_ball(data->mesh1, data->sphere, data->material1);
229 231
230 data->mesh_node = 232 data->mesh_node =
231 eo_add(EVAS_3D_NODE_CLASS, evas, 233 eo_add(EVAS_3D_NODE_CLASS, evas,
@@ -245,12 +247,10 @@ _mesh_setup(Scene_Data *data)
245 evas_3d_mesh_blending_func_set(func1, func2)); 247 evas_3d_mesh_blending_func_set(func1, func2));
246 248
247 eo_do(data->mesh_node, 249 eo_do(data->mesh_node,
248 evas_3d_node_scale_set(2.0, 2.0, 2.0), 250 evas_3d_node_scale_set(2.0, 2.0, 2.0));
249 evas_3d_node_orientation_angle_axis_set(90.0, 1.0, 0.0, 0.0));
250 251
251 eo_do(data->mesh_node1, 252 eo_do(data->mesh_node1,
252 evas_3d_node_scale_set(5.0, 5.0, 5.0), 253 evas_3d_node_scale_set(5.0, 5.0, 5.0));
253 evas_3d_node_orientation_angle_axis_set(90.0, 1.0, 0.0, 0.0));
254} 254}
255 255
256static void 256static void
diff --git a/src/examples/evas/evas-3d-colorpick.c b/src/examples/evas/evas-3d-colorpick.c
index 3fb7adb..215c455 100644
--- a/src/examples/evas/evas-3d-colorpick.c
+++ b/src/examples/evas/evas-3d-colorpick.c
@@ -9,7 +9,7 @@
9 * p - precision of the spheres, t - path for a texture. 9 * p - precision of the spheres, t - path for a texture.
10 * 10 *
11 * @verbatim 11 * @verbatim
12 * gcc -o evas-3d-colorpick evas-3d-colorpick.c evas-3d-primitives.c `pkg-config --libs --cflags evas ecore ecore-evas eo eina efl` -lm 12 * gcc -o evas-3d-colorpick evas-3d-colorpick.c `pkg-config --libs --cflags evas ecore ecore-evas eo eina efl` -lm
13 * @endverbatim 13 * @endverbatim
14 */ 14 */
15 15
@@ -27,7 +27,6 @@
27#include <Ecore_Evas.h> 27#include <Ecore_Evas.h>
28#include <Ecore_Getopt.h> 28#include <Ecore_Getopt.h>
29#include <math.h> 29#include <math.h>
30#include "evas-3d-primitives.h"
31#include "evas-common.h" 30#include "evas-common.h"
32 31
33#define WIDTH 800 32#define WIDTH 800
@@ -40,7 +39,6 @@
40#define SCALE_UNIT 0.5 39#define SCALE_UNIT 0.5
41#define VEC_3(value) value, value, value 40#define VEC_3(value) value, value, value
42 41
43static const vec2 tex_scale = {1, 1};
44static const char *image_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/wood.jpg"; 42static const char *image_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/wood.jpg";
45 43
46Ecore_Evas *ecore_evas = NULL; 44Ecore_Evas *ecore_evas = NULL;
@@ -68,6 +66,7 @@ Ecore_Getopt optdesc = {
68 66
69 typedef struct _Object 67 typedef struct _Object
70 { 68 {
69 Eo *primitive;
71 Eo *node; 70 Eo *node;
72 Eo *mesh; 71 Eo *mesh;
73 Eo *material; 72 Eo *material;
@@ -243,10 +242,14 @@ Eina_Bool
243_init_sphere(void *this, const char *texture) 242_init_sphere(void *this, const char *texture)
244{ 243{
245 Test_object *sphere = (Test_object *)this; 244 Test_object *sphere = (Test_object *)this;
245 sphere->primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
246 sphere->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 246 sphere->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
247 sphere->material = eo_add(EVAS_3D_MATERIAL_CLASS, evas); 247 sphere->material = eo_add(EVAS_3D_MATERIAL_CLASS, evas);
248 evas_3d_add_sphere_frame(sphere->mesh, 0, globalscene.precision, tex_scale); 248 eo_do(sphere->primitive,
249 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_SPHERE),
250 evas_3d_primitive_precision_set(50));
249 eo_do(sphere->mesh, 251 eo_do(sphere->mesh,
252 evas_3d_mesh_from_primitive_set(0, sphere->primitive),
250 evas_3d_mesh_frame_material_set(0, sphere->material), 253 evas_3d_mesh_frame_material_set(0, sphere->material),
251 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG)); 254 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG));
252 255
diff --git a/src/examples/evas/evas-3d-cube-rotate.c b/src/examples/evas/evas-3d-cube-rotate.c
index 8df3292..3eb63f6 100644
--- a/src/examples/evas/evas-3d-cube-rotate.c
+++ b/src/examples/evas/evas-3d-cube-rotate.c
@@ -8,7 +8,7 @@
8 * is pressed. Note, that rotation is taking place around one axis only. 8 * is pressed. Note, that rotation is taking place around one axis only.
9 * 9 *
10 * @verbatim 10 * @verbatim
11 * gcc -o evas-3d-cube-rotate evas-3d-cube-rotate.c evas-3d-primitives.c -g `pkg-config --libs --cflags evas ecore ecore-evas eo` -lm 11 * gcc -o evas-3d-cube-rotate evas-3d-cube-rotate.c -g `pkg-config --libs --cflags evas ecore ecore-evas eo` -lm
12 * @endverbatim 12 * @endverbatim
13 */ 13 */
14 14
@@ -19,8 +19,6 @@
19#include <Ecore_Evas.h> 19#include <Ecore_Evas.h>
20#include <Evas.h> 20#include <Evas.h>
21#include <Eo.h> 21#include <Eo.h>
22#include "evas-3d-primitives.h"
23
24 22
25#define WIDTH 400 23#define WIDTH 400
26#define HEIGHT 400 24#define HEIGHT 400
@@ -35,6 +33,7 @@ typedef struct _Scene_Data
35 33
36 Eo *camera; 34 Eo *camera;
37 Eo *light; 35 Eo *light;
36 Eo *cube;
38 Eo *mesh; 37 Eo *mesh;
39 Eo *material; 38 Eo *material;
40 float angle; 39 float angle;
@@ -48,7 +47,7 @@ Ecore_Evas *ecore_evas = NULL;
48Evas *evas = NULL; 47Evas *evas = NULL;
49Eo *background = NULL; 48Eo *background = NULL;
50Eo *image = NULL; 49Eo *image = NULL;
51static float angle = 0.0; 50static float angle = 0.0f;
52float d_angle = 0.5; 51float d_angle = 0.5;
53 52
54static void 53static void
@@ -200,10 +199,15 @@ _mesh_setup(Scene_Data *data)
200 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 199 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
201 evas_3d_material_shininess_set(100.0)); 200 evas_3d_material_shininess_set(100.0));
202 201
202 /* Setup primitive */
203 data->cube = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
204 eo_do(data->cube,
205 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE));
206
203 /* Setup mesh. */ 207 /* Setup mesh. */
204 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 208 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
205 evas_3d_add_cube_frame(data->mesh, 0);
206 eo_do(data->mesh, 209 eo_do(data->mesh,
210 evas_3d_mesh_from_primitive_set(0, data->cube),
207 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG), 211 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG),
208 evas_3d_mesh_frame_material_set(0, data->material)); 212 evas_3d_mesh_frame_material_set(0, data->material));
209 213
diff --git a/src/examples/evas/evas-3d-cube2.c b/src/examples/evas/evas-3d-cube2.c
index e438973..4f43c7c 100644
--- a/src/examples/evas/evas-3d-cube2.c
+++ b/src/examples/evas/evas-3d-cube2.c
@@ -3,7 +3,7 @@
3 * by interpolation between frames. 3 * by interpolation between frames.
4 * 4 *
5 * @verbatim 5 * @verbatim
6 * gcc -o evas-3d-cube2 evas-3d-cube2.c evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm 6 * gcc -o evas-3d-cube2 evas-3d-cube2.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm
7 * @endverbatim 7 * @endverbatim
8 */ 8 */
9 9
@@ -19,7 +19,6 @@
19#include <Evas.h> 19#include <Evas.h>
20#include <Ecore.h> 20#include <Ecore.h>
21#include <Ecore_Evas.h> 21#include <Ecore_Evas.h>
22#include "evas-3d-primitives.h"
23#include "evas-common.h" 22#include "evas-common.h"
24 23
25#define WIDTH 400 24#define WIDTH 400
@@ -37,6 +36,7 @@ typedef struct _Scene_Data
37 36
38 Eo *camera; 37 Eo *camera;
39 Eo *light; 38 Eo *light;
39 Eo *cube;
40 Eo *mesh; 40 Eo *mesh;
41 Eo *material0; 41 Eo *material0;
42 Eo *material1; 42 Eo *material1;
@@ -195,10 +195,15 @@ _mesh_setup(Scene_Data *data)
195 eo_do(data->material1, 195 eo_do(data->material1,
196 evas_3d_material_texture_set(EVAS_3D_MATERIAL_NORMAL, data->texture_normal)); 196 evas_3d_material_texture_set(EVAS_3D_MATERIAL_NORMAL, data->texture_normal));
197 197
198 /* Set data of primitive */
199 data->cube = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
200 eo_do(data->cube,
201 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE));
202
198 /* Setup mesh. */ 203 /* Setup mesh. */
199 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 204 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
200 evas_3d_add_cube_frame(data->mesh, 0);
201 eo_do(data->mesh, 205 eo_do(data->mesh,
206 evas_3d_mesh_from_primitive_set(0, data->cube),
202 evas_3d_mesh_frame_material_set(0, data->material0), 207 evas_3d_mesh_frame_material_set(0, data->material0),
203 evas_3d_mesh_frame_add(20), 208 evas_3d_mesh_frame_add(20),
204 evas_3d_mesh_frame_material_set(20, data->material1), 209 evas_3d_mesh_frame_material_set(20, data->material1),
diff --git a/src/examples/evas/evas-3d-fog.c b/src/examples/evas/evas-3d-fog.c
index df70644..5154288 100644
--- a/src/examples/evas/evas-3d-fog.c
+++ b/src/examples/evas/evas-3d-fog.c
@@ -2,7 +2,7 @@
2 * Example illustrating usage of fog effect. 2 * Example illustrating usage of fog effect.
3 * 3 *
4 * @verbatim 4 * @verbatim
5 * gcc -o evas-3d-fog evas-3d-fog.c evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo`-lm 5 * gcc -o evas-3d-fog evas-3d-fog.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo`-lm
6 * @endverbatim 6 * @endverbatim
7 */ 7 */
8 8
@@ -14,7 +14,6 @@
14#include <Evas.h> 14#include <Evas.h>
15#include <Ecore.h> 15#include <Ecore.h>
16#include <Ecore_Evas.h> 16#include <Ecore_Evas.h>
17#include "evas-3d-primitives.h"
18 17
19#define WIDTH 1024 18#define WIDTH 1024
20#define HEIGHT 1024 19#define HEIGHT 1024
@@ -32,6 +31,7 @@ typedef struct _Scene_Data
32 Eo *mesh_node; 31 Eo *mesh_node;
33 Eo *mesh_node1; 32 Eo *mesh_node1;
34 Eo *animation_node; 33 Eo *animation_node;
34 Eo *sphere;
35 35
36 Eo *camera; 36 Eo *camera;
37 Eo *light; 37 Eo *light;
@@ -40,8 +40,6 @@ typedef struct _Scene_Data
40 Eo *material; 40 Eo *material;
41} Scene_Data; 41} Scene_Data;
42 42
43static const vec2 tex_scale = {1, 1};
44
45Ecore_Evas *ecore_evas = NULL; 43Ecore_Evas *ecore_evas = NULL;
46Evas *evas = NULL; 44Evas *evas = NULL;
47Eo *background = NULL; 45Eo *background = NULL;
@@ -95,7 +93,7 @@ _camera_setup(Scene_Data *data)
95 93
96 eo_do(data->camera_node, 94 eo_do(data->camera_node,
97 evas_3d_node_camera_set(data->camera), 95 evas_3d_node_camera_set(data->camera),
98 evas_3d_node_position_set(0.0, 0.0, 10.0), 96 evas_3d_node_position_set(0.0, 0.0, 7.0),
99 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 0.0, 97 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 0.0,
100 EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0)); 98 EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0));
101 99
@@ -123,12 +121,12 @@ _light_setup(Scene_Data *data)
123} 121}
124 122
125static void 123static void
126_set_ball(Eo *mesh, int p, Evas_3D_Material *material) 124_set_ball(Eo *mesh, Eo *sphere, Evas_3D_Material *material)
127{ 125{
128 evas_3d_add_sphere_frame(mesh, 0, p, tex_scale); 126 eo_do(mesh,
129 127 evas_3d_mesh_from_primitive_set(0, sphere),
130 eo_do(mesh, evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG), 128 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG),
131 evas_3d_mesh_frame_material_set(0, material)); 129 evas_3d_mesh_frame_material_set(0, material));
132} 130}
133 131
134 132
@@ -147,11 +145,16 @@ _mesh_setup(Scene_Data *data)
147 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 145 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
148 evas_3d_material_shininess_set(100.0)); 146 evas_3d_material_shininess_set(100.0));
149 147
148 data->sphere = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
149 eo_do(data->sphere,
150 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_SPHERE),
151 evas_3d_primitive_precision_set(50));
152
150 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 153 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
151 data->mesh1 = eo_add(EVAS_3D_MESH_CLASS, evas); 154 data->mesh1 = eo_add(EVAS_3D_MESH_CLASS, evas);
152 155
153 _set_ball(data->mesh, 100, data->material); 156 _set_ball(data->mesh, data->sphere, data->material);
154 _set_ball(data->mesh1, 100, data->material); 157 _set_ball(data->mesh1, data->sphere, data->material);
155 158
156 data->animation_node = 159 data->animation_node =
157 eo_add(EVAS_3D_NODE_CLASS, evas, 160 eo_add(EVAS_3D_NODE_CLASS, evas,
diff --git a/src/examples/evas/evas-3d-frustum.c b/src/examples/evas/evas-3d-frustum.c
index efeb8b3..d3e9f81 100644
--- a/src/examples/evas/evas-3d-frustum.c
+++ b/src/examples/evas/evas-3d-frustum.c
@@ -10,7 +10,7 @@
10 * @see evas_3d_camera_node_visible_get. 10 * @see evas_3d_camera_node_visible_get.
11 * 11 *
12 * @verbatim 12 * @verbatim
13 * gcc -o evas-3d-frustum evas-3d-frustum.c evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm 13 * gcc -o evas-3d-frustum evas-3d-frustum.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm
14 * @endverbatim 14 * @endverbatim
15 */ 15 */
16 16
@@ -28,7 +28,6 @@
28#include <Eo.h> 28#include <Eo.h>
29#include <math.h> 29#include <math.h>
30#include "evas-common.h" 30#include "evas-common.h"
31#include "evas-3d-primitives.h"
32 31
33#define WIDTH 800 32#define WIDTH 800
34#define HEIGHT 600 33#define HEIGHT 600
@@ -47,6 +46,8 @@ typedef struct _Scene_Data
47 Eo *camera; 46 Eo *camera;
48 Eo *light; 47 Eo *light;
49 Eo *mesh_model; 48 Eo *mesh_model;
49 Eo *sphere;
50 Eo *cube;
50 Eo *mesh_sphere; 51 Eo *mesh_sphere;
51 Eo *mesh_aabb; 52 Eo *mesh_aabb;
52 Eo *material_model; 53 Eo *material_model;
@@ -60,7 +61,6 @@ Evas_Real obj_x = 0.0, obj_y = 0.0, obj_z = 0.0, obj_sc_x = 10.0, obj_sc_y = 10.
60Evas_Real fleft = -5, fright = 5, fbottom = -5, fup = 5, fnear = 20, ffar = 1000; 61Evas_Real fleft = -5, fright = 5, fbottom = -5, fup = 5, fnear = 20, ffar = 1000;
61Evas_Real radius = 0; 62Evas_Real radius = 0;
62Evas_3D_Frustum_Mode key = EVAS_3D_FRUSTUM_MODE_AABB; 63Evas_3D_Frustum_Mode key = EVAS_3D_FRUSTUM_MODE_AABB;
63static const vec2 tex_scale = {1, 1};
64 64
65static void 65static void
66_show_help() 66_show_help()
@@ -343,19 +343,28 @@ _mesh_setup(Scene_Data *data)
343 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 343 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
344 evas_3d_material_shininess_set(100.0)); 344 evas_3d_material_shininess_set(100.0));
345 345
346 data->cube = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
347 eo_do(data->cube,
348 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE));
349
350 data->sphere = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
351 eo_do(data->sphere,
352 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_SPHERE),
353 evas_3d_primitive_precision_set(20));
354
346 data->mesh_aabb = eo_add(EVAS_3D_MESH_CLASS, evas); 355 data->mesh_aabb = eo_add(EVAS_3D_MESH_CLASS, evas);
347 evas_3d_add_cube_frame(data->mesh_aabb, 0);
348 eo_do(data->mesh_aabb, 356 eo_do(data->mesh_aabb,
349 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_LINES), 357 evas_3d_mesh_from_primitive_set(0, data->cube),
350 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE), 358 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_LINES),
351 evas_3d_mesh_frame_material_set(0, data->material)); 359 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE),
360 evas_3d_mesh_frame_material_set(0, data->material));
352 361
353 data->mesh_sphere = eo_add(EVAS_3D_MESH_CLASS, evas); 362 data->mesh_sphere = eo_add(EVAS_3D_MESH_CLASS, evas);
354 evas_3d_add_sphere_frame(data->mesh_sphere, 0, 20, tex_scale);
355 eo_do(data->mesh_sphere, 363 eo_do(data->mesh_sphere,
356 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_LINES), 364 evas_3d_mesh_from_primitive_set(0, data->sphere),
357 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE), 365 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_LINES),
358 evas_3d_mesh_frame_material_set(0, data->material)); 366 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE),
367 evas_3d_mesh_frame_material_set(0, data->material));
359 368
360 data->mesh_node = 369 data->mesh_node =
361 eo_add(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH)); 370 eo_add(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH));
diff --git a/src/examples/evas/evas-3d-parallax-occlusion.c b/src/examples/evas/evas-3d-parallax-occlusion.c
index ec44e24..33b1e43 100644
--- a/src/examples/evas/evas-3d-parallax-occlusion.c
+++ b/src/examples/evas/evas-3d-parallax-occlusion.c
@@ -4,7 +4,7 @@
4 * Press "n" for use normal mapping shading. Pres "p" for use parallax occlusion mapping shading. 4 * Press "n" for use normal mapping shading. Pres "p" for use parallax occlusion mapping shading.
5 * 5 *
6 * @verbatim 6 * @verbatim
7 * gcc -o evas-3d-parallax-occlusion evas-3d-parallax-occlusion.c evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo`-lm 7 * gcc -o evas-3d-parallax-occlusion evas-3d-parallax-occlusion.c `pkg-config --libs --cflags evas ecore ecore-evas eo efl`-lm
8 * @endverbatim 8 * @endverbatim
9 */ 9 */
10 10
@@ -20,7 +20,6 @@
20#include <Evas.h> 20#include <Evas.h>
21#include <Ecore.h> 21#include <Ecore.h>
22#include <Ecore_Evas.h> 22#include <Ecore_Evas.h>
23#include "evas-3d-primitives.h"
24#include "evas-common.h" 23#include "evas-common.h"
25 24
26#define WIDTH 400 25#define WIDTH 400
@@ -42,6 +41,7 @@ typedef struct _Scene_Data
42 Eo *camera; 41 Eo *camera;
43 Eo *light; 42 Eo *light;
44 Eo *mesh; 43 Eo *mesh;
44 Eo *cube;
45 Eo *material_rocks; 45 Eo *material_rocks;
46 Eo *material_wood; 46 Eo *material_wood;
47 Eo *texture_rocks; 47 Eo *texture_rocks;
@@ -195,12 +195,16 @@ _mesh_setup(Scene_Data *data)
195 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 195 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
196 evas_3d_material_shininess_set(100.0)); 196 evas_3d_material_shininess_set(100.0));
197 197
198 /* Set data of primitive */
199 data->cube = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
200 eo_do(data->cube,
201 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE));
202
198 /* Setup mesh. */ 203 /* Setup mesh. */
199 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 204 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
200 evas_3d_add_cube_frame(data->mesh, 0);
201
202 evas_3d_add_cube_frame(data->mesh, 100);
203 eo_do(data->mesh, 205 eo_do(data->mesh,
206 evas_3d_mesh_from_primitive_set(0, data->cube),
207 evas_3d_mesh_from_primitive_set(100, data->cube),
204 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PARALLAX_OCCLUSION), 208 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PARALLAX_OCCLUSION),
205 evas_3d_mesh_frame_material_set(0, data->material_rocks)); 209 evas_3d_mesh_frame_material_set(0, data->material_rocks));
206 210
diff --git a/src/examples/evas/evas-3d-pick.c b/src/examples/evas/evas-3d-pick.c
index 16b380c..9e8e19b 100644
--- a/src/examples/evas/evas-3d-pick.c
+++ b/src/examples/evas/evas-3d-pick.c
@@ -6,7 +6,7 @@
6 * and parameters which can be got from this function. 6 * and parameters which can be got from this function.
7 * 7 *
8 * @verbatim 8 * @verbatim
9 * gcc -o evas-3d-pick evas-3d-pick.c evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm 9 * gcc -o evas-3d-pick evas-3d-pick.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm
10 * @endverbatim 10 * @endverbatim
11 */ 11 */
12 12
@@ -24,7 +24,6 @@
24#include <Ecore.h> 24#include <Ecore.h>
25#include <Ecore_Evas.h> 25#include <Ecore_Evas.h>
26#include "evas-common.h" 26#include "evas-common.h"
27#include "evas-3d-primitives.h"
28 27
29#define WIDTH 400 28#define WIDTH 400
30#define HEIGHT 400 29#define HEIGHT 400
@@ -43,7 +42,7 @@ static Eo *mesh_node = NULL;
43static Eo *mesh = NULL; 42static Eo *mesh = NULL;
44static Eo *material = NULL; 43static Eo *material = NULL;
45static Eo *texture_diffuse = NULL; 44static Eo *texture_diffuse = NULL;
46static const vec2 tex_scale = {1, 1}; 45static Eo *sphere = NULL;
47 46
48static Eina_Bool 47static Eina_Bool
49_animate_scene(void *data) 48_animate_scene(void *data)
@@ -155,10 +154,13 @@ main(void)
155 EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0)); 154 EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0));
156 eo_do(root_node, evas_3d_node_member_add(camera_node)); 155 eo_do(root_node, evas_3d_node_member_add(camera_node));
157 156
158 /* Add the cube mesh. */ 157 sphere = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
158 eo_do(sphere,
159 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_SPHERE),
160 evas_3d_primitive_precision_set(50));
159 161
160 mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 162 mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
161 evas_3d_add_sphere_frame(mesh, 0, 100, tex_scale); 163 eo_do(mesh, evas_3d_mesh_from_primitive_set(0, sphere));
162 164
163 material = eo_add(EVAS_3D_MATERIAL_CLASS, evas); 165 material = eo_add(EVAS_3D_MATERIAL_CLASS, evas);
164 166
diff --git a/src/examples/evas/evas-3d-primitives.c b/src/examples/evas/evas-3d-primitives.c
deleted file mode 100644
index 393ee16..0000000
--- a/src/examples/evas/evas-3d-primitives.c
+++ /dev/null
@@ -1,620 +0,0 @@
1#define EFL_EO_API_SUPPORT
2#define EFL_BETA_API_SUPPORT
3
4#include "evas-3d-primitives.h"
5
6// TODO Use an external library of linear algebra.
7inline void
8_vec3_subtract(vec3 *out, const vec3 *a, const vec3 *b)
9{
10 out->x = a->x - b->x;
11 out->y = a->y - b->y;
12 out->z = a->z - b->z;
13}
14
15inline void
16_vec3_copy(vec3 *dst, const vec3 *src)
17{
18 dst->x = src->x;
19 dst->y = src->y;
20 dst->z = src->z;
21}
22
23inline void
24_vec3_cross_product(vec3 *out, const vec3 *a, const vec3 *b)
25{
26 vec3 tmp;
27
28 tmp.x = a->y * b->z - a->z * b->y;
29 tmp.y = a->z * b->x - a->x * b->z;
30 tmp.z = a->x * b->y - a->y * b->x;
31
32 _vec3_copy(out, &tmp);
33}
34
35inline void
36_vec3_normalize(vec3 *out)
37{
38 float size = out->x * out->x + out->y *out->y + out->z * out->z;
39 size = sqrt(size);
40 out->x /= size;
41 out->y /= size;
42 out->z /= size;
43}
44
45const float cube_vertices[] =
46{
47 /* Front */
48 -0.5, 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0,
49 0.5, 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
50 -0.5, -0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0,
51 0.5, -0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
52
53 /* Back */
54 0.5, 0.5, -0.5, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, -1.0, 0.0, 0.0,
55 -0.5, 0.5, -0.5, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, -1.0, 0.0, 0.0,
56 0.5, -0.5, -0.5, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0,
57 -0.5, -0.5, -0.5, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, -1.0, 0.0, 0.0,
58
59 /* Left */
60 -0.5, 0.5, -0.5, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0,
61 -0.5, 0.5, 0.5, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0,
62 -0.5, -0.5, -0.5, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
63 -0.5, -0.5, 0.5, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0,
64
65 /* Right */
66 0.5, 0.5, 0.5, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0,
67 0.5, 0.5, -0.5, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, -1.0,
68 0.5, -0.5, 0.5, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0,
69 0.5, -0.5, -0.5, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, -1.0,
70
71 /* Top */
72 -0.5, 0.5, -0.5, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0,
73 0.5, 0.5, -0.5, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
74 -0.5, 0.5, 0.5, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0,
75 0.5, 0.5, 0.5, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
76
77 /* Bottom */
78 0.5, -0.5, -0.5, 0.0, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, -1.0, 0.0, 0.0,
79 -0.5, -0.5, -0.5, 0.0, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 0.0, 0.0,
80 0.5, -0.5, 0.5, 0.0, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0,
81 -0.5, -0.5, 0.5, 0.0, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, -1.0, 0.0, 0.0,
82};
83
84const unsigned short cube_indices[] =
85{
86 0, 1, 2, 2, 1, 3,
87 4, 5, 6, 6, 5, 7,
88 8, 9, 10, 10, 9, 11,
89 12, 13, 14, 14, 13, 15,
90 16, 17, 18, 18, 17, 19,
91 20, 21, 22, 22, 21, 23
92};
93
94const float square_vertices[] =
95{
96 -0.5, 0.5, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0,
97 0.5, 0.5, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
98 -0.5, -0.5, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0,
99 0.5, -0.5, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
100};
101
102const unsigned short square_indices[] = {0, 1, 2, 2, 1, 3};
103
104#define ALLOCATE_VERTEX_DATA \
105 vec3 *vertices = malloc(sizeof(vec3) * vcount); \
106 vec3 *normals = malloc(sizeof(vec3) * vcount); \
107 vec2 *tex_coord = malloc(sizeof(vec2) * vcount); \
108 vec3 *tangents = malloc(sizeof(vec3) * vcount); \
109 unsigned short *indices = malloc(sizeof(short) * icount);
110
111#define SET_VERTEX_DATA(frame) \
112 eo_do(mesh, evas_3d_mesh_vertex_count_set(vcount), \
113 evas_3d_mesh_frame_add(frame), \
114 evas_3d_mesh_frame_vertex_data_copy_set(frame, EVAS_3D_VERTEX_POSITION, \
115 sizeof(vec3), &vertices[0]), \
116 evas_3d_mesh_frame_vertex_data_copy_set(frame, EVAS_3D_VERTEX_NORMAL, \
117 sizeof(vec3), &normals[0]), \
118 evas_3d_mesh_frame_vertex_data_copy_set(frame, EVAS_3D_VERTEX_TEXCOORD, \
119 sizeof(vec2), &tex_coord[0]), \
120 evas_3d_mesh_frame_vertex_data_copy_set(frame, EVAS_3D_VERTEX_TANGENT, \
121 sizeof(vec3), &tangents[0]), \
122 evas_3d_mesh_index_data_copy_set(EVAS_3D_INDEX_FORMAT_UNSIGNED_SHORT, \
123 icount, &indices[0])); \
124 free(vertices); \
125 free(normals); \
126 free(tangents); \
127 free(tex_coord); \
128 free(indices);
129
130#define SET_VERTEX_DATA_FROM_ARRAY(mesh, frame, v_array, v_count, i_array, i_count) \
131 eo_do(mesh, \
132 evas_3d_mesh_vertex_count_set(v_count), \
133 evas_3d_mesh_frame_add(frame), \
134 evas_3d_mesh_frame_vertex_data_set(frame, EVAS_3D_VERTEX_POSITION, \
135 15 * sizeof(float), &v_array[0]), \
136 evas_3d_mesh_frame_vertex_data_set(frame, EVAS_3D_VERTEX_NORMAL, \
137 15 * sizeof(float), &v_array[3]), \
138 evas_3d_mesh_frame_vertex_data_set(frame, EVAS_3D_VERTEX_COLOR, \
139 15 * sizeof(float), &v_array[6]), \
140 evas_3d_mesh_frame_vertex_data_set(frame, EVAS_3D_VERTEX_TEXCOORD, \
141 15 * sizeof(float), &v_array[10]), \
142 evas_3d_mesh_frame_vertex_data_set(frame, EVAS_3D_VERTEX_TANGENT, \
143 15 * sizeof(float), &v_array[12]), \
144 evas_3d_mesh_index_data_set(EVAS_3D_INDEX_FORMAT_UNSIGNED_SHORT, \
145 i_count, &i_array[0]), \
146 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES));
147
148vec3 _get_func_normal(Surface *func, float x, float y)
149{
150 vec3 v00, v01, v10, d1, d2, normal;
151
152 v00 = func(x, y);
153 v01 = func(x, y + 0.01);
154 v10 = func(x + 0.01, y);
155 _vec3_subtract(&d1, &v00, &v01);
156 _vec3_subtract(&d2, &v01, &v10);
157
158 _vec3_cross_product(&normal, &d1, &d2);
159
160 _vec3_normalize(&normal);
161
162 return normal;
163}
164
165static float
166_random(int x, int y)
167{
168 int k = x + y * 57;
169 k = (k << 13) ^ k;
170 return (1.0f - ((k * (k * k * 15731 + 789221) + 1376312589) & 0x7fffffff) /
171 1073741824.0f);
172}
173
174static float
175_smooth(float x, float y)
176{
177 float res;
178 res = (_random(x - 1, y - 1) + _random(x + 1, y - 1) +
179 _random(x - 1, y + 1) + _random(x + 1, y + 1) ) / 16;
180 res += (_random(x - 1, y) + _random(x + 1, y) +
181 _random(x, y - 1) + _random(x, y + 1)) / 8;
182 res += _random(x, y) / 4;
183 return res;
184}
185
186static float
187_interpolate(float a, float b, float x)
188{
189 float ft = x * M_PI;
190 float f = (1 - cosf(ft)) * 0.5;
191 return a * (1 - f) + b * f;
192}
193
194static float _noise(float x, float y)
195{
196 float ix = (int)(x);
197 float fx = x - ix;
198 float iy = (int)(y);
199 float fy = y - iy;
200
201 float v1 = _smooth(ix, iy);
202 float v2 = _smooth(ix + 1, iy);
203 float v3 = _smooth(ix, iy + 1);
204 float v4 = _smooth(ix + 1, iy + 1);
205
206 float i1 = _interpolate(v1, v2, fx);
207 float i2 = _interpolate(v3, v4, fx);
208
209 return _interpolate(i1, i2, fy);
210}
211
212static vec3
213_perlin_terrain(float x,float y)
214{
215 vec3 out;
216 float persistence = 0.5f;
217 float frequency = 5;
218 float amplitude = 1;
219 int i = 0;
220 int octaves = 5;
221
222 out.x = x;
223 x += 0.5;
224 out.y = y;
225 y += 0.5;
226 out.z = 0;
227
228 for(i = 0;i < octaves; i++)
229 {
230 out.z += _noise(x * frequency, y * frequency) * amplitude;
231
232 amplitude *= persistence;
233 frequency *= 2;
234 }
235
236 return out;
237}
238
239void
240_generate_grid_indices(unsigned short *indices, int count)
241{
242 int i, j;
243 unsigned short *index = &indices[0];
244 int vccount = count + 1;
245
246 for (j = 0; j < count; j++)
247 for (i = 0; i < count; i++)
248 {
249 *index++ = (i * vccount) + j;
250 *index++ = (i * vccount) + j + 1;
251 *index++ = ((i + 1) * vccount) + j;
252
253 *index++ = ((i + 1) * vccount) + j;
254 *index++ = (i * vccount) + j + 1;
255 *index++ = ((i + 1) * vccount) + j + 1;
256 }
257}
258
259void
260_generate_tape_indices(unsigned short *indices, int count)
261{
262 int i, vccount = count + 1;
263 unsigned short *index = &indices[0];
264
265 for (i = 0; i < count; i++)
266 {
267 *index++ = i;
268 *index++ = i + 1;
269 *index++ = i + 1 + vccount;
270
271 *index++ = i;
272 *index++ = i + vccount;
273 *index++ = i + vccount + 1;
274 }
275}
276
277void
278evas_3d_add_sphere_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
279{
280 int vcount, icount, vccount, i, j;
281 unsigned short *index;
282
283 vccount = p + 1;
284 vcount = vccount * vccount;
285 icount = p * p * 6;
286
287 ALLOCATE_VERTEX_DATA
288
289 /* Calculate vertices position of the sphere mesh by using
290 splitting of sphere by latitude and longitude. */
291 for (i = 0; i <= p; i++)
292 {
293 double lati, z, r, point_r;
294
295 point_r = 0.00001;//non-zero little value for correct tangents calculation.
296
297 lati = ((M_PI - 2 * point_r) * (double)i) / (double)p;
298 z = cos(lati + point_r);
299 r = fabs(sin(lati + point_r));
300
301 for (j = 0; j <= p; j++)
302 {
303 double longi;
304 int num = (i * (p + 1)) + j;
305
306 longi = (M_PI * 2.0 * (double)j) / (double)p;
307
308 normals[num].x = r * sin(longi);
309 normals[num].y = r * cos(longi);
310 normals[num].z = z;
311
312 vertices[num].x = normals[num].x / 2;
313 vertices[num].y = normals[num].y / 2;
314 vertices[num].z = normals[num].z / 2;
315
316 if (vertices[num].x > 0.0)
317 {
318 tangents[num].x = -normals[num].z;
319 tangents[num].y = normals[num].y;
320 tangents[num].z = normals[num].x;
321 }
322 else
323 {
324 tangents[num].x = normals[num].z;
325 tangents[num].y = normals[num].y;
326 tangents[num].z = -normals[num].x;
327 }
328
329 tex_coord[num].x = i / (float)(vccount - 1) * tex_scale.x;
330 tex_coord[num].y = tex_scale.y - j / (float)(vccount - 1) * tex_scale.y;
331 }
332 }
333
334 _generate_grid_indices(indices, p);
335
336 /* Triangulation of sphere mesh in appliance with buffer of indices. */
337 for (i = 0; i < icount; i += 3)
338 {
339 vec3 e1, e2;
340 float du1, du2, dv1, dv2, f;
341 vec3 tangent;
342 int num0, num1, num2;
343
344 num0 = indices[i + 0];
345 num1 = indices[i + 1];
346 num2 = indices[i + 2];
347
348 e1.x = vertices[num1].x - vertices[num0].x;
349 e1.y = vertices[num1].y - vertices[num0].y;
350 e1.z = vertices[num1].z - vertices[num0].z;
351
352 e2.x = vertices[num2].x - vertices[num0].x;
353 e2.y = vertices[num2].y - vertices[num0].y;
354 e2.z = vertices[num2].z - vertices[num0].z;
355
356 du1 = tex_coord[num1].x - tex_coord[num0].x;
357 dv1 = tex_coord[num1].y - tex_coord[num0].y;
358
359 du2 = tex_coord[num2].x - tex_coord[num0].x;
360 dv2 = tex_coord[num2].y - tex_coord[num0].y;
361
362 f = 1.0 / ((du1 * dv2) - (du2 * dv1));
363
364 tangent.x = f * ((dv2 * e1.x) - (dv1 * e2.x));
365 tangent.y = f * ((dv2 * e1.y) - (dv1 * e2.y));
366 tangent.z = f * ((dv2 * e1.z) - (dv1 * e2.z));
367
368 tangents[num0] = tangent;
369 }
370
371 /* Coupling between vertices by calculation of tangent parametr correct value. */
372 for (i = 0; i <= p; i++)
373 {
374 for (j = 0; j <= p; j++)
375 {
376 if (j == p)
377 {
378 tangents[(i * (p + 1)) + j] = tangents[i * (p + 1)];
379 }
380 }
381 }
382 SET_VERTEX_DATA(frame)
383}
384
385void
386_normalize(vec3 *vertices, vec3 *normals, int vcount)
387{
388 int i;
389 vec3 min, max;
390 min = max = vertices[0];
391
392#define CHECK_MIN_AND_MAX(coord) \
393 if (min.coord > vertices[i].coord) \
394 min.coord = vertices[i].coord; \
395 else if (max.coord < vertices[i].coord) \
396 max.coord = vertices[i].coord;
397 for (i = 1; i < vcount; i++)
398 {
399 CHECK_MIN_AND_MAX(x)
400 CHECK_MIN_AND_MAX(y)
401 CHECK_MIN_AND_MAX(z)
402 }
403#undef CHECK_MIN_AND_MAX
404
405 for (i = 0; i < vcount; i++)
406 {
407 vertices[i].x = (vertices[i].x - min.x) / (max.x - min.x) - 0.5;
408 vertices[i].y = (vertices[i].y - min.y) / (max.y - min.y) - 0.5;
409 vertices[i].z = (vertices[i].z - min.z) / (max.z - min.z) - 0.5;
410
411 normals[i].x = normals[i].x / (max.x - min.x);
412 normals[i].y = normals[i].y / (max.y - min.y);
413 normals[i].z = normals[i].z / (max.z - min.z);
414 }
415}
416
417void
418evas_3d_add_func_surface_frame(Eo *mesh, int frame, Surface func, int p, vec2 tex_scale)
419{
420 int vcount, icount, vccount, i, j;
421 icount = p * p * 6;
422 vccount = p + 1;
423 vcount = vccount * vccount;
424
425 ALLOCATE_VERTEX_DATA
426
427 double v, u, d = 1.0 / p;
428
429 for (j = 0; j < vccount; j++)
430 {
431 u = j * d - 0.5;
432 for (i = 0; i < vccount; i++)
433 {
434 v = i * d - 0.5;
435 vertices[i + j * vccount] = func(v, u);
436 normals[i + j * vccount] = _get_func_normal(func, v, u);
437
438 // TODO Add tangent calculation
439 tangents[i + j * vccount].x = 0;
440 tangents[i + j * vccount].y = 0;
441 tangents[i + j * vccount].z = 0;
442
443 tex_coord[i + j * vccount].x = i / (float)(vccount - 1) * tex_scale.x;
444 tex_coord[i + j *vccount].y = tex_scale.y - j / (float)(vccount - 1) * tex_scale.y;
445 }
446 }
447
448 _normalize(vertices, normals, vcount);
449 _generate_grid_indices(indices, p);
450 SET_VERTEX_DATA(frame)
451}
452
453void
454evas_3d_add_terrain_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
455{
456 evas_3d_add_func_surface_frame(mesh, frame, _perlin_terrain, p, tex_scale);
457}
458
459void
460evas_3d_add_torus_frame(Eo *mesh, int frame, float ratio, int p, vec2 tex_scale)
461{
462 int vcount, icount, vccount, i, j;
463 icount = p * p * 6;
464 vccount = p + 1;
465 vcount = vccount * vccount;
466
467 ALLOCATE_VERTEX_DATA
468
469 double d, sinth, costh, fi, theta, sinfi, cosfi;
470
471 d = 2 * M_PI / p;
472
473 float rratio;
474
475 if ((ratio > 1.0) || (ratio < 0.0))
476 {
477 printf("Ratio of torus should be between 0.0 and 1.0. \n");
478 printf("Ratio = %f is a bad value, so 0.25 is used like default ratio.\n",
479 ratio);
480 rratio = 0.25;
481 }
482 else
483 {
484 rratio = ratio;
485 }
486
487 for (j = 0; j < vccount; j++)
488 {
489 theta = j * d;
490 sinth = sin(theta);
491 costh = cos(theta);
492 for (i = 0; i < vccount; i++)
493 {
494 fi = i * d;
495 sinfi = sin(fi);
496 cosfi = cos(fi);
497 vertices[i + j * vccount].x = (1.0 - rratio + rratio * cosfi) * costh * 0.5;
498 vertices[i + j * vccount].y = (1.0 - rratio + rratio * cosfi) * sinth * 0.5;
499 vertices[i + j * vccount].z = rratio * sinfi * 0.5;
500
501 normals[i + j * vccount].x = cosfi * costh;
502 normals[i + j * vccount].y = cosfi * sinth;
503 normals[i + j * vccount].z = sinfi;
504
505 tangents[i + j * vccount].x = -sinfi * costh;
506 tangents[i + j * vccount].y = -sinfi * sinth;
507 tangents[i + j * vccount].z = cosfi;
508
509 _vec3_normalize(&normals[i + j * vccount]);
510
511 tex_coord[i + j * vccount].x = i / (float)(vccount - 1) * tex_scale.x;
512 tex_coord[i + j *vccount].y = tex_scale.y - j / (float)(vccount - 1) * tex_scale.y;
513 }
514 }
515
516 _generate_grid_indices(indices, p);
517
518 SET_VERTEX_DATA(frame)
519}
520
521void
522evas_3d_add_cylinder_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
523{
524 int vcount, icount, vccount, i;
525 icount = p * 6;
526 vccount = p + 1;
527 vcount = 2 * vccount;
528
529 ALLOCATE_VERTEX_DATA
530
531 double dfi, fi, sinfi, cosfi;
532 dfi = 2 * M_PI / p;
533
534 for (i = 0; i < vccount; i++)
535 {
536 fi = i * dfi;
537 sinfi = sin(fi);
538 cosfi = cos(fi);
539 vertices[i + vccount].x = vertices[i].x = sinfi / 2.0;
540 vertices[i + vccount].y = vertices[i].y = cosfi / 2.0;
541 vertices[i].z = -0.5;
542 vertices[i + vccount].z = 0.5;
543
544 normals[i + vccount].x = normals[i].x = sinfi;
545 normals[i + vccount].y = normals[i].y = cosfi;
546 normals[i + vccount].z = normals[i].z = 0;
547
548 tangents[i + vccount].x = tangents[i].x = cosfi;
549 tangents[i + vccount].y = tangents[i].y = -sinfi;
550 tangents[i + vccount].z = tangents[i].z = 0;
551
552 tex_coord[i].x = i / (float)(vccount - 1) * tex_scale.x;
553 tex_coord[i].y = 0;
554 tex_coord[i + vccount].x = i / (float)(vccount - 1) * tex_scale.x;
555 tex_coord[i + vccount].y = tex_scale.y;
556 }
557
558 _generate_tape_indices(indices, p);
559
560 SET_VERTEX_DATA(frame)
561}
562
563void
564evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
565{
566 int vcount, icount, vccount, i;
567 double dfi, fi, sinfi, cosfi, nplane, nz;
568
569 icount = p * 6;
570 vccount = p + 1;
571 vcount = 2 * vccount;
572
573 dfi = 2.0 * M_PI / p;
574 nz = sqrt(1.0 / 3.0);
575 nplane = sqrt(2.0 / 3.0);
576
577 ALLOCATE_VERTEX_DATA
578
579 for (i = 0; i < vccount; i++)
580 {
581 fi = i * dfi;
582 sinfi = sin(fi);
583 cosfi = cos(fi);
584 vertices[i].x = sinfi / 2.0;
585 vertices[i].y = cosfi / 2.0;
586 vertices[i].z = -0.5;
587 vertices[i + vccount].x = 0;
588 vertices[i + vccount].y = 0;
589 vertices[i + vccount].z = 0.5;
590
591 normals[i + vccount].x = normals[i].x = sinfi * nplane;
592 normals[i + vccount].y = normals[i].y = cosfi * nplane;
593 normals[i + vccount].z = normals[i].z = nz;
594
595 tangents[i + vccount].x = tangents[i].x = cosfi;
596 tangents[i + vccount].y = tangents[i].y = -sinfi;
597 tangents[i + vccount].z = tangents[i].z = 0;
598
599 tex_coord[i].x = i / (float)(vccount - 1) * tex_scale.x;
600 tex_coord[i].y = 0;
601 tex_coord[i + vccount].x = tex_coord[i].x;
602 tex_coord[i + vccount].y = tex_scale.y;
603 }
604
605 _generate_tape_indices(indices, p);
606
607 SET_VERTEX_DATA(frame)
608}
609
610void
611evas_3d_add_square_frame(Eo *mesh, int frame)
612{
613 SET_VERTEX_DATA_FROM_ARRAY(mesh, frame, square_vertices, 4, square_indices, 6)
614}
615
616void
617evas_3d_add_cube_frame(Eo *mesh, int frame)
618{
619 SET_VERTEX_DATA_FROM_ARRAY(mesh, frame, cube_vertices, 24, cube_indices, 36)
620}
diff --git a/src/examples/evas/evas-3d-primitives.h b/src/examples/evas/evas-3d-primitives.h
deleted file mode 100644
index c08ae65..0000000
--- a/src/examples/evas/evas-3d-primitives.h
+++ /dev/null
@@ -1,59 +0,0 @@
1#ifndef EVAS_3D_PRIMITIVES_H
2#define EVAS_3D_PRIMITIVES_H
3
4#include <Eo.h>
5#include <Evas.h>
6#include <math.h>
7
8// TODO Use an external library of linear algebra.
9typedef struct _vec3
10{
11 float x;
12 float y;
13 float z;
14} vec3;
15
16typedef struct _vec2
17{
18 float x;
19 float y;
20} vec2;
21
22/* The type of user-defined parametric surface function.*/
23typedef vec3 (Surface)(float x, float y);
24
25/* Set frame as sphere. */
26void
27evas_3d_add_sphere_frame(Eo *mesh, int frame, int precision, vec2 tex_scale);
28
29/* Set frame as user defined parametric surface.A parametric surface is a
30 * surface in the Euclidean space R3 which is defined by a parametric equation
31 * with two parameters. */
32void
33evas_3d_add_func_surface_frame(Eo *mesh, int frame, Surface func, int precision, vec2 tex_scale);
34
35/* Set frame as sphere as torus */
36void
37evas_3d_add_torus_frame(Eo *mesh, int frame, float rratio, int precision, vec2 tex_scale);
38
39/* Set frame as cylinder. */
40void
41evas_3d_add_cylinder_frame(Eo *mesh, int frame, int precision, vec2 tex_scale);
42
43/* Set frame as cone. */
44void
45evas_3d_add_cone_frame(Eo *mesh, int frame, int precision, vec2 tex_scale);
46
47/* Set frame as square. */
48void
49evas_3d_add_square_frame(Eo *mesh, int frame);
50
51/* Set frame as cube. */
52void
53evas_3d_add_cube_frame(Eo *mesh, int frame);
54
55/* Set frame as terrain generated by perlin noise algorithm*/
56void
57evas_3d_add_terrain_frame(Eo *mesh, int frame, int precision, vec2 tex_scale);
58
59#endif // EVAS_3D_PRIMITIVES_H
diff --git a/src/examples/evas/evas-3d-proxy.c b/src/examples/evas/evas-3d-proxy.c
index b0692f2..e74670e 100644
--- a/src/examples/evas/evas-3d-proxy.c
+++ b/src/examples/evas/evas-3d-proxy.c
@@ -4,7 +4,7 @@
4 * Data which will be used as texture can be generated directly in application. 4 * Data which will be used as texture can be generated directly in application.
5 * 5 *
6 * @verbatim 6 * @verbatim
7 * gcc -o evas-3d-proxy evas-3d-proxy.c evas-3d-primitives.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm 7 * gcc -o evas-3d-proxy evas-3d-proxy.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm
8 * @endverbatim 8 * @endverbatim
9 */ 9 */
10 10
@@ -15,7 +15,6 @@
15#include <Ecore.h> 15#include <Ecore.h>
16#include <Ecore_Evas.h> 16#include <Ecore_Evas.h>
17#include <Evas.h> 17#include <Evas.h>
18#include "evas-3d-primitives.h"
19 18
20#define WIDTH 400 19#define WIDTH 400
21#define HEIGHT 400 20#define HEIGHT 400
@@ -33,6 +32,7 @@ typedef struct _Scene_Data
33 32
34 Eo *camera; 33 Eo *camera;
35 Eo *light; 34 Eo *light;
35 Eo *cube;
36 Eo *mesh; 36 Eo *mesh;
37 Eo *material; 37 Eo *material;
38 Eo *texture; 38 Eo *texture;
@@ -159,10 +159,15 @@ _mesh_setup(Scene_Data *data)
159 159
160 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, data->texture)); 160 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, data->texture));
161 161
162 /* Set data of primitive */
163 data->cube = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
164 eo_do(data->cube,
165 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE));
166
162 /* Setup mesh. */ 167 /* Setup mesh. */
163 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 168 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
164 evas_3d_add_cube_frame(data->mesh, 0);
165 eo_do(data->mesh, 169 eo_do(data->mesh,
170 evas_3d_mesh_from_primitive_set(0, data->cube),
166 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_FLAT), 171 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_FLAT),
167 evas_3d_mesh_frame_material_set(0, data->material)); 172 evas_3d_mesh_frame_material_set(0, data->material));
168 173
diff --git a/src/examples/evas/evas-3d-shadows.c b/src/examples/evas/evas-3d-shadows.c
index 1ae4ee5..bf2319f 100644
--- a/src/examples/evas/evas-3d-shadows.c
+++ b/src/examples/evas/evas-3d-shadows.c
@@ -8,7 +8,7 @@
8 * @see evas_3d_billboard_set/get 8 * @see evas_3d_billboard_set/get
9 * 9 *
10 * @verbatim 10 * @verbatim
11 * 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 11 * gcc -o evas-3d-shadows evas-3d-shadows.c `pkg-config --libs --cflags efl evas ecore ecore-evas eo eina` -lm
12 * @endverbatim 12 * @endverbatim
13 */ 13 */
14 14
@@ -26,7 +26,6 @@
26#include <Ecore_Evas.h> 26#include <Ecore_Evas.h>
27#include <Eina.h> 27#include <Eina.h>
28#include <math.h> 28#include <math.h>
29#include "evas-3d-primitives.h"
30#include "evas-common.h" 29#include "evas-common.h"
31 30
32#define WIDTH 1024 31#define WIDTH 1024
@@ -41,8 +40,6 @@
41static const char *model_path = PACKAGE_EXAMPLES_DIR EVAS_MODEL_FOLDER "/sonic.md2"; 40static const char *model_path = PACKAGE_EXAMPLES_DIR EVAS_MODEL_FOLDER "/sonic.md2";
42static const char *image_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/sonic.png"; 41static const char *image_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/sonic.png";
43static const char *b_image_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/billboard.png"; 42static const char *b_image_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/billboard.png";
44static const vec2 tex_scale = {1, 1};
45static const vec2 fence_tex_scale = {160, 12};
46 43
47Ecore_Evas *ecore_evas = NULL; 44Ecore_Evas *ecore_evas = NULL;
48Evas *evas = NULL; 45Evas *evas = NULL;
@@ -52,6 +49,7 @@ Evas_3D_Node *choosed_node = NULL;
52 49
53typedef struct _Body_3D 50typedef struct _Body_3D
54{ 51{
52 Eo *primitive;
55 Eo *material; 53 Eo *material;
56 Eo *mesh; 54 Eo *mesh;
57 Eo *node; 55 Eo *node;
@@ -201,22 +199,35 @@ _body_material_set(Body_3D *body, float r, float g, float b)
201static void 199static void
202_sphere_setup(Body_3D *sphere) 200_sphere_setup(Body_3D *sphere)
203{ 201{
202 sphere->primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
203 eo_do(sphere->primitive,
204 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_SPHERE),
205 evas_3d_primitive_precision_set(50));
206
204 sphere->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 207 sphere->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
205 evas_3d_add_sphere_frame(sphere->mesh, 0, 50, tex_scale); 208 eo_do(sphere->mesh,
209 evas_3d_mesh_from_primitive_set(0, sphere->primitive));
210
206 _body_material_set(sphere, 1, 0.0, 0.0); 211 _body_material_set(sphere, 1, 0.0, 0.0);
207 212
208 sphere->node = 213 sphere->node = eo_add(EVAS_3D_NODE_CLASS, evas,
209 eo_add(EVAS_3D_NODE_CLASS, evas, 214 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH),
210 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH), 215 evas_3d_node_position_set(3.0, 3.0, 0.0));
211 evas_3d_node_position_set(3.0, 3.0, 0.0));
212 eo_do(sphere->node, evas_3d_node_mesh_add(sphere->mesh)); 216 eo_do(sphere->node, evas_3d_node_mesh_add(sphere->mesh));
213} 217}
214 218
215static void 219static void
216_cone_setup(Body_3D *cone) 220_cone_setup(Body_3D *cone)
217{ 221{
222 cone->primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
223 eo_do(cone->primitive,
224 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CONE),
225 evas_3d_primitive_precision_set(50));
226
218 cone->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 227 cone->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
219 evas_3d_add_cone_frame(cone->mesh, 0, 100, tex_scale); 228 eo_do(cone->mesh,
229 evas_3d_mesh_from_primitive_set(0, cone->primitive));
230
220 _body_material_set(cone, 0.8, 0.5, 0.5); 231 _body_material_set(cone, 0.8, 0.5, 0.5);
221 232
222 cone->node = 233 cone->node =
@@ -230,8 +241,15 @@ _cone_setup(Body_3D *cone)
230static void 241static void
231_cylinder_setup(Body_3D *cylinder) 242_cylinder_setup(Body_3D *cylinder)
232{ 243{
244 cylinder->primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
245 eo_do(cylinder->primitive,
246 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CYLINDER),
247 evas_3d_primitive_precision_set(50));
248
233 cylinder->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 249 cylinder->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
234 evas_3d_add_cylinder_frame(cylinder->mesh, 0, 50, tex_scale); 250 eo_do(cylinder->mesh,
251 evas_3d_mesh_from_primitive_set(0, cylinder->primitive));
252
235 _body_material_set(cylinder, 0.0, 0.0, 1.0); 253 _body_material_set(cylinder, 0.0, 0.0, 1.0);
236 254
237 cylinder->node = 255 cylinder->node =
@@ -276,8 +294,17 @@ _fence_setup(Body_3D *fence)
276 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 1.0, 1.0, 1.0, 1.0), 294 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 1.0, 1.0, 1.0, 1.0),
277 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 295 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
278 evas_3d_material_shininess_set(100.0)); 296 evas_3d_material_shininess_set(100.0));
297
298 fence->primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
299 eo_do(fence->primitive,
300 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CYLINDER),
301 evas_3d_primitive_mode_set(EVAS_3D_PRIMITIVE_MODE_WITHOUT_BASE),
302 evas_3d_primitive_tex_scale_set(160.0, 12.0),
303 evas_3d_primitive_precision_set(50));
304
279 fence->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 305 fence->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
280 evas_3d_add_cylinder_frame(fence->mesh, 0, 50, fence_tex_scale); 306 eo_do(fence->mesh,
307 evas_3d_mesh_from_primitive_set(0, fence->primitive));
281 308
282 eo_do(fence->mesh, 309 eo_do(fence->mesh,
283 evas_3d_mesh_frame_material_set(0, fence->material), 310 evas_3d_mesh_frame_material_set(0, fence->material),
@@ -296,8 +323,13 @@ _fence_setup(Body_3D *fence)
296static void 323static void
297_square_setup(Body_3D *square) 324_square_setup(Body_3D *square)
298{ 325{
326 square->primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
327 eo_do(square->primitive,
328 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_SQUARE));
329
299 square->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 330 square->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
300 evas_3d_add_square_frame(square->mesh, 0); 331 eo_do(square->mesh,
332 evas_3d_mesh_from_primitive_set(0, square->primitive));
301 333
302 _body_material_set(square, 0.4, 0.4, 0.4); 334 _body_material_set(square, 0.4, 0.4, 0.4);
303 335
@@ -313,8 +345,13 @@ _square_setup(Body_3D *square)
313static void 345static void
314_box_setup(Body_3D *box) 346_box_setup(Body_3D *box)
315{ 347{
348 box->primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
349 eo_do(box->primitive,
350 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE));
351
316 box->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 352 box->mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
317 evas_3d_add_cube_frame(box->mesh, 0); 353 eo_do(box->mesh,
354 evas_3d_mesh_from_primitive_set(0, box->primitive));
318 355
319 _body_material_set(box, 0, 1, 0); 356 _body_material_set(box, 0, 1, 0);
320 357
@@ -370,8 +407,13 @@ _billboard_setup(Scene_Data *data)
370 evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT, 407 evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT,
371 EVAS_3D_WRAP_MODE_REPEAT)); 408 EVAS_3D_WRAP_MODE_REPEAT));
372 409
410 data->billboard.primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
411 eo_do(data->billboard.primitive,
412 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_SQUARE));
413
373 data->billboard.mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 414 data->billboard.mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
374 evas_3d_add_square_frame(data->billboard.mesh, 0); 415 eo_do(data->billboard.mesh,
416 evas_3d_mesh_from_primitive_set(0, data->billboard.primitive));
375 417
376 _body_material_set(&(data->billboard), 1.0, 1.0, 1.0); 418 _body_material_set(&(data->billboard), 1.0, 1.0, 1.0);
377 419
diff --git a/src/examples/evas/shooter/evas-3d-shooter-header.h b/src/examples/evas/shooter/evas-3d-shooter-header.h
index 2910c07..67b912e 100644
--- a/src/examples/evas/shooter/evas-3d-shooter-header.h
+++ b/src/examples/evas/shooter/evas-3d-shooter-header.h
@@ -14,7 +14,6 @@
14#include <Evas.h> 14#include <Evas.h>
15#include "Eo.h" 15#include "Eo.h"
16#include "evas-3d-shooter-macros.h" 16#include "evas-3d-shooter-macros.h"
17#include "../evas-3d-primitives.h"
18#include "../evas-common.h" 17#include "../evas-common.h"
19 18
20#define LOCAL_IMAGE_FOLDER PACKAGE_EXAMPLES_DIR "" EVAS_PROJECT_IMAGE_FOLDER 19#define LOCAL_IMAGE_FOLDER PACKAGE_EXAMPLES_DIR "" EVAS_PROJECT_IMAGE_FOLDER
@@ -22,6 +21,7 @@
22 21
23typedef struct _Scene_Data 22typedef struct _Scene_Data
24{ 23{
24 Eo *cylinder_primitive;
25 Eo *texture_diffuse_eagle; 25 Eo *texture_diffuse_eagle;
26 Eo *texture_diffuse_world; 26 Eo *texture_diffuse_world;
27 Eo *texture_diffuse_grass; 27 Eo *texture_diffuse_grass;
diff --git a/src/examples/evas/shooter/evas-3d-shooter-macros.h b/src/examples/evas/shooter/evas-3d-shooter-macros.h
index 83c4710..915afeb 100644
--- a/src/examples/evas/shooter/evas-3d-shooter-macros.h
+++ b/src/examples/evas/shooter/evas-3d-shooter-macros.h
@@ -49,6 +49,18 @@
49#define SNAKE_FRAME_Z1 -59 49#define SNAKE_FRAME_Z1 -59
50#define SNAKE_FRAME_Z2 32 50#define SNAKE_FRAME_Z2 32
51 51
52typedef struct _vec3
53{
54 float x;
55 float y;
56 float z;
57} vec3;
58
59typedef struct _vec2
60{
61 float x;
62 float y;
63} vec2;
52 64
53#define KEY_MOTION(lateral, camera) \ 65#define KEY_MOTION(lateral, camera) \
54 { \ 66 { \
diff --git a/src/examples/evas/shooter/evas-3d-shooter.c b/src/examples/evas/shooter/evas-3d-shooter.c
index 0ca334b..a7caef1 100644
--- a/src/examples/evas/shooter/evas-3d-shooter.c
+++ b/src/examples/evas/shooter/evas-3d-shooter.c
@@ -9,7 +9,7 @@
9* which fixes the rocket entry. The warrior isn't passable for camera, 9* which fixes the rocket entry. The warrior isn't passable for camera,
10* neither is wall, stairs and columns. There is a possibility to go upstairs and break down. 10* neither is wall, stairs and columns. There is a possibility to go upstairs and break down.
11* 11*
12* Compile with "gcc -g evas-3d-shooter.c evas-3d-shooter-header.c ../evas-3d-primitives.c -o evas-3d-shooter `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm" 12* Compile with "gcc -g evas-3d-shooter.c evas-3d-shooter-header.c -o evas-3d-shooter `pkg-config --libs --cflags efl evas ecore ecore-evas eo` -lm"
13* 13*
14* Run program with flag "-s=TRUE" to turn on shadows, with "-f=TRUE" to turn on the fog, with "-b=TRUE" to turn on the blending. 14* Run program with flag "-s=TRUE" to turn on shadows, with "-f=TRUE" to turn on the fog, with "-b=TRUE" to turn on the blending.
15*/ 15*/
@@ -1008,9 +1008,6 @@ _mesh_setup_gun_planet(Scene_Data *data)
1008 MATERIAL_TEXTURE_SET(carpet, carpet, gazebo_top_path, gazebo_t_path) 1008 MATERIAL_TEXTURE_SET(carpet, carpet, gazebo_top_path, gazebo_t_path)
1009 NORMAL_SET(carpet, carpet, gazebo_t_n_path) 1009 NORMAL_SET(carpet, carpet, gazebo_t_n_path)
1010 1010
1011
1012
1013
1014 if (data->blending) 1011 if (data->blending)
1015 { 1012 {
1016 eo_do(data->texture_diffuse_carpet, 1013 eo_do(data->texture_diffuse_carpet,
@@ -1138,9 +1135,8 @@ _mesh_setup_column(Scene_Data *data, int index)
1138 1135
1139 SETUP_MESH_NODE(column[index]) 1136 SETUP_MESH_NODE(column[index])
1140 1137
1141 evas_3d_add_cylinder_frame(data->mesh_column[index], 0, 50, tex_scale);
1142
1143 eo_do(data->mesh_column[index], 1138 eo_do(data->mesh_column[index],
1139 evas_3d_mesh_from_primitive_set(0, data->cylinder_primitive),
1144 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE), 1140 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE),
1145 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES), 1141 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES),
1146 evas_3d_mesh_frame_material_set(0, data->material_column), 1142 evas_3d_mesh_frame_material_set(0, data->material_column),
@@ -1273,9 +1269,17 @@ _scene_setup(Scene_Data *data)
1273 _light_setup(data); 1269 _light_setup(data);
1274 _mesh_setup_gun_planet(data); 1270 _mesh_setup_gun_planet(data);
1275 _mesh_setup_snake(data); 1271 _mesh_setup_snake(data);
1272
1276 for (i = 0; i < 10; i++) 1273 for (i = 0; i < 10; i++)
1277 _mesh_setup_rocket(data, i); 1274 _mesh_setup_rocket(data, i);
1278 1275
1276 data->cylinder_primitive = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas);
1277 eo_do(data->cylinder_primitive,
1278 evas_3d_primitive_mode_set(EVAS_3D_PRIMITIVE_MODE_WITHOUT_BASE),
1279 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CYLINDER),
1280 evas_3d_primitive_tex_scale_set(1.0, 1.0),
1281 evas_3d_primitive_precision_set(50));
1282
1279 for ( i = 0; i < 4; i++) 1283 for ( i = 0; i < 4; i++)
1280 _mesh_setup_column(data, i); 1284 _mesh_setup_column(data, i);
1281 1285