30 #include <unordered_map> 31 #include <unordered_set> 56 namespace visualization {
83 MaterialHandle CreateMaterial(
const void* material_data,
size_t data_size);
88 TextureHandle CreateTexture(
const std::shared_ptr<geometry::Image>& image,
106 size_t index_stride);
108 std::weak_ptr<filament::Material> GetMaterial(
const MaterialHandle&
id);
109 std::weak_ptr<filament::MaterialInstance> GetMaterialInstance(
111 std::weak_ptr<filament::Texture> GetTexture(
const TextureHandle&
id);
112 std::weak_ptr<filament::IndirectLight> GetIndirectLight(
114 std::weak_ptr<filament::Skybox> GetSkybox(
const SkyboxHandle&
id);
115 std::weak_ptr<filament::VertexBuffer> GetVertexBuffer(
117 std::weak_ptr<filament::IndexBuffer> GetIndexBuffer(
125 template <
class ResourceType>
127 std::shared_ptr<ResourceType>
ptr;
128 size_t use_count = 0;
137 filament::Engine& engine_;
139 template <
class ResourceType>
140 using ResourcesContainer =
141 std::unordered_map<REHandle_abstract, BoxedResource<ResourceType>>;
143 ResourcesContainer<filament::MaterialInstance> material_instances_;
144 ResourcesContainer<filament::Material> materials_;
145 ResourcesContainer<filament::Texture> textures_;
146 ResourcesContainer<filament::IndirectLight> ibls_;
147 ResourcesContainer<filament::Skybox> skyboxes_;
148 ResourcesContainer<filament::VertexBuffer> vertex_buffers_;
149 ResourcesContainer<filament::IndexBuffer> index_buffers_;
155 std::unordered_map<REHandle_abstract, std::unordered_set<REHandle_abstract>>
158 filament::Texture* LoadTextureFromImage(
159 const std::shared_ptr<geometry::Image>& image,
bool srgb);
160 filament::Texture* LoadFilledTexture(
const Eigen::Vector3f&
color,
static const MaterialInstanceHandle kColorMapMaterial
Definition: FilamentResourceManager.h:73
BoxedResource()
Definition: FilamentResourceManager.h:130
BoxedResource(std::shared_ptr< ResourceType > p)
Definition: FilamentResourceManager.h:131
static const MaterialHandle kDefaultDepthShader
Definition: FilamentResourceManager.h:68
Definition: RendererHandle.h:115
static const MaterialHandle kDefaultUnlitSolidColorShader
Definition: FilamentResourceManager.h:70
Definition: FilamentResourceManager.h:62
Definition: FilamentResourceManager.h:126
static const TextureHandle kDefaultNormalMap
Definition: FilamentResourceManager.h:76
static const MaterialHandle kDefaultNormalShader
Definition: FilamentResourceManager.h:67
static const MaterialHandle kDefaultUnlit
Definition: FilamentResourceManager.h:66
math::float4 color
Definition: LineSetBuffers.cpp:63
Definition: Renderer.h:46
static const MaterialInstanceHandle kDepthMaterial
Definition: FilamentResourceManager.h:71
std::shared_ptr< ResourceType > ptr
Definition: FilamentResourceManager.h:127
static const TextureHandle kDefaultColorMap
Definition: FilamentResourceManager.h:75
static const MaterialHandle kDefaultUnlitGradientShader
Definition: FilamentResourceManager.h:69
static const MaterialInstanceHandle kNormalsMaterial
Definition: FilamentResourceManager.h:72
Definition: PinholeCameraIntrinsic.cpp:35
static const MaterialHandle kDefaultLit
Definition: FilamentResourceManager.h:64
std::shared_ptr< ResourceType > operator->()
Definition: FilamentResourceManager.h:133
Definition: RendererHandle.h:72
static const TextureHandle kDefaultTexture
Definition: FilamentResourceManager.h:74
static const MaterialHandle kDefaultLitWithTransparency
Definition: FilamentResourceManager.h:65
Definition: FilamentEngine.h:31
The Image class stores image with customizable width, height, num of channels and bytes per channel...
Definition: Image.h:53