mirror of
https://github.com/lighttransport/tinyusdz.git
synced 2026-01-18 01:11:17 +01:00
Add schema file of USDZ for AR.
Add struct for USDZ for AR.
This commit is contained in:
8
schema/usdz/LICENSE/LICENSE.txt
Normal file
8
schema/usdz/LICENSE/LICENSE.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Copyright © 2020 Apple Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
14
schema/usdz/README.md
Normal file
14
schema/usdz/README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Schema Definitions for Third-Party Digital Content Creation (DCC)
|
||||||
|
|
||||||
|
Update your local USD library to add interactive and augmented reality features.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
These schema definition files contain a codified version of the specification addendum defined by [USDZ Schemas for AR][1]. As a developer of third-party digital content creation (DCC) software, you enable your users to configure interactive and AR features in their 3D assets by implementing the specification and providing additional UI.
|
||||||
|
|
||||||
|
## Integrate Interactive and AR Schemas
|
||||||
|
|
||||||
|
To recognize and validate syntax, and to participate in USD features such as transform hierarchies, incorporate the new interactive and AR schemas into your DCC by copying the `schema.usda` files into your USD library and rebuilding. For more information on updating your USD library, see [Generating New Schema Classes][2].
|
||||||
|
|
||||||
|
[1]:https://developer.apple.com/documentation/arkit/usdz_schemas_for_ar
|
||||||
|
[2]:https://graphics.pixar.com/usd/docs/Generating-New-Schema-Classes.html
|
||||||
303
schema/usdz/UsdInteractive/schema.usda
Normal file
303
schema/usdz/UsdInteractive/schema.usda
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
#usda 1.0
|
||||||
|
(
|
||||||
|
"""
|
||||||
|
Copyright © 2020 Apple Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
This file describes the USD Interactive schemata for code generation.
|
||||||
|
"""
|
||||||
|
subLayers = [
|
||||||
|
@usd/schema.usda@,
|
||||||
|
@usdGeom/schema.usda@
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
over "GLOBAL" (
|
||||||
|
customData = {
|
||||||
|
string libraryName = "usdInteractive"
|
||||||
|
string libraryPath = "pxr/usd/usdInteractive"
|
||||||
|
string libraryPrefix = "UsdInteractive"
|
||||||
|
string tokensPrefix = "UsdInteractive"
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
class "Preliminary_AnchoringAPI"
|
||||||
|
(
|
||||||
|
inherits = </APISchemaBase>
|
||||||
|
customData = {
|
||||||
|
token apiSchemaType = "singleApply"
|
||||||
|
}
|
||||||
|
doc = """
|
||||||
|
API schema that specifies that the prim and its children should be
|
||||||
|
placed relative to a detected plane, image, or face.
|
||||||
|
|
||||||
|
When applied to a prim, this API schema allows the runtime to determine
|
||||||
|
the transform of that prim and its children independently from its
|
||||||
|
parent transform.
|
||||||
|
|
||||||
|
\\section Anchor Layering
|
||||||
|
|
||||||
|
When one or more anchorable prims are defined beneath another anchorable
|
||||||
|
prim, each anchorable prim will be positioned independently and the
|
||||||
|
positions of its non-anchorable children will be located relative to it.
|
||||||
|
|
||||||
|
\\note
|
||||||
|
Due to the independent nature of anchorable prims, it is recommended
|
||||||
|
that each anchorable prim be placed at the top level of your content.
|
||||||
|
This also helps make it clear that each subtree has its transform
|
||||||
|
independently calculated by the runtime.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
{
|
||||||
|
uniform token preliminary:anchoring:type (
|
||||||
|
allowedTokens = ["plane", "image", "face", "none"]
|
||||||
|
doc = """
|
||||||
|
Defines the type of anchoring for the prim. This is a required
|
||||||
|
property for this schema.
|
||||||
|
|
||||||
|
plane: The content will be placed along the normal and the center of
|
||||||
|
the detected plane.
|
||||||
|
image: The content will be placed along the normal and center of the
|
||||||
|
detected image.
|
||||||
|
face: The content will be placed along the normal and at the center
|
||||||
|
of the detected face.
|
||||||
|
none: The content will not be anchored. This is equivalent to not
|
||||||
|
applying the anchoring API schema to a prim at all.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
uniform token preliminary:planeAnchoring:alignment (
|
||||||
|
allowedTokens = ["horizontal", "vertical", "any"]
|
||||||
|
doc = """
|
||||||
|
Specifies the kind of detected plane the prim and its children
|
||||||
|
should be placed relative to. This property is only active if the
|
||||||
|
anchoring type is "plane".
|
||||||
|
|
||||||
|
horizontal: Horizontal planes include floors, tables, ceilings, and more.
|
||||||
|
vertical: Vertical planes include walls, doors, windows, and more.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
rel preliminary:imageAnchoring:referenceImage (
|
||||||
|
doc = """
|
||||||
|
Specifies the kind of detected image reference the prim and its
|
||||||
|
children should be placed relative to. This property is only active
|
||||||
|
if the anchoring type is "image".
|
||||||
|
|
||||||
|
\\note
|
||||||
|
This should point to a prim with the type "ReferenceImage".
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Preliminary_ReferenceImage "Preliminary_ReferenceImage" (
|
||||||
|
doc = """
|
||||||
|
Defines an image anchoring reference, which includes the image and its
|
||||||
|
physical width.
|
||||||
|
"""
|
||||||
|
inherits = </Typed>
|
||||||
|
)
|
||||||
|
{
|
||||||
|
uniform asset image (
|
||||||
|
doc = """
|
||||||
|
The image to which this prim should be placed relative to. This
|
||||||
|
should point to an image. This property is only active if the
|
||||||
|
anchoring type is "image".
|
||||||
|
|
||||||
|
\\note
|
||||||
|
In a USDZ, the only valid image types are png and jpeg (any of the
|
||||||
|
multiple common extensions for jpeg).
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
uniform double physicalWidth = 0.0 (
|
||||||
|
doc = """
|
||||||
|
Specifies the physical, real-world width, defined in centimeters to
|
||||||
|
avoid unit changes due to composition, of the image to which this prim
|
||||||
|
should be placed relative to. This property can be used as a reference
|
||||||
|
for AR runtimes to determine the approximate image size to look for
|
||||||
|
and anchor this content to. This property is only active if the
|
||||||
|
anchoring type is "image".
|
||||||
|
|
||||||
|
\\note
|
||||||
|
This property is not affected by its transform hierarchy as it
|
||||||
|
describes a physical width in the real world.
|
||||||
|
|
||||||
|
\\note
|
||||||
|
The height is not required because it can be determined based on the
|
||||||
|
aspect ratio of the image.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Preliminary_Behavior "Preliminary_Behavior" (
|
||||||
|
doc = """A Behavior encapsulates a set of triggers and their associated actions."""
|
||||||
|
inherits = </Typed>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_Behavior"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rel triggers (
|
||||||
|
doc = """
|
||||||
|
List of \a Trigger prims that will execute the list of \p actions.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
rel actions (
|
||||||
|
doc = """
|
||||||
|
List of \a Action prims that are performed when elements of \p triggers
|
||||||
|
are executed. These actions are executed serially. @see GroupAction
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
uniform bool exclusive = false (
|
||||||
|
doc = """
|
||||||
|
Determines whether this behavior can be executed exclusively to other
|
||||||
|
behaviors.
|
||||||
|
Valid values are:
|
||||||
|
- true: If a trigger in this behavior is executed, other exclusive
|
||||||
|
behaviors will stop performing their actions.
|
||||||
|
- false: Other actions in other behaviors can run concurrently
|
||||||
|
with this behavior. (Default)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class "Preliminary_Trigger" (
|
||||||
|
doc = """A Trigger represents an event that when executed, causes an *action*
|
||||||
|
to be performed.
|
||||||
|
Triggers can be executed by:
|
||||||
|
- User input: e.g. a tap gesture
|
||||||
|
- Scene state: e.g. proximity to the camera
|
||||||
|
- Programmatically: e.g. as a result of application state or other event
|
||||||
|
This is the base class for all Behavior triggers.
|
||||||
|
"""
|
||||||
|
inherits = </Typed>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_Trigger"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
uniform token info:id (
|
||||||
|
doc = """The id is the identifier for the type or purpose of the trigger.
|
||||||
|
E.g. TapGesture, ProximityToCamera
|
||||||
|
The value of this id is interpreted by the runtime implementation of the
|
||||||
|
behavior system.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class "Preliminary_Action" (
|
||||||
|
doc = """An Action is performed when a *Trigger* is executed.
|
||||||
|
Performing an action is how a Behavior modifies the state of the scene dynamically.
|
||||||
|
For example, an action might start an animation playing, change the transform
|
||||||
|
of an *Xformable*, or start looping audio.
|
||||||
|
|
||||||
|
This is the base class for Behavior actions"""
|
||||||
|
inherits = </Typed>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_Action"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
uniform token info:id (
|
||||||
|
doc = """The id is the identifier for the type or purpose of the action.
|
||||||
|
E.g. Impulse, Group
|
||||||
|
The value of this id is interpreted by the runtime implementation of the
|
||||||
|
behavior system.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
uniform token multiplePerformOperation= "ignore" (
|
||||||
|
allowedTokens = ["ignore", "allow", "stop"]
|
||||||
|
doc = """Defines how this action handles a request be performed again while
|
||||||
|
already running.
|
||||||
|
Valid values are:
|
||||||
|
- allow: Perform the action again, effectively restarting it.
|
||||||
|
- ignore: Ignore the perform request, and continue running the current action.
|
||||||
|
- stop: Stops the current action.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Preliminary_Text "Preliminary_Text" (
|
||||||
|
doc = """Defines 3D extruded text geometry in the scene"""
|
||||||
|
inherits = </Gprim>
|
||||||
|
)
|
||||||
|
{
|
||||||
|
string content = "" (
|
||||||
|
doc = """
|
||||||
|
Text contents. This string may include line breaks which will be honored.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
string[] font (
|
||||||
|
doc = """
|
||||||
|
An array of font names. They will be traversed in order and the first one that matches an
|
||||||
|
available font will be used. If no font matches exactly the behavior is undefined, although
|
||||||
|
there may be some attempt to find a related font. The font name string contains the family
|
||||||
|
and any styling attributes.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
float pointSize = 144.0 (
|
||||||
|
doc = """
|
||||||
|
Font size in points.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
float width (
|
||||||
|
doc = """
|
||||||
|
Width (X) of the text bounding rectangle in scene units. Must be positive. Is ignored
|
||||||
|
if wrapMode is set to singleLine.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
float height (
|
||||||
|
doc = """
|
||||||
|
Height (Y) of the text bounding rectangle in scene units. Must be positive. Is ignored
|
||||||
|
if wrapMode is set to singleLine.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
float depth = 0 (
|
||||||
|
doc = """
|
||||||
|
Extrusion depth (Z) in scene units. Must be non-negative. The geometry is visible from
|
||||||
|
both sides even for a zero extrusion depth.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
token wrapMode = "flowing" (
|
||||||
|
allowedTokens = ["singleLine", "hardBreaks", "flowing"]
|
||||||
|
doc = """
|
||||||
|
Hint about the intent of the text flow.
|
||||||
|
singleLine: The entire content is a single line
|
||||||
|
hardBreaks: The content contains line breaks and no other line breaking is allowed
|
||||||
|
flowing: The content can flow in the bounds by adding line breaks
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
token horizontalAlignment = "center" (
|
||||||
|
allowedTokens = ["left", "center", "right", "justified"]
|
||||||
|
doc = """
|
||||||
|
Placement of each line relative to the bounding rectangle.
|
||||||
|
left: Left-align each line
|
||||||
|
center: Center-align each line
|
||||||
|
right: Right-align each line
|
||||||
|
justified: Left-align each line, and add spacing between words to right-align also, if possible
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
token verticalAlignment = "middle" (
|
||||||
|
allowedTokens = ["top", "middle", "lowerMiddle", "baseline", "bottom"]
|
||||||
|
doc = """
|
||||||
|
Vertical placement of the text.
|
||||||
|
For a single line the alignment is relative to font features:
|
||||||
|
top: ascender
|
||||||
|
middle: center of capital letters
|
||||||
|
lowerMiddle: center of lowercase letters
|
||||||
|
baseline: baseline
|
||||||
|
bottom: descender
|
||||||
|
For multi-line text the alignment is relative to the bounds:
|
||||||
|
top: lines aligned with the top
|
||||||
|
middle, lowerMiddle: lines together with equal space above and below
|
||||||
|
baseline, bottom: lines aligned with the bottom
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
158
schema/usdz/UsdPhysics/schema.usda
Normal file
158
schema/usdz/UsdPhysics/schema.usda
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
#usda 1.0
|
||||||
|
(
|
||||||
|
"""
|
||||||
|
Copyright © 2020 Apple Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
This file describes the USD Physics schemata for code generation.
|
||||||
|
"""
|
||||||
|
subLayers = [
|
||||||
|
@usd/schema.usda@,
|
||||||
|
@usdGeom/schema.usda@
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
over "GLOBAL" (
|
||||||
|
customData = {
|
||||||
|
string libraryName = "usdPhysics"
|
||||||
|
string libraryPath = "pxr/usd/usdPhysics"
|
||||||
|
string libraryPrefix = "UsdPhysics"
|
||||||
|
string tokensPrefix = "UsdPhysics"
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
class "Preliminary_PhysicsForce" (
|
||||||
|
doc = """Defines a physics based force base type.
|
||||||
|
"""
|
||||||
|
inherits = </Xformable>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_PhysicsForce"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
class Preliminary_PhysicsGravitationalForce "Preliminary_PhysicsGravitationalForce" (
|
||||||
|
doc = """Physical force exerted by some gravitational field on objects within it.
|
||||||
|
"""
|
||||||
|
inherits = </Preliminary_PhysicsForce>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_PhysicsGravitationalForce"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
uniform vector3d physics:gravitationalForce:acceleration = (0.0, -9.81, 0.0) (
|
||||||
|
doc = """Local space vector defining the direction and magnitude of the gravitational force's acceleration effect.
|
||||||
|
Units are in meters per second squared.
|
||||||
|
The default value is the Earth's gravity, assuming upAxis is +Y.
|
||||||
|
Affected by the value of upAxis and by its parent's transform
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class "Preliminary_PhysicsMaterialAPI" (
|
||||||
|
doc = """Specifies the physical properties of a material that a collider can be made of.
|
||||||
|
"""
|
||||||
|
inherits = </APISchemaBase>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_PhysicsMaterialAPI"
|
||||||
|
token apiSchemaType = "singleApply"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
uniform double preliminary:physics:material:restitution (
|
||||||
|
|
||||||
|
doc = """Restitution of the material. Defines how elastic collisions are against objects made of this material
|
||||||
|
Values range between 0.0 and 1.0.
|
||||||
|
0.0 represents a completely inelastic material; while 1.0 represents a completely elastic material
|
||||||
|
No units, it is dimensionless as it is a coefficient.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
uniform double preliminary:physics:material:friction:static (
|
||||||
|
doc = """Friction coefficient of the material as an object that's made of it, as it is in contact with another, but not moving.
|
||||||
|
No units, it is dimensionless as it is a coefficient.
|
||||||
|
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
uniform double preliminary:physics:material:friction:dynamic (
|
||||||
|
doc = """Friction coefficient of the material as an object that's made of it, rubs against another object.
|
||||||
|
No units, it is dimensionless as it is a coefficient.
|
||||||
|
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class "Preliminary_PhysicsRigidBodyAPI" (
|
||||||
|
doc = """Dual purpose interface for:
|
||||||
|
1) Retrieving the attributes of a prim that are related to a rigid body physical simulation.
|
||||||
|
2) Identifying the prim whose transforms values will be computed as a rigid body in the
|
||||||
|
simulation.
|
||||||
|
"""
|
||||||
|
inherits = </APISchemaBase>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_PhysicsRigidBodyAPI"
|
||||||
|
token apiSchemaType = "singleApply"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
uniform double preliminary:physics:rigidBody:mass = 1.0 (
|
||||||
|
doc = """Physical mass of the rigid body in Kilograms. This property is uniformly scaled by the scale
|
||||||
|
component of the prim's transform.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
uniform bool preliminary:physics:rigidBody:initiallyActive = true (
|
||||||
|
doc = """Boolean that determines if a rigid body is active or not at physics simulation startup.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class "Preliminary_PhysicsColliderAPI" (
|
||||||
|
doc = """Interface defining collision shapes of a prim participating in collisions of a physical simulation.
|
||||||
|
"""
|
||||||
|
inherits = </APISchemaBase>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_PhysicsColliderAPI"
|
||||||
|
token apiSchemaType = "singleApply"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rel preliminary:physics:collider:convexShape (
|
||||||
|
doc = """Relation pointing to an override that contains a prim hierarchy that defines the collider's geometry.
|
||||||
|
If the object pointed to by this relationship is different from the object's geometry then
|
||||||
|
it must have its purpose attribute set to guide.
|
||||||
|
Currently the only geometry primitives supported are: UsdGeomCapsule, UsdGeomSphere and UsdGeomCube.
|
||||||
|
UsdGeomCube is scaled to simulate a box collider's differing dimensions along each axis.
|
||||||
|
All other geometry primitives derived from UsdGeomGPrims will approximate the collider by using
|
||||||
|
a bounding box collider defined by its extent. The geometry of the collider is required to be convex.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class "Preliminary_InfiniteColliderPlane" (
|
||||||
|
doc = """Defines a plane in space, but does not need to define any actual
|
||||||
|
mesh geometry for it, but could be have special rendering if its
|
||||||
|
purpose is guide for example.
|
||||||
|
|
||||||
|
Its extent is defined as [(-FLT_MAX, -FLT_MAX, -FLT_MAX), (FLT_MAX, FLT_MAX, FLT_MAX)]
|
||||||
|
"""
|
||||||
|
inherits = </Gprim>
|
||||||
|
customData = {
|
||||||
|
string className = "Preliminary_InfiniteColliderPlane"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
point3d position = (0, 0, 0) (
|
||||||
|
doc = """Location of the plane in space.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
vector3d normal = (0, 1, 0) (
|
||||||
|
doc = """Normal of the plane in space.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
114
src/tinyusdz.hh
114
src/tinyusdz.hh
@@ -2088,6 +2088,120 @@ struct PreviewSurface {
|
|||||||
int64_t displacement_id{-1}; // index to `Scene::shaders`
|
int64_t displacement_id{-1}; // index to `Scene::shaders`
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// USDZ Schemas for AR
|
||||||
|
// https://developer.apple.com/documentation/arkit/usdz_schemas_for_ar/schema_definitions_for_third-party_digital_content_creation_dcc
|
||||||
|
|
||||||
|
// UsdPhysics
|
||||||
|
struct Preliminary_PhysicsGravitationalForce
|
||||||
|
{
|
||||||
|
// physics::gravitatioalForce::acceleration
|
||||||
|
Vec3d acceleration{0.0, -9.81, 0.0}; // [m/s^2]
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_PhysicsMaterialAPI
|
||||||
|
{
|
||||||
|
// preliminary:physics:material:restitution
|
||||||
|
double restitution; // [0.0, 1.0]
|
||||||
|
|
||||||
|
// preliminary:physics:material:friction:static
|
||||||
|
double friction_static;
|
||||||
|
|
||||||
|
// preliminary:physics:material:friction:dynamic
|
||||||
|
double friction_dynamic;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_PhysicsRigidBodyAPI
|
||||||
|
{
|
||||||
|
// preliminary:physics:rigidBody:mass
|
||||||
|
double mass{1.0};
|
||||||
|
|
||||||
|
// preliminary:physics:rigidBody:initiallyActive
|
||||||
|
bool initiallyActive{true};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_PhysicsColliderAPI
|
||||||
|
{
|
||||||
|
// preliminary::physics::collider::convexShape
|
||||||
|
Path convexShape;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_InfiniteColliderPlane
|
||||||
|
{
|
||||||
|
Vec3d position{0.0, 0.0, 0.0};
|
||||||
|
Vec3d normal{0.0, 0.0, 0.0};
|
||||||
|
|
||||||
|
Extent extent; // [-FLT_MAX, FLT_MAX]
|
||||||
|
|
||||||
|
Preliminary_InfiniteColliderPlane() {
|
||||||
|
extent.lower[0] = -std::numeric_limits<float>::max();
|
||||||
|
extent.lower[1] = -std::numeric_limits<float>::max();
|
||||||
|
extent.lower[2] = -std::numeric_limits<float>::max();
|
||||||
|
extent.upper[0] = std::numeric_limits<float>::max();
|
||||||
|
extent.upper[1] = std::numeric_limits<float>::max();
|
||||||
|
extent.upper[2] = std::numeric_limits<float>::max();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// UsdInteractive
|
||||||
|
struct Preliminary_AnchoringAPI
|
||||||
|
{
|
||||||
|
// preliminary:anchoring:type
|
||||||
|
std::string type; // "plane", "image", "face", "none";
|
||||||
|
|
||||||
|
std::string alignment; // "horizontal", "vertical", "any";
|
||||||
|
|
||||||
|
Path referenceImage;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_ReferenceImage
|
||||||
|
{
|
||||||
|
int64_t image_id{-1}; // asset image
|
||||||
|
|
||||||
|
double physicalWidth{0.0};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_Behavior
|
||||||
|
{
|
||||||
|
Path triggers;
|
||||||
|
Path actions;
|
||||||
|
bool exclusive{false};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_Trigger
|
||||||
|
{
|
||||||
|
// uniform token info:id
|
||||||
|
std::string info; // Store decoded string from token id
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_Action
|
||||||
|
{
|
||||||
|
// uniform token info:id
|
||||||
|
std::string info; // Store decoded string from token id
|
||||||
|
|
||||||
|
std::string multiplePerformOperation{"ignore"}; // ["ignore", "allow", "stop"]
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Preliminary_Text
|
||||||
|
{
|
||||||
|
std::string content;
|
||||||
|
std::vector<std::string> font; // An array of font names
|
||||||
|
|
||||||
|
float pointSize{144.0f};
|
||||||
|
float width;
|
||||||
|
float height;
|
||||||
|
float depth{0.0f};
|
||||||
|
|
||||||
|
std::string wrapMode{"flowing"}; // ["singleLine", "hardBreaks", "flowing"]
|
||||||
|
std::string horizontalAlignmment{"center"}; // ["left", "center", "right", "justified"]
|
||||||
|
std::string verticalAlignmment{"middle"}; // ["top", "middle", "lowerMiddle", "baseline", "bottom"]
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
using StringOrId = std::pair<std::string, int32_t>;
|
using StringOrId = std::pair<std::string, int32_t>;
|
||||||
|
|
||||||
// Simple bidirectional Path(string) <-> index lookup
|
// Simple bidirectional Path(string) <-> index lookup
|
||||||
|
|||||||
Reference in New Issue
Block a user