Skip to content

Commit

Permalink
Move EXT_implicit_geometry to glTF root
Browse files Browse the repository at this point in the history
  • Loading branch information
j9liu committed Jun 12, 2024
1 parent 98f2868 commit be26d0f
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 123 deletions.
80 changes: 44 additions & 36 deletions extensions/2.0/Vendor/EXT_implicit_geometry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ Written against the glTF 2.0 specification.

## Overview

This extension allows mesh primitives to represent renderable implicit surfaces. Typically, a glTF mesh primitive requires `attributes` that supply mesh data, and uses `mode` to indicate the mesh topology. With `EXT_implicit_geometry`, the primitive may omit these properties and instead use the extension to infer the implicit 3D volume.

Primitives with this extension may still be affected by node transforms to position, orient, and scale the shape as needed.
This extension allows glTF assets to define implicit geometry surfaces at the root level. This extension does not define any particular behavior for these shapes, but other extensions may build upon it for use in various functions.

## Supported Geometry

Expand All @@ -25,9 +23,9 @@ Currently, this extension supports the following implicit geometries:
- [`ellipsoid`](#ellipsoid)
- [`region`](#region)

Only **one** shape may be defined at a time.
The extension may also be extended itself to permit other geometry types. Only **one** shape may be defined at a time.

By default, the implicit 3D volume is assumed to fill the entire shape specified in the extension. However, each shape allows an optional `slice` property to define the subsection of the shape in which the 3D volume is actually rendered. For instance, while the extension may define an implicit sphere, its `slice` can limit the volume to be only half of the full sphere.
By default, the implicit 3D volume is assumed to fill the entire shape specified in the extension. However, shapes may allow an optional `slice` property to define the subsection of the shape in which the 3D volume is actually rendered. For instance, while the extension may define an implicit sphere, its `slice` can limit the volume to be only half of the full sphere.

### Box

Expand All @@ -41,14 +39,16 @@ The `box` property represents an axis-aligned box that is centered at the origin
</tr>
<tr>
<td><pre>
"primitives": [
"extensions": [
{
"extensions": {
"EXT_implicit_geometry": {
"box": {
"size": [1, 0.5, 2],
"EXT_implicit_geometry": {
"geometries": [
{
"box": {
"size": [1, 0.5, 2],
}
}
}
]
}
}
]
Expand All @@ -71,15 +71,17 @@ The `cylinder` property represents a cylinder that is aligned with the `y`-axis
</tr>
<tr>
<td><pre>
"primitives": [
"extensions": [
{
"extensions": {
"EXT_implicit_geometry": {
"cylinder": {
"radius": 2,
"height": 3
"EXT_implicit_geometry": {
"geometries": [
{
"cylinder": {
"radius": 2,
"height": 3
}
}
}
]
}
}
]
Expand All @@ -102,14 +104,16 @@ The `sphere` property represents a sphere that is centered at the origin. The `r
</tr>
<tr>
<td><pre>
"primitives": [
"extensions": [
{
"extensions": {
"EXT_implicit_geometry": {
"sphere": {
"radius": 2,
"EXT_implicit_geometry": {
"geometries": [
{
"sphere": {
"radius": 2
}
}
}
]
}
}
]
Expand All @@ -134,17 +138,19 @@ The `ellipsoid` property represents an ellipsoid that is centered at the origin.
</tr>
<tr>
<td><pre>
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"extensions": [
{
"EXT_implicit_geometry": {
"geometries": [
{
"ellipsoid": {
"radii": [2, 3, 4]
}
}
}
]
}
]
}
]
</pre></td>
<td>
**TODO** visual example
Expand All @@ -169,19 +175,21 @@ The `heightFromSurface` property indicates the height of the region from the ell
</tr>
<tr>
<td><pre>
"primitives": [
{
"extensions": {
"EXT_implicit_geometry": {
"extensions": [
{
"EXT_implicit_geometry": {
"geometries": [
{
"region": {
"semiMajorAxisRadius": 4,
"semiMinorAxisRadius": 2,
"heightFromSurface": 0.5
}
}
}
]
}
]
}
]
</pre></td>
<td>
**TODO** visual example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "ellipsoid.bounds.schema.json",
"title": "Ellipsoid Bounds",
"$id": "ellipsoid.slice.schema.json",
"title": "Ellipsoid Slice",
"type": "object",
"description": "A set of bounds for an implicit ellipsoid surface. Defines the subsection of the ellipsoid that the implicit volume actually occupies.",
"description": "A slice of an implicit ellipsoid. Defines the subsection of the ellipsoid that the implicit volume actually occupies.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
Expand All @@ -12,41 +12,41 @@
"properties": {
"minRadius": {
"type": "number",
"description": "The minimum radial bound of the ellipsoid.",
"description": "The start of the slice along the radius of the ellipsoid.",
"minimum": 0,
"maximum": 1,
"default": 0
},
"maxRadius": {
"type": "number",
"description": "The maximum radial bound of the ellipsoid.",
"description": "The end of the slice along the radius of the ellipsoid.",
"minimum": 0,
"maximum": 1,
"default": 1
},
"minAngle": {
"type": "array",
"description": "The minimum angular bounds of the ellipsoid in radians. The first element corresponds to the azimuthal angle (a.k.a longitude) and must be in the range [-pi, pi]. The second element corresponds to the polar angle (a.k.a. latitude) and must be in the range [-pi/2, pi/2].",
"description": "The start of the slice across the angles of the sphere, given in radians. The first element corresponds to the azimuthal angle (a.k.a longitude) and must be in the range [-pi, pi]. The second element corresponds to the polar angle (a.k.a. latitude) and must be in the range [-pi/2, pi/2].",
"items": {
"type": "number",
"minimum": -3.14159265359,
"maximum": 3.14159265359,
"maximum": 3.14159265359
},
"minItems": 2,
"maxItems": 2,
"default": [-3.14159265359, -1.57079632679]
},
"minAngle": {
"maxAngle": {
"type": "array",
"description": "The maximum angular bounds of the ellipsoid in radians. The first element corresponds to the azimuthal angle (a.k.a longitude) and must be in the range [-pi, pi]. The second element corresponds to the polar angle (a.k.a. latitude) and must be in the range [-pi/2, pi/2].",
"description": "The end of the slice across the angles of the sphere, given in radians. The first element corresponds to the azimuthal angle (a.k.a longitude) and must be in the range [-pi, pi]. The second element corresponds to the polar angle (a.k.a. latitude) and must be in the range [-pi/2, pi/2].",
"items": {
"type": "number",
"minimum": -3.14159265359,
"maximum": 3.14159265359,
"maximum": 3.14159265359
},
"minItems": 2,
"maxItems": 2,
"default": [3.14159265359, 1.57079632679]
},
}
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "mesh.primitive.EXT_implicit_geometry.schema.json",
"title": "EXT_primitive_voxels glTF Mesh Primitive extension",
"$id": "geometry.schema.json",
"title": "Geometry in EXT_implicit_geometry",
"type": "object",
"description": "`EXT_implicit_geometry` extension for a primitive in a glTF model to represent implicit 3D geometry",
"description": "A definition of implicit 3D geometry.",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"box": {
"$ref": "box.schema.json"
"$ref": "geometry.box.schema.json"
},
"cylinder": {
"$ref": "cylinder.schema.json"
"$ref": "geometry.cylinder.schema.json"
},
"sphere": {
"$ref": "sphere.schema.json"
"$ref": "geometry.sphere.schema.json"
},
"ellipsoid": {
"$ref": "ellipsoid.schema.json"
"$ref": "geometry.ellipsoid.schema.json"
},
"region": {
"$ref": "region.schema.json"
},
"$ref": "geometry.region.schema.json"
}
},
"oneOf": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.EXT_implicit_geometry.schema.json",
"title": "EXT_implicit_geometry glTF extension",
"type": "object",
"description": "`EXT_implicit_geometry` extension to represent implicit 3D geometry in a glTF model",
"allOf": [
{
"$ref": "glTFProperty.schema.json"
}
],
"properties": {
"geometries": {
"type": "array",
"description": "An array of implicit geometry definitions.",
"minItems": 1,
"items": {
"$ref": "geometry.schema.json"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"heightFromSurface": {
"type": "number",
"description": "The height of this region from the surface of the reference ellipsoid in meters.",
"description": "The height of this region from the surface of the reference ellipsoid in meters."
},
"slice": {
"$ref": "region.slice.schema.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "region.bounds.schema.json",
"title": "Region Bounds",
"$id": "region.slice.schema.json",
"title": "Region Slice",
"type": "object",
"description": "A slice of an implicit region relative to an ellipsoid. Defines the subsection of the region that the implicit volume actually occupies.",
"allOf": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@
"items": {
"type": "number",
"minimum": -3.14159265359,
"maximum": 3.14159265359,
"maximum": 3.14159265359
},
"minItems": 2,
"maxItems": 2,
"default": [-3.14159265359, -1.57079632679]
},
"minAngle": {
"maxAngle": {
"type": "array",
"description": "The end of the slice across the angles of the sphere, in radians. The first element corresponds to the azimuthal angle (a.k.a longitude) and must be in the range [-pi, pi]. The second element corresponds to the polar angle (a.k.a. latitude) and must be in the range [-pi/2, pi/2].",
"items": {
"type": "number",
"minimum": -3.14159265359,
"maximum": 3.14159265359,
"maximum": 3.14159265359
},
"minItems": 2,
"maxItems": 2,
"default": [3.14159265359, 1.57079632679]
},
}
}
}
Loading

0 comments on commit be26d0f

Please sign in to comment.