Ajout du schema json v1 non teste
This commit is contained in:
142
schema_json.json
Normal file
142
schema_json.json
Normal file
@@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user