Move texture loader in Resource
This commit is contained in:
parent
37467d5066
commit
6a0491fe51
3 changed files with 31 additions and 28 deletions
|
@ -7,6 +7,7 @@ use crate::core::render::primitives::vulkan_resource::{
|
|||
VulkanCommandBufferAllocator, VulkanComputeQueue, VulkanDescriptorSetAllocator, VulkanDevice,
|
||||
VulkanGraphicsQueue, VulkanInstance, VulkanMemoryAllocator, VulkanTransferQueue,
|
||||
};
|
||||
use crate::core::render::resources::texture::TextureLoader;
|
||||
use bevy_ecs::world::World;
|
||||
|
||||
use super::{AsScene, Scene};
|
||||
|
@ -14,7 +15,6 @@ use super::{AsScene, Scene};
|
|||
pub struct SceneManager {
|
||||
scenes: Vec<Scene>,
|
||||
current_scene_index: Option<usize>,
|
||||
window_context: Option<Rc<RefCell<WindowContext>>>,
|
||||
}
|
||||
|
||||
impl SceneManager {
|
||||
|
@ -22,14 +22,9 @@ impl SceneManager {
|
|||
Self {
|
||||
scenes: Vec::new(),
|
||||
current_scene_index: None,
|
||||
window_context: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_window_context(&mut self, window_context: Rc<RefCell<WindowContext>>) {
|
||||
self.window_context = Some(window_context);
|
||||
}
|
||||
|
||||
fn create_world_with_resources(window_context: &WindowContext) -> World {
|
||||
let mut world = World::new();
|
||||
|
||||
|
@ -45,6 +40,13 @@ impl SceneManager {
|
|||
let vulkan_command_buffer_allocator = vulkan_context.command_buffer_allocator();
|
||||
let vulkan_descriptor_set_allocator = vulkan_context.descriptor_set_allocator();
|
||||
|
||||
let texture_loader = TextureLoader::new(
|
||||
vulkan_device.clone(),
|
||||
vulkan_command_buffer_allocator.clone(),
|
||||
vulkan_memory_allocator.clone(),
|
||||
TextureLoader::select_best_suitable_queue(vulkan_graphics_queue, vulkan_transfer_queue),
|
||||
);
|
||||
|
||||
world.insert_resource(VulkanInstance(vulkan_instance.clone()));
|
||||
world.insert_resource(VulkanDevice(vulkan_device.clone()));
|
||||
world.insert_resource(VulkanGraphicsQueue(vulkan_graphics_queue.clone()));
|
||||
|
@ -57,6 +59,7 @@ impl SceneManager {
|
|||
world.insert_resource(VulkanDescriptorSetAllocator(
|
||||
vulkan_descriptor_set_allocator.clone(),
|
||||
));
|
||||
world.insert_resource(texture_loader);
|
||||
|
||||
world
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue