diff --git a/TileFormats/Batched3DModel/README.md b/TileFormats/Batched3DModel/README.md index e7c620198..bcf208892 100644 --- a/TileFormats/Batched3DModel/README.md +++ b/TileFormats/Batched3DModel/README.md @@ -79,6 +79,8 @@ address[1] = {street : 'Main Street', houseNumber : '2'}; Binary glTF immediately follows the batch table. It begins `20 + batchTableByteLength` bytes from the start of the arraybuffer and continues for the rest of arraybuffer. It may embed all of its geometry, texture, and animations, or it may refer to external sources for some or all of these data. +The glTF asset must be 8-byte aligned so that glTF's byte-alignment guarantees are met. This can be done by padding the Batch Table if it is present. + As described above, each vertex has a `batchId` attribute indicating the model to which it belongs. For example, vertices for a batch with three models may look like this: ``` batchId: [0, 0, 0, ..., 1, 1, 1, ..., 2, 2, 2, ...] diff --git a/TileFormats/FeatureTable/README.md b/TileFormats/FeatureTable/README.md new file mode 100644 index 000000000..e99e24ccc --- /dev/null +++ b/TileFormats/FeatureTable/README.md @@ -0,0 +1,73 @@ +# Feature Table + +## Contributors + +* Sean Lilley, [@lilleyse](https://twitter.com/lilleyse) +* Rob Taglang, [@lasalvavida](https://github.com/lasalvavida) +* Dan Bagnell, [@bagnell](https://github.com/bagnell) +* Patrick Cozzi, [@pjcozzi](https://twitter.com/pjcozzi) + +## Overview + +A _Feature Table_ describes position and appearance properties for each feature in a tile. The _Batch Table_ (TODO: link), on the other hand, contains per-feature application-specific metadata not necessarily used for rendering. + +A Feature Table is used by the following tile formats: +* [Instanced 3D Model](../Instanced3DModel) (i3dm) - each model instance is a feature. +* [Point Cloud](../PointCloud) (pnts) - each point is a feature. +* [Vector](../VectorData) (vctr) - each point/polyline/polygon is a feature. + +Per-feature properties are defined using tile-format-specific semantics defined in each tile format's specification. For example, in _Instanced 3D Model_, `SCALE_NON_UNIFORM` defines the non-uniform scale applied to each 3D model instance. + +## Layout + +A Feature Table is composed of two parts: a JSON header and an optional binary body. The JSON property names are tile-format-specific semantics, and their values can either be defined directly in the JSON, or refer to sections in the binary body. It is more efficient to store long numeric arrays in the binary body. + +**Figure 1**: Feature Table layout + +![feature table layout](figures/feature-table-layout.png) + +When a tile format includes a Feature Table, the Feature Table immediately follows the tile's header. The header will also contain `featureTableJSONByteLength` and `featureTableBinaryByteLength` `uint32` fields, which can be used to extract each respective part of the Feature Table. + +Code for reading the Feature Table can be found in [Cesium3DTileFeatureTableResources.js](https://github.com/AnalyticalGraphicsInc/cesium/blob/3d-tiles/Source/Scene/Cesium3DTileFeatureTableResources.js) in the Cesium implementation of 3D Tiles. + +## JSON Header + +Feature Table values can be represented in the JSON header in three different ways. + +1. A single value or object. (e.g. `"INSTANCES_LENGTH" : 4`) + * This is used for global semantics like `"INSTANCES_LENGTH"`, which defines the number of model instances in an Instanced 3D Model tile. +2. An array of values. (e.g. `"POSITION" : [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]`) + * This is used for per-feature semantics like `"POSITION"` in Instanced 3D Model. Above, each `POSITION` refers to a `float32[3]` data type so there are three features: `Feature 0's position`=`(1.0, 0.0, 0.0)`, `Feature 1's position`=`(0.0, 1.0, 0.0)`, `Feature 2's position`=`(0.0, 0.0, 1.0)`. +3. A reference to data in the binary body, denoted by an object with a `byteOffset` property. (e.g. `"SCALE" : { "byteOffset" : 24}`). + * `byteOffset` is a zero-based offset relative to the start of the binary body. + * The semantic defines the allowed data type, e.g., when `"POSITION"` in Instanced Model refers to the binary body, the component type is `float32` and the number of components is `3`. +The only valid properties in the JSON header are the defined semantics by the tile format. Application-specific data should be stored in the Batch Table. + +JSON Schema Feature Table definitions can be found in [featureTable.schema.json](../../schema/featureTable.schema.json). + +## Binary Body + +When the JSON header includes a reference to the binary, the provided `byteOffset` is used to index into the data. + +**Figure 2**: Indexing into the Feature Table binary body + +![feature table binary index](figures/feature-table-binary-index.png) + +Values can be retrieved using the number of features, `featuresLength`, the desired feature id, `featureId`, and the data type (component type and number of components) for the feature semantic. + +For example, using the `POSITION` semantic, which has a `float32[3]` data type: + +```javascript +var byteOffset = featureTableJSON.POSTION.byteOffset; + +var positionArray = new Float32Array(featureTableBinary.buffer, byteOffset, featuresLength * 3); // There are three components for each POSITION feature. +var position = positionArray.subarray(featureId * 3, featureId * 3 + 3); // Using subarray creates a view into the array, and not a new array. +``` + +## Implementation Notes + +In JavaScript, a `TypedArray` cannot be created on data unless it is byte-aligned to the data type. +For example, a `Float32Array` must be stored in memory such that its data begins on a byte multiple of four since each `float` contains four bytes. + +The string generated from the JSON header should be padded with space characters in order to ensure that the binary body is byte-aligned. +The binary body should also be padded if necessary when there is data following the Feature Table. diff --git a/TileFormats/FeatureTable/figures/feature-table-binary-index.png b/TileFormats/FeatureTable/figures/feature-table-binary-index.png new file mode 100644 index 000000000..3439ff9e0 Binary files /dev/null and b/TileFormats/FeatureTable/figures/feature-table-binary-index.png differ diff --git a/TileFormats/FeatureTable/figures/feature-table-binary-index.pptx b/TileFormats/FeatureTable/figures/feature-table-binary-index.pptx new file mode 100644 index 000000000..6219d5389 Binary files /dev/null and b/TileFormats/FeatureTable/figures/feature-table-binary-index.pptx differ diff --git a/TileFormats/FeatureTable/figures/feature-table-layout.png b/TileFormats/FeatureTable/figures/feature-table-layout.png new file mode 100644 index 000000000..966af2831 Binary files /dev/null and b/TileFormats/FeatureTable/figures/feature-table-layout.png differ diff --git a/TileFormats/FeatureTable/figures/feature-table-layout.pptx b/TileFormats/FeatureTable/figures/feature-table-layout.pptx new file mode 100644 index 000000000..d29ee429a Binary files /dev/null and b/TileFormats/FeatureTable/figures/feature-table-layout.pptx differ diff --git a/TileFormats/Instanced3DModel/README.md b/TileFormats/Instanced3DModel/README.md index c4a2fae02..ee6a80fde 100644 --- a/TileFormats/Instanced3DModel/README.md +++ b/TileFormats/Instanced3DModel/README.md @@ -50,20 +50,23 @@ in the Cesium implementation of 3D Tiles. ## Feature Table Contains values for `i3dm` semantics used to create instanced models. -[//]: # "TODO: Change this link to the feature table specification URL" +More information is available in the [Feature Table specification](../FeatureTable). + +The `i3dm` Feature Table JSON Schema is defined in [i3dm.featureTable.schema.json](../../schema/i3dm.featureTable.schema.json). ### Semantics #### Instance Semantics These semantics map to an array of feature values that are used to create instances. The length of these arrays must be the same for all semantics and is equal to the number of instances. +The value for each instance semantic must be a reference to the Feature Table Binary Body; they cannot be embedded in the Feature Table JSON Header. If a semantic has a dependency on another semantic, that semantic must be defined. If both `SCALE` and `SCALE_NON_UNIFORM` are defined for an instance, both scaling operations will be applied. If both `POSITION` and `POSITION_QUANTIZED` are defined for an instance, the higher precision `POSITION` will be used. If `NORMAL_UP`, `NORMAL_RIGHT`, `NORMAL_UP_OCT32P`, and `NORMAL_RIGHT_OCT32P` are defined for an instance, the higher precision `NORMAL_UP`, and `NORMAL_RIGHT` will be used. -| Semantic | Data Type | Description | Required | +| Semantic | Data Type | Description | Required | | --- | --- | --- | --- | --- | | `POSITION` | `float32[3]` | A 3-component array of numbers containing `x`, `y`, and `z` Cartesian coordinates for the position of the instance. | :white_check_mark: Yes, unless `POSITION_QUANTIZED` is defined. | | `POSITION_QUANTIZED` | `uint16[3]` | A 3-component array of numbers containing `x`, `y`, and `z` in quantized Cartesian coordinates for the position of the instance. | :white_check_mark: Yes, unless `POSITION` is defined. | @@ -233,6 +236,8 @@ When the value of `header.gltfFormat` is `1`, the glTF field is In either case, `header.gltfByteLength` contains the length of the glTF field in bytes. +If the glTF asset is embedded, it must be 8-byte aligned so that glTF's byte-alignment guarantees are met. This can be done by padding the Feature Table or Batch Table if they are present. + ## File Extension `.i3dm` diff --git a/TileFormats/PointCloud/README.md b/TileFormats/PointCloud/README.md index bf67b532d..d566a4ef5 100644 --- a/TileFormats/PointCloud/README.md +++ b/TileFormats/PointCloud/README.md @@ -42,12 +42,16 @@ Code for reading the header can be found in [Points3DModelTileContent.js](https: ## Feature Table Contains per-tile and per-point values that define where and how to render points. +More information is available in the [Feature Table specification](../FeatureTable). + +The `pnts` Feature Table JSON Schema is defined in [pnts.featureTable.schema.json](../../schema/pnts.featureTable.schema.json). ### Semantics #### Point Semantics These semantics map to an array of feature values that are define each point. The length of these arrays must be the same for all semantics and is equal to the number of points. +The value for each point semantic must be a reference to the Feature Table Binary Body; they cannot be embedded in the Feature Table JSON Header. If a semantic has a dependency on another semantic, that semantic must be defined. If both `POSITION` and `POSITION_QUANTIZED` are defined for a point, the higher precision `POSITION` will be used. diff --git a/examples/i3dm.featureTable.json b/examples/i3dm.featureTable.json new file mode 100644 index 000000000..cc279ffe8 --- /dev/null +++ b/examples/i3dm.featureTable.json @@ -0,0 +1,14 @@ +{ + "INSTANCES_LENGTH" : 4, + "QUANTIZED_VOLUME_OFFSET" : [-250.0, 0.0, -250.0], + "QUANTIZED_VOLUME_SCALE" : [500.0, 0.0, 500.0], + "POSITION_QUANTIZED" : { + "byteOffset" : 0 + }, + "NORMAL_UP_OCT32P" : { + "byteOffset" : 24 + }, + "NORMAL_RIGHT_OCT32P" : { + "byteOffset" : 40 + } +} \ No newline at end of file diff --git a/examples/pnts.featureTable.json b/examples/pnts.featureTable.json new file mode 100644 index 000000000..e7da08d7e --- /dev/null +++ b/examples/pnts.featureTable.json @@ -0,0 +1,10 @@ +{ + "POINTS_LENGTH" : 4, + "RTC_CENTER" : [1215013.8, -4736316.7, 4081608.4], + "POSITION" : { + "byteOffset" : 0 + }, + "RGB" : { + "byteOffset" : 48 + } +} \ No newline at end of file diff --git a/schema/README.md b/schema/README.md new file mode 100644 index 000000000..9faaafb4b --- /dev/null +++ b/schema/README.md @@ -0,0 +1,18 @@ +# 3D Tiles JSON Schema + +Parts of 3D Tiles, such as [tileset.json](../#tilesetjson) and the [Feature Table](../TileFormats/FeatureTable) header, are represented with JSON. The JSON schema is defined using [JSON Schema](http://json-schema.org/) draft v4 in schema subdirectories. + +## Usage + +A JSON object can be validated against the schema using a JSON schema validator such as [Ajv: Another JSON Schema Validator](https://github.com/epoberezkin/ajv), which supports JSON Schema draft v4. A command-line tool is available on npm as [ajv-cli](https://www.npmjs.com/package/ajv-cli). + +Validating against the schema does not prove full compliance with the 3D Tiles specification since not all requirements can be represented with JSON schema. For full compliance validation, see [3d-tiles-tools](https://github.com/AnalyticalGraphicsInc/3d-tiles-tools/). + +### Example + +1. Install : `npm install ajv-cli -g` +2. Validate : `ajv -s schema/i3dm.featureTable.schema.json -r schema/featureTable.schema.json -d examples/i3dm.featureTable.json` + +* The `-s` flag points to the schema you want to use for validation. +* Multiple `-r` flags includes any external dependencies for the schema. +* The `-d` flag points to the JSON to validate. diff --git a/schema/asset.schema.json b/schema/asset.schema.json index 1d37bdfd8..150591549 100644 --- a/schema/asset.schema.json +++ b/schema/asset.schema.json @@ -1,18 +1,19 @@ { - "$schema" : "http://json-schema.org/draft-03/schema", - "title" : "asset", + "$schema" : "http://json-schema.org/draft-04/schema", + "id" : "asset.schema.json", + "title" : "Asset", "type" : "object", "description" : "Metadata about the entire tileset.", "properties" : { "version" : { "type" : "string", - "description" : "The 3D Tiles version. The version defines the JSON schema for tileset.json and the base set of tile formats.", - "required" : true + "description" : "The 3D Tiles version. The version defines the JSON schema for tileset.json and the base set of tile formats." }, "tilesetVersion" : { "type" : "string", "description" : "Application-specific version of this tileset, e.g., for when an existing tileset is updated." } }, + "required" : ["version"], "additionalProperties" : false } diff --git a/schema/boundingVolume.schema.json b/schema/boundingVolume.schema.json index 70fac198c..69180fce3 100644 --- a/schema/boundingVolume.schema.json +++ b/schema/boundingVolume.schema.json @@ -1,6 +1,7 @@ { - "$schema" : "http://json-schema.org/draft-03/schema", - "title" : "boundingVolume", + "$schema" : "http://json-schema.org/draft-04/schema", + "id" : "boundingVolume.schema.json", + "title" : "Bounding Volume", "type" : "object", "description" : "A bounding volume that encloses a tile or its contents. At least one property is required. If more than one property is defined, the runtime can determine which to use.", "properties" : { @@ -32,5 +33,12 @@ "maxItems" : 4 } }, + "oneOf" : [{ + "required" : ["box"] + }, { + "required" : ["region"] + }, { + "required" : ["sphere"] + }], "additionalProperties" : false } diff --git a/schema/featureTable.schema.json b/schema/featureTable.schema.json new file mode 100644 index 000000000..96c3a57c2 --- /dev/null +++ b/schema/featureTable.schema.json @@ -0,0 +1,68 @@ +{ + "$schema" : "http://json-schema.org/draft-04/schema#", + "id" : "featureTable.schema.json", + "title" : "Feature Table", + "type" : "object", + "description" : "A set of semantics containing per-tile and per-feature values defining the position and appearance properties for features in a tile.", + "patternProperties" : { + ".*" : { + "properties" : { + "byteOffset" : { + "type" : "integer", + "minimum" : 0 + } + } + } + }, + "definitions" : { + "binaryBodyReference" : { + "type" : "object", + "required" : ["byteOffset"] + }, + "numericArray" : { + "type" : "array", + "items" : { + "type" : "number" + } + }, + "globalPropertyScalar" : { + "oneOf" : [{ + "$ref" : "#/definitions/binaryBodyReference" + }, { + "allOf" : [{ + "$ref" : "#/definitions/numericArray" + }, { + "minItems" : 1, + "maxItems" : 1 + }] + }, { + "type" : "integer", + "minimum" : 0 + }] + }, + "globalPropertyCartesian3" : { + "oneOf" : [{ + "$ref" : "#/definitions/binaryBodyReference" + }, { + "allOf" : [{ + "$ref": "#/definitions/numericArray" + }, { + "minItems" : 3, + "maxItems" : 3 + }] + }] + }, + "globalPropertyCartesian4" : { + "oneOf" : [{ + "$ref" : "#/definitions/binaryBodyReference" + }, { + "allOf": [{ + "$ref": "#/definitions/numericArray" + }, { + "minItems": 4, + "maxItems": 4 + }] + }] + } + } +} diff --git a/schema/i3dm.featureTable.schema.json b/schema/i3dm.featureTable.schema.json new file mode 100644 index 000000000..1cb814704 --- /dev/null +++ b/schema/i3dm.featureTable.schema.json @@ -0,0 +1,66 @@ +{ + "$schema" : "http://json-schema.org/draft-04/schema#", + "id" : "i3dm.featureTable.schema.json", + "title" : "Instanced 3D Model Feature Table", + "type" : "object", + "description" : "A set of Instanced 3D Model semantics that contains values defining the position and appearance properties for instanced models in a tile.", + "allOf" : [{ + "$ref" : "featureTable.schema.json" + }, { + "properties" : { + "POSITION" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "POSITION_QUANTIZED" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "NORMAL_UP" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "NORMAL_RIGHT" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "NORMAL_UP_OCT32P" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "NORMAL_RIGHT_OCT32P" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "SCALE" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "SCALE_NON_UNIFORM" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "BATCH_ID" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "INSTANCES_LENGTH" : { + "$ref" : "featureTable.schema.json#/definitions/globalPropertyScalar" + }, + "QUANTIZED_VOLUME_OFFSET" : { + "$ref" : "featureTable.schema.json#/definitions/globalPropertyCartesian3" + }, + "QUANTIZED_VOLUME_SCALE": { + "$ref" : "featureTable.schema.json#/definitions/globalPropertyCartesian3" + } + }, + "anyOf" : [{ + "required" : ["POSITION"] + }, { + "required" : ["POSITION_QUANTIZED"] + }], + "dependencies" : { + "POSITION_QUANTIZED" : [ + "QUANTIZED_VOLUME_OFFSET", + "QUANTIZED_VOLUME_SCALE" + ], + "NORMAL_UP" : ["NORMAL_RIGHT"], + "NORMAL_RIGHT" : ["NORMAL_UP"], + "NORMAL_UP_OCT32P" : ["NORMAL_RIGHT_OCT32P"], + "NORMAL_RIGHT_OCT32P" : ["NORMAL_UP_OCT32P"] + }, + "required" : ["INSTANCES_LENGTH"], + "additionalProperties" : false + }] +} diff --git a/schema/pnts.featureTable.schema.json b/schema/pnts.featureTable.schema.json new file mode 100644 index 000000000..8e68f12b9 --- /dev/null +++ b/schema/pnts.featureTable.schema.json @@ -0,0 +1,59 @@ +{ + "$schema" : "http://json-schema.org/draft-04/schema#", + "id" : "pnts.featureTable.schema.json", + "title" : "Point Cloud Feature Table", + "type" : "object", + "description" : "A set of Point Cloud semantics that contains values defining the position and appearance properties for points in a tile.", + "allOf" : [{ + "$ref" : "featureTable.schema.json" + }, { + "properties" : { + "POSITION" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "POSITION_QUANTIZED": { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "RGBA" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "RGB" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "NORMAL" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "NORMAL_OCT16P" : { + "$ref" : "featureTable.schema.json#/definitions/binaryBodyReference" + }, + "POINTS_LENGTH" : { + "$ref" : "featureTable.schema.json#/definitions/globalPropertyScalar" + }, + "RTC_CENTER" : { + "$ref" : "featureTable.schema.json#/definitions/globalPropertyCartesian3" + }, + "QUANTIZED_VOLUME_OFFSET" : { + "$ref" : "featureTable.schema.json#/definitions/globalPropertyCartesian3" + }, + "QUANTIZED_VOLUME_SCALE" : { + "$ref" : "featureTable.schema.json#/definitions/globalPropertyCartesian3" + }, + "CONSTANT_RGBA" : { + "$ref" : "featureTable.schema.json#/definitions/globalPropertyCartesian3" + } + }, + "anyOf" : [{ + "required" : ["POSITION"] + }, { + "required" : ["POSITION_QUANTIZED"] + }], + "dependencies" : { + "POSITION_QUANTIZED" : [ + "QUANTIZED_VOLUME_OFFSET", + "QUANTIZED_VOLUME_SCALE" + ] + }, + "required" : ["POINTS_LENGTH"], + "additionalProperties": false + }] +} diff --git a/schema/properties.schema.json b/schema/properties.schema.json index ace71ed8f..13ebf051c 100644 --- a/schema/properties.schema.json +++ b/schema/properties.schema.json @@ -1,19 +1,19 @@ { - "$schema" : "http://json-schema.org/draft-03/schema", - "title" : "properties", + "$schema" : "http://json-schema.org/draft-04/schema", + "id" : "properties.schema.json", + "title" : "Properties", "type" : "object", "description" : "A dictionary object of metadata about per-feature properties.", "properties" : { "maximum" : { "type" : "number", - "description" : "The maximum value of this property of all the features in the tileset.", - "required" : true + "description" : "The maximum value of this property of all the features in the tileset." }, "minimum" : { "type" : "number", - "description" : "The minimum value of this property of all the features in the tileset.", - "required" : true + "description" : "The minimum value of this property of all the features in the tileset." } }, + "required" : ["maximum", "minimum"], "additionalProperties" : false } diff --git a/schema/tile.content.schema.json b/schema/tile.content.schema.json index d7f52631a..ad00aba84 100644 --- a/schema/tile.content.schema.json +++ b/schema/tile.content.schema.json @@ -1,18 +1,19 @@ { - "$schema" : "http://json-schema.org/draft-03/schema", - "title" : "content", + "$schema" : "http://json-schema.org/draft-04/schema", + "id" : "tile.content.schema.json", + "title" : "Tile Content", "type" : "object", "description" : "Metadata about the tile's content and a link to the content.", "properties" : { "boundingVolume" : { - "extends" : { "$ref" : "boundingVolume.schema.json" }, - "description" : "An optional bounding volume that tightly enclosing just the tile's contents. This is used for replacement refinement; tile.boundingVolume provides spatial coherence and tile.content.boundingVolume enables tight view frustum culling. When this is omitted, tile.boundingVolume is used." + "description" : "An optional bounding volume that tightly encloses just the tile's contents. This is used for replacement refinement; tile.boundingVolume provides spatial coherence and tile.content.boundingVolume enables tight view frustum culling. When this is omitted, tile.boundingVolume is used.", + "$ref" : "boundingVolume.schema.json" }, "url" : { "type" : "string", - "description" : "A string that points to the tile's contents with an absolute or relative url. When the url is relative, it is relative to the referring tileset.json. The file extension of content.url defines the tile format. The core 3D Tiles spec supports the following tile formats: Batched 3D Model (*.b3dm), Instanced 3D Model (*.i3dm), Composite (*.cmpt), and 3D Tiles TileSet (*.json)", - "required" : true + "description" : "A string that points to the tile's contents with an absolute or relative url. When the url is relative, it is relative to the referring tileset.json. The file extension of content.url defines the tile format. The core 3D Tiles spec supports the following tile formats: Batched 3D Model (*.b3dm), Instanced 3D Model (*.i3dm), Composite (*.cmpt), and 3D Tiles TileSet (*.json)" } }, + "required" : ["url"], "additionalProperties" : false } diff --git a/schema/tile.schema.json b/schema/tile.schema.json index 4851f8039..fddc97aa9 100644 --- a/schema/tile.schema.json +++ b/schema/tile.schema.json @@ -1,19 +1,18 @@ { - "$schema" : "http://json-schema.org/draft-03/schema", - "title" : "tile", + "$schema" : "http://json-schema.org/draft-04/schema", + "id" : "tile.schema.json", + "title" : "Tile", "type" : "object", "description" : "A tile in a 3D Tiles tileset.", "properties" : { "boundingVolume" : { - "extends" : { "$ref" : "boundingVolume.schema.json" }, "description" : "The bounding volume that encloses the tile.", - "required" : true + "$ref" : "boundingVolume.schema.json" }, "geometricError" : { "type" : "number", "description" : "The error, in meters, introduced if this tile is rendered and its children are not. At runtime, the geometric error is used to compute Screen-Space Error (SSE), i.e., the error measured in pixels.", - "minimum" : 0, - "required" : true + "minimum" : 0 }, "refine" : { "type" : "string", @@ -21,8 +20,8 @@ "enum" : ["add", "replace"] }, "content" : { - "extends" : { "$ref" : "tile.content.schema.json" }, - "description" : "Metadata about the tile's content and a link to the content. When this is omitted the tile is just used for culling. This is required for leaf tiles." + "description" : "Metadata about the tile's content and a link to the content. When this is omitted the tile is just used for culling. This is required for leaf tiles.", + "$ref" : "tile.content.schema.json" }, "children" : { "type" : "array", @@ -33,5 +32,6 @@ "uniqueItems" : true } }, + "required" : ["boundingVolume", "geometricError"], "additionalProperties" : false } diff --git a/schema/tileset.schema.json b/schema/tileset.schema.json index f945ac997..2737a6bc8 100644 --- a/schema/tileset.schema.json +++ b/schema/tileset.schema.json @@ -1,40 +1,31 @@ { - "$schema" : "http://json-schema.org/draft-03/schema", - "title" : "tileset", + "$schema" : "http://json-schema.org/draft-04/schema", + "id" : "tileset.schema.json", + "title" : "Tileset", "type" : "object", "description" : "A 3D Tiles tileset.", "properties" : { "asset" : { - "type" : "object", - "description" : "Metadata about the entire tileset.", - "properties" : { - }, - "additionalProperties" : { - "$ref" : "asset.schema.json" - }, - "required" : true + "$ref" : "asset.schema.json" }, "properties" : { - "type" : "object", - "description" : "A dictionary object of metadata about per-feature properties.", - "properties" : { - }, - "additionalProperties" : { - "$ref" : "properties.schema.json" - }, - "default" : {} + "description": "A dictionary object of metadata about per-feature properties.", + "patternProperties" : { + ".*": { + "$ref": "properties.schema.json" + } + } }, "geometricError" : { "type" : "number", "description" : "The error, in meters, introduced if this tileset is not rendered. At runtime, the geometric error is used to compute Screen-Space Error (SSE), i.e., the error measured in pixels.", - "minimum" : 0, - "required" : true + "minimum" : 0 }, "root" : { - "extends" : { "$ref" : "tile.schema.json" }, "description" : "The root node.", - "required" : true + "$ref" : "tile.schema.json" } }, + "required" : ["asset", "geometricError", "root"], "additionalProperties" : false }