mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
All stuff beside lerp and screenshot
This commit is contained in:
@@ -2,7 +2,7 @@ use bevy::prelude::*;
|
||||
|
||||
use crate::{design_system, math::geo};
|
||||
|
||||
use super::material::GizmoMaterial;
|
||||
use super::material::*;
|
||||
|
||||
#[derive(Resource, Reflect, Debug, Default)]
|
||||
#[reflect(Resource)]
|
||||
@@ -98,25 +98,25 @@ pub(super) fn init_resources(
|
||||
uniform_scale_cube,
|
||||
});
|
||||
|
||||
let translate_x = ra_mats.add(design_system::Color::RED.into());
|
||||
let translate_yz = ra_mats.add(design_system::Color::RED.into());
|
||||
let translate_x = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::RED));
|
||||
let translate_yz = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::RED));
|
||||
|
||||
let translate_y = ra_mats.add(design_system::Color::GREEN.into());
|
||||
let translate_xz = ra_mats.add(design_system::Color::GREEN.into());
|
||||
let translate_y = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::GREEN));
|
||||
let translate_xz = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::GREEN));
|
||||
|
||||
let translate_z = ra_mats.add(design_system::Color::BLUE.into());
|
||||
let translate_xy = ra_mats.add(design_system::Color::BLUE.into());
|
||||
let translate_z = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::BLUE));
|
||||
let translate_xy = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::BLUE));
|
||||
|
||||
let translate_ss = ra_mats.add(Color::WHITE.into());
|
||||
let translate_ss = ra_mats.add(Into::<GizmoMaterial>::into(Color::WHITE));
|
||||
|
||||
let rotate_x = ra_mats.add(design_system::Color::RED.into());
|
||||
let rotate_y = ra_mats.add(design_system::Color::GREEN.into());
|
||||
let rotate_z = ra_mats.add(design_system::Color::BLUE.into());
|
||||
let rotate_ss = ra_mats.add(Color::WHITE.into());
|
||||
let rotate_x = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::RED));
|
||||
let rotate_y = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::GREEN));
|
||||
let rotate_z = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::BLUE));
|
||||
let rotate_ss = ra_mats.add(Into::<GizmoMaterial>::into(Color::WHITE));
|
||||
|
||||
let scale_x = ra_mats.add(design_system::Color::RED.into());
|
||||
let scale_y = ra_mats.add(design_system::Color::GREEN.into());
|
||||
let scale_z = ra_mats.add(design_system::Color::BLUE.into());
|
||||
let scale_x = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::RED));
|
||||
let scale_y = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::GREEN));
|
||||
let scale_z = ra_mats.add(Into::<GizmoMaterial>::into(design_system::Color::BLUE));
|
||||
|
||||
let rotate_trackball = ra_mats.add(GizmoMaterial {
|
||||
color: Color::WHITE.with_a(0.0),
|
||||
|
||||
@@ -302,7 +302,7 @@ pub(super) fn on_rotate(
|
||||
}
|
||||
|
||||
let view_plane_normal = (cam_xform.translation() - p1).normalize();
|
||||
let hit_dist = ray.intersect_plane(p1, view_plane_normal).unwrap();
|
||||
let hit_dist = ray.intersect_plane(p1, Plane3d::new(view_plane_normal)).unwrap();
|
||||
let p2 = ray.origin + ray.direction * hit_dist;
|
||||
let drag_dist = (p2 - p1).length();
|
||||
// TODO: Sensitivity could use some tuning
|
||||
@@ -366,7 +366,7 @@ pub(super) fn on_rotate(
|
||||
};
|
||||
|
||||
// Find the world-space p2, if possible
|
||||
let Some(hit_dist) = ray.intersect_plane(p0, axis_ws) else {
|
||||
let Some(hit_dist) = ray.intersect_plane(p0, Plane3d::new(axis_ws)) else {
|
||||
// This could fail if the axis of rotation is nearly
|
||||
// perpendicular to the view direction
|
||||
return;
|
||||
|
||||
@@ -261,7 +261,7 @@ pub(super) fn on_scale(
|
||||
let plane_vector = axis_ws.cross(axis_tan);
|
||||
|
||||
// Find the intersection of the camera-to-world ray against that plane
|
||||
let Some(hit_dist) = ray.intersect_plane(origin_ws, plane_vector) else {
|
||||
let Some(hit_dist) = ray.intersect_plane(origin_ws, Plane3d::new(plane_vector)) else {
|
||||
return;
|
||||
};
|
||||
let hit_point = ray.origin + ray.direction * hit_dist;
|
||||
@@ -299,7 +299,7 @@ pub(super) fn on_scale(
|
||||
.affine()
|
||||
.transform_vector3(*plane_normal)
|
||||
.normalize();
|
||||
let Some(hit_dist) = ray.intersect_plane(origin_ws, normal_ws) else {
|
||||
let Some(hit_dist) = ray.intersect_plane(origin_ws, Plane3d::new(normal_ws)) else {
|
||||
return;
|
||||
};
|
||||
let hit_point = ray.origin + ray.direction * hit_dist;
|
||||
|
||||
@@ -257,7 +257,7 @@ pub(super) fn on_translate(
|
||||
let plane_vector = axis_ws.cross(axis_tan);
|
||||
|
||||
// Find the intersection of the camera-to-world ray against that plane
|
||||
let Some(hit_dist) = ray.intersect_plane(origin_ws, plane_vector) else {
|
||||
let Some(hit_dist) = ray.intersect_plane(origin_ws, Plane3d::new(plane_vector)) else {
|
||||
return;
|
||||
};
|
||||
let hit_point = ray.origin + ray.direction * hit_dist;
|
||||
@@ -290,7 +290,7 @@ pub(super) fn on_translate(
|
||||
};
|
||||
|
||||
// Find the intersection of the camera-to-world ray against that plane
|
||||
let Some(hit_dist) = ray.intersect_plane(origin_ws, plane_normal) else {
|
||||
let Some(hit_dist) = ray.intersect_plane(origin_ws, Plane3d::new(plane_normal)) else {
|
||||
return;
|
||||
};
|
||||
let target_ws = ray.origin + ray.direction * hit_dist;
|
||||
|
||||
@@ -20,7 +20,7 @@ impl Plugin for SelectionPlugin {
|
||||
Update,
|
||||
(
|
||||
update_selection,
|
||||
process_delete_inputs.run_if(resource_exists::<Selection>()),
|
||||
process_delete_inputs.run_if(resource_exists::<Selection>),
|
||||
),
|
||||
)
|
||||
.add_systems(
|
||||
|
||||
Reference in New Issue
Block a user