refactor: use typemap for aspects!
This commit is contained in:
@@ -30,7 +30,7 @@ impl EyePointer {
|
||||
pub fn new() -> Result<Self> {
|
||||
let node = Node::create_parent_name(&INTERNAL_CLIENT, "", &nanoid!(), false)
|
||||
.add_to_scenegraph()?;
|
||||
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false).unwrap();
|
||||
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false);
|
||||
let pointer =
|
||||
InputMethod::add_to(&node, InputType::Pointer(Pointer::default()), None).unwrap();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::{
|
||||
data::{
|
||||
mask_matches, pulse_receiver_client, PulseSender, KEYMAPS, PULSE_RECEIVER_REGISTRY,
|
||||
},
|
||||
fields::Ray,
|
||||
fields::{Field, Ray},
|
||||
input::{pointer::Pointer, InputMethod, InputType},
|
||||
spatial::Spatial,
|
||||
Node,
|
||||
@@ -60,7 +60,7 @@ impl MousePointer {
|
||||
pub fn new() -> Result<Self> {
|
||||
let node = Node::create_parent_name(&INTERNAL_CLIENT, "", &nanoid!(), false)
|
||||
.add_to_scenegraph()?;
|
||||
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false).unwrap();
|
||||
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false);
|
||||
let pointer =
|
||||
InputMethod::add_to(&node, InputType::Pointer(Pointer::default()), None).unwrap();
|
||||
|
||||
@@ -140,7 +140,7 @@ impl MousePointer {
|
||||
.into_iter()
|
||||
.filter(|rx| mask_matches(&rx.mask, &self.keyboard_sender.mask))
|
||||
.map(|rx| {
|
||||
let result = rx.field_node.field.get().unwrap().ray_march(Ray {
|
||||
let result = rx.field_node.get_aspect::<Field>().unwrap().ray_march(Ray {
|
||||
origin: vec3(0.0, 0.0, 0.0),
|
||||
direction: vec3(0.0, 0.0, -1.0),
|
||||
space: self.spatial.clone(),
|
||||
|
||||
@@ -43,7 +43,7 @@ impl SkController {
|
||||
false,
|
||||
)
|
||||
.add_to_scenegraph()?;
|
||||
Spatial::add_to(&_node, None, Mat4::IDENTITY, false)?;
|
||||
Spatial::add_to(&_node, None, Mat4::IDENTITY, false);
|
||||
let model = sk.model_create_mem("cursor.glb", include_bytes!("cursor.glb"), None)?;
|
||||
let tip = InputType::Tip(Tip::default());
|
||||
let input = InputMethod::add_to(&_node, tip, None)?;
|
||||
|
||||
@@ -42,7 +42,7 @@ impl SkHand {
|
||||
pub fn new(handed: Handed) -> Result<Self> {
|
||||
let _node = Node::create_parent_name(&INTERNAL_CLIENT, "", &nanoid!(), false)
|
||||
.add_to_scenegraph()?;
|
||||
Spatial::add_to(&_node, None, Mat4::IDENTITY, false)?;
|
||||
Spatial::add_to(&_node, None, Mat4::IDENTITY, false);
|
||||
let hand = InputType::Hand(Box::new(Hand {
|
||||
base: FlatHand {
|
||||
right: handed == Handed::Right,
|
||||
|
||||
@@ -42,8 +42,9 @@ impl PlaySpace {
|
||||
pub fn new() -> Result<Self> {
|
||||
let node = Node::create_parent_name(&INTERNAL_CLIENT, "", &nanoid!(), false)
|
||||
.add_to_scenegraph()?;
|
||||
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false)?;
|
||||
let field = BoxField::add_to(&node, [0.0; 3].into())?;
|
||||
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false);
|
||||
BoxField::add_to(&node, [0.0; 3].into());
|
||||
let field = node.get_aspect::<Field>()?.clone();
|
||||
|
||||
let pulse_rx = PulseReceiver::add_to(
|
||||
&node,
|
||||
|
||||
Reference in New Issue
Block a user