summaryrefslogtreecommitdiff
path: root/src/examples/evas/evas-3d-cube2.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-03-11 12:24:08 +0000
committerTom Hacohen <tom@stosb.com>2016-03-11 12:29:03 +0000
commitf24210caac8d50940ddef858994571be59179c10 (patch)
treecfc8b264e77abbab9827517d1827f9a4fb4dcd50 /src/examples/evas/evas-3d-cube2.c
parent9fdac37187e35f45570c3808011d0283c658652d (diff)
Revert "Automatic migration to the new eo_add syntax."
This reverts commit 4f949a2757b6332306264d7f126b15ba7bfd37d4.
Diffstat (limited to 'src/examples/evas/evas-3d-cube2.c')
-rw-r--r--src/examples/evas/evas-3d-cube2.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/examples/evas/evas-3d-cube2.c b/src/examples/evas/evas-3d-cube2.c
index 387edd8..e46c2f7 100644
--- a/src/examples/evas/evas-3d-cube2.c
+++ b/src/examples/evas/evas-3d-cube2.c
@@ -111,10 +111,11 @@ _animate_scene(void *data)
111static void 111static void
112_camera_setup(Scene_Data *data) 112_camera_setup(Scene_Data *data)
113{ 113{
114 eo_add(&data->camera, EVAS_CANVAS3D_CAMERA_CLASS, evas); 114 data->camera = eo_add(EVAS_CANVAS3D_CAMERA_CLASS, evas);
115 evas_canvas3d_camera_projection_perspective_set(data->camera, 60.0, 1.0, 2.0, 50.0); 115 evas_canvas3d_camera_projection_perspective_set(data->camera, 60.0, 1.0, 2.0, 50.0);
116 116
117 eo_add(&data->camera_node, EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(data->camera_node, EVAS_CANVAS3D_NODE_TYPE_CAMERA)); 117 data->camera_node =
118 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_CAMERA));
118 evas_canvas3d_node_camera_set(data->camera_node, data->camera); 119 evas_canvas3d_node_camera_set(data->camera_node, data->camera);
119 evas_canvas3d_node_position_set(data->camera_node, 0.0, 0.0, 3.0); 120 evas_canvas3d_node_position_set(data->camera_node, 0.0, 0.0, 3.0);
120 evas_canvas3d_node_look_at_set(data->camera_node, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0); 121 evas_canvas3d_node_look_at_set(data->camera_node, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0);
@@ -124,12 +125,13 @@ _camera_setup(Scene_Data *data)
124static void 125static void
125_light_setup(Scene_Data *data) 126_light_setup(Scene_Data *data)
126{ 127{
127 eo_add(&data->light, EVAS_CANVAS3D_LIGHT_CLASS, evas); 128 data->light = eo_add(EVAS_CANVAS3D_LIGHT_CLASS, evas);
128 evas_canvas3d_light_ambient_set(data->light, 0.2, 0.2, 0.2, 1.0); 129 evas_canvas3d_light_ambient_set(data->light, 0.2, 0.2, 0.2, 1.0);
129 evas_canvas3d_light_diffuse_set(data->light, 1.0, 1.0, 1.0, 1.0); 130 evas_canvas3d_light_diffuse_set(data->light, 1.0, 1.0, 1.0, 1.0);
130 evas_canvas3d_light_specular_set(data->light, 1.0, 1.0, 1.0, 1.0); 131 evas_canvas3d_light_specular_set(data->light, 1.0, 1.0, 1.0, 1.0);
131 132
132 eo_add(&data->light_node, EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(data->light_node, EVAS_CANVAS3D_NODE_TYPE_LIGHT)); 133 data->light_node =
134 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_LIGHT));
133 evas_canvas3d_node_light_set(data->light_node, data->light); 135 evas_canvas3d_node_light_set(data->light_node, data->light);
134 evas_canvas3d_node_position_set(data->light_node, 0.0, 0.0, 10.0); 136 evas_canvas3d_node_position_set(data->light_node, 0.0, 0.0, 10.0);
135 evas_canvas3d_node_look_at_set(data->light_node, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0); 137 evas_canvas3d_node_look_at_set(data->light_node, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0);
@@ -140,8 +142,8 @@ static void
140_mesh_setup(Scene_Data *data) 142_mesh_setup(Scene_Data *data)
141{ 143{
142 /* Setup material. */ 144 /* Setup material. */
143 eo_add(&data->material0, EVAS_CANVAS3D_MATERIAL_CLASS, evas); 145 data->material0 = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
144 eo_add(&data->material1, EVAS_CANVAS3D_MATERIAL_CLASS, evas); 146 data->material1 = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
145 147
146 evas_canvas3d_material_enable_set(data->material0, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE); 148 evas_canvas3d_material_enable_set(data->material0, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE);
147 evas_canvas3d_material_enable_set(data->material0, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE); 149 evas_canvas3d_material_enable_set(data->material0, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE);
@@ -161,9 +163,9 @@ _mesh_setup(Scene_Data *data)
161 evas_canvas3d_material_color_set(data->material1, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0); 163 evas_canvas3d_material_color_set(data->material1, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0);
162 evas_canvas3d_material_shininess_set(data->material1, 100.0); 164 evas_canvas3d_material_shininess_set(data->material1, 100.0);
163 165
164 eo_add(&data->texture0, EVAS_CANVAS3D_TEXTURE_CLASS, evas); 166 data->texture0 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
165 eo_add(&data->texture1, EVAS_CANVAS3D_TEXTURE_CLASS, evas); 167 data->texture1 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
166 eo_add(&data->texture_normal, EVAS_CANVAS3D_TEXTURE_CLASS, evas); 168 data->texture_normal = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
167 169
168 evas_canvas3d_texture_data_set(data->texture0, EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels0[0]); 170 evas_canvas3d_texture_data_set(data->texture0, EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels0[0]);
169 evas_canvas3d_texture_data_set(data->texture1, EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels1[0]); 171 evas_canvas3d_texture_data_set(data->texture1, EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels1[0]);
@@ -174,18 +176,19 @@ _mesh_setup(Scene_Data *data)
174 evas_canvas3d_material_texture_set(data->material1, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, data->texture_normal); 176 evas_canvas3d_material_texture_set(data->material1, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, data->texture_normal);
175 177
176 /* Set data of primitive */ 178 /* Set data of primitive */
177 eo_add(&data->cube, EVAS_CANVAS3D_PRIMITIVE_CLASS, evas); 179 data->cube = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
178 evas_canvas3d_primitive_form_set(data->cube, EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE); 180 evas_canvas3d_primitive_form_set(data->cube, EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE);
179 181
180 /* Setup mesh. */ 182 /* Setup mesh. */
181 eo_add(&data->mesh, EVAS_CANVAS3D_MESH_CLASS, evas); 183 data->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
182 evas_canvas3d_mesh_from_primitive_set(data->mesh, 0, data->cube); 184 evas_canvas3d_mesh_from_primitive_set(data->mesh, 0, data->cube);
183 evas_canvas3d_mesh_frame_material_set(data->mesh, 0, data->material0); 185 evas_canvas3d_mesh_frame_material_set(data->mesh, 0, data->material0);
184 evas_canvas3d_mesh_frame_add(data->mesh, 20); 186 evas_canvas3d_mesh_frame_add(data->mesh, 20);
185 evas_canvas3d_mesh_frame_material_set(data->mesh, 20, data->material1); 187 evas_canvas3d_mesh_frame_material_set(data->mesh, 20, data->material1);
186 evas_canvas3d_mesh_shade_mode_set(data->mesh, EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP); 188 evas_canvas3d_mesh_shade_mode_set(data->mesh, EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP);
187 189
188 eo_add(&data->mesh_node, EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(data->mesh_node, EVAS_CANVAS3D_NODE_TYPE_MESH)); 190 data->mesh_node =
191 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH));
189 evas_canvas3d_node_member_add(data->root_node, data->mesh_node); 192 evas_canvas3d_node_member_add(data->root_node, data->mesh_node);
190 evas_canvas3d_node_mesh_add(data->mesh_node, data->mesh); 193 evas_canvas3d_node_mesh_add(data->mesh_node, data->mesh);
191} 194}
@@ -193,11 +196,12 @@ _mesh_setup(Scene_Data *data)
193static void 196static void
194_scene_setup(Scene_Data *data) 197_scene_setup(Scene_Data *data)
195{ 198{
196 eo_add(&data->scene, EVAS_CANVAS3D_SCENE_CLASS, evas); 199 data->scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, evas);
197 evas_canvas3d_scene_size_set(data->scene, WIDTH, HEIGHT); 200 evas_canvas3d_scene_size_set(data->scene, WIDTH, HEIGHT);
198 evas_canvas3d_scene_background_color_set(data->scene, 0.0, 0.0, 0.0, 0.0); 201 evas_canvas3d_scene_background_color_set(data->scene, 0.0, 0.0, 0.0, 0.0);
199 202
200 eo_add(&data->root_node, EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(data->root_node, EVAS_CANVAS3D_NODE_TYPE_NODE)); 203 data->root_node =
204 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_NODE));
201 205
202 _camera_setup(data); 206 _camera_setup(data);
203 _light_setup(data); 207 _light_setup(data);
@@ -230,7 +234,7 @@ main(void)
230 _scene_setup(&data); 234 _scene_setup(&data);
231 235
232 /* Add a background rectangle objects. */ 236 /* Add a background rectangle objects. */
233 eo_add(&background, EVAS_RECTANGLE_CLASS, evas); 237 background = eo_add(EVAS_RECTANGLE_CLASS, evas);
234 efl_gfx_color_set(background, 0, 0, 0, 255); 238 efl_gfx_color_set(background, 0, 0, 0, 255);
235 efl_gfx_size_set(background, WIDTH, HEIGHT); 239 efl_gfx_size_set(background, WIDTH, HEIGHT);
236 efl_gfx_visible_set(background, EINA_TRUE); 240 efl_gfx_visible_set(background, EINA_TRUE);