cleanup
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 9m39s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 9m39s
This commit is contained in:
parent
2c169548b9
commit
bc42892d39
5 changed files with 12 additions and 32 deletions
|
@ -180,6 +180,7 @@ impl ApplicationContext {
|
||||||
f(&renderer)
|
f(&renderer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Méthode utilitaire pour accéder au renderer de manière thread-safe
|
||||||
pub fn with_renderer_mut<T, F>(&mut self, f: F) -> T
|
pub fn with_renderer_mut<T, F>(&mut self, f: F) -> T
|
||||||
where
|
where
|
||||||
F: FnOnce(&mut VulkanoWindowRenderer) -> T,
|
F: FnOnce(&mut VulkanoWindowRenderer) -> T,
|
||||||
|
@ -194,6 +195,7 @@ impl ApplicationContext {
|
||||||
f(renderer)
|
f(renderer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Méthode utilitaire pour accéder au gui de manière thread-safe
|
||||||
pub fn with_gui<T, F>(&self, f: F) -> T
|
pub fn with_gui<T, F>(&self, f: F) -> T
|
||||||
where
|
where
|
||||||
F: FnOnce(&Gui) -> T,
|
F: FnOnce(&Gui) -> T,
|
||||||
|
@ -202,6 +204,7 @@ impl ApplicationContext {
|
||||||
f(&gui)
|
f(&gui)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Méthode utilitaire pour accéder au gui de manière thread-safe
|
||||||
pub fn with_gui_mut<T, F>(&mut self, f: F) -> T
|
pub fn with_gui_mut<T, F>(&mut self, f: F) -> T
|
||||||
where
|
where
|
||||||
F: FnOnce(&mut Gui) -> T,
|
F: FnOnce(&mut Gui) -> T,
|
||||||
|
|
|
@ -33,6 +33,7 @@ pub struct App {
|
||||||
input_manager: Arc<Mutex<InputManager>>,
|
input_manager: Arc<Mutex<InputManager>>,
|
||||||
timer: Arc<Mutex<Timer>>,
|
timer: Arc<Mutex<Timer>>,
|
||||||
event_loop_proxy: EventLoopProxy<UserEvent>,
|
event_loop_proxy: EventLoopProxy<UserEvent>,
|
||||||
|
|
||||||
// Context d'application partagé par fenêtre - architecture unifiée
|
// Context d'application partagé par fenêtre - architecture unifiée
|
||||||
app_contexts: HashMap<WindowId, Arc<Mutex<ApplicationContext>>>,
|
app_contexts: HashMap<WindowId, Arc<Mutex<ApplicationContext>>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,16 +42,9 @@ impl SceneManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn current_scene_mut(&mut self) -> Option<&mut Box<dyn Scene>> {
|
pub fn current_scene_mut(&mut self) -> Option<&mut Box<dyn Scene>> {
|
||||||
log::debug!(
|
|
||||||
"current_scene_mut called - index: {:?}, scenes len: {}",
|
|
||||||
self.current_scene_index,
|
|
||||||
self.scenes.len()
|
|
||||||
);
|
|
||||||
if let Some(index) = self.current_scene_index {
|
if let Some(index) = self.current_scene_index {
|
||||||
log::debug!("Getting scene at index {}", index);
|
|
||||||
self.scenes.get_mut(index)
|
self.scenes.get_mut(index)
|
||||||
} else {
|
} else {
|
||||||
log::debug!("No current scene index set");
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,21 +53,9 @@ impl SceneManager {
|
||||||
&mut self,
|
&mut self,
|
||||||
app_context: &mut ApplicationContext,
|
app_context: &mut ApplicationContext,
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
log::debug!("SceneManager::load_scene_if_not_loaded called");
|
|
||||||
log::debug!(
|
|
||||||
"Current scene index: {:?}, scenes count: {}",
|
|
||||||
self.current_scene_index,
|
|
||||||
self.scenes.len()
|
|
||||||
);
|
|
||||||
|
|
||||||
if let Some(scene) = self.current_scene_mut() {
|
if let Some(scene) = self.current_scene_mut() {
|
||||||
log::debug!("Scene found, checking if loaded: {}", scene.loaded());
|
|
||||||
if !scene.loaded() {
|
if !scene.loaded() {
|
||||||
log::debug!("Scene not loaded, loading...");
|
|
||||||
scene.load(app_context)?;
|
scene.load(app_context)?;
|
||||||
log::debug!("Scene loaded successfully");
|
|
||||||
} else {
|
|
||||||
log::debug!("Scene already loaded");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log::warn!("No scene found in SceneManager!");
|
log::warn!("No scene found in SceneManager!");
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl Scene for MainScene {
|
||||||
});
|
});
|
||||||
|
|
||||||
let swapchain_image_view =
|
let swapchain_image_view =
|
||||||
app_context.with_renderer_mut(|renderer| renderer.swapchain_image_view().clone());
|
app_context.with_renderer(|renderer| renderer.swapchain_image_view().clone());
|
||||||
|
|
||||||
let square = Square::new(
|
let square = Square::new(
|
||||||
&app_context.device,
|
&app_context.device,
|
||||||
|
@ -180,7 +180,7 @@ impl Scene for MainScene {
|
||||||
|
|
||||||
{
|
{
|
||||||
let swapchain_image_view =
|
let swapchain_image_view =
|
||||||
app_context.with_renderer_mut(|renderer| renderer.swapchain_image_view().clone());
|
app_context.with_renderer(|renderer| renderer.swapchain_image_view().clone());
|
||||||
let depth_image_view = app_context.with_renderer_mut(|renderer| {
|
let depth_image_view = app_context.with_renderer_mut(|renderer| {
|
||||||
renderer.get_additional_image_view(DEPTH_IMAGE_ID).clone()
|
renderer.get_additional_image_view(DEPTH_IMAGE_ID).clone()
|
||||||
});
|
});
|
||||||
|
@ -219,13 +219,14 @@ impl Scene for MainScene {
|
||||||
before_future.then_execute(app_context.graphics_queue.clone(), command_buffer)?;
|
before_future.then_execute(app_context.graphics_queue.clone(), command_buffer)?;
|
||||||
|
|
||||||
let swapchain_image_view =
|
let swapchain_image_view =
|
||||||
app_context.with_renderer_mut(|renderer| renderer.swapchain_image_view().clone());
|
app_context.with_renderer(|renderer| renderer.swapchain_image_view().clone());
|
||||||
let input_manager_status =
|
let input_manager_status =
|
||||||
app_context.with_input_manager(|input_manager| format!("{:#?}", input_manager));
|
app_context.with_input_manager(|input_manager| format!("{:#?}", input_manager));
|
||||||
let event_loop_proxy = app_context.event_loop_proxy.clone();
|
let event_loop_proxy = app_context.event_loop_proxy.clone();
|
||||||
let delta_time = app_context.get_delta_time();
|
let delta_time = app_context.get_delta_time();
|
||||||
let window_id = app_context.window_id;
|
let window_id = app_context.window_id;
|
||||||
let window_size = app_context.get_window_size();
|
let window_size = app_context.get_window_size();
|
||||||
|
|
||||||
let render_future = app_context.with_gui_mut(|gui| {
|
let render_future = app_context.with_gui_mut(|gui| {
|
||||||
gui.immediate_ui(|gui| {
|
gui.immediate_ui(|gui| {
|
||||||
let ctx = gui.context();
|
let ctx = gui.context();
|
||||||
|
@ -270,15 +271,8 @@ impl Scene for MainScene {
|
||||||
ui.label(format!(" Pitch: {:.2}°", rotation.x.to_degrees()));
|
ui.label(format!(" Pitch: {:.2}°", rotation.x.to_degrees()));
|
||||||
|
|
||||||
ui.separator();
|
ui.separator();
|
||||||
|
|
||||||
ui.label(input_manager_status);
|
ui.label(input_manager_status);
|
||||||
|
|
||||||
ui.label(format!("Delta time: {:?}", delta_time));
|
|
||||||
|
|
||||||
ui.label(format!(
|
|
||||||
"Position: {:?}, Rotation: {:?}",
|
|
||||||
state.camera.get_position(),
|
|
||||||
state.camera.get_rotation()
|
|
||||||
));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,11 @@ impl Scene for SettingsScene {
|
||||||
// Utiliser le RenderPassManager
|
// Utiliser le RenderPassManager
|
||||||
{
|
{
|
||||||
let swapchain_image_view =
|
let swapchain_image_view =
|
||||||
app_context.with_renderer_mut(|renderer| renderer.swapchain_image_view().clone());
|
app_context.with_renderer(|renderer| renderer.swapchain_image_view().clone());
|
||||||
let depth_stencil_image_view = app_context.with_renderer_mut(|renderer| {
|
let depth_stencil_image_view = app_context.with_renderer_mut(|renderer| {
|
||||||
renderer.get_additional_image_view(DEPTH_IMAGE_ID).clone()
|
renderer.get_additional_image_view(DEPTH_IMAGE_ID).clone()
|
||||||
});
|
});
|
||||||
|
|
||||||
let config = RenderPassConfig::default();
|
let config = RenderPassConfig::default();
|
||||||
RenderPassManager::begin_standard_rendering(
|
RenderPassManager::begin_standard_rendering(
|
||||||
&mut builder,
|
&mut builder,
|
||||||
|
@ -82,7 +83,7 @@ impl Scene for SettingsScene {
|
||||||
before_future.then_execute(app_context.graphics_queue.clone(), command_buffer)?;
|
before_future.then_execute(app_context.graphics_queue.clone(), command_buffer)?;
|
||||||
|
|
||||||
let swapchain_image_view =
|
let swapchain_image_view =
|
||||||
app_context.with_renderer_mut(|renderer| renderer.swapchain_image_view().clone());
|
app_context.with_renderer(|renderer| renderer.swapchain_image_view().clone());
|
||||||
|
|
||||||
let event_loop_proxy = app_context.event_loop_proxy.clone();
|
let event_loop_proxy = app_context.event_loop_proxy.clone();
|
||||||
let window_id = app_context.window_id;
|
let window_id = app_context.window_id;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue