|
|
|
@ -18,7 +18,7 @@ impl Plugin for EditorPlugin {
|
|
|
|
Update,
|
|
|
|
Update,
|
|
|
|
(
|
|
|
|
(
|
|
|
|
handle_window_close.run_if(on_event::<WindowCloseRequested>()),
|
|
|
|
handle_window_close.run_if(on_event::<WindowCloseRequested>()),
|
|
|
|
// plane_gizmos,
|
|
|
|
plane_gizmos,
|
|
|
|
// fly_camera,
|
|
|
|
// fly_camera,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.run_if(in_state(EditorState::Open)),
|
|
|
|
.run_if(in_state(EditorState::Open)),
|
|
|
|
@ -83,6 +83,7 @@ fn init_editor(mut commands: Commands) {
|
|
|
|
target: RenderTarget::Window(WindowRef::Entity(editor_window)),
|
|
|
|
target: RenderTarget::Window(WindowRef::Entity(editor_window)),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
transform: Transform::from_xyz(10.0, 10.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
))
|
|
|
|
))
|
|
|
|
@ -157,9 +158,27 @@ fn handle_window_close(
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn _plane_gizmos(mut _gizmos: Gizmos) {
|
|
|
|
fn plane_gizmos(mut gizmos: Gizmos) {
|
|
|
|
todo!()
|
|
|
|
let r = 20.0;
|
|
|
|
// gizmos.line(Vec3::ZERO, Vec3::X, Color::GREEN);
|
|
|
|
let start = -r as i8;
|
|
|
|
|
|
|
|
let end = r as i8;
|
|
|
|
|
|
|
|
(start..=end).into_iter().for_each(|n| {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let offset = Vec3::Z * (n as f32);
|
|
|
|
|
|
|
|
gizmos.line(Vec3::NEG_X * r + offset, Vec3::X * r + offset, Color::GRAY);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let offset = Vec3::X * (n as f32);
|
|
|
|
|
|
|
|
gizmos.line(Vec3::NEG_Z * r + offset, Vec3::Z * r + offset, Color::GRAY);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// World origin arrows
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
gizmos.arrow(Vec3::ZERO, Vec3::X, Color::RED);
|
|
|
|
|
|
|
|
gizmos.arrow(Vec3::ZERO, Vec3::Y, Color::DARK_GREEN);
|
|
|
|
|
|
|
|
gizmos.arrow(Vec3::ZERO, Vec3::Z, Color::BLUE);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn _fly_camera(mut _camera: Query<&mut Transform, (With<Camera>, With<EditorTag>)>) {
|
|
|
|
fn _fly_camera(mut _camera: Query<&mut Transform, (With<Camera>, With<EditorTag>)>) {
|
|
|
|
|