diff options
-rw-r--r-- | media/Test%20sim/index.omg | 7 | ||||
-rw-r--r-- | media/Test%20sim/terrain.omg | 20 | ||||
-rw-r--r-- | src/extantz/scenri.c | 23 | ||||
-rw-r--r-- | src/libraries/love.h | 3 |
4 files changed, 50 insertions, 3 deletions
diff --git a/media/Test%20sim/index.omg b/media/Test%20sim/index.omg index c9d3b71..cf3f78a 100644 --- a/media/Test%20sim/index.omg +++ b/media/Test%20sim/index.omg | |||
@@ -28,6 +28,13 @@ Stuffs = | |||
28 | size = {1.0, 1.0, 1.0}, | 28 | size = {1.0, 1.0, 1.0}, |
29 | rot = {1.0, 0.0, 0.0, 0.0}, | 29 | rot = {1.0, 0.0, 0.0, 0.0}, |
30 | }, | 30 | }, |
31 | ['terrain'] = | ||
32 | { | ||
33 | fileName = 'terrain.omg', | ||
34 | pos = {0.0, -5.0, 0.0}, | ||
35 | size = {256.0, 256.0, 256.0}, | ||
36 | rot = {1.0, 0.0, 0.0, 0.0}, | ||
37 | }, | ||
31 | }, | 38 | }, |
32 | }, | 39 | }, |
33 | } | 40 | } |
diff --git a/media/Test%20sim/terrain.omg b/media/Test%20sim/terrain.omg new file mode 100644 index 0000000..b4edf81 --- /dev/null +++ b/media/Test%20sim/terrain.omg | |||
@@ -0,0 +1,20 @@ | |||
1 | Stuffs = | ||
2 | { | ||
3 | name = "onefang's terrain", | ||
4 | description = 'Just a pretend terrain for testing SledjHamr.', | ||
5 | fake = 4, | ||
6 | uuid = '12345678-1234-4321-abcd-01234terrain', | ||
7 | owner = '12345678-1234-4321-abcd-0123456789ab', | ||
8 | details = | ||
9 | { | ||
10 | Mesh = | ||
11 | { | ||
12 | kind = 'terrain', | ||
13 | -- insert prim parameters here | ||
14 | materials = | ||
15 | { | ||
16 | [0] = {kind = 'face', texture = 'EarthDiffuse.png'}, | ||
17 | }, | ||
18 | }, | ||
19 | }, | ||
20 | } | ||
diff --git a/src/extantz/scenri.c b/src/extantz/scenri.c index 1f51687..912aad9 100644 --- a/src/extantz/scenri.c +++ b/src/extantz/scenri.c | |||
@@ -421,7 +421,6 @@ Scene_Data *scenriAdd(Evas_Object *win) | |||
421 | evas_object_event_callback_add(scene->image, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, scene); | 421 | evas_object_event_callback_add(scene->image, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, scene); |
422 | #endif | 422 | #endif |
423 | 423 | ||
424 | |||
425 | elm_win_resize_object_add(win, scene->image); | 424 | elm_win_resize_object_add(win, scene->image); |
426 | 425 | ||
427 | scene->L = luaL_newstate(); | 426 | scene->L = luaL_newstate(); |
@@ -472,7 +471,7 @@ Scene_Data *scenriAdd(Evas_Object *win) | |||
472 | "userdata,number", 0); | 471 | "userdata,number", 0); |
473 | 472 | ||
474 | // Pass the enums to scenriLua. | 473 | // Pass the enums to scenriLua. |
475 | sprintf(buf, "MeshType = {cube = %d, mesh = %d, sphere = %d}", MT_CUBE, MT_MESH, MT_SPHERE); | 474 | sprintf(buf, "MeshType = {cube = %d, mesh = %d, sphere = %d, terrain = %d}", MT_CUBE, MT_MESH, MT_SPHERE, MT_TERRAIN); |
476 | doLuaString(scene->L, buf, "scenriLua"); | 475 | doLuaString(scene->L, buf, "scenriLua"); |
477 | sprintf(buf, "TextureType = {face = %d, normal = %d}", TT_FACE, TT_NORMAL); | 476 | sprintf(buf, "TextureType = {face = %d, normal = %d}", TT_FACE, TT_NORMAL); |
478 | doLuaString(scene->L, buf, "scenriLua"); | 477 | doLuaString(scene->L, buf, "scenriLua"); |
@@ -616,6 +615,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake) | |||
616 | 615 | ||
617 | // Meshes | 616 | // Meshes |
618 | // TODO - Write real generic cube and sphere stuff later. | 617 | // TODO - Write real generic cube and sphere stuff later. |
618 | // This could be a switch. | ||
619 | if (MT_CUBE == stuffs->stuffs.details.mesh->type) | 619 | if (MT_CUBE == stuffs->stuffs.details.mesh->type) |
620 | { | 620 | { |
621 | Eo *cube; | 621 | Eo *cube; |
@@ -654,6 +654,23 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake) | |||
654 | ); | 654 | ); |
655 | eina_array_push(stuffs->mesh, me); | 655 | eina_array_push(stuffs->mesh, me); |
656 | } | 656 | } |
657 | else if (MT_TERRAIN == stuffs->stuffs.details.mesh->type) | ||
658 | { | ||
659 | Eo *terrain; | ||
660 | |||
661 | eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi); | ||
662 | |||
663 | terrain = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, scene->evas); | ||
664 | eo_do(terrain, evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_TERRAIN)); | ||
665 | |||
666 | me = eo_add(EVAS_CANVAS3D_MESH_CLASS, scene->evas, | ||
667 | evas_canvas3d_mesh_from_primitive_set(0, terrain), | ||
668 | evas_canvas3d_mesh_frame_material_set(0, mi), | ||
669 | |||
670 | evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_DIFFUSE) | ||
671 | ); | ||
672 | eina_array_push(stuffs->mesh, me); | ||
673 | } | ||
657 | else | 674 | else |
658 | { | 675 | { |
659 | eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi); | 676 | eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi); |
@@ -684,6 +701,8 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake) | |||
684 | stuffs->animateStuffs = (aniStuffs) _animateSphere; | 701 | stuffs->animateStuffs = (aniStuffs) _animateSphere; |
685 | else if (3 == fake) | 702 | else if (3 == fake) |
686 | stuffs->animateStuffs = (aniStuffs) _animateSonic; | 703 | stuffs->animateStuffs = (aniStuffs) _animateSonic; |
704 | // else if (4 == fake) | ||
705 | // stuffs->animateStuffs = (aniStuffs) _animateSphere; | ||
687 | 706 | ||
688 | } | 707 | } |
689 | 708 | ||
diff --git a/src/libraries/love.h b/src/libraries/love.h index 1e756f8..0fe6d31 100644 --- a/src/libraries/love.h +++ b/src/libraries/love.h | |||
@@ -116,7 +116,8 @@ typedef enum | |||
116 | { | 116 | { |
117 | MT_CUBE, | 117 | MT_CUBE, |
118 | MT_MESH, | 118 | MT_MESH, |
119 | MT_SPHERE | 119 | MT_SPHERE, |
120 | MT_TERRAIN | ||
120 | } MeshType; | 121 | } MeshType; |
121 | 122 | ||
122 | 123 | ||