summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Walter Seikel <won_fang@yahoo.com.au>2015-09-11 10:12:55 +1000
committerDavid Walter Seikel <won_fang@yahoo.com.au>2015-09-11 10:12:55 +1000
commitd264c3ccd56364a24b67e7add00b413e5cd16f5b (patch)
tree34c919b6730723615e07813090945d31c3967193
parentdca5cb8800e7c8f06e2aa206ecf8f1c69037e28b (diff)
Update to match current APIs.HEADmaster
-rwxr-xr-xbuild.lua2
-rw-r--r--evas-3d-elm.c329
2 files changed, 164 insertions, 167 deletions
diff --git a/build.lua b/build.lua
index 73eb110..3a204bb 100755
--- a/build.lua
+++ b/build.lua
@@ -79,7 +79,7 @@ CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'elementary')
79CFLAGS = CFLAGS .. ' ' .. CFLAGOPTS 79CFLAGS = CFLAGS .. ' ' .. CFLAGOPTS
80 80
81LDFLAGS = '-L ' .. baseDir .. '/lib ' .. pkgConfig('libs-only-L', 'luajit') .. ' -L /usr/lib -L /lib' 81LDFLAGS = '-L ' .. baseDir .. '/lib ' .. pkgConfig('libs-only-L', 'luajit') .. ' -L /usr/lib -L /lib'
82libs = pkgConfig('libs', 'elementary') .. ' ' .. pkgConfig('libs', 'luajit') .. ' -lpthread -lm -Wl,-rpath,' .. baseDir .. '/lib' 82libs = pkgConfig('libs', 'elementary') .. ' ' .. pkgConfig('libs', 'luajit') .. ' -lpthread -lm -ldl -Wl,-rpath,' .. baseDir .. '/lib'
83LFLAGS = '-L ' .. workingDir .. ' -d' 83LFLAGS = '-L ' .. workingDir .. ' -d'
84EDJE_FLAGS = '-id ' .. baseDir .. '/media -fd ' .. baseDir .. '/media' 84EDJE_FLAGS = '-id ' .. baseDir .. '/media -fd ' .. baseDir .. '/media'
85 85
diff --git a/evas-3d-elm.c b/evas-3d-elm.c
index ce6f2ff..458e17c 100644
--- a/evas-3d-elm.c
+++ b/evas-3d-elm.c
@@ -24,32 +24,32 @@ globals ourGlobals;
24 24
25typedef struct _Scene_Data 25typedef struct _Scene_Data
26{ 26{
27 Evas_Object *image; // Our Elm image. 27 Evas_Object *image; // Our Elm image.
28 Evas_3D_Scene *scene; 28 Eo *scene;
29 Evas_3D_Node *root_node; 29 Eo *root_node;
30 Evas_3D_Node *camera_node; 30 Eo *camera_node;
31 Evas_3D_Node *light_node; 31 Eo *light_node;
32 32
33 Evas_3D_Camera *camera; 33 Eo *camera;
34 Evas_3D_Light *light; 34 Eo *light;
35 35
36 Evas_3D_Mesh *mesh; 36 Eo *mesh;
37 Evas_3D_Node *mesh_node; 37 Eo *mesh_node;
38 Evas_3D_Material *material0; 38 Eo *material0;
39 Evas_3D_Material *material1; 39 Eo *material1;
40 Evas_3D_Texture *texture0; 40 Eo *texture0;
41 Evas_3D_Texture *texture1; 41 Eo *texture1;
42 Evas_3D_Texture *texture_normal; 42 Eo *texture_normal;
43 43
44 Evas_3D_Mesh *mesh2; 44 Eo *mesh2;
45 Evas_3D_Node *mesh2_node; 45 Eo *mesh2_node;
46 Evas_3D_Material *material2; 46 Eo *material2;
47 Evas_3D_Texture *texture2; 47 Eo *texture2;
48 48
49 Evas_3D_Mesh *mesh3; 49 Eo *mesh3;
50 Evas_3D_Node *mesh3_node; 50 Eo *mesh3_node;
51 Evas_3D_Material *material3; 51 Eo *material3;
52 Evas_3D_Texture *texture_diffuse; 52 Eo *texture_diffuse;
53} Scene_Data; 53} Scene_Data;
54 54
55static Scene_Data ourScene; 55static Scene_Data ourScene;
@@ -345,22 +345,22 @@ _animate_scene(void *data)
345 inc = 1; 345 inc = 1;
346 346
347 eo_do(scene->mesh_node, 347 eo_do(scene->mesh_node,
348 evas_3d_node_orientation_angle_axis_set(angle, 1.0, 1.0, 1.0), 348 evas_canvas3d_node_orientation_angle_axis_set(angle, 1.0, 1.0, 1.0),
349 evas_3d_node_mesh_frame_set(scene->mesh, frame) 349 evas_canvas3d_node_mesh_frame_set(scene->mesh, frame)
350 ); 350 );
351 351
352 // Animate sonic. 352 // Animate sonic.
353 sonicFrame += 32; 353 sonicFrame += 32;
354 if (sonicFrame > 256 * 50) sonicFrame = 0; 354 if (sonicFrame > 256 * 50) sonicFrame = 0;
355 eo_do(scene->mesh2_node, 355 eo_do(scene->mesh2_node,
356 evas_3d_node_mesh_frame_set(scene->mesh2, sonicFrame) 356 evas_canvas3d_node_mesh_frame_set(scene->mesh2, sonicFrame)
357 ); 357 );
358 358
359 // Animate earth. 359 // Animate earth.
360 earthAngle += 0.3; 360 earthAngle += 0.3;
361 if (earthAngle > 360.0) earthAngle -= 360.0f; 361 if (earthAngle > 360.0) earthAngle -= 360.0f;
362 eo_do(scene->mesh3_node, 362 eo_do(scene->mesh3_node,
363 evas_3d_node_orientation_angle_axis_set(angle, 0.0, 1.0, 0.0) 363 evas_canvas3d_node_orientation_angle_axis_set(angle, 0.0, 1.0, 0.0)
364 ); 364 );
365 365
366 return EINA_TRUE; 366 return EINA_TRUE;
@@ -369,209 +369,209 @@ _animate_scene(void *data)
369static void 369static void
370_camera_setup(Evas *evas, Scene_Data *scene) 370_camera_setup(Evas *evas, Scene_Data *scene)
371{ 371{
372 scene->camera = eo_add(EVAS_3D_CAMERA_CLASS, evas, 372 scene->camera = eo_add(EVAS_CANVAS3D_CAMERA_CLASS, evas,
373 evas_3d_camera_projection_perspective_set(60.0, 1.0, 1.0, 500.0) 373 evas_canvas3d_camera_projection_perspective_set(60.0, 1.0, 1.0, 500.0)
374 ); 374 );
375 375
376 scene->camera_node = eo_add_custom(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_CAMERA), 376 scene->camera_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_CAMERA),
377 evas_3d_node_camera_set(scene->camera), 377 evas_canvas3d_node_camera_set(scene->camera),
378 evas_3d_node_position_set(50.0, 0.0, 20.0), 378 evas_canvas3d_node_position_set(50.0, 0.0, 20.0),
379 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 20.0, EVAS_3D_SPACE_PARENT, 0.0, 0.0, 1.0) 379 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 20.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 1.0)
380 ); 380 );
381 381
382 eo_do(scene->root_node, evas_3d_node_member_add(scene->camera_node)); 382 eo_do(scene->root_node, evas_canvas3d_node_member_add(scene->camera_node));
383 eo_do(scene->scene, evas_3d_scene_camera_node_set(scene->camera_node)); 383 eo_do(scene->scene, evas_canvas3d_scene_camera_node_set(scene->camera_node));
384} 384}
385 385
386static void 386static void
387_light_setup(Evas *evas, Scene_Data *scene) 387_light_setup(Evas *evas, Scene_Data *scene)
388{ 388{
389 scene->light = eo_add(EVAS_3D_LIGHT_CLASS, evas, 389 scene->light = eo_add(EVAS_CANVAS3D_LIGHT_CLASS, evas,
390 evas_3d_light_ambient_set(1.0, 1.0, 1.0, 1.0), 390 evas_canvas3d_light_ambient_set(1.0, 1.0, 1.0, 1.0),
391 evas_3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0), 391 evas_canvas3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0),
392 evas_3d_light_specular_set(1.0, 1.0, 1.0, 1.0), 392 evas_canvas3d_light_specular_set(1.0, 1.0, 1.0, 1.0),
393 evas_3d_light_directional_set(EINA_TRUE) 393 evas_canvas3d_light_directional_set(EINA_TRUE)
394 ); 394 );
395 scene->light_node = eo_add_custom(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_LIGHT), 395 scene->light_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_LIGHT),
396 evas_3d_node_light_set(scene->light), 396 evas_canvas3d_node_light_set(scene->light),
397 evas_3d_node_position_set(1000.0, 0.0, 1000.0), 397 evas_canvas3d_node_position_set(1000.0, 0.0, 1000.0),
398 evas_3d_node_look_at_set(EVAS_3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_3D_SPACE_PARENT, 0.0, 1.0, 0.0) 398 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0)
399 ); 399 );
400 eo_do(scene->root_node, evas_3d_node_member_add(scene->light_node)); 400 eo_do(scene->root_node, evas_canvas3d_node_member_add(scene->light_node));
401} 401}
402 402
403static void 403static void
404_cube_setup(Evas *evas, Scene_Data *scene) 404_cube_setup(Evas *evas, Scene_Data *scene)
405{ 405{
406 // Setup cube materials. 406 // Setup cube materials.
407 scene->texture0 = eo_add(EVAS_3D_TEXTURE_CLASS, evas, 407 scene->texture0 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas,
408 evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels0[0]) 408 evas_canvas3d_texture_data_set(EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels0[0])
409 ); 409 );
410 410
411 scene->texture1 = eo_add(EVAS_3D_TEXTURE_CLASS, evas, 411 scene->texture1 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas,
412 evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels1[0]) 412 evas_canvas3d_texture_data_set(EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels1[0])
413 ); 413 );
414 414
415 scene->texture_normal = eo_add(EVAS_3D_TEXTURE_CLASS, evas, 415 scene->texture_normal = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas,
416 evas_3d_texture_file_set("media/normal_lego.png", NULL) 416 evas_canvas3d_texture_file_set("media/normal_lego.png", NULL)
417 ); 417 );
418 418
419 scene->material0 = eo_add(EVAS_3D_MATERIAL_CLASS, evas, 419 scene->material0 = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas,
420 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 420 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE),
421 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 421 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE),
422 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 422 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE),
423 evas_3d_material_enable_set(EVAS_3D_MATERIAL_NORMAL, EINA_TRUE), 423 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE),
424 424
425 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0), 425 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.2, 0.2, 0.2, 1.0),
426 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0), 426 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 0.8, 0.8, 0.8, 1.0),
427 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 427 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0),
428 evas_3d_material_shininess_set(100.0), 428 evas_canvas3d_material_shininess_set(100.0),
429 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture0) 429 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, scene->texture0)
430 ); 430 );
431 431
432 scene->material1 = eo_add(EVAS_3D_MATERIAL_CLASS, evas, 432 scene->material1 = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas,
433 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 433 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE),
434 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 434 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE),
435 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 435 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE),
436 evas_3d_material_enable_set(EVAS_3D_MATERIAL_NORMAL, EINA_TRUE), 436 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE),
437 437
438 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0), 438 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.2, 0.2, 0.2, 1.0),
439 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0), 439 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 0.8, 0.8, 0.8, 1.0),
440 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 440 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0),
441 evas_3d_material_shininess_set(100.0), 441 evas_canvas3d_material_shininess_set(100.0),
442 442
443 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture1), 443 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, scene->texture1),
444 evas_3d_material_texture_set(EVAS_3D_MATERIAL_NORMAL, scene->texture_normal) 444 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, scene->texture_normal)
445 ); 445 );
446 446
447 // Setup CUBE mesh. 447 // Setup CUBE mesh.
448 scene->mesh = eo_add(EVAS_3D_MESH_CLASS, evas, 448 scene->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas,
449 evas_3d_mesh_vertex_count_set(24), 449 evas_canvas3d_mesh_vertex_count_set(24),
450 evas_3d_mesh_frame_add(0), 450 evas_canvas3d_mesh_frame_add(0),
451 451
452 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_POSITION, 12 * sizeof(float), &cube_vertices[ 0]), 452 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, 12 * sizeof(float), &cube_vertices[ 0]),
453 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_NORMAL, 12 * sizeof(float), &cube_vertices[ 3]), 453 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL, 12 * sizeof(float), &cube_vertices[ 3]),
454 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_COLOR, 12 * sizeof(float), &cube_vertices[ 6]), 454 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_COLOR, 12 * sizeof(float), &cube_vertices[ 6]),
455 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_TEXCOORD, 12 * sizeof(float), &cube_vertices[10]), 455 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD, 12 * sizeof(float), &cube_vertices[10]),
456 456
457 evas_3d_mesh_index_data_set(EVAS_3D_INDEX_FORMAT_UNSIGNED_SHORT, 36, &cube_indices[0]), 457 evas_canvas3d_mesh_index_data_set(EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, 36, &cube_indices[0]),
458 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES), 458 evas_canvas3d_mesh_vertex_assembly_set(EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES),
459 459
460 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_NORMAL_MAP), 460 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP),
461 461
462 evas_3d_mesh_frame_material_set(0, scene->material0), 462 evas_canvas3d_mesh_frame_material_set(0, scene->material0),
463 463
464 evas_3d_mesh_frame_add(20), 464 evas_canvas3d_mesh_frame_add(20),
465 evas_3d_mesh_frame_material_set(20, scene->material1) 465 evas_canvas3d_mesh_frame_material_set(20, scene->material1)
466 ); 466 );
467 467
468 scene->mesh_node = eo_add_custom(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH), 468 scene->mesh_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH),
469 eo_key_data_set("Name", "cube", NULL), 469 eo_key_data_set("Name", "cube"),
470 evas_3d_node_position_set(40.0, 3.5, 23.0), 470 evas_canvas3d_node_position_set(40.0, 3.5, 23.0),
471 evas_3d_node_mesh_add(scene->mesh) 471 evas_canvas3d_node_mesh_add(scene->mesh)
472 ); 472 );
473 473
474 eo_do(scene->root_node, evas_3d_node_member_add(scene->mesh_node)); 474 eo_do(scene->root_node, evas_canvas3d_node_member_add(scene->mesh_node));
475} 475}
476 476
477static void 477static void
478_sonic_setup(Evas *evas, Scene_Data *scene) 478_sonic_setup(Evas *evas, Scene_Data *scene)
479{ 479{
480 // Setup an MD2 mesh. 480 // Setup an MD2 mesh.
481 scene->texture2 = eo_add(EVAS_3D_TEXTURE_CLASS, evas, 481 scene->texture2 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas,
482 evas_3d_texture_file_set("media/sonic.png", NULL), 482 evas_canvas3d_texture_file_set("media/sonic.png", NULL),
483 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST, EVAS_3D_TEXTURE_FILTER_NEAREST), 483 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST),
484 evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT, EVAS_3D_WRAP_MODE_REPEAT) 484 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT)
485 ); 485 );
486 486
487 scene->material2 = eo_add(EVAS_3D_MATERIAL_CLASS, evas, 487 scene->material2 = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas,
488 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture2), 488 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, scene->texture2),
489 489
490 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 490 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE),
491 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 491 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE),
492 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 492 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE),
493 evas_3d_material_enable_set(EVAS_3D_MATERIAL_NORMAL, EINA_TRUE), 493 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE),
494 494
495 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.01, 0.01, 0.01, 1.0), 495 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.01, 0.01, 0.01, 1.0),
496 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 1.0, 1.0, 1.0, 1.0), 496 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 1.0, 1.0, 1.0, 1.0),
497 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 497 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0),
498 evas_3d_material_shininess_set(50.0) 498 evas_canvas3d_material_shininess_set(50.0)
499 ); 499 );
500 500
501 scene->mesh2 = eo_add(EVAS_3D_MESH_CLASS, evas, 501 scene->mesh2 = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas,
502 evas_3d_mesh_file_set(EVAS_3D_MESH_FILE_TYPE_MD2, "media/sonic.md2", NULL), 502 efl_file_set("media/sonic.md2", NULL),
503 evas_3d_mesh_frame_material_set(0, scene->material2), 503 evas_canvas3d_mesh_frame_material_set(0, scene->material2),
504 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG) 504 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG)
505 ); 505 );
506 506
507 scene->mesh2_node = eo_add_custom(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH), 507 scene->mesh2_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH),
508 eo_key_data_set("Name", "sonic", NULL), 508 eo_key_data_set("Name", "sonic"),
509 evas_3d_node_mesh_add(scene->mesh2) 509 evas_canvas3d_node_mesh_add(scene->mesh2)
510 ); 510 );
511 511
512 eo_do(scene->root_node, evas_3d_node_member_add(scene->mesh2_node)); 512 eo_do(scene->root_node, evas_canvas3d_node_member_add(scene->mesh2_node));
513} 513}
514 514
515static void 515static void
516_earth_setup(Evas *evas, Scene_Data *scene) 516_earth_setup(Evas *evas, Scene_Data *scene)
517{ 517{
518 // Setup earth material. 518 // Setup earth material.
519 scene->texture_diffuse = eo_add(EVAS_3D_TEXTURE_CLASS, evas, 519 scene->texture_diffuse = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas,
520 evas_3d_texture_file_set("media/EarthDiffuse.png", NULL), 520 evas_canvas3d_texture_file_set("media/EarthDiffuse.png", NULL),
521 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_LINEAR, EVAS_3D_TEXTURE_FILTER_LINEAR) 521 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR, EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR)
522 ); 522 );
523 523
524 scene->material3 = eo_add(EVAS_3D_MATERIAL_CLASS, evas, 524 scene->material3 = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas,
525 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture_diffuse), 525 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, scene->texture_diffuse),
526 526
527 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 527 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE),
528 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 528 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE),
529 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 529 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE),
530 530
531 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.01, 0.01, 0.01, 1.0), 531 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.01, 0.01, 0.01, 1.0),
532 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 1.0, 1.0, 1.0, 1.0), 532 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 1.0, 1.0, 1.0, 1.0),
533 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 533 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0),
534 evas_3d_material_shininess_set(50.0) 534 evas_canvas3d_material_shininess_set(50.0)
535 ); 535 );
536 536
537 // Setup earth mesh. 537 // Setup earth mesh.
538 _sphere_init(100); 538 _sphere_init(100);
539 539
540 scene->mesh3 = eo_add(EVAS_3D_MESH_CLASS, evas, 540 scene->mesh3 = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas,
541 evas_3d_mesh_vertex_count_set(vertex_count), 541 evas_canvas3d_mesh_vertex_count_set(vertex_count),
542 evas_3d_mesh_frame_add(0), 542 evas_canvas3d_mesh_frame_add(0),
543 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_POSITION, sizeof(vertex), &sphere_vertices[0].position), 543 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, sizeof(vertex), &sphere_vertices[0].position),
544 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_NORMAL, sizeof(vertex), &sphere_vertices[0].normal), 544 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL, sizeof(vertex), &sphere_vertices[0].normal),
545 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_TANGENT, sizeof(vertex), &sphere_vertices[0].tangent), 545 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_TANGENT, sizeof(vertex), &sphere_vertices[0].tangent),
546 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_COLOR, sizeof(vertex), &sphere_vertices[0].color), 546 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_COLOR, sizeof(vertex), &sphere_vertices[0].color),
547 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_TEXCOORD, sizeof(vertex), &sphere_vertices[0].texcoord), 547 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD, sizeof(vertex), &sphere_vertices[0].texcoord),
548 548
549 evas_3d_mesh_index_data_set(EVAS_3D_INDEX_FORMAT_UNSIGNED_SHORT, index_count, &sphere_indices[0]), 549 evas_canvas3d_mesh_index_data_set(EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, index_count, &sphere_indices[0]),
550 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES), 550 evas_canvas3d_mesh_vertex_assembly_set(EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES),
551 evas_3d_mesh_frame_material_set(0, scene->material3), 551 evas_canvas3d_mesh_frame_material_set(0, scene->material3),
552 552
553 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE) 553 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_DIFFUSE)
554 ); 554 );
555 555
556 scene->mesh3_node = eo_add_custom(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH), 556 scene->mesh3_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH),
557 eo_key_data_set("Name", "earth", NULL), 557 eo_key_data_set("Name", "earth"),
558 evas_3d_node_position_set(40.0, -3.5, 23.0), 558 evas_canvas3d_node_position_set(40.0, -3.5, 23.0),
559 evas_3d_node_mesh_add(scene->mesh3) 559 evas_canvas3d_node_mesh_add(scene->mesh3)
560 ); 560 );
561 561
562 eo_do(scene->root_node, evas_3d_node_member_add(scene->mesh3_node)); 562 eo_do(scene->root_node, evas_canvas3d_node_member_add(scene->mesh3_node));
563} 563}
564 564
565static void 565static void
566_scene_setup(Evas *evas, Scene_Data *scene) 566_scene_setup(Evas *evas, Scene_Data *scene)
567{ 567{
568 scene->root_node = eo_add_custom(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_NODE)); 568 scene->root_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_NODE));
569 569
570 // -TODO - set the size based on the size of the enclosing window. 570 // -TODO - set the size based on the size of the enclosing window.
571 scene->scene = eo_add(EVAS_3D_SCENE_CLASS, evas, 571 scene->scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, evas,
572 evas_3d_scene_root_node_set(scene->root_node), 572 evas_canvas3d_scene_root_node_set(scene->root_node),
573 evas_3d_scene_size_set(512, 512), 573 evas_canvas3d_scene_size_set(512, 512),
574 evas_3d_scene_background_color_set(0.0, 0.0, 0.0, 0.0) 574 evas_canvas3d_scene_background_color_set(0.0, 0.0, 0.0, 0.0)
575 ); 575 );
576 576
577 _camera_setup(evas, scene); 577 _camera_setup(evas, scene);
@@ -591,8 +591,8 @@ _on_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo)
591 int scene_w, scene_h; 591 int scene_w, scene_h;
592 Evas_Real scene_x, scene_y; 592 Evas_Real scene_x, scene_y;
593 Evas_Real s, t; 593 Evas_Real s, t;
594 Evas_3D_Node *n; 594 Eo *n;
595 Evas_3D_Mesh *m; 595 Eo *m;
596 Eina_Bool pick; 596 Eina_Bool pick;
597 char *name = NULL; 597 char *name = NULL;
598 598
@@ -601,12 +601,12 @@ _on_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo)
601 obj_x = ev->cur.canvas.x - x; 601 obj_x = ev->cur.canvas.x - x;
602 obj_y = ev->cur.canvas.y - y; 602 obj_y = ev->cur.canvas.y - y;
603 603
604 eo_do(scene->scene, evas_3d_scene_size_get(&scene_w, &scene_h)); 604 eo_do(scene->scene, evas_canvas3d_scene_size_get(&scene_w, &scene_h));
605 605
606 scene_x = obj_x * scene_w / (Evas_Real)w; 606 scene_x = obj_x * scene_w / (Evas_Real)w;
607 scene_y = obj_y * scene_h / (Evas_Real)h; 607 scene_y = obj_y * scene_h / (Evas_Real)h;
608 608
609 eo_do(scene->scene, pick = evas_3d_scene_pick(scene_x, scene_y, &n, &m, &s, &t)); 609 eo_do(scene->scene, pick = evas_canvas3d_scene_pick(scene_x, scene_y, &n, &m, &s, &t));
610 if (pick) 610 if (pick)
611 name = evas_object_data_get(n, "Name"); 611 name = evas_object_data_get(n, "Name");
612 // This is a raw Evas callback, on the Elm image internal Evas_Object. 612 // This is a raw Evas callback, on the Elm image internal Evas_Object.
@@ -631,8 +631,8 @@ _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo)
631 int scene_w, scene_h; 631 int scene_w, scene_h;
632 Evas_Real scene_x, scene_y; 632 Evas_Real scene_x, scene_y;
633 Evas_Real s, t; 633 Evas_Real s, t;
634 Evas_3D_Node *n; 634 Eo *n;
635 Evas_3D_Mesh *m; 635 Eo *m;
636 Eina_Bool pick; 636 Eina_Bool pick;
637 char *name = NULL; 637 char *name = NULL;
638 638
@@ -641,12 +641,12 @@ _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo)
641 obj_x = ev->canvas.x - x; 641 obj_x = ev->canvas.x - x;
642 obj_y = ev->canvas.y - y; 642 obj_y = ev->canvas.y - y;
643 643
644 eo_do(scene->scene, evas_3d_scene_size_get(&scene_w, &scene_h)); 644 eo_do(scene->scene, evas_canvas3d_scene_size_get(&scene_w, &scene_h));
645 645
646 scene_x = obj_x * scene_w / (Evas_Real)w; 646 scene_x = obj_x * scene_w / (Evas_Real)w;
647 scene_y = obj_y * scene_h / (Evas_Real)h; 647 scene_y = obj_y * scene_h / (Evas_Real)h;
648 648
649 eo_do(scene->scene, pick = evas_3d_scene_pick(scene_x, scene_y, &n, &m, &s, &t)); 649 eo_do(scene->scene, pick = evas_canvas3d_scene_pick(scene_x, scene_y, &n, &m, &s, &t));
650 if (pick) 650 if (pick)
651 { 651 {
652 name = evas_object_data_get(n, "Name"); 652 name = evas_object_data_get(n, "Name");
@@ -672,7 +672,7 @@ _changed_cb(void *data, Evas_Object *obj, void *event_info)
672 Scene_Data *scene = data; 672 Scene_Data *scene = data;
673 double val = elm_slider_value_get(obj); 673 double val = elm_slider_value_get(obj);
674 674
675 eo_do(scene->camera_node, evas_3d_node_position_set(50.0 + val, 0.0, 20.0)); 675 eo_do(scene->camera_node, evas_canvas3d_node_position_set(50.0 + val, 0.0, 20.0));
676} 676}
677 677
678static void 678static void
@@ -710,11 +710,10 @@ open_window(globals *ourGlobals)
710 eo_do(obj, 710 eo_do(obj,
711 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 711 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
712 elm_obj_image_fill_outside_set(EINA_TRUE), 712 elm_obj_image_fill_outside_set(EINA_TRUE),
713 elm_obj_image_file_set("media/sky_01.jpg", NULL), 713 efl_file_set("media/sky_01.jpg", NULL),
714 evas_obj_visibility_set(EINA_TRUE) 714 efl_gfx_visible_set(EINA_TRUE)
715 ); 715 );
716 elm_win_resize_object_add(ourGlobals->win, obj); 716 elm_win_resize_object_add(ourGlobals->win, obj);
717 eo_unref(obj);
718 717
719 // Add an image object for 3D scene rendering. 718 // Add an image object for 3D scene rendering.
720 obj = eo_add(ELM_IMAGE_CLASS, ourGlobals->win); 719 obj = eo_add(ELM_IMAGE_CLASS, ourGlobals->win);
@@ -722,7 +721,7 @@ open_window(globals *ourGlobals)
722 eo_do(obj, 721 eo_do(obj,
723 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 722 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
724 elm_obj_image_fill_outside_set(EINA_TRUE), 723 elm_obj_image_fill_outside_set(EINA_TRUE),
725 evas_obj_visibility_set(EINA_TRUE), 724 efl_gfx_visible_set(EINA_TRUE),
726 temp = elm_obj_image_object_get() 725 temp = elm_obj_image_object_get()
727 ); 726 );
728 eo_do(temp, 727 eo_do(temp,
@@ -744,11 +743,10 @@ open_window(globals *ourGlobals)
744 elm_obj_slider_min_max_set(-10, 10), 743 elm_obj_slider_min_max_set(-10, 10),
745 evas_obj_size_hint_align_set(1.0, EVAS_HINT_FILL), 744 evas_obj_size_hint_align_set(1.0, EVAS_HINT_FILL),
746 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 745 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
747 evas_obj_visibility_set(EINA_TRUE) 746 efl_gfx_visible_set(EINA_TRUE)
748 ); 747 );
749 elm_win_resize_object_add(ourGlobals->win, obj); 748 elm_win_resize_object_add(ourGlobals->win, obj);
750 evas_object_smart_callback_add(obj, "changed", _changed_cb, &ourScene); 749 evas_object_smart_callback_add(obj, "changed", _changed_cb, &ourScene);
751 eo_unref(obj);
752 } 750 }
753 751
754 // Set preferred engine back to default from config 752 // Set preferred engine back to default from config
@@ -760,7 +758,6 @@ close_window(globals *ourGlobals)
760{ 758{
761 if (ourGlobals->win) 759 if (ourGlobals->win)
762 { 760 {
763 eo_unref(ourScene.image);
764 evas_object_del(ourGlobals->win); 761 evas_object_del(ourGlobals->win);
765 _sphere_fini(); 762 _sphere_fini();
766 } 763 }