Skip to content

Commit

Permalink
deps update (#126)
Browse files Browse the repository at this point in the history
features
- linux: livekit networking re-enabled
- discover tab search filter

bugfixes
- fix not removing old `UiBackground`s causing ghosting in spritesheets
- fix crash on dropdown index oob
- windows: fix crash on minimize due to 0 fontsize
- fix location of avatar sounds
- fix wearable/emote search filter

misc
- update workflow to use bigwin runner
- deno updated to 1.46
- livekit updated to 0.6
- continue executing scenes after uncaught errors
  • Loading branch information
robtfm authored Sep 27, 2024
1 parent 68c8c70 commit 5a8a4d4
Show file tree
Hide file tree
Showing 26 changed files with 463 additions and 211 deletions.
3 changes: 2 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static", "-C", "link-args=/force:multiple"]
rustflags = ["-C", "target-feature=+crt-static"]

[target.aarch64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
Expand All @@ -12,3 +12,4 @@ rustflags = ["-C", "link-args=-ObjC"]

[env]
RUST_BACKTRACE = "1"
CARGO_FEATURE_CRT_STATIC = "ohyes"
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [self-hosted-windows, ubuntu-latest, macos-latest]
os: [bigwin, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-6.0-full_build-shared.7z" -OutFile ffmpeg-6.0-full_build-shared.7z
Invoke-WebRequest "https://github.com/GyanD/codexffmpeg/releases/download/6.0/ffmpeg-6.0-full_build-shared.7z" -OutFile ffmpeg-6.0-full_build-shared.7z
7z x ffmpeg-6.0-full_build-shared.7z
mkdir ffmpeg
mv ffmpeg-*/* ffmpeg/
Expand All @@ -114,7 +114,7 @@ jobs:
if: runner.os == 'linux'
with:
command: test
args: --all --release --no-default-features --features "ffmpeg"
args: --all --release
- uses: actions-rs/cargo@v1
if: runner.os == 'macos'
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# os: macos-14-large

- build_name: windows-x86_64
os: self-hosted-windows
os: bigwin
# target: x86_64-pc-windows-msvc

env:
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-6.0-full_build-shared.7z" -OutFile ffmpeg-6.0-full_build-shared.7z
Invoke-WebRequest "https://github.com/GyanD/codexffmpeg/releases/download/6.0/ffmpeg-6.0-full_build-shared.7z" -OutFile ffmpeg-6.0-full_build-shared.7z
7z x ffmpeg-6.0-full_build-shared.7z
mkdir ffmpeg
mv ffmpeg-*/* ffmpeg/
Expand All @@ -122,7 +122,7 @@ jobs:
run: cargo build --release --bin decentra-bevy
- name: Cargo build (linux)
if: runner.os == 'linux'
run: cargo build --release --bin decentra-bevy --no-default-features --features "ffmpeg,inspect"
run: cargo build --release --bin decentra-bevy

- name: Package common
run: |
Expand Down Expand Up @@ -177,13 +177,13 @@ jobs:
cd deploy/linux
mkdir BevyExplorer.AppDir/usr
mkdir BevyExplorer.AppDir/usr/bin
cp ../target/release/decentra-bevy BevyExplorer.AppDir/usr/bin
cp ../assets BevyExplorer.AppDir/usr/bin -r
cp ../../target/release/decentra-bevy BevyExplorer.AppDir/usr/bin
cp ../../assets BevyExplorer.AppDir/usr/bin -r
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
chmod +x ./linuxdeploy-x86_64.AppImage
chmod +x ./appimagetool-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appdir BevyExplorer.AppDir --output appimage --create-desktop-file --executable=../target/release/decentra-bevy --icon-file=decentra-bevy.png
./linuxdeploy-x86_64.AppImage --appdir BevyExplorer.AppDir --output appimage --create-desktop-file --executable=../../target/release/decentra-bevy --icon-file=decentra-bevy.png
mv ./decentra-bevy-x86_64.AppImage ${{ env.APPIMAGE_FILE }}
gh release upload "${{ needs.create-release.outputs.tag_name }}" ${{ env.APPIMAGE_FILE }}
env:
Expand Down
16 changes: 11 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ serde = "1.0.152"
serde_json = { version = "1.0.92", features = ["raw_value"] }

itertools = "0.12"
tokio = { version = "1.29.1", features = ["sync"] }
tokio = { version = "1.40", features = ["sync"] }
anyhow = "1.0.70"
urn = "0.7.0"
ethers-signers = "2.0.3"
Expand Down Expand Up @@ -162,10 +162,16 @@ bevy = { git = "https://github.com/robtfm/bevy", branch = "release-0.14-dcl-cosm
ffmpeg-next = { git = "https://github.com/robtfm/rust-ffmpeg", branch = "audio-linesize-0-6.1" }
# parry3d-f64 = { git = "https://github.com/robtfm/parry", branch = "try_convex" }
# rapier3d-f64 = { git = "https://github.com/robtfm/rapier", branch = "master" }
deno_core = { git = "https://github.com/robtfm/deno_core", branch = "0_280_hotfix" }
serde_v8 = { git = "https://github.com/robtfm/deno_core", branch = "0_280_hotfix" }
deno_ops = { git = "https://github.com/robtfm/deno_core", branch = "0_280_hotfix" }
# deno_ops = { path = "../deno_core/ops" }
deno_core = { git = "https://github.com/robtfm/deno_core", branch = "0_307_hotfix" }
serde_v8 = { git = "https://github.com/robtfm/deno_core", branch = "0_307_hotfix" }
deno_ops = { git = "https://github.com/robtfm/deno_core", branch = "0_307_hotfix" }
deno_console = { git = "https://github.com/robtfm/deno", branch = "1_46_hotfix" }
deno_fetch = { git = "https://github.com/robtfm/deno", branch = "1_46_hotfix" }
deno_net = { git = "https://github.com/robtfm/deno", branch = "1_46_hotfix" }
deno_url = { git = "https://github.com/robtfm/deno", branch = "1_46_hotfix" }
deno_webidl = { git = "https://github.com/robtfm/deno", branch = "1_46_hotfix" }
deno_web = { git = "https://github.com/robtfm/deno", branch = "1_46_hotfix" }
deno_websocket = { git = "https://github.com/robtfm/deno", branch = "1_46_hotfix" }

# [patch."https://github.com/robtfm/bevy_dui"]
# bevy_dui = { path = "../bevy_dui" }
Expand Down
8 changes: 6 additions & 2 deletions assets/ui/discover.dui
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
<div style="width: 80%">
<button-set style="width: 100%; flex-wrap: wrap; align-content: center; align-items: center; justify-content: center;" buttons="@category-buttons" />
</div>
<div style="flex-direction: column; width: 10%; align-items: center;">
<div style="flex-direction: column; width: 15%; align-items: center;">
<med-text text="sort by" />
<combo-box style="width: 80%; height: 2.8vmin;" options="@sort-options" selected="@initial-sort" onchanged="@sort-by-changed"/>
<combo-box style="width: 80%; height: 2.8vmin; background-color: #00000055;" options="@sort-options" selected="@initial-sort" onchanged="@sort-by-changed"/>
</div>
<div style="flex-direction: column; width: 10%; align-items: center;">
<med-text text="worlds" />
<div style="width: 6.2vmin; height: 2.8vmin;"><toggle ontoggle="@world-toggle" /></div>
</div>
<div style="align-items: center; flex-direction: column; width: 25%; flex-grow: 1; margin: 1vmin;">
<med-text style="align-self: center;" text="filter" />
<text-entry style="align-self: center; height: 3vmin; width: 100%; background-color: #00000055;" hint-text="(type to filter)" initial-text="@initial-filter" onchanged="@filter-changed" />
</div>
</div>
<hr-thin />
<div style="width: 100%; max-width: 100%; height: 10%; flex-grow: 1; flex-direction: row;">
Expand Down
4 changes: 2 additions & 2 deletions assets/ui/emote.dui
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<space />
<div style="align-items: center; flex-direction: column; width: 25%; flex-grow: 1; margin: 1vmin;">
<med-text style="align-self: center;" text="sort by" />
<combo-box style="align-self: center; height: 3vmin; width: 100%;" options="@sort-by" selected="@initial-sort-by" onchanged="@sort-by-changed" allow-null="false" disabled="false" />
<combo-box style="align-self: center; height: 3vmin; width: 100%; background-color: #00000055;" options="@sort-by" selected="@initial-sort-by" onchanged="@sort-by-changed" allow-null="false" disabled="false" />
</div>
<div style="align-items: center; flex-direction: column; width: 25%; flex-grow: 1; margin: 1vmin;">
<med-text style="align-self: center;" text="filter" />
<text-entry style="align-self: center; height: 3vmin; width: 100%; min-width: 100%;" hint-text="(type to filter)" initial-text="@initial-filter" onchanged="@filter-changed" />
<text-entry style="align-self: center; height: 3vmin; width: 100%; min-width: 100%; background-color: #00000055;" hint-text="(type to filter)" initial-text="@initial-filter" onchanged="@filter-changed" />
</div>

</div>
Expand Down
6 changes: 3 additions & 3 deletions assets/ui/wearables.dui
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
</div>
<div style="align-items: center; flex-direction: column; width: 25%; flex-grow: 1; margin: 1vmin;">
<med-text style="align-self: center;" text="collection" />
<combo-box id="collections" style="align-self: center; height: 3vmin; width: 100%;" empty-text="choose a collection" options="@collections" selected="@initial-collection" allow-null="true" disabled="true" />
<combo-box id="collections" style="align-self: center; height: 3vmin; width: 100%; background-color: #00000055;" empty-text="choose a collection" options="@collections" selected="@initial-collection" allow-null="true" disabled="true" />
</div>
<space />
<div style="align-items: center; flex-direction: column; width: 25%; flex-grow: 1; margin: 1vmin;">
<med-text style="align-self: center;" text="sort by" />
<combo-box style="align-self: center; height: 3vmin; width: 100%;" options="@sort-by" selected="@initial-sort-by" onchanged="@sort-by-changed" allow-null="false" disabled="false" />
<combo-box style="align-self: center; height: 3vmin; width: 100%; background-color: #00000055;" options="@sort-by" selected="@initial-sort-by" onchanged="@sort-by-changed" allow-null="false" disabled="false" />
</div>
<div style="align-items: center; flex-direction: column; width: 25%; flex-grow: 1; margin: 1vmin;">
<med-text style="align-self: center;" text="filter" />
<text-entry style="align-self: center; height: 3vmin; width: 100%;" hint-text="(type to filter)" initial-text="@initial-filter" onchanged="@filter-changed" />
<text-entry style="align-self: center; height: 3vmin; width: 100%; background-color: #00000055;" hint-text="(type to filter)" initial-text="@initial-filter" onchanged="@filter-changed" />
</div>

</div>
Expand Down
62 changes: 31 additions & 31 deletions crates/av/src/audio_source.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::time::Duration;

use bevy::{
prelude::*,
utils::{HashMap, HashSet},
};
use bevy_kira_audio::{
prelude::{AudioEmitter, AudioReceiver},
AudioControl, AudioInstance, AudioTween,
};
use bevy_kira_audio::{prelude::AudioEmitter, AudioControl, AudioInstance, AudioTween};
use common::{
sets::{SceneSets, SetupSets},
sets::SetupSets,
structs::{AudioSettings, PrimaryCameraRes, PrimaryUser, SystemAudio},
util::{AudioReceiver, VolumePanning},
};
use dcl::interface::ComponentPosition;
use dcl_component::{proto_components::sdk::components::PbAudioSource, SceneComponentId};
Expand Down Expand Up @@ -37,8 +37,9 @@ impl Plugin for AudioSourcePlugin {
ComponentPosition::EntityOnly,
);
app.add_systems(
Update,
(update_audio, update_source_volume, play_system_audio).in_set(SceneSets::PostLoop),
PostUpdate,
(update_audio, update_source_volume, play_system_audio)
.after(TransformSystem::TransformPropagate),
);
app.add_systems(Startup, setup_audio.in_set(SetupSets::Main));
}
Expand Down Expand Up @@ -229,20 +230,20 @@ fn play_system_audio(
})
}

#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
fn update_source_volume(
query: Query<(
Entity,
&SceneEntity,
&AudioSource,
Option<&SceneEntity>,
Option<&AudioSource>,
&AudioEmitter,
&GlobalTransform,
)>,
mut audio_instances: ResMut<Assets<AudioInstance>>,
containing_scene: ContainingScene,
player: Query<Entity, With<PrimaryUser>>,
mut prev_scenes: Local<HashSet<Entity>>,
receiver: Query<&GlobalTransform, With<AudioReceiver>>,
pan: VolumePanning,
settings: Res<AudioSettings>,
mut all_instances: Local<HashMap<Entity, Vec<Handle<AudioInstance>>>>,
) {
Expand All @@ -252,39 +253,38 @@ fn update_source_volume(
.map(|p| containing_scene.get(p))
.unwrap_or_default();

let Ok(receiver) = receiver.get_single() else {
return;
};

let mut prev_instances = std::mem::take(&mut *all_instances);

for (ent, scene, source, emitter, transform) in query.iter() {
if current_scenes.contains(&scene.root) {
let (volume, panning) = if source.0.global() {
(source.0.volume.unwrap_or(1.0), 0.5)
for (ent, maybe_scene, maybe_source, emitter, transform) in query.iter() {
if maybe_scene.map_or(true, |scene| current_scenes.contains(&scene.root)) {
let (volume, panning) = if maybe_source.map_or(false, |source| source.0.global()) {
(
maybe_source
.and_then(|source| source.0.volume)
.unwrap_or(1.0),
0.5,
)
} else {
let sound_path = transform.translation() - receiver.translation();
let volume = (1. - sound_path.length() / 125.0).clamp(0., 1.).powi(2)
* source.0.volume.unwrap_or(1.0)
* settings.scene();

let panning = if sound_path.length() > f32::EPSILON {
let right_ear_angle = receiver.right().angle_between(sound_path);
(right_ear_angle.cos() + 1.) / 2.
let volume_adjust = if maybe_scene.is_some() {
settings.scene()
} else {
0.5
settings.avatar()
};

(volume, panning)
let (volume, panning) = pan.volume_and_panning(transform.translation());

(volume * volume_adjust, panning)
};

for h_instance in &emitter.instances {
if let Some(instance) = audio_instances.get_mut(h_instance) {
instance.set_volume(volume as f64, AudioTween::default());
instance.set_volume(volume as f64, AudioTween::linear(Duration::ZERO));
instance.set_panning(panning as f64, AudioTween::default());
} else {
warn!("missing audio instance");
}
}
} else if prev_scenes.contains(&scene.root) {
} else if maybe_scene.map_or(false, |scene| prev_scenes.contains(&scene.root)) {
debug!("stop [{:?}]", ent);
for h_instance in &emitter.instances {
if let Some(instance) = audio_instances.get_mut(h_instance) {
Expand Down
25 changes: 20 additions & 5 deletions crates/avatar/src/animate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use common::{
rpc::{RpcCall, RpcEventSender},
sets::SceneSets,
structs::{AppConfig, PrimaryUser},
util::{TryPushChildrenEx, VolumePanning},
};
use comms::{
chat_marker_things,
Expand Down Expand Up @@ -503,7 +504,13 @@ impl SpawnedExtras {
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
fn play_current_emote(
mut commands: Commands,
mut q: Query<(Entity, &mut ActiveEmote, &AvatarAnimPlayer, &Children)>,
mut q: Query<(
Entity,
&mut ActiveEmote,
&AvatarAnimPlayer,
&Children,
&GlobalTransform,
)>,
definitions: Query<&AvatarDefinition>,
mut emote_loader: CollectibleManager<Emote>,
mut gltfs: ResMut<Assets<Gltf>>,
Expand All @@ -519,11 +526,12 @@ fn play_current_emote(
mut cached_gltf_handles: Local<HashSet<Handle<Gltf>>>,
mut spawned_extras: Local<HashMap<Entity, SpawnedExtras>>,
mut scene_spawner: ResMut<SceneSpawner>,
(audio, sounds, anim_clips, config): (
(audio, sounds, anim_clips, config, pan): (
Res<bevy_kira_audio::Audio>,
Res<Assets<bevy_kira_audio::AudioSource>>,
Res<Assets<AnimationClip>>,
Res<AppConfig>,
VolumePanning,
),
mut emitters: Query<&mut bevy_kira_audio::prelude::AudioEmitter>,
mut audio_instances: ResMut<Assets<AudioInstance>>,
Expand All @@ -532,7 +540,7 @@ fn play_current_emote(
let prior_playing = std::mem::take(&mut *playing);
let mut prev_spawned_extras = std::mem::take(&mut *spawned_extras);

for (entity, mut active_emote, target_entity, children) in q.iter_mut() {
for (entity, mut active_emote, target_entity, children, transform) in q.iter_mut() {
debug!("emote {}", active_emote.urn);
let Some(definition) = children
.iter()
Expand Down Expand Up @@ -877,6 +885,7 @@ fn play_current_emote(
if elapsed >= play_time {
debug!("duration {}", clip_duration);
debug!("play {:?} @ {}>{}", sound.path(), elapsed, play_time);
let (volume, panning) = pan.volume_and_panning(transform.translation());
let existing = spawned_extras
.get_mut(&entity)
.and_then(|extras| extras.audio.as_mut());
Expand All @@ -892,14 +901,16 @@ fn play_current_emote(
existing_emitter.instances.push(
audio
.play(sound)
.with_volume(config.audio.avatar() as f64)
.with_volume((volume * config.audio.avatar()) as f64)
.with_panning(panning as f64)
.handle(),
);
existing.unwrap().1 = elapsed;
} else {
let handle = audio
.play(sound)
.with_volume(config.audio.avatar() as f64)
.with_volume((volume * config.audio.avatar()) as f64)
.with_panning(panning as f64)
.handle();

let audio_entity = commands
Expand All @@ -911,6 +922,10 @@ fn play_current_emote(
))
.id();

if let Some(mut commands) = commands.get_entity(ent) {
commands.try_push_children(&[audio_entity]);
}

spawned_extras
.entry(entity)
.or_insert_with(|| SpawnedExtras::new(active_emote.urn.clone()))
Expand Down
Loading

0 comments on commit 5a8a4d4

Please sign in to comment.