Initial upload
This commit is contained in:
4
docs/stardust-protocol/server/_category_.json
Normal file
4
docs/stardust-protocol/server/_category_.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Server",
|
||||
"position": 3
|
||||
}
|
||||
4
docs/stardust-protocol/server/objects/_category_.json
Normal file
4
docs/stardust-protocol/server/objects/_category_.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Server Objects",
|
||||
"position": 2
|
||||
}
|
||||
11
docs/stardust-protocol/server/objects/environment.md
Normal file
11
docs/stardust-protocol/server/objects/environment.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# /environment
|
||||
|
||||
## Signals
|
||||
### `visible(bool enable)`
|
||||
Enable or disables the skybox visibility (lighting remains active). This is not meant to be used for an additive AR mode as StereoKit will perform that when the OpenXR runtime indicates the layer's blend mode is additive.
|
||||
|
||||
### `setSkytex(string path)`
|
||||
Sets the sky texture to be the image (HDR) at the absolute `path`.
|
||||
|
||||
### `setLighting(string path)`
|
||||
Sets the ambient lighting (using spherical harmonics) to the HDR at the absolute `path`.
|
||||
11
docs/stardust-protocol/server/objects/field.md
Normal file
11
docs/stardust-protocol/server/objects/field.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# /field
|
||||
|
||||
Object managing fields for interaction.
|
||||
|
||||
## Signals
|
||||
### `createBoxField(string name, Vector3 origin, Quaternion orientation, Vector3 size)`
|
||||
Creates a new [[BoxField]] at `/field/[name]`.
|
||||
|
||||
|
||||
### `createSphereField(string name, Vector3 origin, float radius)`
|
||||
Creates a new [[SphereField]] at `/field/[name]`.
|
||||
9
docs/stardust-protocol/server/objects/hmd.md
Normal file
9
docs/stardust-protocol/server/objects/hmd.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# /hmd
|
||||
|
||||
Reference object to the HMD being used to render content and track head position.
|
||||
|
||||
## Signals
|
||||
### `setPosition(Vector3 position)`
|
||||
### `setRotation(Quaternion rotation)`
|
||||
### `setPose(Vector3 position, Quaternion rotation)`
|
||||
### `setIPD(double meters)`
|
||||
10
docs/stardust-protocol/server/objects/input.md
Executable file
10
docs/stardust-protocol/server/objects/input.md
Executable file
@@ -0,0 +1,10 @@
|
||||
# /input
|
||||
|
||||
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.
|
||||
|
||||
### `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`.
|
||||
10
docs/stardust-protocol/server/objects/lifecycle.md
Normal file
10
docs/stardust-protocol/server/objects/lifecycle.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# /lifecycle
|
||||
Object representing the life cycle of the Stardust server, from start to each frame to end.
|
||||
|
||||
## 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.
|
||||
7
docs/stardust-protocol/server/objects/model.md
Normal file
7
docs/stardust-protocol/server/objects/model.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# /model
|
||||
|
||||
Object managing graphical models.
|
||||
|
||||
## Signals
|
||||
### `createFromFile(string name, string path)`
|
||||
Creates a new [[Model]] at `/model/[name]`.
|
||||
7
docs/stardust-protocol/server/objects/spatial.md
Normal file
7
docs/stardust-protocol/server/objects/spatial.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# /spatial
|
||||
|
||||
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]`.
|
||||
37
docs/stardust-protocol/server/types/Model.md
Normal file
37
docs/stardust-protocol/server/types/Model.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# Model
|
||||
### Derived from [[Spatial]]
|
||||
A graphical model.
|
||||
|
||||
## Properties
|
||||
### `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). |
|
||||
10
docs/stardust-protocol/server/types/Node.md
Normal file
10
docs/stardust-protocol/server/types/Node.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Node
|
||||
A base type for all othertypes that exist in 3D space.
|
||||
|
||||
## Methods
|
||||
### `destroy(null)`
|
||||
Destroy this node immediately, as well as all its children if it has any.
|
||||
47
docs/stardust-protocol/server/types/Spatial.md
Normal file
47
docs/stardust-protocol/server/types/Spatial.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Spatial
|
||||
### Derived from [[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]]".
|
||||
### `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).
|
||||
|
||||
## Methods
|
||||
### `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`.
|
||||
|
||||
### `rotateAround(Vector3 point, Quat rotation)`
|
||||
Rotates the Spatial around `point` (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 "absolute" position in space intact.
|
||||
4
docs/stardust-protocol/server/types/_category_.json
Normal file
4
docs/stardust-protocol/server/types/_category_.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Node Types",
|
||||
"position": 1
|
||||
}
|
||||
6
docs/stardust-protocol/server/types/field/BoxField.md
Normal file
6
docs/stardust-protocol/server/types/field/BoxField.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# BoxField
|
||||
Derived from [[Field]], this Field is in a rectangular prism shape.
|
||||
|
||||
## Properties
|
||||
### `setSize(Vector3 size)`
|
||||
Sets the size of the box.
|
||||
13
docs/stardust-protocol/server/types/field/Field.md
Normal file
13
docs/stardust-protocol/server/types/field/Field.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Field
|
||||
### Derived from [[Spatial]]
|
||||
Type that contains methods all Fields share. All fields created are under `/field`.
|
||||
|
||||
## 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.
|
||||
6
docs/stardust-protocol/server/types/field/SphereField.md
Normal file
6
docs/stardust-protocol/server/types/field/SphereField.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# SphereField
|
||||
Derived from [[Field]], this Field is in a sphere shape.
|
||||
|
||||
## Properties
|
||||
### `setRadius(double size)`
|
||||
Sets the radius of the sphere.
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Fields",
|
||||
"position": 4
|
||||
}
|
||||
23
docs/stardust-protocol/server/types/input/InputHandler.md
Executable file
23
docs/stardust-protocol/server/types/input/InputHandler.md
Executable file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
# InputHandler
|
||||
## Derived from [[Spatial]] (`scalable: false`)
|
||||
|
||||
A handler to allow clients to recieve input.
|
||||
|
||||
## Methods
|
||||
### `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` relative to the pose's space.
|
||||
|
||||
### `setField(string field)`
|
||||
Sets the field this input handler will use.
|
||||
|
||||
### `setCallback(string callbackPath, string callbackMethod)`
|
||||
Sets the callback this input handler will use.
|
||||
49
docs/stardust-protocol/server/types/input/InputMethod.md
Executable file
49
docs/stardust-protocol/server/types/input/InputMethod.md
Executable file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
# InputMethod
|
||||
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]] | 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. |
|
||||
|
||||
### `datamap: Dictionary`
|
||||
See #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. |
|
||||
|
||||
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.
|
||||
|
||||
### `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.
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Input",
|
||||
"position": 5
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
include "common.fbs";
|
||||
namespace StardustXR;
|
||||
|
||||
table Hand {
|
||||
finger_joints:[joint] (required);
|
||||
|
||||
palm:joint (required);
|
||||
wrist:joint (required);
|
||||
elbow:joint;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
# HandInput
|
||||
### Derived from [[InputMethod]] and [[Spatial]] (`scalable: false`)
|
||||
|
||||
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
|
||||
@@ -0,0 +1,16 @@
|
||||
include "PointerInput.fbs";
|
||||
include "HandInput.fbs";
|
||||
namespace StardustXR;
|
||||
|
||||
union InputDataRaw {
|
||||
Pointer,
|
||||
Hand
|
||||
}
|
||||
|
||||
table InputData {
|
||||
input:InputDataRaw (required);
|
||||
distance:float = 0;
|
||||
datamap:[ubyte] (flexbuffer);
|
||||
}
|
||||
|
||||
root_type InputData;
|
||||
@@ -0,0 +1,8 @@
|
||||
include "common.fbs";
|
||||
namespace StardustXR;
|
||||
|
||||
table Pointer {
|
||||
origin:vec3 (required);
|
||||
direction:vec3 (required);
|
||||
tilt:float = 0;
|
||||
}
|
||||
36
docs/stardust-protocol/server/types/input/inputtypes/PointerInput.md
Executable file
36
docs/stardust-protocol/server/types/input/inputtypes/PointerInput.md
Executable file
@@ -0,0 +1,36 @@
|
||||
# PointerInput
|
||||
### Derived from [[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.
|
||||
|
||||
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. |
|
||||
|
||||
## 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.
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace StardustXR;
|
||||
|
||||
struct vec3 {
|
||||
x:float;
|
||||
y:float;
|
||||
z:float;
|
||||
}
|
||||
|
||||
struct quat {
|
||||
w:float;
|
||||
x:float;
|
||||
y:float;
|
||||
z:float;
|
||||
}
|
||||
|
||||
struct pose {
|
||||
position:vec3;
|
||||
rotation:quat;
|
||||
}
|
||||
|
||||
struct joint {
|
||||
position:vec3;
|
||||
rotation:quat;
|
||||
radius:float;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
flatc -c *.fbs $@
|
||||
Reference in New Issue
Block a user