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