summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogdan Devichev <b.devichev@samsung.com>2015-01-29 17:39:59 +0200
committerBogdan Devichev <b.devichev@samsung.com>2015-01-29 17:39:59 +0200
commitd69e06183c089e354820fc766080ee3dc8804096 (patch)
treeb4732bebd7009ea0caf8e59fb184f28e418fc8ff
parent23c3cd9489c32093226124aa0efb5f4853230302 (diff)
Obj_io. Step 5. Example to see fix on step 4. (warning with memory in loader will be fixed ASAP)
-rw-r--r--src/examples/evas/Obj_fixes/example_to_explain_fixes.c59
-rw-r--r--src/examples/evas/Obj_fixes/sweet_home_only_vertex_coords.mtl12
-rw-r--r--src/examples/evas/Obj_fixes/sweet_home_only_vertex_coords.obj40
-rw-r--r--src/examples/evas/Obj_fixes/sweet_home_without_normals.mtl22
-rw-r--r--src/examples/evas/Obj_fixes/sweet_home_without_normals.obj96
-rw-r--r--src/examples/evas/Obj_fixes/sweet_home_without_tex_coords.mtl12
-rw-r--r--src/examples/evas/Obj_fixes/sweet_home_without_tex_coords.obj55
7 files changed, 273 insertions, 23 deletions
diff --git a/src/examples/evas/Obj_fixes/example_to_explain_fixes.c b/src/examples/evas/Obj_fixes/example_to_explain_fixes.c
index e07ff287a1..35bdc5385b 100644
--- a/src/examples/evas/Obj_fixes/example_to_explain_fixes.c
+++ b/src/examples/evas/Obj_fixes/example_to_explain_fixes.c
@@ -17,6 +17,21 @@
17#define WIDTH 1900 17#define WIDTH 1900
18#define HEIGHT 1080 18#define HEIGHT 1080
19 19
20#define ADD_OBJ_MESH(mesh_name, Y, Z) \
21 mesh_name = eo_add(EVAS_3D_MESH_CLASS, evas); \
22 eo_do(mesh_name, \
23 efl_file_set("sweet_"#mesh_name".obj", NULL), \
24 evas_3d_mesh_frame_material_set(0, material), \
25 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG)); \
26 eo_do(mesh_name, efl_file_save("saved_"#mesh_name".obj", NULL, NULL)); \
27 mesh_name##_node = eo_add(EVAS_3D_NODE_CLASS, evas, \
28 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH)); \
29 eo_do(root_node, \
30 evas_3d_node_member_add(mesh_name##_node)); \
31 eo_do(mesh_name##_node, \
32 evas_3d_node_mesh_add(mesh_name), \
33 evas_3d_node_position_set(0, Y, Z));
34
20Ecore_Evas *ecore_evas = NULL; 35Ecore_Evas *ecore_evas = NULL;
21Evas *evas = NULL; 36Evas *evas = NULL;
22Eo *background = NULL; 37Eo *background = NULL;
@@ -27,8 +42,14 @@ Eo *root_node = NULL;
27Eo *camera_node = NULL; 42Eo *camera_node = NULL;
28Eo *light_node = NULL; 43Eo *light_node = NULL;
29Eo *camera = NULL; 44Eo *camera = NULL;
30Eo *mesh_node = NULL; 45Eo *home_node = NULL;
31Eo *mesh = NULL; 46Eo *home = NULL;
47Eo *home_without_normals_node = NULL;
48Eo *home_without_normals = NULL;;
49Eo *home_without_tex_coords_node = NULL;
50Eo *home_without_tex_coords = NULL;
51Eo *home_only_vertex_coords_node = NULL;
52Eo *home_only_vertex_coords = NULL;
32Eo *material = NULL; 53Eo *material = NULL;
33Eo *texture = NULL; 54Eo *texture = NULL;
34Eo *light = NULL; 55Eo *light = NULL;
@@ -38,7 +59,7 @@ static float angle = 0;
38static Eina_Bool 59static Eina_Bool
39_animate_scene(void *data) 60_animate_scene(void *data)
40{ 61{
41 angle += 0.5; 62 angle += 0.2;
42 63
43 eo_do((Evas_3D_Node *)data, evas_3d_node_orientation_angle_axis_set(angle, 1.0, 1.0, -1.0)); 64 eo_do((Evas_3D_Node *)data, evas_3d_node_orientation_angle_axis_set(angle, 1.0, 1.0, -1.0));
44 65
@@ -92,7 +113,7 @@ main(void)
92 /* Add the camera. */ 113 /* Add the camera. */
93 camera = eo_add(EVAS_3D_CAMERA_CLASS, evas); 114 camera = eo_add(EVAS_3D_CAMERA_CLASS, evas);
94 eo_do(camera, 115 eo_do(camera,
95 evas_3d_camera_projection_perspective_set(60.0, 1.0, 1.0, 500.0)); 116 evas_3d_camera_projection_perspective_set(100.0, 1.0, 1.0, 500.0));
96 117
97 camera_node = 118 camera_node =
98 eo_add(EVAS_3D_NODE_CLASS, evas, 119 eo_add(EVAS_3D_NODE_CLASS, evas,
@@ -102,8 +123,8 @@ main(void)
102 eo_do(root_node, 123 eo_do(root_node,
103 evas_3d_node_member_add(camera_node)); 124 evas_3d_node_member_add(camera_node));
104 eo_do(camera_node, 125 eo_do(camera_node,
105 evas_3d_node_position_set(10.0, 0.0, 2.0), 126 evas_3d_node_position_set(10.0, 0.0, 0.0),
106 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 2.0, 127 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 0.0,
107 EVAS_3D_SPACE_PARENT, 0.0, 0.0, 1.0)); 128 EVAS_3D_SPACE_PARENT, 0.0, 0.0, 1.0));
108 /* Add the light. */ 129 /* Add the light. */
109 light = eo_add(EVAS_3D_LIGHT_CLASS, evas); 130 light = eo_add(EVAS_3D_LIGHT_CLASS, evas);
@@ -124,16 +145,14 @@ main(void)
124 eo_do(root_node, 145 eo_do(root_node,
125 evas_3d_node_member_add(light_node)); 146 evas_3d_node_member_add(light_node));
126 147
127 /* Add the mesh. */ 148 texture = eo_add(EVAS_3D_TEXTURE_CLASS, evas);
128 mesh = eo_add(EVAS_3D_MESH_CLASS, evas);
129 material = eo_add(EVAS_3D_MATERIAL_CLASS, evas); 149 material = eo_add(EVAS_3D_MATERIAL_CLASS, evas);
130 150
131 eo_do(mesh, 151 ADD_OBJ_MESH(home, -3, -3)
132 efl_file_set("sweet_home.obj", NULL), 152 ADD_OBJ_MESH(home_without_normals, -3, 3)
133 evas_3d_mesh_frame_material_set(0, material), 153 ADD_OBJ_MESH(home_without_tex_coords, 3, -3)
134 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG)); 154 ADD_OBJ_MESH(home_only_vertex_coords, 3, 3)
135 155
136 texture = eo_add(EVAS_3D_TEXTURE_CLASS, evas);
137 eo_do(texture, 156 eo_do(texture,
138 evas_3d_texture_file_set("sweet_home_temp.png", NULL), 157 evas_3d_texture_file_set("sweet_home_temp.png", NULL),
139 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST, 158 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST,
@@ -154,15 +173,6 @@ main(void)
154 1.0, 1.0, 1.0, 1.0), 173 1.0, 1.0, 1.0, 1.0),
155 evas_3d_material_shininess_set(50.0)); 174 evas_3d_material_shininess_set(50.0));
156 175
157 eo_do(mesh, efl_file_save("saved_home.obj", NULL, NULL));
158
159 mesh_node = eo_add(EVAS_3D_NODE_CLASS, evas,
160 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH));
161 eo_do(root_node,
162 evas_3d_node_member_add(mesh_node));
163 eo_do(mesh_node,
164 evas_3d_node_mesh_add(mesh));
165
166 /* Set up scene. */ 176 /* Set up scene. */
167 eo_do(scene, 177 eo_do(scene,
168 evas_3d_scene_root_node_set(root_node), 178 evas_3d_scene_root_node_set(root_node),
@@ -185,7 +195,10 @@ main(void)
185 /* Set the image object as render target for 3D scene. */ 195 /* Set the image object as render target for 3D scene. */
186 eo_do(image, evas_obj_image_scene_set(scene)); 196 eo_do(image, evas_obj_image_scene_set(scene));
187 197
188 ecore_timer_add(0.01, _animate_scene, mesh_node); 198 ecore_timer_add(0.01, _animate_scene, home_node);
199 ecore_timer_add(0.01, _animate_scene, home_without_normals_node);
200 ecore_timer_add(0.01, _animate_scene, home_without_tex_coords_node);
201 ecore_timer_add(0.01, _animate_scene, home_only_vertex_coords_node);
189 202
190 /* Enter main loop. */ 203 /* Enter main loop. */
191 ecore_main_loop_begin(); 204 ecore_main_loop_begin();
diff --git a/src/examples/evas/Obj_fixes/sweet_home_only_vertex_coords.mtl b/src/examples/evas/Obj_fixes/sweet_home_only_vertex_coords.mtl
new file mode 100644
index 0000000000..19d1272a1e
--- /dev/null
+++ b/src/examples/evas/Obj_fixes/sweet_home_only_vertex_coords.mtl
@@ -0,0 +1,12 @@
1# Blender MTL File: 'sweet_home.blend'
2# Material Count: 1
3
4newmtl Material
5Ns 96.078431
6Ka 0.000000 0.000000 0.000000
7Kd 0.640000 0.640000 0.640000
8Ks 0.500000 0.500000 0.500000
9Ni 1.000000
10d 1.000000
11illum 2
12map_Kd /home/bdevichev/Desktop/rect.png
diff --git a/src/examples/evas/Obj_fixes/sweet_home_only_vertex_coords.obj b/src/examples/evas/Obj_fixes/sweet_home_only_vertex_coords.obj
new file mode 100644
index 0000000000..675b032db0
--- /dev/null
+++ b/src/examples/evas/Obj_fixes/sweet_home_only_vertex_coords.obj
@@ -0,0 +1,40 @@
1# Blender v2.69 (sub 0) OBJ File: 'sweet_home.blend'
2# www.blender.org
3mtllib sweet_home_only_vertex_coords.mtl
4o Cube
5v 1.000003 -0.999997 0.000002
6v -0.999997 -1.000003 0.000002
7v -1.000002 0.999998 0.000002
8v 0.999998 1.000002 0.000002
9v 1.000002 -0.999998 2.000002
10v -0.999998 -1.000002 2.000002
11v -1.000002 0.999998 2.000002
12v 0.999997 1.000003 2.000002
13v 0.000002 -1.000000 3.075149
14v -0.000002 1.000000 3.075149
15v 0.666668 -0.644449 2.358384
16v 0.333335 -0.644450 2.716766
17v 0.666667 -0.293067 2.358384
18v 0.333334 -0.293068 2.716766
19v 0.662209 -0.629904 2.991038
20v 0.337794 -0.629904 2.980731
21v 0.662208 -0.307612 2.991038
22v 0.337793 -0.307613 2.980731
23usemtl Material
24s off
25f 4 8 5 1
26f 6 2 1 5 9
27f 7 10 8 4 3
28f 11 12 14 13
29f 15 17 18 16
30f 2 3 4 1
31f 6 7 3 2
32f 6 9 10 7
33f 14 12 16 18
34f 11 13 17 15
35f 13 14 18 17
36f 12 11 15 16
37f 5 11 12 9
38f 9 12 14 10
39f 13 8 10 14
40f 11 5 8 13
diff --git a/src/examples/evas/Obj_fixes/sweet_home_without_normals.mtl b/src/examples/evas/Obj_fixes/sweet_home_without_normals.mtl
new file mode 100644
index 0000000000..c3342d4c8b
--- /dev/null
+++ b/src/examples/evas/Obj_fixes/sweet_home_without_normals.mtl
@@ -0,0 +1,22 @@
1# Blender MTL File: 'sweet_home.blend'
2# Material Count: 2
3
4newmtl Material
5Ns 96.078431
6Ka 0.000000 0.000000 0.000000
7Kd 0.640000 0.640000 0.640000
8Ks 0.500000 0.500000 0.500000
9Ni 1.000000
10d 1.000000
11illum 2
12map_Kd /home/bdevichev/Desktop/rect.png
13
14newmtl Material_Untitled
15Ns 96.078431
16Ka 0.000000 0.000000 0.000000
17Kd 0.640000 0.640000 0.640000
18Ks 0.500000 0.500000 0.500000
19Ni 1.000000
20d 1.000000
21illum 2
22map_Kd /home/bdevichev/Desktop/sweet_home.png
diff --git a/src/examples/evas/Obj_fixes/sweet_home_without_normals.obj b/src/examples/evas/Obj_fixes/sweet_home_without_normals.obj
new file mode 100644
index 0000000000..a535ece5a4
--- /dev/null
+++ b/src/examples/evas/Obj_fixes/sweet_home_without_normals.obj
@@ -0,0 +1,96 @@
1# Blender v2.69 (sub 0) OBJ File: 'sweet_home.blend'
2# www.blender.org
3mtllib sweet_home_without_normals.mtl
4o Cube
5v 1.000003 -0.999997 0.000002
6v -0.999997 -1.000003 0.000002
7v -1.000002 0.999998 0.000002
8v 0.999998 1.000002 0.000002
9v 1.000002 -0.999998 2.000002
10v -0.999998 -1.000002 2.000002
11v -1.000002 0.999998 2.000002
12v 0.999997 1.000003 2.000002
13v 0.000002 -1.000000 3.075149
14v -0.000002 1.000000 3.075149
15v 0.666668 -0.644449 2.358384
16v 0.333335 -0.644450 2.716766
17v 0.666667 -0.293067 2.358384
18v 0.333334 -0.293068 2.716766
19v 0.662209 -0.629904 2.991038
20v 0.337794 -0.629904 2.980731
21v 0.662208 -0.307612 2.991038
22v 0.337793 -0.307613 2.980731
23vt 0.013689 0.608350
24vt 0.285640 0.608350
25vt 0.285640 0.978776
26vt 0.013689 0.978776
27vt 0.564957 0.983606
28vt 0.293719 0.983606
29vt 0.293719 0.613180
30vt 0.564957 0.613180
31vt 0.646856 0.021326
32vt 0.083404 0.021326
33vt 0.083369 0.584801
34vt 0.646820 0.584801
35vt 0.949735 0.303064
36vt 0.654355 0.022016
37vt 0.957234 0.303753
38vt 0.654320 0.585490
39vt 0.090869 0.585491
40vt 0.090904 0.022016
41vt 0.820337 0.692442
42vt 0.820337 0.803140
43vt 0.740863 0.803140
44vt 0.740863 0.692442
45vt 0.695284 0.903159
46vt 0.695284 0.830265
47vt 0.768687 0.830265
48vt 0.768687 0.903159
49vt 0.874667 0.789013
50vt 0.874667 0.893367
51vt 0.979009 0.893367
52vt 0.979009 0.789013
53vt 0.567834 0.981515
54vt 0.567834 0.611089
55vt 0.768686 0.903159
56vt 0.768687 0.823686
57vt 0.811715 0.826975
58vt 0.811715 0.899870
59vt 0.591196 0.903159
60vt 0.591196 0.823686
61vt 0.695284 0.826975
62vt 0.695284 0.899870
63vt 0.666035 0.721564
64vt 0.667476 0.661838
65vt 0.740863 0.660019
66vt 0.591196 0.741571
67vt 0.666035 0.660015
68vt 0.666035 0.803140
69vt 0.592658 0.801339
70vt 0.013481 0.981515
71vt 0.104078 0.915663
72vt 0.194676 0.915663
73vt 0.285274 0.981515
74vt 0.194676 0.850582
75vt 0.285274 0.611089
76vt 0.104078 0.850582
77vt 0.013481 0.611089
78usemtl Material
79s off
80f 6/1 9/2 10/3 7/4
81usemtl Material_Untitled
82f 4/5 8/6 5/7 1/8
83f 6/9 2/10 1/11 5/12 9/13
84f 7/14 10/15 8/16 4/17 3/18
85f 11/19 12/20 14/21 13/22
86f 15/23 17/24 18/25 16/26
87f 2/27 3/28 4/29 1/30
88f 6/2 7/3 3/31 2/32
89f 14/33 12/34 16/35 18/36
90f 11/37 13/38 17/39 15/40
91f 13/21 14/41 18/42 17/43
92f 12/44 11/45 15/46 16/47
93f 5/48 11/49 12/50 9/51
94f 9/51 12/50 14/52 10/53
95f 13/54 8/55 10/53 14/52
96f 11/49 5/48 8/55 13/54
diff --git a/src/examples/evas/Obj_fixes/sweet_home_without_tex_coords.mtl b/src/examples/evas/Obj_fixes/sweet_home_without_tex_coords.mtl
new file mode 100644
index 0000000000..19d1272a1e
--- /dev/null
+++ b/src/examples/evas/Obj_fixes/sweet_home_without_tex_coords.mtl
@@ -0,0 +1,12 @@
1# Blender MTL File: 'sweet_home.blend'
2# Material Count: 1
3
4newmtl Material
5Ns 96.078431
6Ka 0.000000 0.000000 0.000000
7Kd 0.640000 0.640000 0.640000
8Ks 0.500000 0.500000 0.500000
9Ni 1.000000
10d 1.000000
11illum 2
12map_Kd /home/bdevichev/Desktop/rect.png
diff --git a/src/examples/evas/Obj_fixes/sweet_home_without_tex_coords.obj b/src/examples/evas/Obj_fixes/sweet_home_without_tex_coords.obj
new file mode 100644
index 0000000000..50339a28b7
--- /dev/null
+++ b/src/examples/evas/Obj_fixes/sweet_home_without_tex_coords.obj
@@ -0,0 +1,55 @@
1# Blender v2.69 (sub 0) OBJ File: 'sweet_home.blend'
2# www.blender.org
3mtllib sweet_home_without_tex_coords.mtl
4o Cube
5v 1.000003 -0.999997 0.000002
6v -0.999997 -1.000003 0.000002
7v -1.000002 0.999998 0.000002
8v 0.999998 1.000002 0.000002
9v 1.000002 -0.999998 2.000002
10v -0.999998 -1.000002 2.000002
11v -1.000002 0.999998 2.000002
12v 0.999997 1.000003 2.000002
13v 0.000002 -1.000000 3.075149
14v -0.000002 1.000000 3.075149
15v 0.666668 -0.644449 2.358384
16v 0.333335 -0.644450 2.716766
17v 0.666667 -0.293067 2.358384
18v 0.333334 -0.293068 2.716766
19v 0.662209 -0.629904 2.991038
20v 0.337794 -0.629904 2.980731
21v 0.662208 -0.307612 2.991038
22v 0.337793 -0.307613 2.980731
23vn 1.000000 0.000002 0.000000
24vn 0.000002 -1.000000 0.000000
25vn -0.000002 1.000000 -0.000000
26vn -0.732233 -0.000001 -0.681054
27vn -0.031755 -0.000000 0.999496
28vn -0.000000 0.000000 -1.000000
29vn -1.000000 -0.000002 -0.000000
30vn -0.732233 -0.000002 0.681054
31vn -0.999857 -0.000002 0.016891
32vn 0.999975 0.000002 0.007049
33vn 0.017155 0.999327 0.032422
34vn 0.017160 -0.999327 0.032422
35vn 0.732233 0.000001 0.681054
36vn 0.732233 0.000002 0.681054
37vn 0.732234 0.000002 0.681053
38usemtl Material
39s off
40f 4//1 8//1 5//1 1//1
41f 6//2 2//2 1//2 5//2 9//2
42f 7//3 10//3 8//3 4//3 3//3
43f 11//4 12//4 14//4 13//4
44f 15//5 17//5 18//5 16//5
45f 2//6 3//6 4//6 1//6
46f 6//7 7//7 3//7 2//7
47f 6//8 9//8 10//8 7//8
48f 14//9 12//9 16//9 18//9
49f 11//10 13//10 17//10 15//10
50f 13//11 14//11 18//11 17//11
51f 12//12 11//12 15//12 16//12
52f 5//13 11//13 12//13 9//13
53f 9//14 12//14 14//14 10//14
54f 13//14 8//14 10//14 14//14
55f 11//15 5//15 8//15 13//15