summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Walter Seikel <won_fang@yahoo.com.au>2014-05-08 05:13:28 +1000
committerDavid Walter Seikel <won_fang@yahoo.com.au>2014-05-08 05:13:28 +1000
commit533e9519293801bfc6e76aefaebeef5371403688 (patch)
treeea36bd6eb153cdecd8ef02d9b6743642f847968c
parent03a78ef0d875b77c0dab73dc2deb9ff7d85ae6c4 (diff)
Combine eo_add and eo_do, plus some consolidation of calls.
-rw-r--r--evas-3d-elm.c204
1 files changed, 84 insertions, 120 deletions
diff --git a/evas-3d-elm.c b/evas-3d-elm.c
index 7a6a66a..9fd8b0e 100644
--- a/evas-3d-elm.c
+++ b/evas-3d-elm.c
@@ -377,54 +377,54 @@ _animate_scene(void *data)
377static void 377static void
378_camera_setup(globals *ourGlobals, Scene_Data *scene) 378_camera_setup(globals *ourGlobals, Scene_Data *scene)
379{ 379{
380 scene->camera = eo_add(EVAS_3D_CAMERA_CLASS, ourGlobals->evas); 380 scene->camera = eo_add(EVAS_3D_CAMERA_CLASS, ourGlobals->evas,
381 eo_do(scene->camera,
382 evas_3d_camera_projection_perspective_set(60.0, 1.0, 1.0, 500.0) 381 evas_3d_camera_projection_perspective_set(60.0, 1.0, 1.0, 500.0)
383 ); 382 );
384 383
385 scene->camera_node = evas_3d_node_add(ourGlobals->evas, EVAS_3D_NODE_TYPE_CAMERA); 384 scene->camera_node = eo_add_custom(EVAS_3D_NODE_CLASS, ourGlobals->evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_CAMERA),
386 eo_do(scene->camera_node, 385 evas_3d_node_camera_set(scene->camera),
387 evas_3d_node_camera_set(scene->camera)
388 );
389 eo_do(scene->root_node, evas_3d_node_member_add(scene->camera_node));
390 eo_do(scene->camera_node,
391 evas_3d_node_position_set(50.0, 0.0, 20.0), 386 evas_3d_node_position_set(50.0, 0.0, 20.0),
392 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) 387 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)
393 ); 388 );
389
390 eo_do(scene->root_node, evas_3d_node_member_add(scene->camera_node));
391 eo_do(scene->scene, evas_3d_scene_camera_node_set(scene->camera_node));
394} 392}
395 393
396static void 394static void
397_light_setup(globals *ourGlobals, Scene_Data *scene) 395_light_setup(globals *ourGlobals, Scene_Data *scene)
398{ 396{
399 scene->light = eo_add(EVAS_3D_LIGHT_CLASS, ourGlobals->evas); 397 scene->light = eo_add(EVAS_3D_LIGHT_CLASS, ourGlobals->evas,
400 eo_do(scene->light,
401 evas_3d_light_ambient_set(1.0, 1.0, 1.0, 1.0), 398 evas_3d_light_ambient_set(1.0, 1.0, 1.0, 1.0),
402 evas_3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0), 399 evas_3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0),
403 evas_3d_light_specular_set(1.0, 1.0, 1.0, 1.0), 400 evas_3d_light_specular_set(1.0, 1.0, 1.0, 1.0),
404 evas_3d_light_directional_set(EINA_TRUE) 401 evas_3d_light_directional_set(EINA_TRUE)
405 ); 402 );
406 403 scene->light_node = eo_add_custom(EVAS_3D_NODE_CLASS, ourGlobals->evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_LIGHT),
407 scene->light_node = evas_3d_node_add(ourGlobals->evas, EVAS_3D_NODE_TYPE_LIGHT); 404 evas_3d_node_light_set(scene->light),
408 eo_do(scene->light_node,
409 evas_3d_node_light_set(scene->light)
410 );
411 eo_do(scene->root_node,
412 evas_3d_node_member_add(scene->light_node)
413 );
414 eo_do(scene->light_node,
415 evas_3d_node_position_set(1000.0, 0.0, 1000.0), 405 evas_3d_node_position_set(1000.0, 0.0, 1000.0),
416 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) 406 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)
417 ); 407 );
408 eo_do(scene->root_node, evas_3d_node_member_add(scene->light_node));
418} 409}
419 410
420static void 411static void
421_cube_setup(globals *ourGlobals, Scene_Data *scene) 412_cube_setup(globals *ourGlobals, Scene_Data *scene)
422{ 413{
423 // Setup cube materials. 414 // Setup cube materials.
424 scene->material0 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas); 415 scene->texture0 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas,
425 scene->material1 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas); 416 evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels0[0])
417 );
426 418
427 eo_do(scene->material0, 419 scene->texture1 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas,
420 evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels1[0])
421 );
422
423 scene->texture_normal = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas,
424 evas_3d_texture_file_set("media/normal_lego.png", NULL)
425 );
426
427 scene->material0 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas,
428 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 428 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE),
429 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 429 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE),
430 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 430 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE),
@@ -433,10 +433,11 @@ _cube_setup(globals *ourGlobals, Scene_Data *scene)
433 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0), 433 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0),
434 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0), 434 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0),
435 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 435 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
436 evas_3d_material_shininess_set(100.0) 436 evas_3d_material_shininess_set(100.0),
437 ); 437 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture0)
438 );
438 439
439 eo_do(scene->material1, 440 scene->material1 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas,
440 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 441 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE),
441 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 442 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE),
442 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 443 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE),
@@ -445,28 +446,14 @@ _cube_setup(globals *ourGlobals, Scene_Data *scene)
445 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0), 446 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.2, 0.2, 0.2, 1.0),
446 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0), 447 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 0.8, 0.8, 0.8, 1.0),
447 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 448 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
448 evas_3d_material_shininess_set(100.0) 449 evas_3d_material_shininess_set(100.0),
449 );
450
451 scene->texture0 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas);
452 scene->texture1 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas);
453 scene->texture_normal = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas);
454 450
455 eo_do(scene->texture0, 451 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture1),
456 evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels0[0]) 452 evas_3d_material_texture_set(EVAS_3D_MATERIAL_NORMAL, scene->texture_normal)
457 ); 453 );
458 eo_do(scene->texture1,
459 evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels1[0])
460 );
461 eo_do(scene->texture_normal, evas_3d_texture_file_set("media/normal_lego.png", NULL));
462
463 eo_do(scene->material0, evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture0));
464 eo_do(scene->material1, evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture1));
465 eo_do(scene->material1, evas_3d_material_texture_set(EVAS_3D_MATERIAL_NORMAL, scene->texture_normal));
466 454
467 // Setup CUBE mesh. 455 // Setup CUBE mesh.
468 scene->mesh = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas); 456 scene->mesh = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas,
469 eo_do(scene->mesh,
470 evas_3d_mesh_vertex_count_set(24), 457 evas_3d_mesh_vertex_count_set(24),
471 evas_3d_mesh_frame_add(0), 458 evas_3d_mesh_frame_add(0),
472 459
@@ -485,37 +472,27 @@ _cube_setup(globals *ourGlobals, Scene_Data *scene)
485 evas_3d_mesh_frame_add(20), 472 evas_3d_mesh_frame_add(20),
486 evas_3d_mesh_frame_material_set(20, scene->material1) 473 evas_3d_mesh_frame_material_set(20, scene->material1)
487 ); 474 );
488 scene->mesh_node = evas_3d_node_add(ourGlobals->evas, EVAS_3D_NODE_TYPE_MESH); 475
489 eo_do(scene->root_node, evas_3d_node_member_add(scene->mesh_node)); 476 scene->mesh_node = eo_add_custom(EVAS_3D_NODE_CLASS, ourGlobals->evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH),
490 eo_do(scene->mesh_node,
491 eo_key_data_set("Name", "cube", NULL), 477 eo_key_data_set("Name", "cube", NULL),
492 evas_3d_node_position_set(40.0, 3.5, 23.0), 478 evas_3d_node_position_set(40.0, 3.5, 23.0),
493 evas_3d_node_mesh_add(scene->mesh) 479 evas_3d_node_mesh_add(scene->mesh)
494 ); 480 );
481
482 eo_do(scene->root_node, evas_3d_node_member_add(scene->mesh_node));
495} 483}
496 484
497static void 485static void
498_sonic_setup(globals *ourGlobals, Scene_Data *scene) 486_sonic_setup(globals *ourGlobals, Scene_Data *scene)
499{ 487{
500 // Setup an MD2 mesh. 488 // Setup an MD2 mesh.
501 scene->mesh2 = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas); 489 scene->texture2 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas,
502 eo_do(scene->mesh2,
503 evas_3d_mesh_file_set(EVAS_3D_MESH_FILE_TYPE_MD2, "media/sonic.md2", NULL)
504 );
505
506 scene->material2 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas);
507 eo_do(scene->mesh2,
508 evas_3d_mesh_frame_material_set(0, scene->material2)
509 );
510
511 scene->texture2 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas);
512 eo_do(scene->texture2,
513 evas_3d_texture_file_set("media/sonic.png", NULL), 490 evas_3d_texture_file_set("media/sonic.png", NULL),
514 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST, EVAS_3D_TEXTURE_FILTER_NEAREST), 491 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST, EVAS_3D_TEXTURE_FILTER_NEAREST),
515 evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT, EVAS_3D_WRAP_MODE_REPEAT) 492 evas_3d_texture_wrap_set(EVAS_3D_WRAP_MODE_REPEAT, EVAS_3D_WRAP_MODE_REPEAT)
516 ); 493 );
517 494
518 eo_do(scene->material2, 495 scene->material2 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas,
519 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture2), 496 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture2),
520 497
521 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 498 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE),
@@ -529,102 +506,89 @@ _sonic_setup(globals *ourGlobals, Scene_Data *scene)
529 evas_3d_material_shininess_set(50.0) 506 evas_3d_material_shininess_set(50.0)
530 ); 507 );
531 508
532 scene->mesh2_node = evas_3d_node_add(ourGlobals->evas, EVAS_3D_NODE_TYPE_MESH); 509 scene->mesh2 = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas,
533 eo_do(scene->root_node, 510 evas_3d_mesh_file_set(EVAS_3D_MESH_FILE_TYPE_MD2, "media/sonic.md2", NULL),
534 evas_3d_node_member_add(scene->mesh2_node) 511 evas_3d_mesh_frame_material_set(0, scene->material2),
512 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG)
535 ); 513 );
536 eo_do(scene->mesh2_node, 514
515 scene->mesh2_node = eo_add_custom(EVAS_3D_NODE_CLASS, ourGlobals->evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH),
537 eo_key_data_set("Name", "sonic", NULL), 516 eo_key_data_set("Name", "sonic", NULL),
538 evas_3d_node_mesh_add(scene->mesh2) 517 evas_3d_node_mesh_add(scene->mesh2)
539 ); 518 );
540 519
541 eo_do(scene->mesh2, 520 eo_do(scene->root_node, evas_3d_node_member_add(scene->mesh2_node));
542 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG)
543 );
544} 521}
545 522
546static void 523static void
547_earth_setup(globals *ourGlobals, Scene_Data *scene) 524_earth_setup(globals *ourGlobals, Scene_Data *scene)
548{ 525{
549 // Setup earth material. 526 // Setup earth material.
550 scene->material3 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas); 527 scene->texture_diffuse = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas,
528 evas_3d_texture_file_set("media/EarthDiffuse.png", NULL),
529 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_LINEAR, EVAS_3D_TEXTURE_FILTER_LINEAR)
530 );
551 531
552 scene->texture_diffuse = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas); 532 scene->material3 = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas,
553 eo_do(scene->texture_diffuse, 533 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture_diffuse),
554 evas_3d_texture_file_set("media/EarthDiffuse.png", NULL),
555 evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_LINEAR, EVAS_3D_TEXTURE_FILTER_LINEAR));
556 eo_do(scene->material3,
557 evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, scene->texture_diffuse),
558 534
559 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), 535 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE),
560 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), 536 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE),
561 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), 537 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE),
562 538
563 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.01, 0.01, 0.01, 1.0), 539 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 0.01, 0.01, 0.01, 1.0),
564 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 1.0, 1.0, 1.0, 1.0), 540 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 1.0, 1.0, 1.0, 1.0),
565 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0), 541 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 1.0, 1.0, 1.0, 1.0),
566 evas_3d_material_shininess_set(50.0)); 542 evas_3d_material_shininess_set(50.0)
543 );
567 544
568 // Setup earth mesh. 545 // Setup earth mesh.
569 _sphere_init(100); 546 _sphere_init(100);
570 547
571 scene->mesh3 = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas); 548 scene->mesh3 = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas,
572 eo_do(scene->mesh3, 549 evas_3d_mesh_vertex_count_set(vertex_count),
573 evas_3d_mesh_vertex_count_set(vertex_count), 550 evas_3d_mesh_frame_add(0),
574 evas_3d_mesh_frame_add(0), 551 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_POSITION, sizeof(vertex), &sphere_vertices[0].position),
575 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_POSITION, sizeof(vertex), &sphere_vertices[0].position), 552 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_NORMAL, sizeof(vertex), &sphere_vertices[0].normal),
576 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_NORMAL, sizeof(vertex), &sphere_vertices[0].normal), 553 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_TANGENT, sizeof(vertex), &sphere_vertices[0].tangent),
577 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_TANGENT, sizeof(vertex), &sphere_vertices[0].tangent), 554 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_COLOR, sizeof(vertex), &sphere_vertices[0].color),
578 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_COLOR, sizeof(vertex), &sphere_vertices[0].color), 555 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_TEXCOORD, sizeof(vertex), &sphere_vertices[0].texcoord),
579 evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_TEXCOORD, sizeof(vertex), &sphere_vertices[0].texcoord), 556
580 557 evas_3d_mesh_index_data_set(EVAS_3D_INDEX_FORMAT_UNSIGNED_SHORT, index_count, &sphere_indices[0]),
581 evas_3d_mesh_index_data_set(EVAS_3D_INDEX_FORMAT_UNSIGNED_SHORT, index_count, &sphere_indices[0]), 558 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES),
582 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES), 559 evas_3d_mesh_frame_material_set(0, scene->material3),
583 evas_3d_mesh_frame_material_set(0, scene->material3) 560
584 ); 561 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE)
585 562 );
586 scene->mesh3_node = evas_3d_node_add(ourGlobals->evas, EVAS_3D_NODE_TYPE_MESH); 563
587 eo_do(scene->root_node, 564 scene->mesh3_node = eo_add_custom(EVAS_3D_NODE_CLASS, ourGlobals->evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH),
588 evas_3d_node_member_add(scene->mesh3_node)
589 );
590 eo_do(scene->mesh3_node,
591 eo_key_data_set("Name", "earth", NULL), 565 eo_key_data_set("Name", "earth", NULL),
592 evas_3d_node_position_set(40.0, -3.5, 23.0), 566 evas_3d_node_position_set(40.0, -3.5, 23.0),
593 evas_3d_node_mesh_add(scene->mesh3) 567 evas_3d_node_mesh_add(scene->mesh3)
594 ); 568 );
595 569
596 eo_do(scene->mesh3, 570 eo_do(scene->root_node, evas_3d_node_member_add(scene->mesh3_node));
597 evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_DIFFUSE)
598 );
599} 571}
600 572
601
602static void 573static void
603_scene_setup(globals *ourGlobals, Scene_Data *scene) 574_scene_setup(globals *ourGlobals, Scene_Data *scene)
604{ 575{
605 scene->scene = eo_add(EVAS_3D_SCENE_CLASS, ourGlobals->evas); 576 scene->root_node = eo_add_custom(EVAS_3D_NODE_CLASS, ourGlobals->evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_NODE));
606 eo_do(scene->scene, 577
578 // -TODO - set the size based on the size of the enclosing window.
579 scene->scene = eo_add(EVAS_3D_SCENE_CLASS, ourGlobals->evas,
580 evas_3d_scene_root_node_set(scene->root_node),
607 evas_3d_scene_size_set(512, 512), 581 evas_3d_scene_size_set(512, 512),
608 evas_3d_scene_background_color_set(0.0, 0.0, 0.0, 0.0) 582 evas_3d_scene_background_color_set(0.0, 0.0, 0.0, 0.0)
609 ); 583 );
610
611// scene->root_node = eo_add(EVAS_3D_NODE_CLASS, ourGlobals->evas, EVAS_3D_NODE_TYPE_NODE);
612 scene->root_node = evas_3d_node_add(ourGlobals->evas, EVAS_3D_NODE_TYPE_NODE);
613 584
614 _camera_setup(ourGlobals, scene); 585 _camera_setup(ourGlobals, scene);
615 _light_setup(ourGlobals, scene); 586 _light_setup(ourGlobals, scene);
616 _cube_setup(ourGlobals, scene); 587 _cube_setup(ourGlobals, scene);
617 _sonic_setup(ourGlobals, scene); 588 _sonic_setup(ourGlobals, scene);
618 _earth_setup(ourGlobals, scene); 589 _earth_setup(ourGlobals, scene);
619
620 eo_do(scene->scene,
621 evas_3d_scene_root_node_set(scene->root_node),
622 evas_3d_scene_camera_node_set(scene->camera_node)
623 );
624} 590}
625 591
626
627
628static void _on_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo) 592static void _on_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo)
629{ 593{
630 Scene_Data *scene = data; 594 Scene_Data *scene = data;