Misc renderer improvements:
- Reuse renderer and gltf loader between scenes - Use puish descriptors to simplify the management of descriptor sets in the scene renderer - Don't keep the imgui swapchain in the scene classes - Fix alpha blending, add alpha masking - Fix mipmaps not being used in renderer - Add cache when loading images and models - Only premultiply the colours if required - Add support for gltTF animations Allow removing an object and its descendants from the scene, allow loading from a memory buffer
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "image_loader.h"
|
||||
#include "render/growable_descriptor_pool.h"
|
||||
#include "utils/cache.h"
|
||||
#include "utils/thread_safe.h"
|
||||
#include "wivrn_config.h"
|
||||
#include "xr/hand_tracker.h"
|
||||
@@ -42,7 +43,7 @@ class imgui_textures
|
||||
struct texture_data
|
||||
{
|
||||
vk::raii::Sampler sampler;
|
||||
loaded_image image;
|
||||
std::shared_ptr<loaded_image> image;
|
||||
std::shared_ptr<vk::raii::DescriptorSet> descriptor_set;
|
||||
};
|
||||
|
||||
@@ -53,6 +54,9 @@ protected:
|
||||
vk::raii::DescriptorSetLayout ds_layout;
|
||||
vk::raii::CommandPool command_pool;
|
||||
|
||||
using image_cache_type = utils::cache<std::string, loaded_image, image_loader>;
|
||||
std::shared_ptr<image_cache_type> image_cache;
|
||||
|
||||
private:
|
||||
growable_descriptor_pool descriptor_pool;
|
||||
std::unordered_map<ImTextureID, texture_data> textures;
|
||||
@@ -62,7 +66,8 @@ public:
|
||||
vk::raii::PhysicalDevice physical_device,
|
||||
vk::raii::Device & device,
|
||||
uint32_t queue_family_index,
|
||||
thread_safe<vk::raii::Queue> & queue);
|
||||
thread_safe<vk::raii::Queue> & queue,
|
||||
std::shared_ptr<image_cache_type> image_cache = {});
|
||||
ImTextureID load_texture(const std::string & filename, vk::raii::Sampler && sampler);
|
||||
ImTextureID load_texture(const std::string & filename);
|
||||
ImTextureID load_texture(const std::span<const std::byte> & bytes, vk::raii::Sampler && sampler, const std::string & name = "");
|
||||
@@ -165,7 +170,7 @@ private:
|
||||
|
||||
std::vector<viewport> layers_;
|
||||
|
||||
xr::swapchain & swapchain;
|
||||
xr::swapchain swapchain;
|
||||
int image_index;
|
||||
|
||||
ImGuiContext * context;
|
||||
@@ -200,8 +205,9 @@ public:
|
||||
uint32_t queue_family_index,
|
||||
thread_safe<vk::raii::Queue> & queue,
|
||||
std::span<controller> controllers,
|
||||
xr::swapchain & swapchain,
|
||||
std::vector<viewport> layers);
|
||||
xr::swapchain && swapchain,
|
||||
std::vector<viewport> layers,
|
||||
std::shared_ptr<imgui_textures::image_cache_type> image_cache);
|
||||
|
||||
~imgui_context();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user