From f49b050e8587cf9b667f58ffcc0da46c6a030a4c Mon Sep 17 00:00:00 2001 From: Tom Ray Date: Thu, 2 Apr 2026 00:08:43 +0200 Subject: [PATCH] Ajout du schema json v1 non teste --- schema_json.json | 142 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 schema_json.json diff --git a/schema_json.json b/schema_json.json new file mode 100644 index 0000000..21c99f5 --- /dev/null +++ b/schema_json.json @@ -0,0 +1,142 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "SceneDescription", + "type": "object", + "ID": 100, + "properties": { + "name": { "type": "string", "ID": 101}, + "description": { "type": "string", "ID": 102}, + "entities": { + "type": "array", + "items": { "$ref": "#/definitions/Entity" } + } + }, + "required": ["name", "entities"], + "definitions": { + + "Entity": { + "type": "object", + "ID": 200, + "properties": { + "entityref": { "type": "integer", "ID": 201 }, + "parent": { "type": ["integer", "null"] , "ID": 202}, + "name": { "type": "string", "ID": 203 }, + "description": { "type": "string", "ID": 204 }, + "children": { + "type": "array", + "ID": 205, + "items": { "type": "integer" } + }, + "components": { "$ref": "#/definitions/Components" } + }, + "required": ["entityref", "name", "components"] + }, + + "Components": { + "type": "object", + "ID": 300, + "properties": { + "transform": { "$ref": "#/definitions/Transform" }, + "renderer": { "$ref": "#/definitions/Renderer" }, + "camera": { "$ref": "#/definitions/Camera" }, + "collider": { "$ref": "#/definitions/Collider" }, + "rigidbody": { "$ref": "#/definitions/RigidBody" } + } + }, + + "Vec3": { + "type": "array", + "ID": 401, + "items": { "type": "number" }, + "minItems": 3, + "maxItems": 3 + }, + + "Vec4": { + "type": "array", + "ID": 402, + "items": { "type": "number" }, + "minItems": 4, + "maxItems": 4 + }, + + "Transform": { + "type": "object", + "ID": 301, + "properties": { + "position": { "$ref": "#/definitions/Vec3" }, + "rotation": { "$ref": "#/definitions/Vec3" }, + "scale": { "$ref": "#/definitions/Vec3" } + }, + "required": ["position", "rotation", "scale"] + }, + + "Renderer": { + "type": "object", + "ID": 302, + "properties": { + "model": { "type": "string", "ID": 3021 }, + "shader": { "type": "string", "ID": 3022 }, + "albedo": { "type": "string", "ID": 3023 } + }, + "required": ["model", "shader"] + }, + + "Camera": { + "type": "object", + "ID": 303, + "properties": { + "fov": { "type": "number", "minimum": 1, "maximum": 179, "ID": 3031 }, + "near": { "type": "number", "minimum": 0.001, "ID": 3032 }, + "far": { "type": "number", "minimum": 0.1, "ID": 3033 } + }, + "required": ["fov", "near", "far"] + }, + + "Collider": { + "type": "object", + "ID": 304, + "properties": { + "type": { + "type": "string", + "ID": 3041, + "enum": ["Box", "Sphere", "Capsule", "ConvexHull", "Mesh", "Compound"] + }, + "size": { "$ref": "#/definitions/Vec3" }, + "radius": { "type": "number", "minimum": 0, "ID": 3042 }, + "halfHeight": { "type": "number", "minimum": 0, "ID": 3043 } + }, + "required": ["type"], + "allOf": [ + { + "if": { "properties": { "type": { "const": "Box" } } }, + "then": { "required": ["size"] } + }, + { + "if": { "properties": { "type": { "const": "Sphere" } } }, + "then": { "required": ["radius"] } + }, + { + "if": { "properties": { "type": { "const": "Capsule" } } }, + "then": { "required": ["radius", "halfHeight"] } + } + ] + }, + + "RigidBody": { + "type": "object", + "ID": 305, + "properties": { + "type": { + "type": "string", + "ID": 3051, + "enum": ["Static", "Kinematic", "Dynamic"] + }, + "mass": { "type": "number", "minimum": 0, "ID": 3052 }, + "friction": { "type": "number", "minimum": 0, "maximum": 1, "ID": 3053 }, + "restitution": { "type": "number", "minimum": 0, "maximum": 1, "ID": 3054 } + }, + "required": ["type"] + } + } +} \ No newline at end of file