fix(input): input not working
This commit is contained in:
@@ -6,7 +6,6 @@ use crate::{
|
||||
use color_eyre::eyre::Result;
|
||||
use glam::Vec3;
|
||||
use parking_lot::Mutex;
|
||||
use portable_atomic::{AtomicBool, Ordering};
|
||||
use prisma::Lerp;
|
||||
use std::{collections::VecDeque, sync::Arc};
|
||||
use stereokit_rust::{
|
||||
@@ -16,7 +15,6 @@ use stereokit_rust::{
|
||||
static LINES_REGISTRY: Registry<Lines> = Registry::new();
|
||||
|
||||
pub struct Lines {
|
||||
enabled: Arc<AtomicBool>,
|
||||
space: Arc<Spatial>,
|
||||
data: Mutex<Vec<Line>>,
|
||||
}
|
||||
@@ -39,7 +37,6 @@ impl Lines {
|
||||
});
|
||||
|
||||
let lines = LINES_REGISTRY.add(Lines {
|
||||
enabled: node.enabled.clone(),
|
||||
space: node.get_aspect::<Spatial>()?.clone(),
|
||||
data: Mutex::new(lines),
|
||||
});
|
||||
@@ -104,7 +101,7 @@ impl Drop for Lines {
|
||||
|
||||
pub fn draw_all(token: &MainThreadToken) {
|
||||
for lines in LINES_REGISTRY.get_valid_contents() {
|
||||
if lines.enabled.load(Ordering::Relaxed) {
|
||||
if lines.space.node().unwrap().enabled() {
|
||||
lines.draw(token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ use color_eyre::eyre::{bail, eyre, Result};
|
||||
use glam::{Mat4, Vec2, Vec3};
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
use portable_atomic::{AtomicBool, Ordering};
|
||||
use rustc_hash::FxHashMap;
|
||||
use send_wrapper::SendWrapper;
|
||||
use stardust_xr::values::ResourceID;
|
||||
@@ -244,7 +243,6 @@ impl ModelPartAspect for ModelPart {
|
||||
}
|
||||
|
||||
pub struct Model {
|
||||
enabled: Arc<AtomicBool>,
|
||||
space: Arc<Spatial>,
|
||||
_resource_id: ResourceID,
|
||||
sk_model: OnceCell<SKModel>,
|
||||
@@ -260,7 +258,6 @@ impl Model {
|
||||
.ok_or_else(|| eyre!("Resource not found"))?;
|
||||
|
||||
let model = Arc::new(Model {
|
||||
enabled: node.enabled.clone(),
|
||||
space: node.get_aspect::<Spatial>().unwrap().clone(),
|
||||
_resource_id: resource_id,
|
||||
sk_model: OnceCell::new(),
|
||||
@@ -290,7 +287,7 @@ impl Model {
|
||||
}
|
||||
drop(parts);
|
||||
|
||||
if self.enabled.load(Ordering::Relaxed) {
|
||||
if self.space.node().unwrap().enabled() {
|
||||
sk_model.draw(token, self.space.global_transform(), None, None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ use color_eyre::eyre::{eyre, Result};
|
||||
use glam::{vec3, Mat4, Vec2};
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
use portable_atomic::{AtomicBool, Ordering};
|
||||
use std::{ffi::OsStr, path::PathBuf, sync::Arc};
|
||||
use stereokit_rust::{
|
||||
font::Font,
|
||||
@@ -34,7 +33,6 @@ fn convert_align(x_align: super::XAlign, y_align: super::YAlign) -> TextAlign {
|
||||
}
|
||||
|
||||
pub struct Text {
|
||||
enabled: Arc<AtomicBool>,
|
||||
space: Arc<Spatial>,
|
||||
font_path: Option<PathBuf>,
|
||||
style: OnceCell<SkTextStyle>,
|
||||
@@ -46,7 +44,6 @@ impl Text {
|
||||
pub fn add_to(node: &Arc<Node>, text: String, style: TextStyle) -> Result<Arc<Text>> {
|
||||
let client = node.get_client().ok_or_else(|| eyre!("Client not found"))?;
|
||||
let text = TEXT_REGISTRY.add(Text {
|
||||
enabled: node.enabled.clone(),
|
||||
space: node.get_aspect::<Spatial>().unwrap().clone(),
|
||||
font_path: style.font.as_ref().and_then(|res| {
|
||||
get_resource_file(&res, &client, &[OsStr::new("ttf"), OsStr::new("otf")])
|
||||
@@ -166,7 +163,7 @@ impl Drop for Text {
|
||||
|
||||
pub fn draw_all(token: &MainThreadToken) {
|
||||
for text in TEXT_REGISTRY.get_valid_contents() {
|
||||
if text.enabled.load(Ordering::Relaxed) {
|
||||
if text.space.node().unwrap().enabled() {
|
||||
text.draw(token);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user