Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXT_structural_metadata: Properties for structured data #2151

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
576 changes: 576 additions & 0 deletions extensions/2.0/Vendor/EXT_structural_metadata/README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,501 changes: 1,501 additions & 0 deletions extensions/2.0/Vendor/EXT_structural_metadata/figures/property-table.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,987 changes: 1,987 additions & 0 deletions extensions/2.0/Vendor/EXT_structural_metadata/figures/property-texture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "EXT_structural_metadata.schema.json",
"title": "EXT_structural_metadata glTF extension",
"type": "object",
"description": "Structural metadata about a glTF element.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"class": {
"type": "string",
"description": "The class that property values conform to. The value shall be a class ID declared in the `classes` dictionary of the metadata schema."
},
"properties": {
"type": "object",
"description": "A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary and each value contains the property values. The type of the value shall match the property definition: For `BOOLEAN` use `true` or `false`. For `STRING` use a JSON string. For numeric types use a JSON number. For `ENUM` use a valid enum `name`, not an integer value. For `ARRAY`, `VECN`, and `MATN` types use a JSON array containing values matching the `componentType`. Required properties shall be included in this dictionary.",
"minProperties": 1,
"additionalProperties": {
"$ref": "definitions.schema.json#/definitions/anyValue"
}
},
"extensions": {},
"extras": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "class.property.schema.json",
"title": "Class Property in EXT_structural_metadata",
"type": "object",
"description": "A class property.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "The name of the property, e.g. for display purposes."
},
"description": {
"type": "string",
"minLength": 1,
"description": "The description of the property."
},
"type": {
"description": "The element type.",
"anyOf": [
{
"const": "SCALAR"
},
{
"const": "VEC2"
},
{
"const": "VEC3"
},
{
"const": "VEC4"
},
{
"const": "MAT2"
},
{
"const": "MAT3"
},
{
"const": "MAT4"
},
{
"const": "STRING"
},
{
"const": "BOOLEAN"
},
{
"const": "ENUM"
},
{
"type": "string"
}
]
},
"componentType": {
"description": "The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types.",
"anyOf": [
{
"const": "INT8"
},
{
"const": "UINT8"
},
{
"const": "INT16"
},
{
"const": "UINT16"
},
{
"const": "INT32"
},
{
"const": "UINT32"
},
{
"const": "INT64"
},
{
"const": "UINT64"
},
{
"const": "FLOAT32"
},
{
"const": "FLOAT64"
},
{
"type": "string"
}
]
},
"enumType": {
"type": "string",
"description": "Enum ID as declared in the `enums` dictionary. Required when `type` is `ENUM`."
},
"array": {
"type": "boolean",
"default": false,
"description": "Whether the property is an array. When `count` is defined the property is a fixed-length array. Otherwise the property is a variable-length array."
},
"count": {
"type": "integer",
"minimum": 2,
"description": "The number of array elements. May only be defined when `array` is true."
},
"normalized": {
"type": "boolean",
"description": "Specifies whether integer values are normalized. Only applicable to `SCALAR`, `VECN`, and `MATN` types with integer component types. For unsigned integer component types, values are normalized between `[0.0, 1.0]`. For signed integer component types, values are normalized between `[-1.0, 1.0]`. For all other component types, this property must be false.",
"default": false
},
"offset": {
"allOf": [
{
"$ref": "definitions.schema.json#/definitions/numericValue"
}
],
"description": "An offset to apply to property values. Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`."
},
"scale": {
"allOf": [
{
"$ref": "definitions.schema.json#/definitions/numericValue"
}
],
"description": "A scale to apply to property values. Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`."
},
"max": {
"allOf": [
{
"$ref": "definitions.schema.json#/definitions/numericValue"
}
],
"description": "Maximum allowed value for the property. Only applicable to `SCALAR`, `VECN`, and `MATN` types. This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied."
},
"min": {
"allOf": [
{
"$ref": "definitions.schema.json#/definitions/numericValue"
}
],
"description": "Minimum allowed value for the property. Only applicable to `SCALAR`, `VECN`, and `MATN` types. This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied."
},
"required": {
"type": "boolean",
"description": "If required, the property must be present in every entity conforming to the class. If not required, individual entities may include `noData` values, or the entire property may be omitted. As a result, `noData` has no effect on a required property. Client implementations may use required properties to make performance optimizations.",
"default": false
},
"noData": {
"allOf": [
{
"$ref": "definitions.schema.json#/definitions/noDataValue"
}
],
"description": "A `noData` value represents missing data — also known as a sentinel value — wherever it appears. `BOOLEAN` properties may not specify `noData` values. This is given as the plain property value, without the transforms from the `normalized`, `offset`, and `scale` properties. Must not be defined if `required` is true."
},
"default": {
"allOf": [
{
"$ref": "definitions.schema.json#/definitions/anyValue"
}
],
"description": "A default value to use when encountering a `noData` value or an omitted property. The value is given in its final form, taking the effect of `normalized`, `offset`, and `scale` properties into account. Must not be defined if `required` is true."
},
"semantic": {
"type": "string",
"minLength": 1,
"description": "An identifier that describes how this property should be interpreted. The semantic cannot be used by other properties in the class."
},
"extensions": {},
"extras": {}
},
"required": [
"type"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "class.schema.json",
"title": "Class in EXT_structural_metadata",
"type": "object",
"description": "A class containing a set of properties.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "The name of the class, e.g. for display purposes."
},
"description": {
"type": "string",
"minLength": 1,
"description": "The description of the class."
},
"properties": {
"type": "object",
"description": "A dictionary, where each key is a property ID and each value is an object defining the property. Property IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.",
"minProperties": 1,
"additionalProperties": {
"$ref": "class.property.schema.json"
}
},
"extensions": {},
"extras": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "definitions.schema.json",
"title": "Definitions",
"description": "Common definitions used in schema files.",
"definitions": {
"numericValue": {
"title": "Numeric Value",
"oneOf": [
{
"type": "number"
},
{
"type": "array",
"items": {
"type": "number"
},
"minItems": 1
},
{
"type": "array",
"items": {
"type": "array",
"items": {
"type": "number"
},
"minItems": 1
},
"minItems": 1
}
],
"description": "For `SCALAR` this is a number. For `VECN` this is an array of `N` numbers. For `MATN` this is an array of `N²` numbers. For fixed-length arrays this is an array of `count` elements of the given `type`."
},
"noDataValue": {
"title": "No Data Value",
"oneOf": [
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "number"
},
"minItems": 1
},
{
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
{
"type": "array",
"items": {
"type": "array",
"items": {
"type": "number"
},
"minItems": 1
},
"minItems": 1
}
],
"description": "For `SCALAR` this is a number. For `STRING` this is a string. For `ENUM` this is a string that must be a valid enum `name`, not an integer value. For `VECN` this is an array of `N` numbers. For `MATN` this is an array of `N²` numbers. For fixed-length arrays this is an array of `count` elements of the given `type`."
},
"anyValue": {
"title": "Any Value",
"oneOf": [
{
"type": "number"
},
{
"type": "string"
},
{
"type": "boolean"
},
{
"type": "array",
"items": {
"type": "number"
},
"minItems": 1
},
{
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
{
"type": "array",
"items": {
"type": "boolean"
},
"minItems": 1
},
{
"type": "array",
"items": {
"type": "array",
"items": {
"type": "number"
},
"minItems": 1
},
"minItems": 1
}
],
"description": "For `SCALAR` this is a number. For `STRING` this is a string. For `ENUM` this is a string that must be a valid enum `name`, not an integer value. For `BOOLEAN` this is a boolean. For `VECN` this is an array of `N` numbers. For `MATN` this is an array of `N²` numbers. For fixed-length array this is an array of `count` elements of the given `type`. For variable-length arrays this is an array of any length of the given `type`."
}
}
}
Loading
Loading