Skip to content

Commit

Permalink
add rectangle shape
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Aug 21, 2024
1 parent 3ad6898 commit bb97e11
Show file tree
Hide file tree
Showing 31 changed files with 4,515 additions and 1,849 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

445 changes: 323 additions & 122 deletions wasm/example-unavi-scene/src/bindings.rs

Large diffs are not rendered by default.

446 changes: 323 additions & 123 deletions wasm/example-unavi-shapes/src/bindings.rs

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions wasm/example-unavi-shapes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use bindings::{
exports::wired::script::types::{Guest, GuestScript},
unavi::{
scene::api::{Root, Scene},
shapes::api::{Cuboid, Cylinder, Sphere, Vec3},
shapes::api::{Cuboid, Cylinder, Rectangle, Sphere},
},
wired::math::types::Transform,
wired::math::types::{Transform, Vec2, Vec3},
};

#[allow(warnings)]
Expand All @@ -17,6 +17,7 @@ impl GuestScript for Script {
fn new() -> Self {
let scene = Scene::new();

// 3D
let cuboid = Cuboid::new(Vec3::new(1.0, 0.5, 1.5)).to_physics_node();
cuboid.set_transform(Transform::from_translation(Vec3::new(3.0, 0.0, 0.0)));
scene.add_node(&cuboid);
Expand All @@ -32,6 +33,11 @@ impl GuestScript for Script {
let cylinder = Cylinder::new(0.5, 1.0).to_physics_node();
scene.add_node(&cylinder);

// 2D
let rectangle = Rectangle::new(Vec2::splat(1.0)).to_physics_node();
rectangle.set_transform(Transform::from_translation(Vec3::new(-1.5, 0.0, 0.0)));
scene.add_node(&rectangle);

Root::add_scene(&scene);

Script
Expand Down
1 change: 1 addition & 0 deletions wasm/example-unavi-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package = "example:unavi-ui"

[package.metadata.component.target.dependencies]
"unavi:scene" = { path = "../unavi-scene/wit" }
"unavi:shapes" = { path = "../unavi-shapes/wit" }
"unavi:ui" = { path = "../unavi-ui/wit" }
"wired:input" = { path = "../../wired-protocol/spatial/wit/wired-input" }
"wired:log" = { path = "../../wired-protocol/spatial/wit/wired-log" }
Expand Down
256 changes: 135 additions & 121 deletions wasm/example-unavi-ui/src/bindings.rs

Large diffs are not rendered by default.

600 changes: 400 additions & 200 deletions wasm/example-wired-input/src/bindings.rs

Large diffs are not rendered by default.

600 changes: 400 additions & 200 deletions wasm/example-wired-physics/src/bindings.rs

Large diffs are not rendered by default.

575 changes: 388 additions & 187 deletions wasm/example-wired-scene/src/bindings.rs

Large diffs are not rendered by default.

318 changes: 159 additions & 159 deletions wasm/test-wired-player/src/bindings.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions wasm/test-wired-scene/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ wit-bindgen-rt.workspace = true
package = "test:wired-scene"

[package.metadata.component.target.dependencies]
"unavi:shapes" = { path = "../unavi-shapes/wit" }
"wired:input" = { path = "../../wired-protocol/spatial/wit/wired-input" }
"wired:log" = { path = "../../wired-protocol/spatial/wit/wired-log" }
"wired:math" = { path = "../../wired-protocol/spatial/wit/wired-math" }
Expand Down
332 changes: 173 additions & 159 deletions wasm/test-wired-scene/src/bindings.rs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions wasm/unavi-scene/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ package = "unavi:scene"
world = "guest"

[package.metadata.component.target.dependencies]
"unavi:shapes" = { path = "../unavi-shapes/wit" }
"wired:input" = { path = "../../wired-protocol/spatial/wit/wired-input" }
"wired:log" = { path = "../../wired-protocol/spatial/wit/wired-log" }
"wired:math" = { path = "../../wired-protocol/spatial/wit/wired-math" }
"wired:physics" = { path = "../../wired-protocol/spatial/wit/wired-physics" }
"wired:scene" = { path = "../../wired-protocol/spatial/wit/wired-scene" }
332 changes: 173 additions & 159 deletions wasm/unavi-scene/src/bindings.rs

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions wasm/unavi-scene/wit/world.wit
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ world guest {
export api;
}

world prelude {
import api;
}

interface api {
use wired:math/types.{transform};
use wired:scene/node.{node};
Expand Down
1 change: 1 addition & 0 deletions wasm/unavi-shapes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ license.workspace = true
crate-type = ["cdylib"]

[dependencies]
glam.workspace = true
hexasphere = "14.1.0"
parry3d = "0.17.0"
wit-bindgen-rt.workspace = true
Expand Down
Loading

0 comments on commit bb97e11

Please sign in to comment.