Update for rust

This commit is contained in:
Nova
2022-09-30 14:05:12 -04:00
parent 52e61bb163
commit 41218d6804
33 changed files with 53 additions and 101 deletions

View File

@@ -4,104 +4,51 @@ sidebar_position: 2
# Installation
As Stardust is a display server, it is split into multiple parts. Make sure to install the parts in order to avoid issues, and don't be afraid to ask questions in the Matrix or Discord servers!
As Stardust is a display server, it is split into multiple parts. Don't be afraid to ask questions in the [Matrix](https://matrix.to/#/#stardustxr:matrix.org) or [Discord](https://discord.gg/A9w7fKE) servers!
1. [libstardustxr client/server/fusion](#libstardustxr-server-client-and-fusion)
2. [stardust-xr](#stardust-xr-reference-server)
3. Other clients (such as the [tests](#stardust-client-tests))
## [stardust-xr](https://github.com/StardustXR/stardust-xr-server) (reference server)
## [libstardustxr](https://github.com/StardustXR/libstardustxr) (server, client, and fusion)
### Packages
AUR: `libstardustxr-git` and `libstardustxr-fusion-git`
<!-- ### Packages -->
<!-- AUR: `stardust-xr-git` -->
### Build system
1. Meson >= 0.55.0
2. Ninja (tested on 1.10.2)
1. Cargo
### Build dependencies
1. Flatbuffers >= 2.0.8
2. EGL+GLES 3.2
3. GLX+Xlib
4. fontconfig
5. dlopen
6. libseat (such as [seatd](https://sr.ht/~kennylevinsen/seatd/))
7. wayland
8. OpenXR Loader (required even if run in flatscreen mode, generally just named `openxr`)
### Download
```bash
git clone https://github.com/StardustXR/stardust-xr-server.git
cd stardust-xr-server
```
### Build
```bash
cargo build
```
### Install
```bash
cargo install
```
## [Flatland](https://github.com/StardustXR/flatland) (Simple simula-like panel UI client for 2D app interaction)
### Build system
1. Cargo
### Build dependencies
1. Flatbuffers >= 1.12.0
### Download
```bash
git clone https://github.com/StardustXR/libstardustxr.git
cd libstardustxr
```
### Build
```bash
meson build --prefix=/usr
cd build
ninja
```
### Install
```bash
ninja install
```
## [stardust-xr](https://github.com/StardustXR/stardust-xr) (reference server)
### Packages
AUR: `stardust-xr-git`
### Build system
1. Meson >= 0.55.0
2. Ninja (tested on 1.10.2)
3. CMake (tested on 3.21.1)
### Build dependencies
1. [libstardustxr](#libstardustxr-server-client-and-fusion)
2. Flatbuffers >= 1.12.0
3. EGL+GLES 3.2
4. GLX+Xlib
5. fontconfig
6. dlopen
7. libseat (such as [seatd](https://sr.ht/~kennylevinsen/seatd/))
8. wayland
9. xwayland
10. OpenXR Loader (required even if run in flatscreen mode, generally just named `openxr`)
11. libxkbcommon-x11
### Download
```bash
git clone https://github.com/StardustXR/stardust-xr.git
cd stardust-xr
```
### Build
```bash
meson build --prefix=/usr
cd build
ninja
```
### Install
```bash
meson install --skip-subprojects
```
## [Stardust Client Tests](https://github.com/StardustXR/stardust-client-tests)
### Build system
1. Meson >= 0.55.0
2. Ninja (tested on 1.10.2)
### Build dependencies
1. [libstardustxr](#libstardustxr-server-client-and-fusion)
2. Flatbuffers >= 1.12.0
3. sdbus-cpp
### Download
```bash
git clone https://github.com/StardustXR/stardust-client-tests.git
cd stardust-client-tests
```
### Build
```bash
meson build --prefix=/usr
cd build
ninja
cargo install flatland
```

View File

@@ -4,7 +4,7 @@ sidebar_position: 3
# Starting
First, try running `stardustxr` in a terminal window. If a headset is plugged in and OpenXR is working no window will show up. However, the headset should show the same things as the window that opens:
First, try running `stardust-xr-server` in a terminal window. If a headset is plugged in and OpenXR is working no window will show up. However, the headset should show the same things as the window that opens:
![A pitch black void with a single bleach white hand in the middle](/img/docs/run/xr_mode_windowed_blank.png)
@@ -20,11 +20,16 @@ Flatscreen mode when `~/.config/stardust/skytex.hdr` is [Zhengyang Gate](https:/
### Help screen
```
Stardust XR
Usage: stardustxr [OPTIONS]
stardust-xr-server 0.10.0
Nova King <technobaboo@proton.me>
Stardust XR reference display server
Options:
-h,--help Print this help message and exit
-F,--flatscreen Run Stardust in flatscreen mode
--field-debug Draw translucent meshes around fields
USAGE:
stardust-xr-server [OPTIONS]
OPTIONS:
-f, --flatscreen Force flatscreen mode and use the mouse pointer as a 3D pointer
-h, --help Print help information
-o, --overlay <PRIORITY> Run Stardust XR as an overlay with given priority
-V, --version Print version information
```

View File

@@ -7,7 +7,7 @@ sidebar_position: 4
## Server
The server is what renders all the meshes of each client, takes in input from input methods, and spits out input to input handlers according to the SUIS (Spatial Universal Interaction System). As well, the server is going to be part Wayland compositor and OpenXR runtime so all 2D and XR applications can be used together at once (if the hardware allows). It is the glue of Stardust, allowing any number of clients and apps to work in harmony while allowing the user full control in an intuitive way.
As new technologies come out, keeping the same server and trying to progressively upgrade it may lead to bloat and issues, so the protocol is designed to make creating new servers possible without too much hassle. Old interfaces can be deprecated without breaking the overall system, and new interfaces can be added if needed due to the object-oriented design. The design is highly inspired by game engines, however the reference server is made in StereoKit due to it being more optimal.
As new technologies come out, keeping the same server and trying to progressively upgrade it may lead to bloat and issues, so the protocol is designed to make creating new servers possible without too much hassle or to make servers modular. Old interfaces can be deprecated without breaking the overall system, and new interfaces can be added if needed due to the object-oriented design. The design is highly inspired by game engines, however the reference server is made in StereoKit due to it being more optimal.
### Reference Server
Stardust has a reference server, but unlike other display servers this reference server is just as functional as any other Stardust server would be, because all the functionality is implemented in the clients. The server is just the glue.
@@ -30,10 +30,10 @@ The reference server uses StereoKit as its backend for many reasons:
- Uses OpenXR as its backend out of the box
## IPC
The Stardust XR IPC uses Unix domain sockets for communication.
The Stardust XR IPC uses Unix domain sockets for communication and a protocol based on flatbuffers/flexbuffers.
## [Protocol](stardust-protocol/protocol.md)
The Stardust XR protocol is object-oriented, depending on a scenegraph on the server end and scenegraph or functionally equivalent structure on the client end. This allows easier implementation of the protocol while still remaining fast and reliable.
## Clients
The clients tell the server what models to draw, where they would like to accept input in, etc. Stardust clients are much more suited to widgets or user interfaces to 2D/XR apps. However, if a more fully featured application works better in Stardust it can do that too.
The clients tell the server what models to draw, where they would like to accept input in, etc. Stardust clients are much more suited to widgets or user interfaces to 2D/XR apps.

View File

@@ -1,4 +0,0 @@
{
"label": "Protocol",
"position": 2
}

View File

@@ -1,4 +0,0 @@
{
"label": "Client",
"position": 2
}

View File

@@ -1 +0,0 @@
# Initial Client Connection

View File

@@ -1,78 +0,0 @@
---
sidebar_position: 1
---
# Protocol
## Data
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;
table Message {
type: ubyte;
id: uint;
object: string;
method: string;
error: string;
data:[ubyte] (flexbuffer);
}
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` |
| `id` | `0` or ID of method call |
| `object` | Path to the object the error comes from |
| `method` | What method caused the error (if applicable, otherwise this is an empty string) |
| `error` | String containing the error message itself |
| `data` | Empty vector |
### Signal
Signals are method calls that do not expect a response of any kind.
| Field Name | Value |
|-:|:-|
| `type` | `1` |
| `object` | Path to object to send signal to |
| `method` | Name of the method to execute |
| `data` | Flexbuffer containing arguments to pass to remote method |
### Method Call
Method calls allow for remote procedure calling.
| Field Name | Value |
|-:|:-|
| `type` | `2` |
| `id` | Dynamically generated ID to identify method return for this method |
| `object` | Path to object to execute method on |
| `method` | Name of the method to execute |
| `data` | Flexbuffer containing arguments to pass to remote method |
### Method Return
Message to pass the return value back to the program.
| Field Name | Value |
|-:|:-|
| `type` | `3` |
| `id` | The same as the message call's ID |
| `data` | Flexbuffer containing return value |
## Data Types
Stardust does not support the `Map` or `FixedTypedVector` flexbuffers datatypes.
### Color
A `Vector` of 4 `float` is treated as a `Color` in the form `RGBA`.
### Vector2
A `Vector` of 2 `double` is treated as a `Vector2`.
### Vector3
A `Vector` of 3 `double` is treated as a `Vector3`.
### Quaternion
A `Vector` of 4 `double` is treated as a `Quaternion`.

View File

@@ -1,4 +0,0 @@
{
"label": "Server",
"position": 3
}

View File

@@ -1,4 +0,0 @@
{
"label": "Server Objects",
"position": 2
}

View File

@@ -1,13 +0,0 @@
# /drawable
Object managing anything drawable, from the skytex to models.
## Signals
### `createModelFromFile(string name, string spacePath, string path)`
Creates a new [Model](../types/Model.md) at `/model/[name]` with parent at `spacePath`.
### `setSkytex(string path)`
Sets the sky texture to be the image (HDR) at the absolute `path`.
### `setSkylight(string path)`
Sets the ambient lighting (using spherical harmonics) to the HDR at the absolute `path`.

View File

@@ -1,13 +0,0 @@
# /field
Object managing fields for interaction.
## Signals
### `createBoxField(string name, string spacePath, Vector3 origin, Quaternion orientation, Vector3 size)`
Creates a new [BoxField](../types/field/BoxField.md) at `/field/[name]` with parent at `spacePath`.
### `createCylinderField(string name, string spacePath, Vector3 origin, Quaternion orientation, float length, float radius)`
Creates a new [CylinderField](../types/field/CylinderField.md) at `/field/[name]` with parent at `spacePath`.
### `createSphereField(string name, string spacePath, Vector3 origin, float radius)`
Creates a new [SphereField](../types/field/SphereField.md) at `/field/[name]` with parent at `spacePath`.

View File

@@ -1,9 +0,0 @@
# /hmd
Reference object to the HMD being used to render content and track head position. This does not currently work, but is planned to.
<!-- ## Signals -->
<!-- ### `setPosition(Vector3 position)` -->
<!-- ### `setRotation(Quaternion rotation)` -->
<!-- ### `setPose(Vector3 position, Quaternion rotation)` -->
<!-- ### `setIPD(double meters)` -->

View File

@@ -1,16 +0,0 @@
# /input
Object managing input and interaction.
## Signals
<!-- ### `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](../types/input/InputHandler.md) with the specified `name` and `field`, located relative to the space referenced in `spacePath` and the `postion` + `rotation`.
## Methods
### `Vector<Vector<string inputHandlerUUID, Vector3 position>> getInputHandlers(string spacePath, bool excludeSelf)`
Returns a list of all [InputHandler](../types/input/InputHandler.md) UUIDs and their positions (relative to the space at `spacePath`), as well as puts aliases to those handlers in `/input/global_handler/[UUID]`. Excludes handlers from this client if `excludeSelf` is true.

View File

@@ -1,14 +0,0 @@
# /
Object managing the client/server relationship as a whole.
## Signals
### `subscribeLogicStep(string path, string method)`
Executes `method` on object at `path` on the client when the main logic loop of the server starts each frame.
`method` must have arguments of `(double delta, double timeToRender)`.
`delta` gives the time in seconds between the current time and the last time the logic loop executed while `timeToRender` gives the time in ms since epoch when the current frame is expected to reach the user's eyes (returns 0 for now).
### `disconnect(null)`
Lets the server know that the client wishes to disconnect. After this it can be assumed the client is disconnected from the server.

View File

@@ -1,10 +0,0 @@
# /spatial
Object managing spatial objects and spatial manipulation.
## Signals
### `createSpatial(string name, string spacePath, Vector3 origin, Quat orientation, Vector3 scale, bool translatable, bool rotatable, bool scalable)`
Creates a new [Spatial](../types/Spatial.md) at `/spatial/spatial/[name]` with parent at `spacePath`.
### `createZone(string name, string fieldPath, string spacePath, Vector3 origin, Quat orientation, string callbackPath, string callbackMethod)`
Creates a new [Zone](../types/Zone.md) at `/spatial/zone/[name]` with parent at `spacePath` and field at `fieldPath`. The arguments `callbackPath` and `callbackMethod` refer to a callback method accepting a `Vector` of 2 `TypedVector`s, the first being a list of names of nodes that have just entered the field and the second being names of nodes that left (as `string`).

View File

@@ -1,41 +0,0 @@
---
sidebar_position: 3
---
# Model
### Derived from [Spatial](Spatial)
A graphical model. It will only show when enabled.
## Properties
### `setVisible(bool visible)`
Enables/disables visibility.
### `setOrigin(Vector3 origin)`
Sets the origin to `origin`.
### `setOrientation(Quat orientation)`
Sets the orientation to `orientation`.
<!-- -->
<!-- ### `setPose(Vector3 origin, Quat orientation)` -->
<!-- Sets the pose using `origin` and `orientation` absolutely. -->
### `destroy()`
Destroys the model instance. Resources like the mesh and material and textures may be in memory still, but the resource manager will clean it up if needed.
### `setMaterialProperty(uint32 submeshIndex, string propertyName, float value)`
### `setMaterialProperty(uint32 submeshIndex, string propertyName, Color value)`
### `setMaterialProperty(uint32 submeshIndex, string propertyName, string value)`
Sets the material property `propertyName` on this model's submesh at `submeshIndex` to `value`. Valid material names are:
| Name | Type | Description |
|--------------|--------------|----------------------------------------------------------------------------------------------|
|`color` | `Color` | Tint/multiply the shader's output color by this amount. (default is opaque white) |
|`roughness` | `float` | Scale the metal texture's roughness by this amount |
|`metallic` | `float` | Scale the metal texture's metalness by this amount |
|`tex_scale` | `float` | Scale the UV coordinates of all textures by this amount |
|`diffuse` | `string` | Path to the diffuse texture of the material (if it has one). |
|`emission` | `string` | Path to the emission texture of the material (if it has one). |
|`metal` | `string` | Path to the metalness texture of the material (if it has one). |
|`normal` | `string` | Path to the normal map texture of the material (if it has one). |
|`occlusion` | `string` | Path to the occlusion map texture of the material (if it has one). |

View File

@@ -1,13 +0,0 @@
---
sidebar_position: 1
---
# Node
A base type for all other types that exist in 3D space.
## Methods
### `destroy()`
Destroy this node immediately, as well as all its children if it has any.
### `setEnabled(bool enabled)`
Set if this node is enabled or not, for example a disabled model will not render and a disabled input handler will not recieve input.

View File

@@ -1,56 +0,0 @@
---
sidebar_position: 2
---
# Spatial
### 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 [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. [Fields](field/Field), [PointerInput](input/inputtypes/PointerInput.md)).
### `zoneable: bool`
If false, no zones will see that this spatial exists. Useful for locking objects in space so they aren't affected by workspaces and generally shouldn't be true for anything other than the root spatial of an object.
## Signals
### `move(Vector3 position)`
Moves the Spatial relative to itself if `translatable` is not `false`.
### `rotate(Quat rotation)`
Rotates the Spatial relative to itself if `rotatable` is not `false`.
### `scale(float scale)`
Multiplies the Spatial's scale vector by `scale` if `scalable` is not `false`.
### `setOrigin(Vector3 origin)`
Sets the origin to `origin` if `translatable` is not `false`.
### `setOrientation(Quat orientation)`
Sets the orientation to `orientation` if `rotatable` is not `false`.
### `setScale(Vector3 scale)`
Sets the scale to `scale` if `scalable` is not `false`.
### `setPose(Vector3 origin, Quat orientation)`
Sets the pose relative to the Spatial's space if `translatable` and `rotatable` are true. This method saves on IPC calls compared to `setOrigin` and `setOrientation` in sequence.
### `setTransform(Vector3 origin, Quat orientation)`
Sets the transform relative to the Spatial's space if `translatable`, `rotatable` and `scalable` are true. This method saves on IPC calls compared to `setOrigin`, `setOrientation`, and `setScale` in sequence.
### `setSpatialParent(string parentPath)`
Sets the spatial parent of this `Spatial` while keeping the object in the same place in local space.
### `setSpatialParentInPlace(string parentPath)`
Sets the spatial parent of this `Spatial` while not changing the object's absolute position.
### `setZoneable(bool zoneable)`
Enable/disable this spatial's zoneable property.
## Methods
### `Vector<Vector3 origin, Quat orientation, Vector3 scale> getTransform(null)`
Returns the `origin`, `orientation`, and `scale` of this spatial relative to its parent.

View File

@@ -1,18 +0,0 @@
---
sidebar_position: 9
---
# Zone
### Derived from [Spatial](Spatial)
An object to manipulate compatible [Spatials](Spatial) inside its field, such as organizing/aligning widgets or creating workspaces, acting as an inertial reference frame or part of a multi-selection wand.
## Signals
### `bool isCaptured(string spatialUUID)`
Returns `true`/`false` if the [Spatial](Spatial) is captured by this zone or another, `null` if the [Spatial](Spatial) at `spatialUUID` is not accessible by this zone or does not exist.
### `capture(string spatialUUID)`
Captures the [Spatial](Spatial) at `spatialUUID` if that [Spatial](Spatial) exists and is accessible by this zone. This means that the [Spatial](Spatial) cannot be seen or affected by other zones unless a zone is closer to the [Spatial](Spatial) than this zone.
### `release(string spatialUUID)`
Uncaptures the [Spatial](Spatial) at `spatialUUID` so any zone the [Spatial](Spatial) is inside can access it.

View File

@@ -1,4 +0,0 @@
{
"label": "Node Types",
"position": 1
}

View File

@@ -1,7 +0,0 @@
# BoxField
### Derived from [Field](Field)
This field is in a rectangular prism shape.
## Properties
### `setSize(Vector3 size)`
Sets the size of the box.

View File

@@ -1,7 +0,0 @@
# CylinderField
### Derived from [Field](Field)
A cylinder shaped field defined by radius and length, along the forward vector.
## Properties
### `setSize(Vector3 size)`
Sets the size of the box.

View File

@@ -1,13 +0,0 @@
# 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)`
Returns the distance from `point` to the surface of the object, positive if the point is outside and negative if inside. When `point` is far enough away the object will give an approximate distance to the origin instead of the surface.
### `Vector3 normal(string spacePath, Vector3 point)`
Returns the normal of `point` compared to the surface of the object. Normal always points toward object.
### `Vector3 closestPoint(string spacePath, Vector3 point)`
Returns the closest point from `point` to the surface of the object. Use this instead of `distance` and `normal` when best to limit IPC calls.

View File

@@ -1,7 +0,0 @@
# SphereField
### Derived from [Field](Field)
This Field is in a sphere shape.
## Properties
### `setRadius(double size)`
Sets the radius of the sphere.

View File

@@ -1,4 +0,0 @@
{
"label": "Fields",
"position": 4
}

View File

@@ -1,26 +0,0 @@
---
sidebar_position: 1
---
# InputHandler
## Derived from [Spatial](../Spatial) (`scalable: false`)
A handler to allow clients to recieve input. Won't send input through the callback if disabled.
## Methods
### `setField(string field)`
Sets the field this input handler will use.
### `setCallback(string callbackPath, string callbackMethod)`
Sets the callback this input handler will use.
### `setActions(Vector<String> actions)`
Specify all compatible action names (human-readable).
### `Vector<String> getActions(null)`
Get a list of all action names (human-readable).
### `setActions(Vector<String> actions)`
Set all the objects on this input handler to `actions`.
### `runAction(String actionName)`
Runs the action specififed by `actionName`.

View File

@@ -1,51 +0,0 @@
---
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
### `type: uint8`
| | Name | Description |
|---|--------------|-------------------------------------------------------------------------------------------------------------|
| 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`](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:](#datamap)
## Internal Methods
### `distanceToField(string field)`
Returns the distance from this input to a field in meters. `field` is the name of the field, not the full path.
### `serialize()`
Returns a serialized version of the InputMethod, each serialized schema is shown under #Serialization in the respective Input subclasses.
## Serialization
| Key | Value Type |
|-----------|-------------|
| type | `int` |
| distance | `float` |
## Datamap
The datamap is a dictionary containing abstracted and raw data related to the input that clients can use to analyze input in the most optimal way. It has keys of type `Key`(Flexbuffers-specific, in any other language use a `String`) and values:
| Type | Example Uses | Usage Notes |
|-----------|----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| `bool` | Digital buttons | If values are analog, use a `float` instead with `1.0` being considered `true`. |
| `float` | Analog trigger, grip | For values such as grip/trigger, make the range `0.0`-`1.0`, for something like a scroll wheel `-0.5`-`0.5`. |
| `Vector2` | Touchpad, joystick | For values such as trackpad and joystick, make each component in the range of `-0.5`-`0.5` and calculate+apply deadzone before setting these values. |
| `Vector3` | Pinch position, grip axis vector | For points and directions, make this a value inside the InputMethod's local space. Raw hand pose data should not be put in the datamap. |
| `string` | Input device type/name | Device name such as `"valveindex"` and device type such as `"controller"` on a PointerInput. Useful for client devs to customize input to work best with these devices. |
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](../input/InputMethod). This pose also defines the main interaction point. -->
### `modifyDatamap(Dictionary data)`
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,4 +0,0 @@
{
"label": "Input",
"position": 5
}

View File

@@ -1,57 +0,0 @@
# HandInput
### Derived from [InputMethod](../InputMethod)
A full 27-bone hand+forearm input with useful abstractions provided through the datamap.
The local space of a hand is where +Z is away from the palm, +Y is from the palm to the fingers, and +X is orthogonal and to the right.
## Serialization
| Key | Value Type |
|-----------|--------------|
| origin | `Vector3` |
| direction | `Vector3` |
| tilt | `float` |
| datamap | `Dictionary` |
```js
[
thumb metacarpal,
thumb proximal,
thumb distal,
thumb tip,
index metacarpal,
index proximal,
index intermediate,
index distal,
index tip,
middle metacarpal,
middle proximal,
middle intermediate,
middle distal,
middle tip,
ring metacarpal,
ring proximal,
ring intermediate,
ring distal,
ring tip,
little metacarpal,
little proximal,
little intermediate,
little distal,
little tip
]
```
(This section is WIP)
## Datamap
### Required
| Key | Value Type | Description |
|-----------------|-----------------------------|--------------------------------------------------------------------|
| confidence | `float` (range `0.0`-`1.0`) | How confident the hand tracker is of the pose of the hand |
| isLeft | `bool` | `true` if this hand is the left hand, `false` if not |
| pinchStrength | `float` (range `0.0`-`1.0`) | How much the hand is pinching |
| pinchDistance | `float` (>`0.0`) | The distance in meters between the thumb and index finger |
| grabStrength | `float` (range `0.0`-`1.0`) | How much the hand is making a fist |
## Methods
**TODO**: Properly secured field distance calculation accessible to clients

View File

@@ -1,37 +0,0 @@
# PointerInput
### Derived from [InputMethod](../InputMethod)
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.
## Serialization
| Key | Value Type |
|-----------|--------------|
| origin | `Vector3` |
| direction | `Vector3` |
| tilt | `float` |
| datamap | `Dictionary` |
## Datamap
### Required
| Key | Value Type | Description |
|--------|-------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| select | `float` (range `0.0`-`1.0`) | Whether the pointer is attempting to select an object, usually through trigger. 1.0 is selected, 0.0 is not selected, and inbetween is to add smoothness to the interaction. |
| grab | `float` (range `0.0`-`1.0`) | How much the pointer is attempting to grab an object. 0.0 is not grabbing at all, 1.0 is grabbing the strongest, and inbetween is to add smoothness. |
| scroll | `Vector2` (component range `-0.5`-`0.5`) | The amount to scroll on this input tick (sensitivity determined on the receiving client). Can be used for 2D scrolling as well as adjusting depth/size when grabbing an object. |
### Built in
| Key | Value Type | Description |
|--------|--------------|-----------------------------------------------------------|
| deepestPointDistance | `float` (>=`0.0`) | The distance along the ray where the deepest surface point resides. |
| type | `string` | The type of pointer. Can be one of `"eyes"`, `"mouse"`, `"controller"`, `"gaze"`, `"generic"` |
## Methods
### `setDirection(Vector3 direction)`
Sets the direction the pointer is pointing in stage space.
### `setTilt(float angle)`
Sets the tilt of the pointer (rotation about the pointer direction) clockwise in radians.
### `setOrientation(Vector3 direction, float angle)`
Sets the direction and tilt of the pointer to save on IPC calls.
### `setPose(Vector3 origin, Vector3 direction, float angle)`
Sets the origin, direction, and tilt of the pointer to save on IPC calls.

View File

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

View File

@@ -1,4 +0,0 @@
{
"label": "Item",
"position": 6
}