From 78d50e42d1c756b154b837ead99fad72aed884ac Mon Sep 17 00:00:00 2001 From: spatialfree Date: Thu, 18 Apr 2024 12:32:58 -0400 Subject: [PATCH] nova help *o* --- readme.md | 13 +++++++++++++ src/main.rs | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..950d9ab --- /dev/null +++ b/readme.md @@ -0,0 +1,13 @@ +# braille_xr + +xyz -> rgb + +° color picker that you can move around in a color_cube + +when you pull the color picker out of the cube it will pick colors from your environment +while showing you where that color is in the color_cube + +useful cmds +```shell + cargo doc --open +``` \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 63ecd7f..d15ca8a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,11 @@ +use std::collections::{HashMap, HashSet}; + use manifest_dir_macros::directory_relative_path; use mint::{Vector2, Vector3}; use stardust_xr_fusion::{ - client::{Client, RootHandler}, core::values::ResourceID, drawable::Model, fields::BoxField, input::{InputData, InputDataType, InputHandler}, spatial::{SpatialAspect, Transform}, HandlerWrapper + client::{Client, RootHandler}, core::values::ResourceID, data, drawable::Model, fields::BoxField, input::{InputData, InputDataType, InputHandler, InputHandlerHandler, UnknownInputMethod}, spatial::{SpatialAspect, Transform}, HandlerWrapper }; -use stardust_xr_molecules::{input_action::{BaseInputAction, InputActionHandler}, Grabbable, GrabbableSettings}; +use stardust_xr_molecules::{input_action::{BaseInputAction, InputActionHandler}, Grabbable, GrabbableSettings, PointerMode}; #[derive(Debug, Clone, Copy)] struct State { @@ -19,6 +21,33 @@ struct Root { pub hover_color: Vector3, } +struct OtherStruct { + model: Model, + handler: InputHandler, + inputs: HashMap, +} + +impl OtherStruct { + fn update(&mut self, info: &stardust_xr_fusion::client::FrameInfo) { + + for (data, method) in self.inputs.iter() { + data.datamap.with_data(|data| { + data.idx("color_hover").as_f32() + }); + data.captured = true; + method.capture(&self.handler).unwrap(); + } + + self.inputs.clear(); + } +} + +impl InputHandlerHandler for OtherStruct { + fn input(&mut self, input: stardust_xr_fusion::input::UnknownInputMethod, data: InputData) { + self.inputs.insert(data); + } +} + impl Root { async fn create(client: &Client) -> Self { // stardust_xr_fusion::drawable::Model