11 #include <unordered_map>
12 #include <unordered_set>
44 namespace visualization {
102 const std::shared_ptr<geometry::Image>
image,
118 size_t index_stride);
139 template <
class ResourceType>
141 std::shared_ptr<ResourceType>
ptr;
151 filament::Engine& engine_;
153 template <
class ResourceType>
154 using ResourcesContainer =
155 std::unordered_map<REHandle_abstract, BoxedResource<ResourceType>>;
157 ResourcesContainer<filament::MaterialInstance> material_instances_;
158 ResourcesContainer<filament::Material> materials_;
159 ResourcesContainer<filament::Texture> textures_;
160 ResourcesContainer<filament::RenderTarget> render_targets_;
161 ResourcesContainer<filament::IndirectLight> ibls_;
162 ResourcesContainer<filament::Skybox> skyboxes_;
163 ResourcesContainer<filament::VertexBuffer> vertex_buffers_;
164 ResourcesContainer<filament::IndexBuffer> index_buffers_;
170 std::unordered_map<REHandle_abstract, std::unordered_set<REHandle_abstract>>
174 std::unordered_map<uint64_t, TextureHandle> texture_cache_;
176 filament::Texture* LoadTextureFromImage(
177 const std::shared_ptr<geometry::Image>&
image,
bool srgb);
180 filament::Texture* LoadFilledTexture(
const Eigen::Vector3f&
color,
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:183
math::float4 color
Definition: LineSetBuffers.cpp:45
std::vector< UVAtlasVertex > vb
Definition: UVUnwrapping.cpp:27
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Definition: Image.h:34
The Image class stores image with customizable rows, cols, channels, dtype and device.
Definition: Image.h:29
Definition: FilamentResourceManager.h:50
std::weak_ptr< filament::RenderTarget > GetRenderTarget(const RenderTargetHandle &id)
Definition: FilamentResourceManager.cpp:769
static const MaterialInstanceHandle kNormalsMaterial
Definition: FilamentResourceManager.h:67
void DestroyAll()
Definition: FilamentResourceManager.cpp:794
static const MaterialHandle kInfinitePlaneShader
Definition: FilamentResourceManager.h:63
std::weak_ptr< filament::IndexBuffer > GetIndexBuffer(const IndexBufferHandle &id)
Definition: FilamentResourceManager.cpp:789
static const TextureHandle kDefaultColorMap
Definition: FilamentResourceManager.h:70
VertexBufferHandle AddVertexBuffer(filament::VertexBuffer *vertex_buffer)
Definition: FilamentResourceManager.cpp:718
SkyboxHandle CreateColorSkybox(const Eigen::Vector3f &color)
Definition: FilamentResourceManager.cpp:659
static const TextureHandle kDefaultNormalMap
Definition: FilamentResourceManager.h:71
RenderTargetHandle CreateRenderTarget(TextureHandle color, TextureHandle depth)
Definition: FilamentResourceManager.cpp:582
~FilamentResourceManager()
Definition: FilamentResourceManager.cpp:383
std::weak_ptr< filament::Material > GetMaterial(const MaterialHandle &id)
Definition: FilamentResourceManager.cpp:754
IndirectLightHandle CreateIndirectLight(const ResourceLoadRequest &request)
Definition: FilamentResourceManager.cpp:604
std::weak_ptr< filament::Skybox > GetSkybox(const SkyboxHandle &id)
Definition: FilamentResourceManager.cpp:779
FilamentResourceManager(filament::Engine &engine)
Definition: FilamentResourceManager.cpp:378
static const MaterialHandle kDefaultLineShader
Definition: FilamentResourceManager.h:64
static const MaterialHandle kDefaultUnlitBackgroundShader
Definition: FilamentResourceManager.h:62
static const MaterialHandle kDefaultDepthShader
Definition: FilamentResourceManager.h:58
static const MaterialHandle kDefaultUnlit
Definition: FilamentResourceManager.h:55
static const MaterialHandle kDefaultUnlitSolidColorShader
Definition: FilamentResourceManager.h:61
static const MaterialHandle kDefaultUnlitGradientShader
Definition: FilamentResourceManager.h:60
TextureHandle CreateColorAttachmentTexture(int width, int height)
Definition: FilamentResourceManager.cpp:551
static const MaterialHandle kDefaultUnlitPolygonOffsetShader
Definition: FilamentResourceManager.h:65
IndexBufferHandle CreateIndexBuffer(size_t indices_count, size_t index_stride)
Definition: FilamentResourceManager.cpp:733
void ReuseVertexBuffer(VertexBufferHandle vb)
Definition: FilamentResourceManager.cpp:724
TextureHandle CreateDepthAttachmentTexture(int width, int height)
Definition: FilamentResourceManager.cpp:567
std::weak_ptr< filament::MaterialInstance > GetMaterialInstance(const MaterialInstanceHandle &id)
Definition: FilamentResourceManager.cpp:760
static const MaterialHandle kDefaultDepthValueShader
Definition: FilamentResourceManager.h:59
MaterialInstanceHandle CreateMaterialInstance(const MaterialHandle &id)
Definition: FilamentResourceManager.cpp:428
static const MaterialHandle kDefaultUnlitWithTransparency
Definition: FilamentResourceManager.h:56
TextureHandle CreateTexture(const char *path, bool srgb)
Definition: FilamentResourceManager.cpp:441
static const MaterialHandle kDefaultNormalShader
Definition: FilamentResourceManager.h:57
static const MaterialHandle kDefaultLitSSR
Definition: FilamentResourceManager.h:54
static const MaterialInstanceHandle kColorMapMaterial
Definition: FilamentResourceManager.h:68
static const MaterialInstanceHandle kDepthMaterial
Definition: FilamentResourceManager.h:66
SkyboxHandle CreateSkybox(const ResourceLoadRequest &request)
Definition: FilamentResourceManager.cpp:673
std::weak_ptr< filament::Texture > GetTexture(const TextureHandle &id)
Definition: FilamentResourceManager.cpp:764
MaterialHandle CreateMaterial(const void *material_data, size_t data_size)
Definition: FilamentResourceManager.cpp:385
static const TextureHandle kDefaultTexture
Definition: FilamentResourceManager.h:69
TextureHandle CreateTextureFilled(const Eigen::Vector3f &color, size_t dimension)
Definition: FilamentResourceManager.cpp:501
bool UpdateTexture(TextureHandle texture, const std::shared_ptr< geometry::Image > image, bool srgb)
Definition: FilamentResourceManager.cpp:510
void Destroy(const REHandle_abstract &id)
Definition: FilamentResourceManager.cpp:806
static const MaterialHandle kDefaultLitWithTransparency
Definition: FilamentResourceManager.h:53
std::weak_ptr< filament::VertexBuffer > GetVertexBuffer(const VertexBufferHandle &id)
Definition: FilamentResourceManager.cpp:784
std::weak_ptr< filament::IndirectLight > GetIndirectLight(const IndirectLightHandle &id)
Definition: FilamentResourceManager.cpp:775
static const MaterialHandle kDefaultLit
Definition: FilamentResourceManager.h:52
Definition: Renderer.h:36
Definition: FilamentEngine.h:12
Definition: PinholeCameraIntrinsic.cpp:16
Definition: FilamentResourceManager.h:140
std::shared_ptr< ResourceType > operator->()
Definition: FilamentResourceManager.h:147
size_t use_count
Definition: FilamentResourceManager.h:142
BoxedResource()
Definition: FilamentResourceManager.h:144
std::shared_ptr< ResourceType > ptr
Definition: FilamentResourceManager.h:141
BoxedResource(std::shared_ptr< ResourceType > p)
Definition: FilamentResourceManager.h:145
Definition: RendererHandle.h:47
Definition: RendererHandle.h:90