Skip to content

Commit

Permalink
fix ci (#132)
Browse files Browse the repository at this point in the history
Signed-off-by: Schmarni <[email protected]>
  • Loading branch information
Schmarni-Dev authored Sep 29, 2024
1 parent d5f9227 commit 3860057
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 76 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install bevy dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
g++ pkg-config libx11-dev libasound2-dev libudev-dev libopenxr-loader1 libopenxr-dev
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2

- name: Clippy lints
run: cargo clippy --all --all-features --all-targets --no-deps -- -D warnings

Expand All @@ -37,6 +40,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install bevy dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
g++ pkg-config libx11-dev libasound2-dev libudev-dev libopenxr-loader1 libopenxr-dev
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2

Expand Down
4 changes: 3 additions & 1 deletion Cargo.lock

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

16 changes: 13 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ repository.workspace = true
edition.workspace = true
rust-version.workspace = true

[lints]
workspace = true


[workspace]
resolver = "2"
Expand All @@ -20,6 +23,11 @@ license = "MIT-0 OR Apache-2.0"
repository = "https://github.com/NexusSocial/nexus-vr"
rust-version = "1.81.0"

[workspace.lints.clippy]
too_many_arguments = "allow"
type_complexity = "allow"


[workspace.dependencies]


Expand All @@ -34,15 +42,17 @@ bincode = "1.3.3"
avian3d = { version = "0.1.2", features = ["serialize"] }
bevy_embedded_assets = "0.11.0"
bevy_web_file_drop = "0.0.6"
bevy_vr_controller = { path = "../bevy_vr_controller" }
bevy_vr_controller = { git = "https://github.com/unavi-xyz/bevy_vr_controller", rev = "4a5cc73" }
bevy_mod_openxr = { git = "https://github.com/awtterpip/bevy_oxr" }
bevy_xr_utils = { git = "https://github.com/awtterpip/bevy_oxr" }
bevy_spatial_egui = { path = "../bevy_spatial_egui" }
bevy_spatial_egui = { git = "https://github.com/Schmarni-Dev/bevy_spatial_egui" }
bevy_egui = "0.29.0"
bevy-suis = { git = "https://github.com/Schmarni-Dev/bevy-suis", branch = "further_work" }
bevy_vrm = "0.0.12"
egui-aesthetix = { version = "0.2.4", features = ["tokyo_night", "default"] }
bevy_suis_lasers = { path = "./crates/bevy_suis_lasers"}
bevy_suis_lasers = { path = "./crates/bevy_suis_lasers" }


[profile.release]
lto = true
codegen-units = 1
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_suis_lasers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ rust-version.workspace = true
bevy-suis = { git = "https://github.com/Schmarni-Dev/bevy-suis", branch = "further_work" }
bevy = { version = "0.14", default-features = false }

[lints]
workspace = true

[dev-dependencies]
bevy = { version = "0.14", default-features = true }
bevy_mod_openxr.git = "https://github.com/awtterpip/bevy_oxr"
3 changes: 1 addition & 2 deletions crates/bevy_suis_lasers/examples/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use bevy_suis::{
SuisCorePlugin,
};
use bevy_suis_lasers::{
draw_lasers::{Laser, LaserPlugin},
laser_input_methods::LaserInputMethodPlugin,
draw_lasers::LaserPlugin, laser_input_methods::LaserInputMethodPlugin,
};
fn main() -> AppExit {
App::new()
Expand Down
11 changes: 6 additions & 5 deletions crates/bevy_suis_lasers/src/draw_lasers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ impl Laser {
}
}

const TOTAL_LENGTH: f32 = SEGMENT_LENGTH + GAP_LENGTH;
impl Default for Laser {
fn default() -> Self {
Self::new()
}
}

const SEGMENT_LENGTH: f32 = 0.05;
const GAP_LENGTH: f32 = 0.03;
Expand Down Expand Up @@ -103,14 +107,12 @@ fn update_laser(

let mut position_along = 0.0;
let mut segment_count = 0;
let mut level = 0;
let mut segment_length = SEGMENT_LENGTH;
let mut gap_length = GAP_LENGTH;

while position_along < length {
// Adjust segment length and gap length every K segments
if segment_count > 0 && segment_count % K == 0 {
level += 1;
segment_length *= 2.0;
gap_length *= 2.0;
}
Expand All @@ -128,11 +130,10 @@ fn update_laser(
let rotation = Quat::from_rotation_arc(Vec3::Y, laser_direction);

// Scale the segment mesh along Y to represent the new length
let mut transform = Transform {
let transform = Transform {
translation: segment_position,
rotation,
scale: Vec3::new(1.0, segment_length / SEGMENT_LENGTH, 1.0),
..Default::default()
};

let bundle = PbrBundle {
Expand Down
28 changes: 25 additions & 3 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ all-features = true

[advisories]
version = 2
ignore = [
]
ignore = []

[licenses]
version = 2
Expand All @@ -25,6 +24,23 @@ allow = [
"LicenseRef-ring",
]

[[licenses.exceptions]]
name = "unicode-ident"
allow = ["Unicode-DFS-2016"]

[[licenses.exceptions]]
# https://github.com/emilk/egui/issues/2321
name = "epaint"
allow = ["OFL-1.1", "LicenseRef-UFL-1.0"]

[[licenses.clarify]]
name = "ring"
expression = "LicenseRef-ring"
license-files = [
{ path = "LICENSE", hash = 0xbd0eed23 },
]


[bans]
multiple-versions = "warn"
# Certain crates that we don't want multiple versions of in the dependency tree
Expand All @@ -38,4 +54,10 @@ unknown-registry = "deny"
unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# please don't make this list any longer qwq
allow-git = []
allow-git = [
"https://github.com/Schmarni-Dev/bevy-suis",
"https://github.com/awtterpip/bevy_oxr",
"https://github.com/unavi-xyz/bevy_vr_controller",
"https://github.com/Schmarni-Dev/bevy_spatial_egui",
"https://github.com/Schmarni-Dev/schminput"
]
26 changes: 10 additions & 16 deletions src/file_import.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use crate::MainWindow;
use bevy::log::info;
use bevy::math::EulerRot::XYZ;
use bevy::prelude::*;
use bevy_egui::{egui, EguiContext};
use bevy_spatial_egui::SpawnSpatialEguiWindowCommand;
use egui_aesthetix::Aesthetix;
use std::ops::{Add, Sub};
use std::path::Path;
use std::ops::Add;
use std::sync::Arc;

pub struct FileImportPlugin;
Expand All @@ -16,6 +14,7 @@ impl Plugin for FileImportPlugin {
}
}

#[allow(dead_code)]
#[derive(Copy, Clone, Component, Debug)]
pub enum FileType {
Vrm,
Expand All @@ -37,21 +36,16 @@ fn draw_ui(
ctx.get_mut().set_style(
Arc::new(egui_aesthetix::themes::TokyoNightStorm).custom_style(),
);
#[allow(clippy::needless_if)]
egui::panel::CentralPanel::default().show(ctx.get_mut(), |ui| {
ui.heading(format!("Path: {}", file_import_window.path));
if ui.button("png").clicked() {

}
if ui.button("worldspace model").clicked() {

}
if ui.button("switch avatar").clicked() {

}
ui.add_space(10.0);
if ui.button("cancel").clicked() {
commands.entity(entity).despawn_recursive();
}
if ui.button("png").clicked() {}
if ui.button("worldspace model").clicked() {}
if ui.button("switch avatar").clicked() {}
ui.add_space(10.0);
if ui.button("cancel").clicked() {
commands.entity(entity).despawn_recursive();
}
});
}
}
Expand Down
13 changes: 7 additions & 6 deletions src/file_sharing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::networking::{Connection, ConnectionTrait, ReliableMessage};
use bevy::prelude::*;
use bevy_matchbox::prelude::MultipleChannels;
use bevy_matchbox::MatchboxSocket;
use futures_channel::mpsc::{channel, Receiver, SendError, Sender};
use futures_channel::mpsc::{channel, Receiver, Sender};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use uuid::Uuid;
Expand All @@ -24,6 +24,7 @@ impl FilePart {
}
}

#[allow(dead_code)]
#[derive(Component)]
pub struct InProgressFile {
len: usize,
Expand Down Expand Up @@ -56,6 +57,7 @@ impl Plugin for FileSharingPlugin {
#[derive(Resource)]
struct P2pFileRx(Receiver<(Uuid, Vec<u8>)>);

#[allow(dead_code)]
#[derive(Resource)]
pub struct P2pFileSender(Sender<(Uuid, Vec<u8>)>);

Expand All @@ -70,7 +72,7 @@ fn send_parts_of_file(
for chunk in bytes.chunks(256) {
chunks.push(chunk.to_vec());
}
local.insert(uuid.clone(), chunks);
local.insert(uuid, chunks);
while let Err(e) = connection
.send_all(&ReliableMessage::FilePart(FilePart::Start { uuid, len }))
{
Expand All @@ -82,17 +84,16 @@ fn send_parts_of_file(

let mut list_of_empty = vec![];

for (uuid, mut chunks) in local.iter_mut() {
for (uuid, chunks) in local.iter_mut() {
if let Some(chunk) = chunks.pop() {
let message =
ReliableMessage::FilePart(FilePart::Part(uuid.clone(), chunk));
let message = ReliableMessage::FilePart(FilePart::Part(*uuid, chunk));
while let Err(e) = connection.send_all(&message) {
if e.first().unwrap().1.is_disconnected() {
return;
}
}
} else {
list_of_empty.push(uuid.clone());
list_of_empty.push(*uuid);
}
}

Expand Down
11 changes: 4 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use crate::file_import::FileImportPlugin;
use crate::file_sharing::FileSharingPlugin;
use crate::networking::{ConnectToRoom, LocalPlayer, NetworkingPlugin, SpawnPlayer};
use crate::networking::{ConnectToRoom, LocalPlayer, NetworkingPlugin};
use crate::physics_sync::PhysicsSyncNetworkingPlugin;
use crate::player_networking::PlayerNetworking;
use avian3d::prelude::{
Collider, CollisionLayers, GravityScale, LockedAxes, RigidBody,
};
use avian3d::prelude::{Collider, GravityScale, LockedAxes, RigidBody};
use avian3d::PhysicsPlugins;
use bevy::app::App;
use bevy::asset::{AssetMetaCheck, AssetServer, Assets, Handle};
Expand All @@ -23,10 +21,8 @@ use bevy_suis::debug::SuisDebugGizmosPlugin;
use bevy_suis::window_pointers::SuisWindowPointerPlugin;
use bevy_suis::SuisCorePlugin;
use bevy_vr_controller::animation::defaults::default_character_animations;
use bevy_vr_controller::movement::PlayerInputState;
use bevy_vr_controller::player::{
PlayerAvatar, PlayerBody, PlayerHeight, PlayerJumpHeight, PlayerSettings,
PlayerSpawn, PlayerSpeed, SpawnedPlayer, VoidTeleport,
PlayerAvatar, PlayerBody, PlayerSettings, PlayerSpawn, VoidTeleport,
};
use bevy_vr_controller::velocity::AverageVelocity;
use bevy_vr_controller::VrControllerPlugin;
Expand Down Expand Up @@ -118,6 +114,7 @@ fn setup_main_window(mut cmds: Commands) {
});
}

#[allow(dead_code)]
#[derive(Resource)]
pub struct FloorMaterial((Handle<StandardMaterial>, Handle<Mesh>));

Expand Down
6 changes: 3 additions & 3 deletions src/networking.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::file_sharing::FileParts;
use avian3d::prelude::{AngularVelocity, LinearVelocity, Position};
use bevy::app::App;
use bevy::ecs::system::{EntityCommand, SystemParam};
use bevy::ecs::world::Command;
use bevy::ecs::system::SystemParam;
use bevy::prelude::*;
use bevy_derive::{Deref, DerefMut};
use bevy_matchbox::prelude::{
Expand All @@ -19,6 +17,8 @@ pub enum ReliableMessage {
FilePart(crate::file_sharing::FilePart),
}

// should this used Boxed values for a smaller base size?
#[allow(clippy::large_enum_variant)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum UnreliableMessage {
UpdatePhysicsPosition(UpdatePhysicsPosition),
Expand Down
18 changes: 9 additions & 9 deletions src/physics_sync.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::networking::{RemotePlayer, UpdatePhysicsPosition};
use avian3d::math::AsF32;
use avian3d::prelude::{AngularVelocity, LinearVelocity, Position, Rotation};
use bevy::prelude::*;

Expand All @@ -22,19 +21,20 @@ fn sync_positions(
)>,
) {
for update in event_reader.read() {
for (uuid, mut pos, mut rot, mut lin, mut ang) in players.iter_mut() {
for (uuid, mut pos, mut rot, mut lin, _) in players.iter_mut() {
if uuid.0 != update.uuid {
continue;
}
if pos.distance(*update.position) <= 0.01 {
if rot.0.angle_between(update.rotation.0).abs() <= 0.01 {
continue;
}
// This position check is one centimeter?! that's a little big no?
if pos.distance(*update.position) <= 0.01
&& rot.0.angle_between(update.rotation.0).abs() <= 0.01
{
continue;
}

*pos = update.position.clone();
*rot = update.rotation.clone();
*lin = update.linear_velocity.clone();
*pos = update.position;
*rot = update.rotation;
*lin = update.linear_velocity;
//*ang = update.angular_velocity.clone();
}
}
Expand Down
Loading

0 comments on commit 3860057

Please sign in to comment.