diff options
author | David Walter Seikel | 2016-02-06 22:14:01 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-02-06 22:14:01 +1000 |
commit | 6a15944f255d0d9653573ad0857e527f58f5f997 (patch) | |
tree | 160c55c97b259b884b4d8cff29516049dad390c2 | |
parent | Put the ~/.SledHamr/ creation code into all three main binaries. sigh (diff) | |
download | SledjHamr-6a15944f255d0d9653573ad0857e527f58f5f997.zip SledjHamr-6a15944f255d0d9653573ad0857e527f58f5f997.tar.gz SledjHamr-6a15944f255d0d9653573ad0857e527f58f5f997.tar.bz2 SledjHamr-6a15944f255d0d9653573ad0857e527f58f5f997.tar.xz |
Pass stuff size up to C code.
This is getting unweildy. lol
-rw-r--r-- | lib/scenriLua.lua | 4 | ||||
-rw-r--r-- | src/extantz/extantz.h | 2 | ||||
-rw-r--r-- | src/extantz/scenri.c | 15 | ||||
-rw-r--r-- | src/libraries/love.h | 1 |
4 files changed, 13 insertions, 9 deletions
diff --git a/lib/scenriLua.lua b/lib/scenriLua.lua index 2938a9d..f9cd0e5 100644 --- a/lib/scenriLua.lua +++ b/lib/scenriLua.lua | |||
@@ -37,7 +37,7 @@ do | |||
37 | end | 37 | end |
38 | preallocateStuffs(count) | 38 | preallocateStuffs(count) |
39 | for k, v in pairs(Stuffs.details.stuffs) do | 39 | for k, v in pairs(Stuffs.details.stuffs) do |
40 | partFillStuffs(k, v.fileName, v.pos[1], v.pos[2], v.pos[3], v.rot[1], v.rot[2], v.rot[3], v.rot[4]) | 40 | partFillStuffs(k, v.fileName, v.pos[1], v.pos[2], v.pos[3], v.rot[1], v.rot[2], v.rot[3], v.rot[4], v.size[1], v.size[2], v.size[3]) |
41 | end | 41 | end |
42 | end | 42 | end |
43 | elseif 'cannot open ' ~= string.sub(err, 1, 12) then | 43 | elseif 'cannot open ' ~= string.sub(err, 1, 12) then |
@@ -78,7 +78,7 @@ do | |||
78 | local meshFile = Stuffs.details.Mesh.fileName or v.fileName | 78 | local meshFile = Stuffs.details.Mesh.fileName or v.fileName |
79 | local eStuffs = addStuffs(Stuffs.uuid, Stuffs.name, Stuffs.description, | 79 | local eStuffs = addStuffs(Stuffs.uuid, Stuffs.name, Stuffs.description, |
80 | Stuffs.owner, v.fileName, MeshType[Stuffs.details.Mesh.kind], | 80 | Stuffs.owner, v.fileName, MeshType[Stuffs.details.Mesh.kind], |
81 | v.pos[1], v.pos[2], v.pos[3], v.rot[1], v.rot[2], v.rot[3], v.rot[4]) | 81 | v.pos[1], v.pos[2], v.pos[3], v.rot[1], v.rot[2], v.rot[3], v.rot[4], v.size[1], v.size[2], v.size[3]) |
82 | if eStuffs then | 82 | if eStuffs then |
83 | addMaterial(eStuffs, -1, TextureType[Stuffs.details.Mesh.materials[0].kind ], Stuffs.details.Mesh.materials[0].texture) | 83 | addMaterial(eStuffs, -1, TextureType[Stuffs.details.Mesh.materials[0].kind ], Stuffs.details.Mesh.materials[0].texture) |
84 | stuffsSetup(eStuffs, Stuffs.fake) | 84 | stuffsSetup(eStuffs, Stuffs.fake) |
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index ccafc01..1f62496 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h | |||
@@ -291,7 +291,7 @@ Eina_Bool animateScene(globals *ourGlobals); | |||
291 | void scenriDel(Scene_Data *scene); | 291 | void scenriDel(Scene_Data *scene); |
292 | void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake); | 292 | void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake); |
293 | ExtantzStuffs *addStuffs(char *uuid, char *name, char *description, char *owner, | 293 | ExtantzStuffs *addStuffs(char *uuid, char *name, char *description, char *owner, |
294 | char *file, MeshType type, double px, double py, double pz, double rx, double ry, double rz, double rw); | 294 | char *file, MeshType type, double px, double py, double pz, double rx, double ry, double rz, double rw, double sx, double sy, double sz); |
295 | void addMaterial(ExtantzStuffs *e, int face, TextureType type, char *file); | 295 | void addMaterial(ExtantzStuffs *e, int face, TextureType type, char *file); |
296 | 296 | ||
297 | winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save); | 297 | 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 d37667b..1f51687 100644 --- a/src/extantz/scenri.c +++ b/src/extantz/scenri.c | |||
@@ -212,9 +212,9 @@ static int _partFillStuffs(lua_State *L) | |||
212 | ExtantzStuffs *result = NULL; | 212 | ExtantzStuffs *result = NULL; |
213 | Scene_Data *scene = NULL; | 213 | Scene_Data *scene = NULL; |
214 | char *name, *file; | 214 | char *name, *file; |
215 | double px, py, pz, rx, ry, rz, rw; | 215 | double px, py, pz, rx, ry, rz, rw, sx, sy, sz; |
216 | 216 | ||
217 | pull_lua(L, 1, "$ $ # # # # # # #", &name, &file, &px, &py, &pz, &rx, &ry, &rz, &rw); | 217 | pull_lua(L, 1, "$ $ # # # # # # # # # #", &name, &file, &px, &py, &pz, &rx, &ry, &rz, &rw, &sx, &sy, &sz); |
218 | lua_getfield(L, LUA_REGISTRYINDEX, "sceneData"); | 218 | lua_getfield(L, LUA_REGISTRYINDEX, "sceneData"); |
219 | scene = (Scene_Data *) lua_touserdata(L, -1); | 219 | scene = (Scene_Data *) lua_touserdata(L, -1); |
220 | 220 | ||
@@ -227,6 +227,7 @@ static int _partFillStuffs(lua_State *L) | |||
227 | strcpy(result->stuffs.file, file); | 227 | strcpy(result->stuffs.file, file); |
228 | result->stuffs.details.mesh->pos.x = px; result->stuffs.details.mesh->pos.y = py; result->stuffs.details.mesh->pos.z = pz; | 228 | result->stuffs.details.mesh->pos.x = px; result->stuffs.details.mesh->pos.y = py; result->stuffs.details.mesh->pos.z = pz; |
229 | result->stuffs.details.mesh->rot.x = rx; result->stuffs.details.mesh->rot.y = ry; result->stuffs.details.mesh->rot.z = rz; result->stuffs.details.mesh->rot.w = rw; | 229 | result->stuffs.details.mesh->rot.x = rx; result->stuffs.details.mesh->rot.y = ry; result->stuffs.details.mesh->rot.z = rz; result->stuffs.details.mesh->rot.w = rw; |
230 | result->stuffs.details.mesh->size.x = sx; result->stuffs.details.mesh->size.y = sy; result->stuffs.details.mesh->size.z = sz; | ||
230 | result->stage = ES_PART; | 231 | result->stage = ES_PART; |
231 | break; | 232 | break; |
232 | } | 233 | } |
@@ -275,10 +276,10 @@ static int _addStuffsL(lua_State *L) | |||
275 | ExtantzStuffs *result = NULL; | 276 | ExtantzStuffs *result = NULL; |
276 | char *uuid, *name, *description, *owner, *file; | 277 | char *uuid, *name, *description, *owner, *file; |
277 | int type; | 278 | int type; |
278 | double px, py, pz, rx, ry, rz, rw; | 279 | double px, py, pz, rx, ry, rz, rw, sx, sy, sz; |
279 | 280 | ||
280 | pull_lua(L, 1, "$ $ $ $ $ % # # # # # # #", &uuid, &name, &description, &owner, &file, &type, &px, &py, &pz, &rx, &ry, &rz, &rw); | 281 | pull_lua(L, 1, "$ $ $ $ $ % # # # # # # # # # #", &uuid, &name, &description, &owner, &file, &type, &px, &py, &pz, &rx, &ry, &rz, &rw, &sx, &sy, &sz); |
281 | result = addStuffs(uuid, name, description, owner, file, type, px, py, pz, rx, ry, rz, rw); | 282 | result = addStuffs(uuid, name, description, owner, file, type, px, py, pz, rx, ry, rz, rw, sx, sy, sz); |
282 | if (result) | 283 | if (result) |
283 | { | 284 | { |
284 | lua_getfield(L, LUA_REGISTRYINDEX, "sceneData"); | 285 | lua_getfield(L, LUA_REGISTRYINDEX, "sceneData"); |
@@ -670,6 +671,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake) | |||
670 | eo_key_data_set("Name", stuffs->stuffs.name), | 671 | eo_key_data_set("Name", stuffs->stuffs.name), |
671 | evas_canvas3d_node_position_set(stuffs->stuffs.details.mesh->pos.x, stuffs->stuffs.details.mesh->pos.y, stuffs->stuffs.details.mesh->pos.z), | 672 | evas_canvas3d_node_position_set(stuffs->stuffs.details.mesh->pos.x, stuffs->stuffs.details.mesh->pos.y, stuffs->stuffs.details.mesh->pos.z), |
672 | 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), | 673 | 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), |
674 | evas_canvas3d_node_scale_set(stuffs->stuffs.details.mesh->size.x, stuffs->stuffs.details.mesh->size.y, stuffs->stuffs.details.mesh->size.z), | ||
673 | evas_canvas3d_node_mesh_add(me) | 675 | evas_canvas3d_node_mesh_add(me) |
674 | ); | 676 | ); |
675 | 677 | ||
@@ -686,7 +688,7 @@ void stuffsSetup(ExtantzStuffs *stuffs, Scene_Data *scene, int fake) | |||
686 | } | 688 | } |
687 | 689 | ||
688 | ExtantzStuffs *addStuffs(char *uuid, char *name, char *description, char *owner, | 690 | ExtantzStuffs *addStuffs(char *uuid, char *name, char *description, char *owner, |
689 | char *file, MeshType type, double px, double py, double pz, double rx, double ry, double rz, double rw) | 691 | char *file, MeshType type, double px, double py, double pz, double rx, double ry, double rz, double rw, double sx, double sy, double sz) |
690 | { | 692 | { |
691 | ExtantzStuffs *result = calloc(1, sizeof(ExtantzStuffs)); | 693 | ExtantzStuffs *result = calloc(1, sizeof(ExtantzStuffs)); |
692 | 694 | ||
@@ -710,6 +712,7 @@ ExtantzStuffs *addStuffs(char *uuid, char *name, char *description, char *owner, | |||
710 | result->stuffs.details.mesh->type = type; | 712 | result->stuffs.details.mesh->type = type; |
711 | result->stuffs.details.mesh->pos.x = px; result->stuffs.details.mesh->pos.y = py; result->stuffs.details.mesh->pos.z = pz; | 713 | result->stuffs.details.mesh->pos.x = px; result->stuffs.details.mesh->pos.y = py; result->stuffs.details.mesh->pos.z = pz; |
712 | result->stuffs.details.mesh->rot.x = rx; result->stuffs.details.mesh->rot.y = ry; result->stuffs.details.mesh->rot.z = rz; result->stuffs.details.mesh->rot.w = rw; | 714 | result->stuffs.details.mesh->rot.x = rx; result->stuffs.details.mesh->rot.y = ry; result->stuffs.details.mesh->rot.z = rz; result->stuffs.details.mesh->rot.w = rw; |
715 | result->stuffs.details.mesh->size.x = sx; result->stuffs.details.mesh->size.y = sy; result->stuffs.details.mesh->size.z = sz; | ||
713 | result->stage = ES_NORMAL; | 716 | result->stage = ES_NORMAL; |
714 | 717 | ||
715 | return result; | 718 | return result; |
diff --git a/src/libraries/love.h b/src/libraries/love.h index 1de8032..1e756f8 100644 --- a/src/libraries/love.h +++ b/src/libraries/love.h | |||
@@ -136,6 +136,7 @@ typedef struct _mesh | |||
136 | MeshType type; | 136 | MeshType type; |
137 | vec3 pos; | 137 | vec3 pos; |
138 | vec4 rot; | 138 | vec4 rot; |
139 | vec3 size; | ||
139 | Eina_Inarray *materials; // Material | 140 | Eina_Inarray *materials; // Material |
140 | Eina_Inarray *parts; // Mesh | 141 | Eina_Inarray *parts; // Mesh |
141 | } Mesh; | 142 | } Mesh; |