Skip to content

Commit

Permalink
move to crates folder
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Nov 27, 2023
1 parent bc31e2f commit b0356d8
Show file tree
Hide file tree
Showing 68 changed files with 396 additions and 18 deletions.
12 changes: 2 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
[workspace]
resolver = "2"
members = [
"unavi-app",
"unavi-native",
"unavi-server",
"unavi-system-api",
"unavi-ui",
"unavi-web/client",
"unavi-web/common",
"unavi-wired-api",
"wired-protocol-proto"
"crates/*",
]

[workspace.package]
Expand All @@ -27,7 +19,7 @@ bin-package = "unavi-server"
bin-default-features = true
lib-package = "unavi-web-client"
lib-profile-release = "wasm-release"
style-file = "unavi-web/common/style.css"
style-file = "crates/unavi-web-common/style.css"

[profile.dev]
opt-level = 1
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use unavi_app::networking::JoinWorld;
fn main() {
unavi_app::App::new()
.add_plugins(unavi_app::UnaviPlugin {
file_path: "../assets".to_string(),
file_path: "../../assets".to_string(),
log_level: tracing::Level::DEBUG,
})
.add_systems(Startup, setup_world)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(unavi_app::UnaviPlugin {
file_path: "../assets".to_string(),
file_path: "../../assets".to_string(),
..default()
})
.run();
Expand Down
2 changes: 1 addition & 1 deletion unavi-server/Cargo.toml → crates/unavi-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tracing-subscriber = "0.3.18"

leptos = { version = "0.5.1", features = ["ssr"], optional = true }
leptos_axum = { version = "0.5.1", optional = true }
unavi-web-common= { path = "../unavi-web/common", features = ["ssr"], optional = true }
unavi-web-common= { path = "../unavi-web-common", features = ["ssr"], optional = true }

aeronet = { version = "0.3.0", features = ["bevy"], optional = true }
aeronet_wt_core = { version = "0.3.0", optional = true }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions crates/unavi-ui/wit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# wired-protocol-wit

[WIT](https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md) specification for [The Wired 🔌](https://github.com/unavi-xyz/wired-protocol).

### (!) Contains extraneous code

This repo contains additional `.wit` files beyond the scope of The Wired.
This is a temporary solution to ease development of [UNAVI](https://github.com/unavi-xyz/unavi), as WIT tooling is very young with no good solution for dependency management.
Hopefully a solution is merged upstream soon 🙏.
7 changes: 7 additions & 0 deletions crates/unavi-ui/wit/unavi_button.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package unavi:button;

world button {
use hover.{hover-state};

export press: func(state: hover-state);
}
15 changes: 15 additions & 0 deletions crates/unavi-ui/wit/wired_input.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
interface hover {
enum hover-state {
hovering,
not-hovering
}

record hover-event {
cursor: u32,
state: hover-state,
time: u64
}

on-hover-enter: func(event: hover-event);
on-hover-leave: func(event: hover-event);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
leptos = { version = "0.5.1", features = ["hydrate"] }
unavi-web-common = { path = "../common", features = ["hydrate"] }
unavi-app = { path = "../../unavi-app" }
unavi-web-common = { path = "../unavi-web-common", features = ["hydrate"] }
unavi-app = { path = "../unavi-app" }
console_error_panic_hook = "0.1.7"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions crates/unavi-wired-api/wit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# wired-protocol-wit

[WIT](https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md) specification for [The Wired 🔌](https://github.com/unavi-xyz/wired-protocol).

### (!) Contains extraneous code

This repo contains additional `.wit` files beyond the scope of The Wired.
This is a temporary solution to ease development of [UNAVI](https://github.com/unavi-xyz/unavi), as WIT tooling is very young with no good solution for dependency management.
Hopefully a solution is merged upstream soon 🙏.
7 changes: 7 additions & 0 deletions crates/unavi-wired-api/wit/button.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package unavi:button;

world button {
use hover.{hover-state};

export press: func(state: hover-state);
}
15 changes: 15 additions & 0 deletions crates/unavi-wired-api/wit/input.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
interface hover {
enum hover-state {
hovering,
not-hovering
}

record hover-event {
cursor: u32,
state: hover-state,
time: u64
}

on-hover-enter: func(event: hover-event);
on-hover-leave: func(event: hover-event);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions crates/wired-protocol-proto/protos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# wired-protocol-proto

[Protobuf](https://protobuf.dev/) specification for [The Wired 🔌](https://github.com/unavi-xyz/wired-protocol).
23 changes: 23 additions & 0 deletions crates/wired-protocol-proto/protos/world/webrtc/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";

package world.webrtc.common;

message Position {
float x = 1;
float y = 2;
float z = 3;
}

message Rotation {
float x = 1;
float y = 2;
float z = 3;
float w = 4;
}


message Location {
Position body_position = 1;
float body_rotation = 2;
Rotation head_rotation = 3;
}
11 changes: 11 additions & 0 deletions crates/wired-protocol-proto/protos/world/webrtc/request.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";

package world.webrtc.request;

import "world/webrtc/common.proto";

message Request {
oneof message {
common.Location publish_location = 1;
}
}
16 changes: 16 additions & 0 deletions crates/wired-protocol-proto/protos/world/webrtc/response.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

package world.webrtc.response;

import "world/webrtc/common.proto";

message Response {
oneof message {
PlayerLocation player_location = 1;
}
}

message PlayerLocation {
uint32 player_id = 1;
common.Location location = 2;
}
17 changes: 17 additions & 0 deletions crates/wired-protocol-proto/protos/world/websocket/request.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package world.websocket.request;

import "world/websocket/signaling/request.proto";

message Request {
oneof message {
signaling.request.PauseAudio pause_audio = 1;
signaling.request.ConnectTransport connect_transport = 2;
signaling.request.CreateTransport create_transport = 3;
signaling.request.GetRouterRtpCapabilities get_router_rtp_capabilities = 4;
signaling.request.SetRtpCapabilities set_rtp_capabilities = 5;
signaling.request.Produce produce = 6;
signaling.request.ProduceData produce_data = 7;
}
}
17 changes: 17 additions & 0 deletions crates/wired-protocol-proto/protos/world/websocket/response.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package world.websocket.response;

import "world/websocket/signaling/response.proto";

message Response {
oneof response {
signaling.response.CreateConsumer create_consumer = 1;
signaling.response.CreateDataConsumer create_data_consumer = 2;
signaling.response.ProducerId producer_id = 3;
signaling.response.DataProducerId data_producer_id = 4;
signaling.response.RouterRtpCapabilities router_rtp_capabilities = 5;
signaling.response.TransportCreated transport_created = 6;
signaling.response.TransportConnected transport_connected = 13;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
syntax = "proto3";

package world.websocket.signaling.common;

enum TransportType {
CONSUMER = 0;
PRODUCER = 1;
}

message DtlsParameters {
enum Role {
AUTO = 0;
CLIENT = 1;
SERVER = 2;
}

message Fingerprint {
string algorithm = 1;
string value = 2;
}

Role role = 1;
repeated Fingerprint fingerprints = 2;
}

message IceCandidate {
enum Protocol {
UDP = 0;
TCP = 1;
}

enum Type {
HOST = 0;
SRFLX = 1;
PRFLX = 2;
RELAY = 3;
}

enum TcpType {
ACTIVE = 0;
PASSIVE = 1;
SO = 2;
}

string foundation = 1;
int32 priority = 2;
string ip = 3;
int32 port = 4;
Protocol protocol = 5;
Type type = 6;
optional TcpType tcp_type = 7;
}

message RtcpFeedback {
string type = 1;
optional string parameter = 2;
}


message RtpCapabilities {
enum MediaKind {
AUDIO = 0;
VIDEO = 1;
}

message Codec {
MediaKind kind = 1;
string mime_type = 2;
int32 clock_rate = 3;
optional int32 channels = 4;
repeated RtcpFeedback rtcp_feedback = 5;
}

message HeaderExtension {
enum Direction {
SENDRECV = 0;
SENDONLY = 1;
RECVONLY = 2;
INACTIVE = 3;
}

string uri = 1;
MediaKind kind = 2;
int32 preferred_id = 3;
optional bool preferred_encrypt = 4;
optional Direction direction = 5;
}

repeated Codec codecs = 1;
repeated HeaderExtension header_extensions = 2;
}

message RtpParameters {
message Codec {
string mime_type = 1;
int32 payload_type = 2;
int32 clock_rate = 3;
optional int32 channels = 4;
repeated RtcpFeedback rtcp_feedback = 5;
}

message HeaderExtension {
string uri = 1;
int32 id = 2;
}

repeated Codec codecs = 1;
repeated HeaderExtension header_extensions = 2;
}

message SctpParameters {
message PartialReliability {
optional bool allowed = 1;
optional int32 max_retransmits = 2;
optional int32 max_packet_life_time = 3;
}

int32 port = 1;
optional int32 max_message_size = 2;
optional int32 max_retransmits = 3;
optional bool negotiated = 4;
optional bool stream_reset = 5;
optional PartialReliability partial_reliability = 6;
}

message SctpStreamParameters {
int32 stream_id = 1;
optional bool ordered = 2;
optional int32 max_packet_life_time = 3;
optional int32 max_retransmits = 4;
optional string protocol = 6;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";

package world.websocket.signaling.request;

import "world/websocket/signaling/common.proto";

message PauseAudio {
bool paused = 1;
}

message ConnectTransport {
common.TransportType type = 1;
common.DtlsParameters dtlsParameters = 2;
}

message CreateTransport {
common.TransportType type = 1;
}

message GetRouterRtpCapabilities {
}

message SetRtpCapabilities {
common.RtpCapabilities rtpCapabilities = 1;
}

message Produce {
common.RtpParameters rtpParameters = 1;
}

message ProduceData {
common.SctpStreamParameters sctpStreamParameters = 1;
}
Loading

0 comments on commit b0356d8

Please sign in to comment.