Finish JerryScript Entity/Scene wiring; remove JSON serialize/deserialize

Register Entity, the generic Component wrapper, and Scene as JerryScript
classes (modulelist.c ties them together, plus their .d.ts stubs), so
scenes/entities can be built from script going forward instead of the
JSON scene format.

With scripting now the intended authoring path, drop the JSON
serialize/deserialize machinery entirely: componentdefinition_t's
serialize/deserialize callbacks, every component's *Serialize/
*Deserialize function, entitySerialize/entityDeserialize,
sceneSerialize/sceneDeserialize, and the "prefabs/<name>.json"/
"scenes/<name>.json" asset fallback in entityPrefabResolveAndApply/
scenePrefabResolveAndApply (C-coded prefabs only now). physicsshape.c
and its test are removed outright since they only existed for this.
game.c's test scene now comes from the existing overworldSceneCreate()
C builder instead of loading the now-deleted assets/scenes/test.json.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-30 11:19:08 -05:00
parent 015d90519f
commit e61914bad4
53 changed files with 576 additions and 2081 deletions
-45
View File
@@ -94,50 +94,6 @@ static void test_entityPositionParentChildWorldTransform(void **state) {
assert_int_equal(memoryGetAllocatedCount(), 0);
}
static void test_entityPositionDeserializeLookAt(void **state) {
entitymanager_t mgr;
entityManagerInit(&mgr);
entityid_t entity = entityManagerAdd(&mgr);
componentid_t comp = entityAddComponent(
&mgr, entity, COMPONENT_TYPE_POSITION
);
const char_t *json =
"{ \"x\": 0, \"y\": 5, \"z\": 10, "
"\"lookAt\": { \"x\": 0, \"y\": 0, \"z\": 0 } }";
yyjson_doc *doc = yyjson_read(json, strlen(json), YYJSON_READ_NOFLAG);
assert_non_null(doc);
errorret_t ret = entityPositionDeserialize(
&mgr, entity, comp, yyjson_doc_get_root(doc)
);
yyjson_doc_free(doc);
assert_true(errorIsOk(ret));
// The eye point decoded back out of localTransform should match "x"/"y"/"z".
vec3 eye;
entityPositionGetLocalPosition(&mgr, entity, comp, eye);
assert_float_equal(eye[0], 0.0f, 0.0001f);
assert_float_equal(eye[1], 5.0f, 0.0001f);
assert_float_equal(eye[2], 10.0f, 0.0001f);
// Forward (-local Z, see entityCameraGetForward's convention) should
// point from eye toward the lookAt target (the origin here).
mat4 transform;
entityPositionGetLocalTransform(&mgr, entity, comp, transform);
vec3 forward = { -transform[2][0], -transform[2][1], -transform[2][2] };
glm_vec3_normalize(forward);
vec3 toTarget = { -eye[0], -eye[1], -eye[2] };
glm_vec3_normalize(toTarget);
assert_float_equal(glm_vec3_dot(forward, toTarget), 1.0f, 0.001f);
entityManagerDispose(&mgr);
assert_int_equal(memoryGetAllocatedCount(), 0);
}
static void test_entityPositionDisposeDeep(void **state) {
entitymanager_t mgr;
entityManagerInit(&mgr);
@@ -167,7 +123,6 @@ int main(int argc, char **argv) {
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_entityPositionLocalGetSet),
cmocka_unit_test(test_entityPositionParentChildWorldTransform),
cmocka_unit_test(test_entityPositionDeserializeLookAt),
cmocka_unit_test(test_entityPositionDisposeDeep),
};