Compare commits
2 Commits
0.46.0
...
Nervyalloy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08c7a5efea | ||
|
|
b5dcffd7c0 |
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -2620,7 +2620,7 @@ checksum = "2f2b15926089e5526bb2dd738a2eb0e59034356e06eb71e1cd912358c0e62c4d"
|
||||
[[package]]
|
||||
name = "stardust-xr"
|
||||
version = "0.45.0"
|
||||
source = "git+https://github.com/StardustXR/core.git?branch=dev#bce6ec660f026c577156b3cff41f9312c1caa1d3"
|
||||
source = "git+https://github.com/StardustXR/core.git?branch=dev#d2964d8db079afaadb7faa4987e34814e62d6279"
|
||||
dependencies = [
|
||||
"cluFlock",
|
||||
"color-eyre",
|
||||
@@ -2641,7 +2641,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "stardust-xr-schemas"
|
||||
version = "1.5.3"
|
||||
source = "git+https://github.com/StardustXR/core.git?branch=dev#bce6ec660f026c577156b3cff41f9312c1caa1d3"
|
||||
source = "git+https://github.com/StardustXR/core.git?branch=dev#d2964d8db079afaadb7faa4987e34814e62d6279"
|
||||
dependencies = [
|
||||
"flatbuffers",
|
||||
"flexbuffers",
|
||||
@@ -3359,7 +3359,7 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
51
flake.lock
generated
51
flake.lock
generated
@@ -26,11 +26,11 @@
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722555600,
|
||||
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
|
||||
"lastModified": 1743550720,
|
||||
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
|
||||
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -47,11 +47,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1712014858,
|
||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||
"lastModified": 1743550720,
|
||||
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
||||
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -65,11 +65,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1713050562,
|
||||
"narHash": "sha256-m7c6XpmpTM1URuqMG2KqtaWbL2Vt8vJFJtmvq123BmY=",
|
||||
"lastModified": 1725868201,
|
||||
"narHash": "sha256-rDBQ9tXQCCA7emikSYH59ADJELE2IpzB7eoLrpHYzU4=",
|
||||
"owner": "StardustXR",
|
||||
"repo": "flatland",
|
||||
"rev": "b3b0f29c4ea1b82c96cf9de507837bf15a5e4c0e",
|
||||
"rev": "0914dd3df54a5e6258dfc0a02d65af1c0fc0fc90",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -84,11 +84,11 @@
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1719226092,
|
||||
"narHash": "sha256-YNkUMcCUCpnULp40g+svYsaH1RbSEj6s4WdZY/SHe38=",
|
||||
"lastModified": 1747284884,
|
||||
"narHash": "sha256-lTSKhRrassMcJ1ZsuUVunyl/F04vvCKY80HB/4rvvm4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "hercules-ci-effects",
|
||||
"rev": "11e4b8dc112e2f485d7c97e1cee77f9958f498f5",
|
||||
"rev": "7168f6002a6b48a9b6151e1e97e974a0722ecfdc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -115,23 +115,26 @@
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1722555339,
|
||||
"narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
|
||||
"lastModified": 1743296961,
|
||||
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1713714899,
|
||||
"narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=",
|
||||
"lastModified": 1747179050,
|
||||
"narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6143fc5eeb9c4f00163267708e26191d1e918932",
|
||||
"rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -143,11 +146,11 @@
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1723991338,
|
||||
"narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=",
|
||||
"lastModified": 1747542820,
|
||||
"narHash": "sha256-GaOZntlJ6gPPbbkTLjbd8BMWaDYafhuuYRNrxCGnPJw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8a3354191c0d7144db9756a74755672387b702ba",
|
||||
"rev": "292fa7d4f6519c074f0a50394dbbe69859bb6043",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
let
|
||||
sk_gpu_zip = fetchurl {
|
||||
url =
|
||||
"https://github.com/StereoKit/sk_gpu/releases/download/v2024.8.16/sk_gpu.v2024.8.16.zip";
|
||||
sha256 = "sha256-Wk3PZFlWqhrsQ8xG0sQaV2xSasdg2D7TMiPvl/CgtGU=";
|
||||
"https://github.com/StereoKit/sk_gpu/releases/download/v2024.9.26/sk_gpu.v2024.9.26.zip";
|
||||
sha256 = "sha256-W32RveeCszioWGtbCsvAqB28YHvOsw2xJ15MosYLFXk=";
|
||||
};
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "sk_gpu";
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
, xorg
|
||||
, fontconfig
|
||||
, libxkbcommon
|
||||
, xkeyboard_config
|
||||
, libclang
|
||||
|
||||
, cmake
|
||||
@@ -15,11 +16,13 @@
|
||||
, fetchFromGitHub
|
||||
, sk_gpu
|
||||
, libXau
|
||||
, libgbm
|
||||
|
||||
, libXdmcp
|
||||
, stdenv
|
||||
, lib
|
||||
, openxr-loader
|
||||
, makeWrapper
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
@@ -47,10 +50,17 @@ rustPlatform.buildRustPackage rec {
|
||||
rev = "900e40fb5d2502927360fe2f31762bdbb624455f";
|
||||
sha256 = "sha256-zBRAXgG5Fi6+5uPQCI/RCGatY6O4ELuYBoKrPNn4K+8=";
|
||||
};
|
||||
openxr_loader = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "OpenXR-SDK";
|
||||
rev = "288d3a7ebc1ad959f62d51da75baa3d27438c499";
|
||||
sha256 = "sha256-RdmnBe26hqPmqwCHIJolF6bSmZRmIKVlGF+TXAY35ig=";
|
||||
};
|
||||
|
||||
DEP_MESHOPTIMIZER_SOURCE = "${meshoptimizer}";
|
||||
DEP_BASIS_UNIVERSAL_SOURCE = "${basis_universal}";
|
||||
DEP_SK_GPU_SOURCE = "${sk_gpu}";
|
||||
DEP_OPENXR_LOADER_SOURCE = "${openxr_loader}";
|
||||
|
||||
postPatch = let libPath = lib.makeLibraryPath [ stdenv.cc.cc.lib ];
|
||||
in ''
|
||||
@@ -69,7 +79,8 @@ rustPlatform.buildRustPackage rec {
|
||||
--set-rpath "${libPath}" \
|
||||
$sk/sk_gpu/tools/linux_x64/skshaderc
|
||||
'';
|
||||
nativeBuildInputs = [ cmake pkg-config llvmPackages.libcxxClang ];
|
||||
|
||||
nativeBuildInputs = [ cmake pkg-config llvmPackages.libcxxClang makeWrapper ];
|
||||
buildInputs = [
|
||||
libGL
|
||||
mesa
|
||||
@@ -78,9 +89,16 @@ rustPlatform.buildRustPackage rec {
|
||||
xorg.libXfixes
|
||||
fontconfig
|
||||
libxkbcommon
|
||||
xkeyboard_config
|
||||
libXau
|
||||
libXdmcp
|
||||
openxr-loader
|
||||
libgbm
|
||||
];
|
||||
LIBCLANG_PATH = "${libclang.lib}/lib";
|
||||
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/stardust-xr-server \
|
||||
--set XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb"
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -4,11 +4,7 @@ use super::{
|
||||
input_method_client,
|
||||
};
|
||||
use crate::{
|
||||
core::{
|
||||
client::Client,
|
||||
error::{Result, ServerError},
|
||||
registry::Registry,
|
||||
},
|
||||
core::{client::Client, error::Result, registry::Registry},
|
||||
nodes::{
|
||||
Node,
|
||||
alias::{Alias, AliasList},
|
||||
@@ -16,7 +12,6 @@ use crate::{
|
||||
spatial::Spatial,
|
||||
},
|
||||
};
|
||||
use color_eyre::eyre::eyre;
|
||||
use parking_lot::Mutex;
|
||||
use stardust_xr::values::Datamap;
|
||||
use std::sync::{Arc, Weak};
|
||||
@@ -247,16 +242,7 @@ impl InputMethodRefAspect for InputMethodRef {
|
||||
let input_handler = handler.get_aspect::<InputHandler>()?;
|
||||
|
||||
input_method.capture_attempts.add_raw(&input_handler);
|
||||
|
||||
let Some(handler_alias) = input_method
|
||||
.handler_aliases
|
||||
.get_from_aspect(&*input_handler)
|
||||
else {
|
||||
return Err(ServerError::Report(eyre!(
|
||||
"Internal: Couldn't get handler alias somehow?"
|
||||
)));
|
||||
};
|
||||
input_method_client::request_capture_handler(&node, handler_alias.get_id())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[doc = "If captured by this handler, release it (e.g. the object is let go of after grabbing)."]
|
||||
@@ -265,15 +251,6 @@ impl InputMethodRefAspect for InputMethodRef {
|
||||
let input_handler = handler.get_aspect::<InputHandler>()?;
|
||||
|
||||
input_method.capture_attempts.remove(&input_handler);
|
||||
|
||||
let Some(handler_alias) = input_method
|
||||
.handler_aliases
|
||||
.get_from_aspect(&*input_handler)
|
||||
else {
|
||||
return Err(ServerError::Report(eyre!(
|
||||
"Internal: Couldn't get handler alias somehow?"
|
||||
)));
|
||||
};
|
||||
input_method_client::release_handler(&node, handler_alias.get_id())
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ impl Root {
|
||||
|
||||
pub fn set_transform(&self, transform: Mat4) {
|
||||
let spatial = self.node.get_aspect::<Spatial>().unwrap();
|
||||
// spatial.set_spatial_parent(None).unwrap();
|
||||
spatial.set_spatial_parent(None).unwrap();
|
||||
spatial.set_local_transform(transform);
|
||||
}
|
||||
pub async fn save_state(&self) -> Result<ClientState> {
|
||||
|
||||
@@ -192,29 +192,45 @@ impl Spatial {
|
||||
fn get_parent(&self) -> Option<Arc<Spatial>> {
|
||||
self.parent.lock().clone()
|
||||
}
|
||||
fn set_parent(self: &Arc<Self>, new_parent: &Arc<Spatial>) {
|
||||
fn set_parent(self: &Arc<Self>, new_parent: Option<&Arc<Spatial>>) {
|
||||
if let Some(parent) = self.get_parent() {
|
||||
parent.children.remove(self);
|
||||
}
|
||||
new_parent.children.add_raw(self);
|
||||
if let Some(new_parent) = &new_parent {
|
||||
new_parent.children.add_raw(self);
|
||||
}
|
||||
|
||||
*self.parent.lock() = Some(new_parent.clone());
|
||||
*self.parent.lock() = new_parent.cloned();
|
||||
}
|
||||
|
||||
pub fn set_spatial_parent(self: &Arc<Self>, parent: &Arc<Spatial>) -> Result<()> {
|
||||
if self.is_ancestor_of(parent.clone()) {
|
||||
pub fn set_spatial_parent(self: &Arc<Self>, parent: Option<&Arc<Spatial>>) -> Result<()> {
|
||||
let is_ancestor = parent
|
||||
.as_ref()
|
||||
.map(|parent| self.is_ancestor_of((*parent).clone()))
|
||||
.unwrap_or(false);
|
||||
if is_ancestor {
|
||||
bail!("Setting spatial parent would cause a loop");
|
||||
}
|
||||
self.set_parent(parent);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
pub fn set_spatial_parent_in_place(self: &Arc<Self>, parent: &Arc<Spatial>) -> Result<()> {
|
||||
if self.is_ancestor_of(parent.clone()) {
|
||||
pub fn set_spatial_parent_in_place(
|
||||
self: &Arc<Self>,
|
||||
parent: Option<&Arc<Spatial>>,
|
||||
) -> Result<()> {
|
||||
let is_ancestor = parent
|
||||
.as_ref()
|
||||
.map(|parent| self.is_ancestor_of((*parent).clone()))
|
||||
.unwrap_or(false);
|
||||
if is_ancestor {
|
||||
bail!("Setting spatial parent would cause a loop");
|
||||
}
|
||||
|
||||
self.set_local_transform(Spatial::space_to_space_matrix(Some(self), Some(parent)));
|
||||
self.set_local_transform(Spatial::space_to_space_matrix(
|
||||
Some(self),
|
||||
parent.map(AsRef::as_ref),
|
||||
));
|
||||
self.set_parent(parent);
|
||||
|
||||
Ok(())
|
||||
@@ -266,7 +282,7 @@ impl SpatialAspect for Spatial {
|
||||
let this_spatial = node.get_aspect::<Spatial>()?;
|
||||
let parent = parent.get_aspect::<Spatial>()?;
|
||||
|
||||
this_spatial.set_spatial_parent(&parent)?;
|
||||
this_spatial.set_spatial_parent(Some(&parent))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -278,7 +294,7 @@ impl SpatialAspect for Spatial {
|
||||
let this_spatial = node.get_aspect::<Spatial>()?;
|
||||
let parent = parent.get_aspect::<Spatial>()?;
|
||||
|
||||
this_spatial.set_spatial_parent_in_place(&parent)?;
|
||||
this_spatial.set_spatial_parent_in_place(Some(&parent))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -45,10 +45,7 @@ pub fn release(spatial: &Spatial) {
|
||||
};
|
||||
let spatial = spatial_node.get_aspect::<Spatial>().unwrap();
|
||||
|
||||
let Some(old_parent) = spatial.old_parent.lock().take() else {
|
||||
return;
|
||||
};
|
||||
let _ = spatial.set_spatial_parent_in_place(&old_parent);
|
||||
let _ = spatial.set_spatial_parent_in_place(spatial.old_parent.lock().take().as_ref());
|
||||
let mut spatial_zone = spatial.zone.lock();
|
||||
|
||||
if let Some(spatial_zone) = spatial_zone.upgrade() {
|
||||
|
||||
Reference in New Issue
Block a user