summaryrefslogtreecommitdiff
path: root/src/examples/evas/evas-3d-aabb.c
diff options
context:
space:
mode:
authorOleksandr Shcherbina <o.shcherbina@samsung.com>2015-06-17 16:31:14 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-06-17 17:52:17 +0200
commitd409df1caa38ae7eac87f85ff4113484bc5b2099 (patch)
tree2adcbeadf2f4b2e7f4e7ba327a574c6620c23663 /src/examples/evas/evas-3d-aabb.c
parent9bf6f14a8a59195fe9be004aaff446c51474fc5d (diff)
evas: change interface evas_3d to evas_canvas3d
Summary: Regard to https://phab.enlightenment.org/T2479 it is need for right generation Eolian files Reviewers: cedric Subscribers: cedric, tasn Differential Revision: https://phab.enlightenment.org/D2711 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/examples/evas/evas-3d-aabb.c')
-rw-r--r--src/examples/evas/evas-3d-aabb.c144
1 files changed, 72 insertions, 72 deletions
diff --git a/src/examples/evas/evas-3d-aabb.c b/src/examples/evas/evas-3d-aabb.c
index 6a9d905..7b91089 100644
--- a/src/examples/evas/evas-3d-aabb.c
+++ b/src/examples/evas/evas-3d-aabb.c
@@ -57,7 +57,7 @@ _animate_scene(void *data)
57{ 57{
58 static int frame = 0; 58 static int frame = 0;
59 59
60 eo_do((Evas_3D_Node *)data, evas_3d_node_mesh_frame_set(mesh, frame)); 60 eo_do((Evas_Canvas3D_Node *)data, evas_canvas3d_node_mesh_frame_set(mesh, frame));
61 61
62 _redraw_aabb(); 62 _redraw_aabb();
63 63
@@ -78,28 +78,28 @@ static void
78_on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *eo EINA_UNUSED, void *event_info) 78_on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *eo EINA_UNUSED, void *event_info)
79{ 79{
80 Evas_Event_Key_Down *ev = event_info; 80 Evas_Event_Key_Down *ev = event_info;
81 Evas_3D_Node *node = (Evas_3D_Node *)data; 81 Evas_Canvas3D_Node *node = (Evas_Canvas3D_Node *)data;
82 82
83 switch(atoi(ev->key)) 83 switch(atoi(ev->key))
84 { 84 {
85 case 1: 85 case 1:
86 { 86 {
87 eo_do(node, evas_3d_node_orientation_angle_axis_set(90, 1.0, 0.0, 0.0)); 87 eo_do(node, evas_canvas3d_node_orientation_angle_axis_set(90, 1.0, 0.0, 0.0));
88 break; 88 break;
89 } 89 }
90 case 2: 90 case 2:
91 { 91 {
92 eo_do(node, evas_3d_node_orientation_angle_axis_set(90, 0.0, 1.0, 0.0)); 92 eo_do(node, evas_canvas3d_node_orientation_angle_axis_set(90, 0.0, 1.0, 0.0));
93 break; 93 break;
94 } 94 }
95 case 3: 95 case 3:
96 { 96 {
97 eo_do(node, evas_3d_node_orientation_angle_axis_set(90, 0.0, 0.0, 1.0)); 97 eo_do(node, evas_canvas3d_node_orientation_angle_axis_set(90, 0.0, 0.0, 1.0));
98 break; 98 break;
99 } 99 }
100 case 4: 100 case 4:
101 { 101 {
102 eo_do(node, evas_3d_node_orientation_angle_axis_set(90, 1.0, 1.0, 0.0)); 102 eo_do(node, evas_canvas3d_node_orientation_angle_axis_set(90, 1.0, 1.0, 0.0));
103 break; 103 break;
104 } 104 }
105 } 105 }
@@ -120,9 +120,9 @@ _redraw_aabb()
120{ 120{
121 Evas_Real x0, y0, z0, x1, y1, z1; 121 Evas_Real x0, y0, z0, x1, y1, z1;
122 122
123 eo_do(mesh_node, evas_3d_node_bounding_box_get(&x0, &y0, &z0, &x1, &y1, &z1)); 123 eo_do(mesh_node, evas_canvas3d_node_bounding_box_get(&x0, &y0, &z0, &x1, &y1, &z1));
124 eo_do(mesh_box_node, evas_3d_node_position_set((x0 + x1)/2, (y0 + y1)/2, (z0 + z1)/2), 124 eo_do(mesh_box_node, evas_canvas3d_node_position_set((x0 + x1)/2, (y0 + y1)/2, (z0 + z1)/2),
125 evas_3d_node_scale_set(x1 - x0, y1 - y0, z1 - z0)); 125 evas_canvas3d_node_scale_set(x1 - x0, y1 - y0, z1 - z0));
126 126
127 return EINA_TRUE; 127 return EINA_TRUE;
128} 128}
@@ -142,107 +142,107 @@ main(void)
142 142
143 evas = ecore_evas_get(ecore_evas); 143 evas = ecore_evas_get(ecore_evas);
144 144
145 scene = eo_add(EVAS_3D_SCENE_CLASS, evas); 145 scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, evas);
146 146
147 root_node = eo_add(EVAS_3D_NODE_CLASS, evas, 147 root_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
148 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_NODE)); 148 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_NODE));
149 149
150 camera = eo_add(EVAS_3D_CAMERA_CLASS, evas); 150 camera = eo_add(EVAS_CANVAS3D_CAMERA_CLASS, evas);
151 eo_do(camera, 151 eo_do(camera,
152 evas_3d_camera_projection_perspective_set(60.0, 1.0, 1.0, 500.0)); 152 evas_canvas3d_camera_projection_perspective_set(60.0, 1.0, 1.0, 500.0));
153 153
154 camera_node = 154 camera_node =
155 eo_add(EVAS_3D_NODE_CLASS, evas, 155 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
156 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_CAMERA)); 156 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_CAMERA));
157 eo_do(camera_node, 157 eo_do(camera_node,
158 evas_3d_node_camera_set(camera)); 158 evas_canvas3d_node_camera_set(camera));
159 eo_do(root_node, 159 eo_do(root_node,
160 evas_3d_node_member_add(camera_node)); 160 evas_canvas3d_node_member_add(camera_node));
161 eo_do(camera_node, 161 eo_do(camera_node,
162 evas_3d_node_position_set(100.0, 50.0, 20.0), 162 evas_canvas3d_node_position_set(100.0, 50.0, 20.0),
163 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 20.0, 163 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 20.0,
164 EVAS_3D_SPACE_PARENT, 0.0, 0.0, 1.0)); 164 EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 1.0));
165 light = eo_add(EVAS_3D_LIGHT_CLASS, evas); 165 light = eo_add(EVAS_CANVAS3D_LIGHT_CLASS, evas);
166 eo_do(light, 166 eo_do(light,
167 evas_3d_light_ambient_set(1.0, 1.0, 1.0, 1.0), 167 evas_canvas3d_light_ambient_set(1.0, 1.0, 1.0, 1.0),
168 evas_3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0), 168 evas_canvas3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0),
169 evas_3d_light_specular_set(1.0, 1.0, 1.0, 1.0), 169 evas_canvas3d_light_specular_set(1.0, 1.0, 1.0, 1.0),
170 evas_3d_light_directional_set(EINA_TRUE)); 170 evas_canvas3d_light_directional_set(EINA_TRUE));
171 171
172 light_node = 172 light_node =
173 eo_add(EVAS_3D_NODE_CLASS, evas, 173 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
174 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_LIGHT)); 174 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_LIGHT));
175 eo_do(light_node, 175 eo_do(light_node,
176 evas_3d_node_light_set(light), 176 evas_canvas3d_node_light_set(light),
177 evas_3d_node_position_set(1000.0, 0.0, 1000.0), 177 evas_canvas3d_node_position_set(1000.0, 0.0, 1000.0),
178 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 0.0, 178 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0,
179 EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0)); 179 EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0));
180 eo_do(root_node, 180 eo_do(root_node,
181 evas_3d_node_member_add(light_node)); 181 evas_canvas3d_node_member_add(light_node));
182 182
183 mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 183 mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
184 material = eo_add(EVAS_3D_MATERIAL_CLASS, evas); 184 material = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
185 185
186 eo_do(mesh, 186 eo_do(mesh,
187 efl_file_set(model_path, NULL), 187 efl_file_set(model_path, NULL),
188 evas_3d_mesh_frame_material_set(0, material), 188 evas_canvas3d_mesh_frame_material_set(0, material),
189 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG)); 189 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG));
190 190
191 texture = eo_add(EVAS_3D_TEXTURE_CLASS, evas); 191 texture = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
192 eo_do(texture, 192 eo_do(texture,
193 evas_3d_texture_file_set(image_path, NULL), 193 evas_canvas3d_texture_file_set(image_path, NULL),
194 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST, 194 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST,
195 EVAS_3D_TEXTURE_FILTER_NEAREST), 195 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST),
196 evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT, 196 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT,
197 EVAS_3D_WRAP_MODE_REPEAT)); 197 EVAS_CANVAS3D_WRAP_MODE_REPEAT));
198 eo_do(material, 198 eo_do(material,
199 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, texture), 199 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, texture),
200 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 200 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_AMBIENT, EINA_TRUE),
201 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 201 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, EINA_TRUE),
202 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 202 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_SPECULAR, EINA_TRUE),
203 evas_3d_material_enable_set(EVAS_3D_MATERIAL_NORMAL, EINA_TRUE), 203 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_NORMAL, EINA_TRUE),
204 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 204 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_AMBIENT,
205 0.01, 0.01, 0.01, 1.0), 205 0.01, 0.01, 0.01, 1.0),
206 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 206 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE,
207 1.0, 1.0, 1.0, 1.0), 207 1.0, 1.0, 1.0, 1.0),
208 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 208 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_SPECULAR,
209 1.0, 1.0, 1.0, 1.0), 209 1.0, 1.0, 1.0, 1.0),
210 evas_3d_material_shininess_set(50.0)); 210 evas_canvas3d_material_shininess_set(50.0));
211 211
212 mesh_node = eo_add(EVAS_3D_NODE_CLASS, evas, 212 mesh_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
213 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH)); 213 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH));
214 mesh_box_node = eo_add(EVAS_3D_NODE_CLASS, evas, 214 mesh_box_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
215 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH)); 215 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH));
216 216
217 material_box = eo_add(EVAS_3D_MATERIAL_CLASS, evas); 217 material_box = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
218 eo_do(material_box, evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE)); 218 eo_do(material_box, evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, EINA_TRUE));
219 219
220 cube = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas); 220 cube = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
221 eo_do(cube, 221 eo_do(cube,
222 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE)); 222 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE));
223 223
224 mesh_box = eo_add(EVAS_3D_MESH_CLASS, evas); 224 mesh_box = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
225 eo_do(mesh_box, 225 eo_do(mesh_box,
226 evas_3d_mesh_from_primitive_set(0, cube), 226 evas_canvas3d_mesh_from_primitive_set(0, cube),
227 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_LINES), 227 evas_canvas3d_mesh_vertex_assembly_set(EVAS_CANVAS3D_VERTEX_ASSEMBLY_LINES),
228 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_VERTEX_COLOR), 228 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_VERTEX_COLOR),
229 evas_3d_mesh_frame_material_set(0, material_box)); 229 evas_canvas3d_mesh_frame_material_set(0, material_box));
230 _redraw_aabb(); 230 _redraw_aabb();
231 231
232 eo_do(root_node, 232 eo_do(root_node,
233 evas_3d_node_member_add(mesh_box_node)); 233 evas_canvas3d_node_member_add(mesh_box_node));
234 eo_do(mesh_box_node, 234 eo_do(mesh_box_node,
235 evas_3d_node_mesh_add(mesh_box)); 235 evas_canvas3d_node_mesh_add(mesh_box));
236 236
237 eo_do(root_node, 237 eo_do(root_node,
238 evas_3d_node_member_add(mesh_node)); 238 evas_canvas3d_node_member_add(mesh_node));
239 eo_do(mesh_node, 239 eo_do(mesh_node,
240 evas_3d_node_mesh_add(mesh)); 240 evas_canvas3d_node_mesh_add(mesh));
241 241
242 eo_do(scene, 242 eo_do(scene,
243 evas_3d_scene_root_node_set(root_node), 243 evas_canvas3d_scene_root_node_set(root_node),
244 evas_3d_scene_camera_node_set(camera_node), 244 evas_canvas3d_scene_camera_node_set(camera_node),
245 evas_3d_scene_size_set(WIDTH, HEIGHT)); 245 evas_canvas3d_scene_size_set(WIDTH, HEIGHT));
246 246
247 background = eo_add(EVAS_RECTANGLE_CLASS, evas); 247 background = eo_add(EVAS_RECTANGLE_CLASS, evas);
248 eo_do(background, 248 eo_do(background,