Map loading
All checks were successful
Build Dusk / run-tests (push) Successful in 1m15s
Build Dusk / build-linux (push) Successful in 1m33s
Build Dusk / build-psp (push) Successful in 1m56s

This commit is contained in:
2026-02-03 19:20:50 -06:00
parent 13dba8b604
commit 5cea284906
25 changed files with 415 additions and 120 deletions

View File

@@ -185,7 +185,25 @@ int moduleCameraIndex(lua_State *l) {
if(cam->viewType == CAMERA_VIEW_TYPE_MATRIX) {
} else if(cam->viewType == CAMERA_VIEW_TYPE_LOOKAT) {
// TODO: Push vec3
if(stringCompare(key, "position") == 0) {
vec3 *v = (vec3 *)lua_newuserdata(l, sizeof(vec3));
memoryCopy(v, &cam->lookat.position, sizeof(vec3));
luaL_getmetatable(l, "vec3_mt");
lua_setmetatable(l, -2);
return 1;
} else if(stringCompare(key, "target") == 0) {
vec3 *v = (vec3 *)lua_newuserdata(l, sizeof(vec3));
memoryCopy(v, &cam->lookat.target, sizeof(vec3));
luaL_getmetatable(l, "vec3_mt");
lua_setmetatable(l, -2);
return 1;
} else if(stringCompare(key, "up") == 0) {
vec3 *v = (vec3 *)lua_newuserdata(l, sizeof(vec3));
memoryCopy(v, &cam->lookat.up, sizeof(vec3));
luaL_getmetatable(l, "vec3_mt");
lua_setmetatable(l, -2);
return 1;
}
} else if(cam->viewType == CAMERA_VIEW_TYPE_LOOKAT_PIXEL_PERFECT) {
} else if(cam->viewType == CAMERA_VIEW_TYPE_2D) {
@@ -267,5 +285,24 @@ int moduleCameraNewIndex(lua_State *l) {
}
}
if(cam->viewType == CAMERA_VIEW_TYPE_LOOKAT) {
if(stringCompare(key, "position") == 0) {
vec3 *v = (vec3 *)luaL_checkudata(l, 3, "vec3_mt");
assertNotNull(v, "Vec3 pointer cannot be NULL.");
memoryCopy(&cam->lookat.position, v, sizeof(vec3));
return 0;
} else if(stringCompare(key, "target") == 0) {
vec3 *v = (vec3 *)luaL_checkudata(l, 3, "vec3_mt");
assertNotNull(v, "Vec3 pointer cannot be NULL.");
memoryCopy(&cam->lookat.target, v, sizeof(vec3));
return 0;
} else if(stringCompare(key, "up") == 0) {
vec3 *v = (vec3 *)luaL_checkudata(l, 3, "vec3_mt");
assertNotNull(v, "Vec3 pointer cannot be NULL.");
memoryCopy(&cam->lookat.up, v, sizeof(vec3));
return 0;
}
}
return 0;
}