summaryrefslogtreecommitdiff
path: root/src/examples/evas/evas-3d-cube2.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-cube2.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-cube2.c')
-rw-r--r--src/examples/evas/evas-3d-cube2.c136
1 files changed, 68 insertions, 68 deletions
diff --git a/src/examples/evas/evas-3d-cube2.c b/src/examples/evas/evas-3d-cube2.c
index 4f43c7c..c053867 100644
--- a/src/examples/evas/evas-3d-cube2.c
+++ b/src/examples/evas/evas-3d-cube2.c
@@ -94,7 +94,7 @@ _animate_scene(void *data)
94 angle += 0.2; 94 angle += 0.2;
95 95
96 eo_do(scene->mesh_node, 96 eo_do(scene->mesh_node,
97 evas_3d_node_orientation_angle_axis_set(angle, 1.0, 1.0, 1.0)); 97 evas_canvas3d_node_orientation_angle_axis_set(angle, 1.0, 1.0, 1.0));
98 98
99 /* Rotate */ 99 /* Rotate */
100 if (angle > 360.0) angle -= 360.0f; 100 if (angle > 360.0) angle -= 360.0f;
@@ -104,7 +104,7 @@ _animate_scene(void *data)
104 if (frame >= 20) inc = -1; 104 if (frame >= 20) inc = -1;
105 else if (frame <= 0) inc = 1; 105 else if (frame <= 0) inc = 1;
106 106
107 eo_do(scene->mesh_node, evas_3d_node_mesh_frame_set(scene->mesh, frame)); 107 eo_do(scene->mesh_node, evas_canvas3d_node_mesh_frame_set(scene->mesh, frame));
108 108
109 return EINA_TRUE; 109 return EINA_TRUE;
110} 110}
@@ -112,129 +112,129 @@ _animate_scene(void *data)
112static void 112static void
113_camera_setup(Scene_Data *data) 113_camera_setup(Scene_Data *data)
114{ 114{
115 data->camera = eo_add(EVAS_3D_CAMERA_CLASS, evas); 115 data->camera = eo_add(EVAS_CANVAS3D_CAMERA_CLASS, evas);
116 eo_do(data->camera, 116 eo_do(data->camera,
117 evas_3d_camera_projection_perspective_set(60.0, 1.0, 2.0, 50.0)); 117 evas_canvas3d_camera_projection_perspective_set(60.0, 1.0, 2.0, 50.0));
118 118
119 data->camera_node = 119 data->camera_node =
120 eo_add(EVAS_3D_NODE_CLASS, evas, 120 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
121 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_CAMERA)); 121 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_CAMERA));
122 eo_do(data->camera_node, 122 eo_do(data->camera_node,
123 evas_3d_node_camera_set(data->camera), 123 evas_canvas3d_node_camera_set(data->camera),
124 evas_3d_node_position_set(0.0, 0.0, 3.0), 124 evas_canvas3d_node_position_set(0.0, 0.0, 3.0),
125 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 0.0, 125 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0,
126 EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0)); 126 EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0));
127 eo_do(data->root_node, 127 eo_do(data->root_node,
128 evas_3d_node_member_add(data->camera_node)); 128 evas_canvas3d_node_member_add(data->camera_node));
129} 129}
130 130
131static void 131static void
132_light_setup(Scene_Data *data) 132_light_setup(Scene_Data *data)
133{ 133{
134 data->light = eo_add(EVAS_3D_LIGHT_CLASS, evas); 134 data->light = eo_add(EVAS_CANVAS3D_LIGHT_CLASS, evas);
135 eo_do(data->light, 135 eo_do(data->light,
136 evas_3d_light_ambient_set(0.2, 0.2, 0.2, 1.0), 136 evas_canvas3d_light_ambient_set(0.2, 0.2, 0.2, 1.0),
137 evas_3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0), 137 evas_canvas3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0),
138 evas_3d_light_specular_set(1.0, 1.0, 1.0, 1.0)); 138 evas_canvas3d_light_specular_set(1.0, 1.0, 1.0, 1.0));
139 139
140 data->light_node = 140 data->light_node =
141 eo_add(EVAS_3D_NODE_CLASS, evas, 141 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
142 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_LIGHT)); 142 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_LIGHT));
143 eo_do(data->light_node, 143 eo_do(data->light_node,
144 evas_3d_node_light_set(data->light), 144 evas_canvas3d_node_light_set(data->light),
145 evas_3d_node_position_set(0.0, 0.0, 10.0), 145 evas_canvas3d_node_position_set(0.0, 0.0, 10.0),
146 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 0.0, 146 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0,
147 EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0)); 147 EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0));
148 eo_do(data->root_node, evas_3d_node_member_add(data->light_node)); 148 eo_do(data->root_node, evas_canvas3d_node_member_add(data->light_node));
149} 149}
150 150
151static void 151static void
152_mesh_setup(Scene_Data *data) 152_mesh_setup(Scene_Data *data)
153{ 153{
154 /* Setup material. */ 154 /* Setup material. */
155 data->material0 = eo_add(EVAS_3D_MATERIAL_CLASS, evas); 155 data->material0 = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
156 data->material1 = eo_add(EVAS_3D_MATERIAL_CLASS, evas); 156 data->material1 = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
157 157
158 eo_do(data->material0, 158 eo_do(data->material0,
159 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 159 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_AMBIENT, EINA_TRUE),
160 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 160 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, EINA_TRUE),
161 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 161 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_SPECULAR, EINA_TRUE),
162 evas_3d_material_enable_set(EVAS_3D_MATERIAL_NORMAL, EINA_TRUE), 162 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_NORMAL, EINA_TRUE),
163 163
164 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0), 164 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0),
165 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0), 165 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0),
166 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 166 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
167 evas_3d_material_shininess_set(100.0)); 167 evas_canvas3d_material_shininess_set(100.0));
168 168
169 eo_do(data->material1, 169 eo_do(data->material1,
170 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 170 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_AMBIENT, EINA_TRUE),
171 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 171 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, EINA_TRUE),
172 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 172 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_SPECULAR, EINA_TRUE),
173 evas_3d_material_enable_set(EVAS_3D_MATERIAL_NORMAL, EINA_TRUE), 173 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_NORMAL, EINA_TRUE),
174 174
175 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0), 175 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0),
176 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0), 176 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0),
177 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 177 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
178 evas_3d_material_shininess_set(100.0)); 178 evas_canvas3d_material_shininess_set(100.0));
179 179
180 data->texture0 = eo_add(EVAS_3D_TEXTURE_CLASS, evas); 180 data->texture0 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
181 data->texture1 = eo_add(EVAS_3D_TEXTURE_CLASS, evas); 181 data->texture1 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
182 data->texture_normal = eo_add(EVAS_3D_TEXTURE_CLASS, evas); 182 data->texture_normal = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
183 183
184 eo_do(data->texture0, 184 eo_do(data->texture0,
185 evas_3d_texture_data_set(EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels0[0])); 185 evas_canvas3d_texture_data_set(EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels0[0]));
186 eo_do(data->texture1, 186 eo_do(data->texture1,
187 evas_3d_texture_data_set(EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels1[0])); 187 evas_canvas3d_texture_data_set(EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels1[0]));
188 eo_do(data->texture_normal, 188 eo_do(data->texture_normal,
189 evas_3d_texture_file_set(normal_map_path, NULL)); 189 evas_canvas3d_texture_file_set(normal_map_path, NULL));
190 190
191 eo_do(data->material0, 191 eo_do(data->material0,
192 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, data->texture0)); 192 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, data->texture0));
193 eo_do(data->material1, 193 eo_do(data->material1,
194 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, data->texture1)); 194 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE, data->texture1));
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_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_NORMAL, data->texture_normal));
197 197
198 /* Set data of primitive */ 198 /* Set data of primitive */
199 data->cube = eo_add(EVAS_3D_PRIMITIVE_CLASS, evas); 199 data->cube = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
200 eo_do(data->cube, 200 eo_do(data->cube,
201 evas_3d_primitive_form_set(EVAS_3D_MESH_PRIMITIVE_CUBE)); 201 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE));
202 202
203 /* Setup mesh. */ 203 /* Setup mesh. */
204 data->mesh = eo_add(EVAS_3D_MESH_CLASS, evas); 204 data->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
205 eo_do(data->mesh, 205 eo_do(data->mesh,
206 evas_3d_mesh_from_primitive_set(0, data->cube), 206 evas_canvas3d_mesh_from_primitive_set(0, data->cube),
207 evas_3d_mesh_frame_material_set(0, data->material0), 207 evas_canvas3d_mesh_frame_material_set(0, data->material0),
208 evas_3d_mesh_frame_add(20), 208 evas_canvas3d_mesh_frame_add(20),
209 evas_3d_mesh_frame_material_set(20, data->material1), 209 evas_canvas3d_mesh_frame_material_set(20, data->material1),
210 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_NORMAL_MAP)); 210 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP));
211 211
212 data->mesh_node = 212 data->mesh_node =
213 eo_add(EVAS_3D_NODE_CLASS, evas, 213 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
214 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH)); 214 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH));
215 eo_do(data->root_node, evas_3d_node_member_add(data->mesh_node)); 215 eo_do(data->root_node, evas_canvas3d_node_member_add(data->mesh_node));
216 eo_do(data->mesh_node, evas_3d_node_mesh_add(data->mesh)); 216 eo_do(data->mesh_node, evas_canvas3d_node_mesh_add(data->mesh));
217} 217}
218 218
219static void 219static void
220_scene_setup(Scene_Data *data) 220_scene_setup(Scene_Data *data)
221{ 221{
222 data->scene = eo_add(EVAS_3D_SCENE_CLASS, evas); 222 data->scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, evas);
223 eo_do(data->scene, 223 eo_do(data->scene,
224 evas_3d_scene_size_set(WIDTH, HEIGHT), 224 evas_canvas3d_scene_size_set(WIDTH, HEIGHT),
225 evas_3d_scene_background_color_set(0.0, 0.0, 0.0, 0.0)); 225 evas_canvas3d_scene_background_color_set(0.0, 0.0, 0.0, 0.0));
226 226
227 data->root_node = 227 data->root_node =
228 eo_add(EVAS_3D_NODE_CLASS, evas, 228 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
229 evas_3d_node_constructor(EVAS_3D_NODE_TYPE_NODE)); 229 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_NODE));
230 230
231 _camera_setup(data); 231 _camera_setup(data);
232 _light_setup(data); 232 _light_setup(data);
233 _mesh_setup(data); 233 _mesh_setup(data);
234 234
235 eo_do(data->scene, 235 eo_do(data->scene,
236 evas_3d_scene_root_node_set(data->root_node), 236 evas_canvas3d_scene_root_node_set(data->root_node),
237 evas_3d_scene_camera_node_set(data->camera_node)); 237 evas_canvas3d_scene_camera_node_set(data->camera_node));
238} 238}
239 239
240int 240int