mirror of
https://github.com/hannobraun/Fornjot
synced 2025-09-09 19:06:32 +00:00
Merge fj-window
into fj-viewer
This commit is contained in:
parent
7bba23a723
commit
c54c8c7150
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -905,7 +905,6 @@ dependencies = [
|
||||
"fj-interop",
|
||||
"fj-math",
|
||||
"fj-viewer",
|
||||
"fj-window",
|
||||
"thiserror 2.0.12",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
@ -966,6 +965,7 @@ dependencies = [
|
||||
"bytemuck",
|
||||
"fj-interop",
|
||||
"fj-math",
|
||||
"futures",
|
||||
"getrandom 0.2.15",
|
||||
"image",
|
||||
"nalgebra",
|
||||
@ -974,6 +974,7 @@ dependencies = [
|
||||
"tobj",
|
||||
"tracing",
|
||||
"wgpu",
|
||||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -17,11 +17,13 @@ workspace = true
|
||||
[dependencies]
|
||||
fj-interop.workspace = true
|
||||
fj-math.workspace = true
|
||||
futures = "0.3.31"
|
||||
nalgebra = "0.33.2"
|
||||
tobj = "4.0.3"
|
||||
raw-window-handle = "0.6.0"
|
||||
thiserror = "2.0.12"
|
||||
tracing = "0.1.41"
|
||||
winit = "0.30.9"
|
||||
|
||||
[dependencies.bytemuck]
|
||||
version = "1.22.0"
|
||||
|
@ -1,8 +1,4 @@
|
||||
use fj_interop::Model;
|
||||
use fj_viewer::{
|
||||
DEFAULT_CAMERA_TUNING_CONFIG, InputEvent, RendererInitError, Screen,
|
||||
ScreenSize, Viewer,
|
||||
};
|
||||
use futures::executor::block_on;
|
||||
use winit::{
|
||||
application::ApplicationHandler,
|
||||
@ -16,7 +12,11 @@ use winit::{
|
||||
window::WindowId,
|
||||
};
|
||||
|
||||
use crate::window::{self, Window};
|
||||
use crate::{
|
||||
DEFAULT_CAMERA_TUNING_CONFIG, InputEvent, RendererInitError, Screen,
|
||||
ScreenSize, Viewer,
|
||||
window::{self, Window},
|
||||
};
|
||||
|
||||
/// Display the provided mesh in a window that processes input
|
||||
pub fn display(model: Model, invert_zoom: bool) -> Result<(), Error> {
|
||||
@ -122,8 +122,8 @@ impl ApplicationHandler for DisplayState {
|
||||
}
|
||||
WindowEvent::MouseInput { state, button, .. } => {
|
||||
let button = match button {
|
||||
MouseButton::Left => Some(fj_viewer::MouseButton::Left),
|
||||
MouseButton::Right => Some(fj_viewer::MouseButton::Right),
|
||||
MouseButton::Left => Some(crate::MouseButton::Left),
|
||||
MouseButton::Right => Some(crate::MouseButton::Right),
|
||||
_ => None,
|
||||
};
|
||||
|
@ -10,15 +10,19 @@
|
||||
|
||||
mod assets;
|
||||
mod camera;
|
||||
mod display;
|
||||
mod graphics;
|
||||
mod input;
|
||||
mod screen;
|
||||
mod viewer;
|
||||
mod window;
|
||||
|
||||
pub use self::{
|
||||
display::{Error, display},
|
||||
graphics::{DeviceError, RendererInitError},
|
||||
input::InputEvent,
|
||||
input::{CameraTuningConfig, DEFAULT_CAMERA_TUNING_CONFIG, MouseButton},
|
||||
screen::{NormalizedScreenPosition, Screen, ScreenSize},
|
||||
viewer::Viewer,
|
||||
window::WindowError,
|
||||
};
|
||||
|
@ -1,8 +1,9 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use fj_viewer::{Screen, ScreenSize};
|
||||
use winit::event_loop::ActiveEventLoop;
|
||||
|
||||
use crate::{Screen, ScreenSize};
|
||||
|
||||
/// A window that can be used with `fj-viewer`
|
||||
pub struct Window {
|
||||
inner: Arc<winit::window::Window>,
|
@ -4,14 +4,8 @@
|
||||
//! split into multiple libraries that can be used semi-independently, and this
|
||||
//! is one of those.
|
||||
//!
|
||||
//! This library provides a window abstraction based on Winit.
|
||||
//! This library has been deprecated. Its contents have moved into
|
||||
//! [`fj-viewer`].
|
||||
//!
|
||||
//! [Fornjot]: https://www.fornjot.app/
|
||||
|
||||
mod display;
|
||||
mod window;
|
||||
|
||||
pub use self::{
|
||||
display::{Error, display},
|
||||
window::WindowError,
|
||||
};
|
||||
//! [`fj-viewer`]: https://crates.io/crates/fj-viewer
|
||||
|
@ -20,7 +20,6 @@ fj-export.workspace = true
|
||||
fj-interop.workspace = true
|
||||
fj-math.workspace = true
|
||||
fj-viewer.workspace = true
|
||||
fj-window.workspace = true
|
||||
thiserror = "2.0.12"
|
||||
tracing = "0.1.41"
|
||||
|
||||
|
@ -90,7 +90,7 @@ impl Instance {
|
||||
|
||||
let model = Model { mesh, aabb };
|
||||
|
||||
crate::window::display(model, false)?;
|
||||
crate::viewer::display(model, false)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -108,7 +108,7 @@ pub enum Error {
|
||||
|
||||
/// Error displaying model
|
||||
#[error("Error displaying model")]
|
||||
Display(#[from] crate::window::Error),
|
||||
Display(#[from] crate::viewer::Error),
|
||||
|
||||
/// Error exporting model
|
||||
#[error("Error exporting model")]
|
||||
|
@ -22,4 +22,3 @@ pub use fj_export as export;
|
||||
pub use fj_interop as interop;
|
||||
pub use fj_math as math;
|
||||
pub use fj_viewer as viewer;
|
||||
pub use fj_window as window;
|
||||
|
Loading…
x
Reference in New Issue
Block a user