Refine API docs

This commit is contained in:
technobaboo
2021-07-22 08:43:24 -05:00
parent de6a42fc41
commit 163246c267
16 changed files with 45 additions and 32 deletions

View File

@@ -3,8 +3,9 @@ sidebar_position: 1
---
# Protocol
## Data
Every message uses flatbuffers and most use flexbuffers to add variant data such as method arguments and return values. The flatbuffers Message type is:
Every message uses [flatbuffers](https://google.github.io/flatbuffers/) and [flexbuffers](https://google.github.io/flatbuffers/flexbuffers.html) to add variant data such as method arguments and return values. The Stardust XR Message schema is:
```cpp
namespace StardustXR;
@@ -23,7 +24,9 @@ root_type Message;
## Message Types
All fields not accounted for are assumed to be not included or `0` or `""`
### Error
| Field Name | Value |
|-:|:-|
| `type` | `0` |
@@ -35,6 +38,7 @@ All fields not accounted for are assumed to be not included or `0` or `""`
### Signal
Signals are method calls that do not expect a response of any kind.
| Field Name | Value |
|-:|:-|
| `type` | `1` |
@@ -43,7 +47,8 @@ Signals are method calls that do not expect a response of any kind.
| `data` | Flexbuffer containing arguments to pass to remote method |
### Method Call
Method calls allow for remote procedure calling and should block the thread they are sent from until a response is heard.
Method calls allow for remote procedure calling.
| Field Name | Value |
|-:|:-|
| `type` | `2` |
@@ -54,6 +59,7 @@ Method calls allow for remote procedure calling and should block the thread they
### Method Return
Message to pass the return value back to the program.
| Field Name | Value |
|-:|:-|
| `type` | `3` |

View File

@@ -4,8 +4,8 @@ Object managing fields for interaction.
## Signals
### `createBoxField(string name, Vector3 origin, Quaternion orientation, Vector3 size)`
Creates a new [[BoxField]] at `/field/[name]`.
Creates a new [BoxField](../types/field/BoxField.md) at `/field/[name]`.
### `createSphereField(string name, Vector3 origin, float radius)`
Creates a new [[SphereField]] at `/field/[name]`.
Creates a new [SphereField](../types/field/SphereField.md) at `/field/[name]`.

View File

@@ -3,8 +3,8 @@
Object managing input and interaction.
## Signals
### `registerPointerInput(string name, Vector3 origin, Vector3 direction, float tilt)`
Creates a new [[Pointerinput]] at `/input/methods/[name]` with the origin, direction, and tilt specified.
<!-- ### `registerPointerInput(string name, Vector3 origin, Vector3 direction, float tilt)` -->
<!-- Creates a new [PointerInput](../types/input/inputtypes/PointerInput.fbs) at `/input/methods/[name]` with the origin, direction, and tilt specified. -->
<!-- -->
### `registerInputHandler(string name, string field, string spacePath, Vector3 position, Quat rotation, string callbackPath, string callbackMethod)`
Creates a new [[InputHandler]] with the specified `name` and `field`, located relative to the space referenced in `spacePath` and the `postion` + `rotation`.
Creates a new [InputHandler](../types/input/InputHandler.md) with the specified `name` and `field`, located relative to the space referenced in `spacePath` and the `postion` + `rotation`.

View File

@@ -4,4 +4,4 @@ Object managing graphical models.
## Signals
### `createFromFile(string name, string path)`
Creates a new [[Model]] at `/model/[name]`.
Creates a new [Model](../types/Model.md) at `/model/[name]`.

View File

@@ -4,4 +4,4 @@ Object managing spatial nodes for parenting.
## Signals
### `create(string name, Vector3 origin, Quat orientation, Vector3 scale, bool translatable, bool rotatable, bool scalable)`
Creates a new [[Spatial]] at `/spatial/[name]`.
Creates a new [Spatial](../types/Spatial.md) at `/spatial/[name]`.

View File

@@ -3,7 +3,7 @@ sidebar_position: 3
---
# Model
### Derived from [[Spatial]]
### Derived from [Spatial](Spatial)
A graphical model.
## Properties

View File

@@ -3,8 +3,8 @@ sidebar_position: 1
---
# Node
A base type for all othertypes that exist in 3D space.
A base type for all other types that exist in 3D space.
## Methods
### `destroy(null)`
Destroy this node immediately, as well as all its children if it has any.
<!-- ## Methods -->
<!-- ### `destroy(null)` -->
<!-- Destroy this node immediately, as well as all its children if it has any. -->

View File

@@ -3,17 +3,17 @@ sidebar_position: 2
---
# Spatial
### Derived from [[Node]]
### Derived from [Node](Node)
A base type for types that exist in 3D space, always relative to another space or the engine's world space. Spatials are always relative because in AR or XXR reference spaces change constantly in response to new environments.
## Internal Properties
Sometimes it makes sense for a Spatial to not be scalable (like in [[Field]]s where scaling dramatically increases the number of steps to raymarch for pointers) or not be rotatable (point lights) or such, so these are disabled for certain Spatial-derived objects, mentioned right after "Derived from [[Spatial]]".
Sometimes it makes sense for a Spatial to not be scalable (like in [Fields](field/Field) where scaling dramatically increases the number of steps to raymarch for pointers) or not be rotatable (point lights) or such, so these are disabled for certain Spatial-derived objects, mentioned right after "Derived from [Spatial](Spatial)".
### `translatable: bool`
If false, object's origin cannot be modified from a client.
### `rotatable: bool`
If false, object's rotation cannot be modified from a client (e.g. point lights, point sound sources).
### `scalable: bool`
If false, object's scale cannot be modified from a client (e.g. [[Field]]s, [[PointerInput]]s).
If false, object's scale cannot be modified from a client (e.g. [Fields](field/Field), [PointerInput](input/inputtypes/PointerInput.md)).
## Methods
### `move(Vector3 position)`

View File

@@ -1,5 +1,6 @@
# BoxField
Derived from [[Field]], this Field is in a rectangular prism shape.
### Derived from [Field](Field)
This field is in a rectangular prism shape.
## Properties
### `setSize(Vector3 size)`

View File

@@ -1,6 +1,6 @@
# Field
### Derived from [[Spatial]]
Type that contains methods all Fields share. All fields created are under `/field`.
### Derived from [Spatial](../Spatial)
Type that contains methods all Fields share. All fields created are under `/field`. See [/field](../../objects/field.md) for the field factory.
## Methods
### `double distance(string spacePath, Vector3 point)`

View File

@@ -1,5 +1,6 @@
# SphereField
Derived from [[Field]], this Field is in a sphere shape.
### Derived from [Field](Field)
This Field is in a sphere shape.
## Properties
### `setRadius(double size)`

View File

@@ -2,7 +2,7 @@
sidebar_position: 1
---
# InputHandler
## Derived from [[Spatial]] (`scalable: false`)
## Derived from [Spatial](../Spatial) (`scalable: false`)
A handler to allow clients to recieve input.

View File

@@ -2,6 +2,7 @@
sidebar_position: 2
---
# InputMethod
## Derived from [Spatial](../Spatial.md) (`scalable: false`)
Represents an input device generically, with specifics being fleshed out in subclasses.
## Internal Properties
@@ -10,11 +11,11 @@ Represents an input device generically, with specifics being fleshed out in subc
|---|--------------|-------------------------------------------------------------------------------------------------------------|
| 0 | `Global` | A non-spatial input, used for power buttons and system volume and such |
| 1 | `Controller` | Contains a pose and datamap for buttons, trackpad, joystick, grip, trigger, etc. |
| 2 | [[PointerInput]] | Defined by origin, direction, and tilt with datamap for buttons, trackpad, etc. |
| 3 | [[HandInput]] | Contains a full 27-bone hand skeleton (including forearm) and datamap for abstractions like grip, pinch distance/point, etc. |
| 2 | [`PointerInput`](inputtypes/PointerInput.md) | Defined by origin, direction, and tilt with datamap for buttons, trackpad, etc. |
| 3 | [`HandInput`](inputtypes/HandInput.md) | Contains a full 27-bone hand skeleton (including forearm) and datamap for abstractions like grip, pinch distance/point, etc. |
### `datamap: Dictionary`
See #Datamap:
See [Datamap:](#datamap)
## Internal Methods
### `distanceToField(string field)`
@@ -42,8 +43,8 @@ The datamap is a dictionary containing abstracted and raw data related to the in
Standard supported datamap keys will be put in the individual type's documentation, however you can put more data in and some input handlers may be able to use that data for better interactions.
## Methods
### `setPosition(Vector3 point)`
Sets the position of this [[InputMethod]]. This pose also defines the main interaction point.
<!-- ### `setPosition(Vector3 point)` -->
<!-- Sets the position of this [InputMethod](../input/InputMethod). This pose also defines the main interaction point. -->
### `modifyDatamap(Dictionary data)`
Modifies the datamap of this [[InputMethod]]. Each key here will add to the datamap if not present and set the existing value if present. Any key not present in `data` will be unaffected.
Merges the datamap of this [InputMethod](InputMethod) with `data`. Each key here will add to the datamap if not present and set the existing value if present. Any key not present in `data` will be unaffected.

View File

@@ -1,5 +1,5 @@
# HandInput
### Derived from [[InputMethod]] and [[Spatial]] (`scalable: false`)
### Derived from [InputMethod](../InputMethod)
A full 27-bone hand+forearm input with useful abstractions provided through the datamap.

View File

@@ -1,7 +1,7 @@
# PointerInput
### Derived from [[InputMethod]]
### Derived from [InputMethod](../InputMethod)
An input method for pointers, such as the Huawei VR Glass's remote, a pointer put on an Index controller, Oculus style laser mouse, etc.
An input method for pointers, such as the Daydream's remote, a pointer put on an Index controller, Oculus style laser mouse, and your desktop's mouse in flatscreen.
The local space for a pointer is where +Z is along the pointer's direction, +X is to the right of the pointer when laying face up, and +Y is upward when laying face up.

View File

@@ -0,0 +1,4 @@
{
"label": "Input Method Types",
"position": 3
}