From f0cce6bd0e7bfafcaf91df0dccd16f43cba1ea4b Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 1 Jun 2014 18:42:37 +1000 Subject: Get the from disk sim loading to work. Still an odd problem with sonic that doesn't make sense. --- src/extantz/build.lua | 2 +- src/extantz/extantz.c | 58 +++++++++++--- src/extantz/extantz.h | 14 ++-- src/extantz/scenri.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++---- src/libraries/love.h | 2 +- src/love/love.c | 15 +++- 6 files changed, 263 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/extantz/build.lua b/src/extantz/build.lua index c2990ff..703b577 100755 --- a/src/extantz/build.lua +++ b/src/extantz/build.lua @@ -24,4 +24,4 @@ runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c crappissp runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS) runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS) CFLAGS = CFLAGS .. ' -Wl,-export-dynamic' -compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'camera', 'Evas_3D_demo', 'files', 'scenri', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o') +compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'camera', 'files', 'scenri', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o') diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 835429f..e102165 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c @@ -11,7 +11,7 @@ static void on_pixels(void *data, Evas_Object *obj); int logDom = -1; // Our logging domain. globals ourGlobals; static Eina_Strbuf *serverStream; -static char *myKey = "12345678-1234-4321-abcd-0123456789ab"; +//static char *myKey = "12345678-1234-4321-abcd-0123456789ab"; //static char *myName = "onefang rejected"; @@ -22,20 +22,11 @@ static Eina_Bool _add(void *data, int type, Ecore_Con_Event_Server_Add *ev) PI("Connected to love server."); ourGlobals->server = ev->server; - - // Pretend we logged in. - strcpy(ourGlobals->uuid, myKey); - if (ourGlobals->LSLGuiMess) ourGlobals->LSLGuiMess->server = ourGlobals->server; if (ourGlobals->purkle) ourGlobals->purkle->server = ourGlobals->server; - Evas_3D_Demo_add(ourGlobals); - // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move. - ourGlobals->gld.move = ourGlobals->scene->move; - evas_object_data_set(elm_image_object_get(ourGlobals->scene->image), "glob", ourGlobals); - evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals->scene->image), on_pixels, ourGlobals); - // Setup our callback for clicking in world. - ourGlobals->scene->clickCb = _onWorldClick; + // TODO - If this is not a local love server, we should attempt to log in here. + // Or attempt a hypergrid style TP. return ECORE_CALLBACK_RENEW; } @@ -96,6 +87,40 @@ static Eina_Bool _data(void *data, int type, Ecore_Con_Event_Server_Data *ev) PE("No LSLGuiMess to send - %s", command); } + else if (0 == strncmp(command, "loadSim(", 8)) + { + char *p, *t; + int scenriLua; + + // Pretend we logged in. Actually in the case of a local love server, we realy have logged in now. + strcpy(ourGlobals->uuid, SID); + PI("Your UUID is %s.", ourGlobals->uuid); + strcpy(buf, &command[8]); + p = buf; + while ('"' == p[0]) + p++; + while ('\'' == p[0]) + p++; + t = p; + while (('"' != p[0]) && ('\'' != p[0])) + p++; + p[0] = '\0'; + // TODO - For now, assume it's a file:// URL. + t += 7; + //strcat(t, "/index.omg"); + PI("Loading local sim from %s", t); + + // TODO - Later do the same with eet files in C code, but keep both implementations. + lua_getglobal(ourGlobals->scene->L, "package"); + lua_getfield(ourGlobals->scene->L, lua_gettop(ourGlobals->scene->L), "loaded"); + lua_remove(ourGlobals->scene->L, -2); // Removes "package" + lua_getfield(ourGlobals->scene->L, lua_gettop(ourGlobals->scene->L), "scenriLua"); + lua_remove(ourGlobals->scene->L, -2); // Removes "loaded" + scenriLua = lua_gettop(ourGlobals->scene->L); + + push_lua(ourGlobals->scene->L, "@ ( $ $ )", scenriLua, "loadSim", t); +// Evas_3D_Demo_add(ourGlobals, t); + } else { PI("Some random command %s", command); @@ -587,7 +612,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) if (!ephysics_init()) return 1; - eina_clist_init(&(ourGlobals.stuffs)); gld = &ourGlobals.gld; gldata_init(gld); @@ -662,6 +686,14 @@ EAPI_MAIN int elm_main(int argc, char **argv) init_evas_gl(&ourGlobals); + // Setup our Evas_3D stuff. + ourGlobals.scene = scenriAdd(ourGlobals.win); + // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move. + ourGlobals.gld.move = ourGlobals.scene->move; + evas_object_data_set(elm_image_object_get(ourGlobals.scene->image), "glob", &ourGlobals); + evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals.scene->image), on_pixels, &ourGlobals); + ourGlobals.scene->clickCb = _onWorldClick; + // Gotta do this after adding the windows, otherwise the menu renders under the window. // This sucks, gotta redefine this menu each time we create a new window? // Also, GL focus gets lost when any menu is used. sigh diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index 5095556..1526626 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h @@ -132,6 +132,7 @@ typedef struct typedef struct _Scene_Data { + Evas *evas; Evas_Object *image; // Our Elm image. Evas_3D_Scene *scene; Evas_3D_Node *root_node; @@ -140,6 +141,8 @@ typedef struct _Scene_Data Evas_3D_Light *light; + Eina_Clist stuffs; +/* Evas_3D_Mesh *mesh; Evas_3D_Node *mesh_node; Evas_3D_Material *material0; @@ -157,10 +160,11 @@ typedef struct _Scene_Data Evas_3D_Node *mesh3_node; Evas_3D_Material *material3; Evas_3D_Texture *texture_diffuse; - +*/ cameraMove *move; Evas_Object_Event_Cb clickCb; + lua_State *L; } Scene_Data; typedef void (* aniStuffs)(void *stuffs); @@ -168,6 +172,7 @@ typedef void (* aniStuffs)(void *stuffs); typedef struct _extantzStuffs { Stuffs stuffs; + Scene_Data *scene; Evas_3D_Node *mesh_node; // Multiple Evas_3D_Mesh's can be in one Evas_3D_Node // Can't use in arrays here, can't find the element sizes of incomplete types. Eina_Array *mesh; // Evas_3D_Mesh @@ -245,7 +250,6 @@ typedef struct _globals GLData gld; Scene_Data *scene; - Eina_Clist stuffs; EPhysics_World *world; @@ -278,7 +282,7 @@ EAPI void finishIrr(globals *ourGlobals); void overlay_add(globals *ourGlobals); -EAPI void Evas_3D_Demo_add(globals *ourGlobals); +EAPI void Evas_3D_Demo_add(globals *ourGlobals, char *file); Eina_Bool animateScene(globals *ourGlobals); void Evas_3D_Demo_fini(globals *ourGlobals); @@ -287,9 +291,9 @@ Evas_3D_Node *cameraAdd(Evas *evas, Scene_Data *scene, Evas_Object *win); Eina_Bool animateCamera(Scene_Data *scene); Eina_Bool animateScene(globals *ourGlobals); void scenriDel(Scene_Data *scene); -void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, int fake); +void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake); ExtantzStuffs *addStuffs(char *uuid, char *name, char *description, char *owner, - char *file, MeshType type, float px, float py, float pz, float rx, float ry, float rz, float rw); + char *file, MeshType type, double px, double py, double pz, double rx, double ry, double rz, double rw); void addMaterial(ExtantzStuffs *e, int face, TextureType type, char *file); winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save); diff --git a/src/extantz/scenri.c b/src/extantz/scenri.c index 4ebc64a..e7d30c4 100644 --- a/src/extantz/scenri.c +++ b/src/extantz/scenri.c @@ -1,11 +1,85 @@ +// scenri.c, deals with the in world scenery. + +/* TODO - I can see this growing to be very big, so should start to split it up at some point. + Base stuff - + scenriAdd/Del() + mouse hover showing tooltips + mouse click on objects + world animator that calls animators for stuffs + addStuffs/Materials() setupStuffs() + + Scripting hooks + Lua hooks + LSL wrappers around Lua hooks + Lua file loader, maybe have this in libg3d? + + Basic mesh stuff (likely just libg3d) - + create cube, sphere, etc + load meshes + + In world editing + +*/ + #include "extantz.h" +#define SKANG "skang" +#define THINGASM "thingasm" + + + +static void _animateCube(ExtantzStuffs *stuffs) +{ + static float angle = 0.0f; + static int frame = 0; + static int inc = 1; + Evas_3D_Mesh *m; + + eina_accessor_data_get(stuffs->aMesh, 0, (void **) &m); + + angle += 0.5; + if (angle > 360.0) angle -= 360.0f; + + frame += inc; + if (frame >= 20) inc = -1; + else if (frame <= 0) inc = 1; + + eo_do(stuffs->mesh_node, + evas_3d_node_orientation_angle_axis_set(angle, 1.0, 1.0, 1.0), + evas_3d_node_mesh_frame_set(m, frame) + ); +} + +static void _animateSphere(ExtantzStuffs *stuffs) +{ + static float earthAngle = 0.0f; + + earthAngle += 0.3; + if (earthAngle > 360.0) earthAngle -= 360.0f; + eo_do(stuffs->mesh_node, + evas_3d_node_orientation_angle_axis_set(earthAngle, 0.0, 1.0, 0.0) + ); +} + +static void _animateSonic(ExtantzStuffs *stuffs) +{ + static int sonicFrame = 0; + Evas_3D_Mesh *m; + + eina_accessor_data_get(stuffs->aMesh, 0, (void **) &m); + sonicFrame += 32; + if (sonicFrame > 256 * 50) sonicFrame = 0; + eo_do(stuffs->mesh_node, + evas_3d_node_mesh_frame_set(m, sonicFrame) + ); +} + Eina_Bool animateScene(globals *ourGlobals) { ExtantzStuffs *e; - EINA_CLIST_FOR_EACH_ENTRY(e, &ourGlobals->stuffs, ExtantzStuffs, node) + EINA_CLIST_FOR_EACH_ENTRY(e, &ourGlobals->scene->stuffs, ExtantzStuffs, node) { if (e->animateStuffs) e->animateStuffs(e); } @@ -99,6 +173,52 @@ static void _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void } +static int _addStuffsL(lua_State *L) +{ + ExtantzStuffs *result = NULL; + char *uuid, *name, *description, *owner, *file; + int type; + double px, py, pz, rx, ry, rz, rw; + + pull_lua(L, 1, "$ $ $ $ $ % # # # # # # #", &uuid, &name, &description, &owner, &file, &type, &px, &py, &pz, &rx, &ry, &rz, &rw); + result = addStuffs(uuid, name, description, owner, file, type, px, py, pz, rx, ry, rz, rw); + if (result) + { + lua_getfield(L, LUA_REGISTRYINDEX, "sceneData"); + result->scene = (Scene_Data *) lua_touserdata(L, -1); + + lua_pushlightuserdata(L, (void *) result); + return 1; + } + + return 0; +} + +static int _addMaterialL(lua_State *L) +{ + ExtantzStuffs *e = NULL; + int face, type; + char *file; + + pull_lua(L, 1, "* % % $", &e, &face, &type, &file); + if (e) + addMaterial(e, face, type, file); + + return 0; +} + +static int _stuffsSetupL(lua_State *L) +{ + ExtantzStuffs *e = NULL; + int fake; + + pull_lua(L, 1, "* %", &e, &fake); + if (e) + stuffsSetup(e, e->scene, fake); + + return 0; +} + Scene_Data *scenriAdd(Evas_Object *win) { Scene_Data *scene; @@ -108,6 +228,8 @@ Scene_Data *scenriAdd(Evas_Object *win) evas = evas_object_evas_get(win); eo_do(win, evas_obj_size_get(&w, &h)); scene = calloc(1, sizeof(Scene_Data)); + scene->evas = evas; + eina_clist_init(&(scene->stuffs)); scene->root_node = eo_add_custom(EVAS_3D_NODE_CLASS, evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_NODE)); @@ -152,11 +274,61 @@ Scene_Data *scenriAdd(Evas_Object *win) elm_win_resize_object_add(win, scene->image); + scene->L = luaL_newstate(); + if (scene->L) + { + char buf[PATH_MAX]; + int skang, scenriLua; + + luaL_openlibs(scene->L); + lua_getglobal(scene->L, "require"); + lua_pushstring(scene->L, "scenriLua"); + lua_call(scene->L, 1, 1); + + // Shove our structure into the registry. + lua_pushlightuserdata(scene->L, scene); + lua_setfield(scene->L, LUA_REGISTRYINDEX, "sceneData"); + + // The skang module should have been loaded by now, so we can just grab it out of package.loaded[]. + lua_getglobal(scene->L, "package"); + lua_getfield(scene->L, lua_gettop(scene->L), "loaded"); + lua_remove(scene->L, -2); // Removes "package" + lua_getfield(scene->L, lua_gettop(scene->L), SKANG); + lua_remove(scene->L, -2); // Removes "loaded" + lua_setfield(scene->L, LUA_REGISTRYINDEX, SKANG); + lua_getfield(scene->L, LUA_REGISTRYINDEX, SKANG); // Puts the skang table back on the stack. + skang = lua_gettop(scene->L); + + // Same for the scenriLua module, we just loaded it. + lua_getglobal(scene->L, "package"); + lua_getfield(scene->L, lua_gettop(scene->L), "loaded"); + lua_remove(scene->L, -2); // Removes "package" + lua_getfield(scene->L, lua_gettop(scene->L), "scenriLua"); + lua_remove(scene->L, -2); // Removes "loaded" + scenriLua = lua_gettop(scene->L); + + // Define our functions. + push_lua(scene->L, "@ ( = $ $ & $ )", skang, THINGASM, scenriLua, "addStuffs", "Add an in world stuffs.", _addStuffsL, + "string,string,string,string,string,number,number,number,number,number,number,number,number", 0); + push_lua(scene->L, "@ ( = $ $ & $ )", skang, THINGASM, scenriLua, "addMaterial", "Add a material to an in world stuffs.", _addMaterialL, + "userdata,number,number,string", 0); + push_lua(scene->L, "@ ( = $ $ & $ )", skang, THINGASM, scenriLua, "stuffsSetup", "Render the stuffs.", _stuffsSetupL, + "userdata,number", 0); + + // Pass the enums to scenriLua. + sprintf(buf, "MeshType = {cube = %d, mesh = %d, sphere = %d}", MT_CUBE, MT_MESH, MT_SPHERE); + doLuaString(scene->L, buf, "scenriLua"); + sprintf(buf, "TextureType = {face = %d, normal = %d}", TT_FACE, TT_NORMAL); + doLuaString(scene->L, buf, "scenriLua"); + } + return scene; } void scenriDel(Scene_Data *scene) { + lua_close(scene->L); + // TODO - I should probably free up all this Evas_3D stuff. Oddly Eo doesn't bitch about it, only valgrind. // Eo bitches if they are unref'd here. // So either Eo or valgrind bitches, depending on what I do. I'll leave them commented out, let valgrind bitch, and blame Evas_3D. @@ -257,8 +429,8 @@ static vertex *sphere_vertices = NULL; static int index_count = 0; static unsigned short *sphere_indices = NULL; -static inline vec3 -_normalize(const vec3 *v) + +static inline vec3 _normalize(const vec3 *v) { double l = sqrt(v->x * v->x + v->y * v->y + v->z * v->z); vec3 vec; @@ -270,7 +442,6 @@ _normalize(const vec3 *v) return vec; } - static void _sphere_init(int precision) { int i, j; @@ -405,7 +576,7 @@ static void _sphere_init(int precision) } -void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, int fake) +void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake) { char buf[PATH_MAX]; Material *m; @@ -419,12 +590,12 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, // Textures if (1 == fake) { - t = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, + t = eo_add(EVAS_3D_TEXTURE_CLASS, scene->evas, evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels0[0]) ); eina_array_push(stuffs->textures, t); - t1 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, + t1 = eo_add(EVAS_3D_TEXTURE_CLASS, scene->evas, evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels1[0]) ); eina_array_push(stuffs->textures, t1); @@ -433,7 +604,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, EINA_INARRAY_FOREACH(stuffs->stuffs.details.mesh->materials, m) { snprintf(buf, sizeof(buf), "%s/%s", prefix_data_get(), m->texture); - ti = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, + ti = eo_add(EVAS_3D_TEXTURE_CLASS, scene->evas, evas_3d_texture_file_set(buf, NULL), evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_LINEAR, EVAS_3D_TEXTURE_FILTER_LINEAR), // Only for sphere originally. evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST, EVAS_3D_TEXTURE_FILTER_NEAREST), // Only for sonic originally. @@ -446,7 +617,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, if (1 == fake) { eina_accessor_data_get(stuffs->aTexture, 0, (void **) &t); - mi = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas, + mi = eo_add(EVAS_3D_MATERIAL_CLASS, scene->evas, evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), @@ -462,7 +633,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, eina_accessor_data_get(stuffs->aTexture, 1, (void **) &t1); eina_accessor_data_get(stuffs->aTexture, 2, (void **) &ti); - mj = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas, + mj = eo_add(EVAS_3D_MATERIAL_CLASS, scene->evas, evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, EINA_TRUE), evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, EINA_TRUE), @@ -481,7 +652,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, else { eina_accessor_data_get(stuffs->aTexture, 0, (void **) &t); - mi = eo_add(EVAS_3D_MATERIAL_CLASS, ourGlobals->evas, + mi = eo_add(EVAS_3D_MATERIAL_CLASS, scene->evas, evas_3d_material_texture_set(EVAS_3D_MATERIAL_DIFFUSE, t), evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, EINA_TRUE), @@ -503,7 +674,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, { eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi); eina_accessor_data_get(stuffs->aMaterial, 1, (void **) &mj); - me = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas, + me = eo_add(EVAS_3D_MESH_CLASS, scene->evas, evas_3d_mesh_vertex_count_set(24), evas_3d_mesh_frame_add(0), @@ -529,7 +700,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, _sphere_init(100); eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi); - me = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas, + me = eo_add(EVAS_3D_MESH_CLASS, scene->evas, evas_3d_mesh_vertex_count_set(vertex_count), evas_3d_mesh_frame_add(0), evas_3d_mesh_frame_vertex_data_set(0, EVAS_3D_VERTEX_POSITION, sizeof(vertex), &sphere_vertices[0].position), @@ -550,7 +721,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, { eina_accessor_data_get(stuffs->aMaterial, 0, (void **) &mi); snprintf(buf, sizeof(buf), "%s/%s", prefix_data_get(), stuffs->stuffs.details.mesh->fileName); - me = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas, + me = eo_add(EVAS_3D_MESH_CLASS, scene->evas, evas_3d_mesh_file_set(EVAS_3D_MESH_FILE_TYPE_MD2, buf, NULL), evas_3d_mesh_frame_material_set(0, mi), evas_3d_mesh_shade_mode_set(EVAS_3D_SHADE_MODE_PHONG) @@ -559,7 +730,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, } eina_accessor_data_get(stuffs->aMesh, 0, (void **) &me); - stuffs->mesh_node = eo_add_custom(EVAS_3D_NODE_CLASS, ourGlobals->evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH), + stuffs->mesh_node = eo_add_custom(EVAS_3D_NODE_CLASS, scene->evas, evas_3d_node_constructor(EVAS_3D_NODE_TYPE_MESH), eo_key_data_set("Name", stuffs->stuffs.name, NULL), evas_3d_node_position_set(stuffs->stuffs.details.mesh->pos.x, stuffs->stuffs.details.mesh->pos.y, stuffs->stuffs.details.mesh->pos.z), evas_3d_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), @@ -567,11 +738,19 @@ void stuffsSetup(ExtantzStuffs *stuffs, globals *ourGlobals, Scene_Data *scene, ); eo_do(scene->root_node, evas_3d_node_member_add(stuffs->mesh_node)); - eina_clist_add_head(&(ourGlobals->stuffs), &(stuffs->node)); + eina_clist_add_head(&(scene->stuffs), &(stuffs->node)); + + if (1 == fake) + stuffs->animateStuffs = (aniStuffs) _animateCube; + else if (2 == fake) + stuffs->animateStuffs = (aniStuffs) _animateSphere; + else if (3 == fake) + stuffs->animateStuffs = (aniStuffs) _animateSonic; + } ExtantzStuffs *addStuffs(char *uuid, char *name, char *description, char *owner, - char *file, MeshType type, float px, float py, float pz, float rx, float ry, float rz, float rw) + char *file, MeshType type, double px, double py, double pz, double rx, double ry, double rz, double rw) { ExtantzStuffs *result = calloc(1, sizeof(ExtantzStuffs)); diff --git a/src/libraries/love.h b/src/libraries/love.h index e99f282..e2cfcb4 100644 --- a/src/libraries/love.h +++ b/src/libraries/love.h @@ -175,7 +175,7 @@ love server starts up Extantz client starts up -> love login(name, password) loads user details - <- love this is your user uuid + <- love this is your user uuid and start sim get sim details from lspace at this URL (or local disk directory file://) -> lspace gimme the sim (or just pick up the index.omg file from disk) <- lspace index.omg diff --git a/src/love/love.c b/src/love/love.c index 7d50917..9c24cd3 100644 --- a/src/love/love.c +++ b/src/love/love.c @@ -506,11 +506,18 @@ static Eina_Bool _delLuaSL(void *data, int type, Ecore_Con_Event_Server_Del *ev) static Eina_Bool _addClient(void *data, int type, Ecore_Con_Event_Client_Add *ev) { - gameGlobals *ourGlobals = data; + gameGlobals *ourGlobals = data; - ourGlobals->client = ev->client; - ecore_con_client_timeout_set(ev->client, 0); - return ECORE_CALLBACK_RENEW; + ourGlobals->client = ev->client; + ecore_con_client_timeout_set(ev->client, 0); + + if (ourGlobals->client) + { + // TODO - Sending the currently hard coded ownerKey here, should actually deal with logging in / hypergrid TP style things instead. + sendBack(ourGlobals->client, ownerKey, "loadSim('file://%s/Test%%20sim')", prefix_data_get()); + } + + return ECORE_CALLBACK_RENEW; } static Eina_Bool _dataClient(void *data, int type, Ecore_Con_Event_Client_Data *ev) -- cgit v1.1