aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz/scenri.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-03-13 19:59:59 +1000
committerDavid Walter Seikel2016-03-13 19:59:59 +1000
commitbb128645efa19772a5c1a039df9c46213feb4426 (patch)
tree87bb9931b4effd3dc1db4ee607d69367cc19a9c6 /src/extantz/scenri.c
parentIntroducing Rough Hir, the new default avatar. At least, when we get avatars. (diff)
downloadSledjHamr-bb128645efa19772a5c1a039df9c46213feb4426.zip
SledjHamr-bb128645efa19772a5c1a039df9c46213feb4426.tar.gz
SledjHamr-bb128645efa19772a5c1a039df9c46213feb4426.tar.bz2
SledjHamr-bb128645efa19772a5c1a039df9c46213feb4426.tar.xz
Update to new eo_* syntax.
Diffstat (limited to '')
-rw-r--r--src/extantz/scenri.c223
1 files changed, 103 insertions, 120 deletions
diff --git a/src/extantz/scenri.c b/src/extantz/scenri.c
index 4f15109..a487d47 100644
--- a/src/extantz/scenri.c
+++ b/src/extantz/scenri.c
@@ -100,10 +100,8 @@ static void _animateCube(ExtantzStuffs *stuffs)
100 if (frame >= 20) inc = -1; 100 if (frame >= 20) inc = -1;
101 else if (frame <= 0) inc = 1; 101 else if (frame <= 0) inc = 1;
102 102
103 eo_do(stuffs->mesh_node, 103 evas_canvas3d_node_orientation_angle_axis_set(stuffs->mesh_node, angle, 1.0, 1.0, 1.0);
104 evas_canvas3d_node_orientation_angle_axis_set(angle, 1.0, 1.0, 1.0), 104 evas_canvas3d_node_mesh_frame_set(stuffs->mesh_node, m, frame);
105 evas_canvas3d_node_mesh_frame_set(m, frame)
106 );
107} 105}
108 106
109static void _animateSphere(ExtantzStuffs *stuffs) 107static void _animateSphere(ExtantzStuffs *stuffs)
@@ -112,9 +110,7 @@ static void _animateSphere(ExtantzStuffs *stuffs)
112 110
113 earthAngle += 0.3; 111 earthAngle += 0.3;
114 if (earthAngle > 360.0) earthAngle -= 360.0f; 112 if (earthAngle > 360.0) earthAngle -= 360.0f;
115 eo_do(stuffs->mesh_node, 113 evas_canvas3d_node_orientation_angle_axis_set(stuffs->mesh_node, earthAngle, 0.0, 1.0, 0.0);
116 evas_canvas3d_node_orientation_angle_axis_set(earthAngle, 0.0, 1.0, 0.0)
117 );
118} 114}
119 115
120static void _animateSonic(ExtantzStuffs *stuffs) 116static void _animateSonic(ExtantzStuffs *stuffs)
@@ -125,9 +121,7 @@ static void _animateSonic(ExtantzStuffs *stuffs)
125 eina_accessor_data_get(stuffs->aMesh, 0, (void **) &m); 121 eina_accessor_data_get(stuffs->aMesh, 0, (void **) &m);
126 sonicFrame += 32; 122 sonicFrame += 32;
127 if (sonicFrame > 256 * 50) sonicFrame = 0; 123 if (sonicFrame > 256 * 50) sonicFrame = 0;
128 eo_do(stuffs->mesh_node, 124 evas_canvas3d_node_mesh_frame_set(stuffs->mesh_node, m, sonicFrame);
129 evas_canvas3d_node_mesh_frame_set(m, sonicFrame)
130 );
131} 125}
132 126
133Eina_Bool animateScene(globals *ourGlobals) 127Eina_Bool animateScene(globals *ourGlobals)
@@ -206,12 +200,12 @@ static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void
206 obj_x = ev->canvas.x - x; 200 obj_x = ev->canvas.x - x;
207 obj_y = ev->canvas.y - y; 201 obj_y = ev->canvas.y - y;
208 202
209 eo_do(scene->scene, evas_canvas3d_scene_size_get(&scene_w, &scene_h)); 203 evas_canvas3d_scene_size_get(scene->scene, &scene_w, &scene_h);
210 204
211 scene_x = obj_x * scene_w / (Evas_Real)w; 205 scene_x = obj_x * scene_w / (Evas_Real)w;
212 scene_y = obj_y * scene_h / (Evas_Real)h; 206 scene_y = obj_y * scene_h / (Evas_Real)h;
213 207
214 eo_do(scene->scene, pick = evas_canvas3d_scene_pick(scene_x, scene_y, &n, &m, &s, &t)); 208 pick = evas_canvas3d_scene_pick(scene->scene, scene_x, scene_y, &n, &m, &s, &t);
215 if (pick) 209 if (pick)
216 { 210 {
217 name = evas_object_data_get(n, "Name"); 211 name = evas_object_data_get(n, "Name");
@@ -406,24 +400,21 @@ Scene_Data *scenriAdd(Evas_Object *win)
406{ 400{
407 Scene_Data *scene; 401 Scene_Data *scene;
408 Evas_Object *evas; 402 Evas_Object *evas;
409#if USE_ELM_IMG
410 Evas_Object *temp;
411#endif
412 int w, h; 403 int w, h;
413 404
414 evas = evas_object_evas_get(win); 405 evas = evas_object_evas_get(win);
415 eo_do(win, efl_gfx_size_get(&w, &h)); 406 efl_gfx_size_get(win, &w, &h);
416 scene = calloc(1, sizeof(Scene_Data)); 407 scene = calloc(1, sizeof(Scene_Data));
417 scene->evas = evas; 408 scene->evas = evas;
418 eina_clist_init(&(scene->stuffs)); 409 eina_clist_init(&(scene->stuffs));
419 eina_clist_init(&(scene->loading)); 410 eina_clist_init(&(scene->loading));
420 411
421 scene->root_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_NODE)); 412 scene->root_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_NODE));
422 413
423 scene->scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, evas, 414 scene->scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, evas,
424 evas_canvas3d_scene_root_node_set(scene->root_node), 415 evas_canvas3d_scene_root_node_set(eoid, scene->root_node),
425 evas_canvas3d_scene_size_set(w, h), 416 evas_canvas3d_scene_size_set(eoid, w, h),
426 evas_canvas3d_scene_background_color_set(0.0, 0.0, 0.0, 0.0) 417 evas_canvas3d_scene_background_color_set(eoid, 0.0, 0.0, 0.0, 0.0)
427 ); 418 );
428 419
429 // Add an image object for 3D scene rendering. 420 // Add an image object for 3D scene rendering.
@@ -432,10 +423,10 @@ Scene_Data *scenriAdd(Evas_Object *win)
432 // Note that we can't reuse the windows background image, Evas_3D needs both images. 423 // Note that we can't reuse the windows background image, Evas_3D needs both images.
433#if USE_ELM_IMG 424#if USE_ELM_IMG
434 scene->image = eo_add(ELM_IMAGE_CLASS, win, 425 scene->image = eo_add(ELM_IMAGE_CLASS, win,
435 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 426 evas_obj_size_hint_weight_set(eoid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
436 elm_obj_image_fill_outside_set(EINA_TRUE), 427 elm_obj_image_fill_outside_set(eoid, EINA_TRUE),
437 efl_gfx_visible_set(EINA_TRUE), 428 efl_gfx_visible_set(eoid, EINA_TRUE),
438 temp = elm_obj_image_object_get() 429 scene->image_e = elm_obj_image_object_get(eoid)
439 ); 430 );
440#else 431#else
441 scene->image = evas_object_image_filled_add(evas); 432 scene->image = evas_object_image_filled_add(evas);
@@ -446,17 +437,18 @@ Scene_Data *scenriAdd(Evas_Object *win)
446 437
447 // Lights! 438 // Lights!
448 scene->light = eo_add(EVAS_CANVAS3D_LIGHT_CLASS, evas, 439 scene->light = eo_add(EVAS_CANVAS3D_LIGHT_CLASS, evas,
449 evas_canvas3d_light_ambient_set(1.0, 1.0, 1.0, 1.0), 440 evas_canvas3d_light_ambient_set(eoid, 1.0, 1.0, 1.0, 1.0),
450 evas_canvas3d_light_diffuse_set(1.0, 1.0, 1.0, 1.0), 441 evas_canvas3d_light_diffuse_set(eoid, 1.0, 1.0, 1.0, 1.0),
451 evas_canvas3d_light_specular_set(1.0, 1.0, 1.0, 1.0), 442 evas_canvas3d_light_specular_set(eoid, 1.0, 1.0, 1.0, 1.0),
452 evas_canvas3d_light_directional_set(EINA_TRUE) 443 evas_canvas3d_light_directional_set(eoid, EINA_TRUE)
453 ); 444 );
454 scene->light_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_LIGHT), 445 scene->light_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas,
455 evas_canvas3d_node_light_set(scene->light), 446 evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_LIGHT),
456 evas_canvas3d_node_position_set(1000.0, 0.0, 1000.0), 447 evas_canvas3d_node_light_set(eoid, scene->light),
457 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) 448 evas_canvas3d_node_position_set(eoid, 1000.0, 0.0, 1000.0),
449 evas_canvas3d_node_look_at_set(eoid, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 1.0, 0.0)
458 ); 450 );
459 eo_do(scene->root_node, evas_canvas3d_node_member_add(scene->light_node)); 451 evas_canvas3d_node_member_add(scene->root_node, scene->light_node);
460 452
461 // Cameras! 453 // Cameras!
462 scene->camera_node = cameraAdd(evas, scene, scene->image); 454 scene->camera_node = cameraAdd(evas, scene, scene->image);
@@ -466,13 +458,13 @@ Scene_Data *scenriAdd(Evas_Object *win)
466 elm_object_tooltip_hide(scene->image); 458 elm_object_tooltip_hide(scene->image);
467 459
468#if USE_ELM_IMG 460#if USE_ELM_IMG
469 eo_do(temp, evas_obj_image_scene_set(scene->scene)); 461 evas_obj_image_scene_set(scene->image_e, scene->scene);
470 462
471 // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas callbacks instead. 463 // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas callbacks instead.
472 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, scene); 464 evas_object_event_callback_add(scene->image_e, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, scene);
473 evas_object_event_callback_add(temp, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, scene); 465 evas_object_event_callback_add(scene->image_e, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, scene);
474#else 466#else
475 eo_do(scene->image, evas_obj_image_scene_set(scene->scene)); 467 evas_obj_image_scene_set(scene->image, scene->scene);
476 468
477 // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas callbacks instead. 469 // Elm can't seem to be able to tell us WHERE an image was clicked, so use raw Evas callbacks instead.
478 evas_object_event_callback_add(scene->image, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, scene); 470 evas_object_event_callback_add(scene->image, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, scene);
@@ -594,11 +586,9 @@ static void _set_vertex_data_from_array(Evas_Canvas3D_Mesh *mesh, int frame, con
594 float *address, *out; 586 float *address, *out;
595 int stride, i, j; 587 int stride, i, j;
596 588
597 eo_do(mesh, 589 evas_canvas3d_mesh_frame_vertex_data_copy_set(mesh, frame, attr, 0, NULL);
598 evas_canvas3d_mesh_frame_vertex_data_copy_set(frame, attr, 0, NULL), 590 address = (float *)evas_canvas3d_mesh_frame_vertex_data_map(mesh, frame, attr);
599 address = (float *)evas_canvas3d_mesh_frame_vertex_data_map(frame, attr), 591 stride = evas_canvas3d_mesh_frame_vertex_stride_get(mesh, frame, attr);
600 stride = evas_canvas3d_mesh_frame_vertex_stride_get(frame, attr)
601 );
602 592
603 if (stride == 0) stride = sizeof(float) * attr_count; 593 if (stride == 0) stride = sizeof(float) * attr_count;
604 594
@@ -609,7 +599,7 @@ static void _set_vertex_data_from_array(Evas_Canvas3D_Mesh *mesh, int frame, con
609 out[j] = data[start + (line * i) + j]; 599 out[j] = data[start + (line * i) + j];
610 } 600 }
611 601
612 eo_do(mesh, evas_canvas3d_mesh_frame_vertex_data_unmap(frame, attr)); 602 evas_canvas3d_mesh_frame_vertex_data_unmap(mesh, frame, attr);
613} 603}
614 604
615void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake) 605void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
@@ -628,13 +618,13 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
628 if (1 == fake) 618 if (1 == fake)
629 { 619 {
630 t = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, scene->evas, 620 t = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, scene->evas,
631 evas_canvas3d_texture_data_set(EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels0[0]) 621 evas_canvas3d_texture_data_set(eoid, EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels0[0])
632 ); 622 );
633 eina_array_push(stuffs->textures, t); 623 eina_array_push(stuffs->textures, t);
634 624
635 t1 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, scene->evas, 625 t1 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, scene->evas,
636 evas_canvas3d_texture_data_set(EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels1[0]) 626 evas_canvas3d_texture_data_set(eoid, EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels1[0])
637 ); 627 );
638 eina_array_push(stuffs->textures, t1); 628 eina_array_push(stuffs->textures, t1);
639 } 629 }
640 630
@@ -642,10 +632,10 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
642 { 632 {
643 snprintf(buf, sizeof(buf), "%s/%s", prefix_data_get(), m->texture); 633 snprintf(buf, sizeof(buf), "%s/%s", prefix_data_get(), m->texture);
644 ti = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, scene->evas, 634 ti = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, scene->evas,
645 evas_canvas3d_texture_file_set(buf, NULL), 635 evas_canvas3d_texture_file_set(eoid, buf, NULL),
646 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR, EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR), // Only for sphere originally. 636 evas_canvas3d_texture_filter_set(eoid, EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR, EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR), // Only for sphere originally.
647 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST), // Only for sonic originally. 637 evas_canvas3d_texture_filter_set(eoid, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST), // Only for sonic originally.
648 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT) 638 evas_canvas3d_texture_wrap_set(eoid, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT)
649 ); 639 );
650 eina_array_push(stuffs->textures, ti); 640 eina_array_push(stuffs->textures, ti);
651 } 641 }
@@ -655,34 +645,31 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
655 { 645 {
656 eina_accessor_data_get(stuffs->aTexture, 0, (void **) &t); 646 eina_accessor_data_get(stuffs->aTexture, 0, (void **) &t);
657 mi = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, scene->evas, 647 mi = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, scene->evas,
658 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE), 648 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE),
659 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE), 649 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE),
660 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE), 650 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE),
661 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE), 651 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE),
662 652 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.2, 0.2, 0.2, 1.0),
663 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.2, 0.2, 0.2, 1.0), 653 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 0.8, 0.8, 0.8, 1.0),
664 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 0.8, 0.8, 0.8, 1.0), 654 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0),
665 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0), 655 evas_canvas3d_material_shininess_set(eoid, 100.0),
666 evas_canvas3d_material_shininess_set(100.0), 656 evas_canvas3d_material_texture_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, t)
667 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, t)
668 ); 657 );
669 eina_array_push(stuffs->materials, mi); 658 eina_array_push(stuffs->materials, mi);
670 659
671 eina_accessor_data_get(stuffs->aTexture, 1, (void **) &t1); 660 eina_accessor_data_get(stuffs->aTexture, 1, (void **) &t1);
672 eina_accessor_data_get(stuffs->aTexture, 2, (void **) &ti); 661 eina_accessor_data_get(stuffs->aTexture, 2, (void **) &ti);
673 mj = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, scene->evas, 662 mj = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, scene->evas,
674 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE), 663 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE),
675 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE), 664 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE),
676 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE), 665 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE),
677 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE), 666 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE),
678 667 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.2, 0.2, 0.2, 1.0),
679 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.2, 0.2, 0.2, 1.0), 668 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 0.8, 0.8, 0.8, 1.0),
680 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 0.8, 0.8, 0.8, 1.0), 669 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0),
681 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0), 670 evas_canvas3d_material_shininess_set(eoid, 100.0),
682 evas_canvas3d_material_shininess_set(100.0), 671 evas_canvas3d_material_texture_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, t1),
683 672 evas_canvas3d_material_texture_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, ti)
684 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, t1),
685 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, ti)
686 ); 673 );
687 eina_array_push(stuffs->materials, mj); 674 eina_array_push(stuffs->materials, mj);
688 } 675 }
@@ -690,17 +677,16 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
690 { 677 {
691 eina_accessor_data_get(stuffs->aTexture, 0, (void **) &t); 678 eina_accessor_data_get(stuffs->aTexture, 0, (void **) &t);
692 mi = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, scene->evas, 679 mi = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, scene->evas,
693 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, t), 680 evas_canvas3d_material_texture_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, t),
694 681 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE),
695 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE), 682 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE),
696 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE), 683 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE),
697 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE), 684 evas_canvas3d_material_enable_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE), // Not for sphere originally.
698 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE), // Not for sphere originally. 685
699 686 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.01, 0.01, 0.01, 1.0),
700 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0.01, 0.01, 0.01, 1.0), 687 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 1.0, 1.0, 1.0, 1.0),
701 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 1.0, 1.0, 1.0, 1.0), 688 evas_canvas3d_material_color_set(eoid, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0),
702 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0), 689 evas_canvas3d_material_shininess_set(eoid, 50.0)
703 evas_canvas3d_material_shininess_set(50.0)
704 ); 690 );
705 eina_array_push(stuffs->materials, mi); 691 eina_array_push(stuffs->materials, mi);
706 } 692 }
@@ -715,16 +701,16 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
715 701
716#if 0 702#if 0
717 Eo *cube = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, scene->evas); 703 Eo *cube = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, scene->evas);
718 eo_do(cube, evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE)); 704 evas_canvas3d_primitive_form_set(cube, EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE);
719 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas, 705 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas,
720 evas_canvas3d_mesh_from_primitive_set(0, cube), 706 evas_canvas3d_mesh_from_primitive_set(eoid, 0, cube)
721 ); 707 );
722#else 708#else
723 // More or less copied from EFL, so I can create my own primitives. 709 // More or less copied from EFL, so I can create my own primitives.
724 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas, 710 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas,
725 evas_canvas3d_mesh_frame_add(0), 711 evas_canvas3d_mesh_frame_add(eoid, 0),
726 evas_canvas3d_mesh_vertex_count_set(24), 712 evas_canvas3d_mesh_vertex_count_set(eoid, 24),
727 evas_canvas3d_mesh_index_data_set(EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, 36, &cube_indices[0]) 713 evas_canvas3d_mesh_index_data_set(eoid, EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, 36, &cube_indices[0])
728 ); 714 );
729 715
730 _set_vertex_data_from_array(me, 0, cube_vertices, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, 0, 3, 15, 24); 716 _set_vertex_data_from_array(me, 0, cube_vertices, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, 0, 3, 15, 24);
@@ -735,13 +721,11 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
735 721
736#endif 722#endif
737 723
738 eo_do(me, 724 evas_canvas3d_mesh_vertex_assembly_set(me, EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES);
739 evas_canvas3d_mesh_vertex_assembly_set(EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES), 725 evas_canvas3d_mesh_shade_mode_set(me, EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP);
740 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP), 726 evas_canvas3d_mesh_frame_material_set(me, 0, mi);
741 evas_canvas3d_mesh_frame_material_set(0, mi), 727 evas_canvas3d_mesh_frame_add(me, 20);
742 evas_canvas3d_mesh_frame_add(20), 728 evas_canvas3d_mesh_frame_material_set(me, 20, mj);
743 evas_canvas3d_mesh_frame_material_set(20, mj)
744 );
745 729
746 eina_array_push(stuffs->mesh, me); 730 eina_array_push(stuffs->mesh, me);
747 } 731 }
@@ -752,13 +736,12 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
752 eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi); 736 eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi);
753 737
754 sphere = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, scene->evas); 738 sphere = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, scene->evas);
755 eo_do(sphere, evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_SPHERE)); 739 evas_canvas3d_primitive_form_set(sphere, EVAS_CANVAS3D_MESH_PRIMITIVE_SPHERE);
756 740
757 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas, 741 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas,
758 evas_canvas3d_mesh_from_primitive_set(0, sphere), 742 evas_canvas3d_mesh_from_primitive_set(eoid, 0, sphere),
759 evas_canvas3d_mesh_frame_material_set(0, mi), 743 evas_canvas3d_mesh_frame_material_set(eoid, 0, mi),
760 744 evas_canvas3d_mesh_shade_mode_set(eoid, EVAS_CANVAS3D_SHADE_MODE_DIFFUSE)
761 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_DIFFUSE)
762 ); 745 );
763 eina_array_push(stuffs->mesh, me); 746 eina_array_push(stuffs->mesh, me);
764 } 747 }
@@ -770,15 +753,14 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
770 753
771 // Attempt to create a heightfield. 754 // Attempt to create a heightfield.
772 terrain = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, scene->evas); 755 terrain = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, scene->evas);
773 eo_do(terrain, evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_SURFACE), 756 evas_canvas3d_primitive_form_set(terrain, EVAS_CANVAS3D_MESH_PRIMITIVE_SURFACE);
774 evas_canvas3d_primitive_precision_set(256), 757 evas_canvas3d_primitive_precision_set(terrain, 256);
775 evas_canvas3d_primitive_tex_scale_set(1.0, 1.0), 758 evas_canvas3d_primitive_tex_scale_set(terrain, 1.0, 1.0);
776 evas_canvas3d_primitive_surface_set(_SL_RAW_terrain) 759 evas_canvas3d_primitive_surface_set(terrain, _SL_RAW_terrain);
777 );
778 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas, 760 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas,
779 evas_canvas3d_mesh_from_primitive_set(0, terrain), 761 evas_canvas3d_mesh_from_primitive_set(eoid, 0, terrain),
780 evas_canvas3d_mesh_frame_material_set(0, mi), 762 evas_canvas3d_mesh_frame_material_set(eoid, 0, mi),
781 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_DIFFUSE) 763 evas_canvas3d_mesh_shade_mode_set(eoid, EVAS_CANVAS3D_SHADE_MODE_DIFFUSE)
782 ); 764 );
783 eina_array_push(stuffs->mesh, me); 765 eina_array_push(stuffs->mesh, me);
784 } 766 }
@@ -787,23 +769,24 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake)
787 eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi); 769 eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi);
788 snprintf(buf, sizeof(buf), "%s/%s", prefix_data_get(), stuffs->stuffs.details.mesh->fileName); 770 snprintf(buf, sizeof(buf), "%s/%s", prefix_data_get(), stuffs->stuffs.details.mesh->fileName);
789 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas, 771 me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas,
790 efl_file_set(buf, NULL), 772 efl_file_set(eoid, buf, NULL),
791 evas_canvas3d_mesh_frame_material_set(0, mi), 773 evas_canvas3d_mesh_frame_material_set(eoid, 0, mi),
792 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG) 774 evas_canvas3d_mesh_shade_mode_set(eoid, EVAS_CANVAS3D_SHADE_MODE_PHONG)
793 ); 775 );
794 eina_array_push(stuffs->mesh, me); 776 eina_array_push(stuffs->mesh, me);
795 } 777 }
796 778
797 eina_accessor_data_get(stuffs->aMesh, 0, (void **) &me); 779 eina_accessor_data_get(stuffs->aMesh, 0, (void **) &me);
798 stuffs->mesh_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, scene->evas, evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH), 780 stuffs->mesh_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, scene->evas,
799 eo_key_data_set("Name", stuffs->stuffs.name), 781 evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH),
800 evas_canvas3d_node_position_set(stuffs->stuffs.details.mesh->pos.x, stuffs->stuffs.details.mesh->pos.y, stuffs->stuffs.details.mesh->pos.z), 782 eo_key_data_set(eoid, "Name", stuffs->stuffs.name),
801 evas_canvas3d_node_orientation_set(stuffs->stuffs.details.mesh->rot.x, stuffs->stuffs.details.mesh->rot.y, stuffs->stuffs.details.mesh->rot.z, stuffs->stuffs.details.mesh->rot.w), 783 evas_canvas3d_node_position_set(eoid, stuffs->stuffs.details.mesh->pos.x, stuffs->stuffs.details.mesh->pos.y, stuffs->stuffs.details.mesh->pos.z),
802 evas_canvas3d_node_scale_set(stuffs->stuffs.details.mesh->size.x, stuffs->stuffs.details.mesh->size.y, stuffs->stuffs.details.mesh->size.z), 784 evas_canvas3d_node_orientation_set(eoid, stuffs->stuffs.details.mesh->rot.x, stuffs->stuffs.details.mesh->rot.y, stuffs->stuffs.details.mesh->rot.z, stuffs->stuffs.details.mesh->rot.w),
803 evas_canvas3d_node_mesh_add(me) 785 evas_canvas3d_node_scale_set(eoid, stuffs->stuffs.details.mesh->size.x, stuffs->stuffs.details.mesh->size.y, stuffs->stuffs.details.mesh->size.z),
804 ); 786 evas_canvas3d_node_mesh_add(eoid, me)
787 );
805 788
806 eo_do(scene->root_node, evas_canvas3d_node_member_add(stuffs->mesh_node)); 789 evas_canvas3d_node_member_add(scene->root_node, stuffs->mesh_node);
807 eina_clist_add_head(&(scene->stuffs), &(stuffs->node)); 790 eina_clist_add_head(&(scene->stuffs), &(stuffs->node));
808 791
809 if (1 == fake) 792 if (1 == fake)