5#include <unordered_map>
85 static MaterialTextureSet from_directory(
const std::string &base_path,
const std::string &material_name);
109 void bind(
unsigned int slot = 0)
const;
void pass_data(const T *data, size_t count) const
void pass_data(const std::vector< T > &data) const
void pass_data(const std::vector< T > &data) const
void pass_dynamic_data(const std::vector< T > &data) const
void pass_data(const T *data, size_t count) const
std::shared_ptr< Texture > get_texture(AssetID id)
size_t get_loaded_mesh_count() const
std::unordered_map< AssetID, std::shared_ptr< Texture > > texture_cache_
AssetManager(AssetRegistry ®istry)
std::shared_ptr< Mesh > get_mesh(AssetID id)
size_t get_loaded_material_count() const
AssetRegistry & registry_
std::unordered_map< AssetID, std::shared_ptr< Material > > material_cache_
size_t get_loaded_texture_count() const
std::shared_ptr< Material > get_material(AssetID id)
std::unordered_map< AssetID, std::shared_ptr< Mesh > > mesh_cache_
Registry for storing assets.
const std::filesystem::path & get_project_root()
std::optional< AssetID > get_uuid_by_path(const std::filesystem::path &filepath)
AssetID generate_uuid(const std::filesystem::path &filepath)
void unregister_asset(AssetID uuid)
bool has_asset_changed(AssetID uuid) const
void set_project_root(const std::filesystem::path &project_root)
std::filesystem::path get_absolute_path(AssetID uuid)
std::unordered_map< std::filesystem::path, AssetID > path_to_uuid_
std::filesystem::path registry_file_
AssetID register_asset(const std::filesystem::path &filepath, AssetType type)
std::unordered_map< AssetID, AssetMetadata > assets_
std::filesystem::path to_absolute_path(const std::filesystem::path &relative_path) const
static AssetType get_type_from_extension(const std::filesystem::path &filepath)
std::filesystem::path to_relative_path(const std::filesystem::path &absolute_path) const
AssetID register_asset(const std::filesystem::path &filepath)
std::vector< AssetID > register_directory(const std::filesystem::path &directory_path, bool recursive)
std::vector< AssetMetadata > get_assets_by_type(AssetType type)
std::filesystem::path get_relative_path(AssetID uuid)
bool asset_exists(AssetID uuid) const
size_t get_asset_count() const
std::vector< AssetID > get_modified_assets() const
AssetRegistry(const std::filesystem::path ®istry_file, const std::filesystem::path &project_root)
std::optional< AssetMetadata > get_asset(AssetID uuid) const
std::filesystem::path project_root_
std::vector< AssetMetadata > get_all_assets() const
uint64_t get_file_last_modified(const std::filesystem::path &filepath) const
static void compile_shader_from_material(Material &material)
static std::optional< MaterialData > load(const std::filesystem::path &filepath)
void apply_to_material(Material &material) const
std::unordered_map< TextureType, std::shared_ptr< Texture > > textures_
bool has(TextureType type) const
std::shared_ptr< Texture > get(TextureType type) const
void set_ambient_color(const glm::vec3 &color)
void bind_all_properties(uint32_t shader_program, int &texture_unit) const
Material & set_texture(Texture *texture, int texture_slot=0)
std::map< std::string, Property > properties_
std::shared_ptr< Material > base_material_
std::vector< int > bound_texture_units_
Material & set_texture_internal(Texture *texture, TextureType type, int texture_slot)
void set_uv_offset(const glm::vec2 &offset)
void bind() const
Used to bind a Material for rendering.
bool is_transparent() const
uint32_t get_compiled_shader_id() const
void unbind_all_textures() const
std::unordered_map< std::string, Property > overrides_
void set_uv_tiling(float x, float y)
const std::string & get_name() const
void set_roughness(float roughness)
const auto & get_properties() const
void set_specular_color(const glm::vec3 &color)
std::optional< ShaderInfo > custom_shader_info_
std::unordered_set< std::string > touched_uniforms_
void set_uv_rotation(float rotation)
void set_compiled_shader_id(uint32_t shader_id)
Material & set_texture(const std::shared_ptr< Texture > &texture, int texture_slot=0)
void set_metallic(float metallic)
void set_uv_tiling(const glm::vec2 &tiling)
void set_diffuse_color(const glm::vec3 &color)
void set_opacity(float opacity)
uint32_t compiled_shader_id_
bool has_custom_shader() const
void set_emissive_color(const glm::vec3 &color)
void set_custom_shader(const ShaderInfo &shader_info)
const ShaderInfo * get_shader_info() const
void set_shininess(float shininess)
static std::shared_ptr< Mesh > load(const std::filesystem::path &filepath)
Mesh(const std::vector< Vertex > &vertices, const std::vector< unsigned int > &indices)
int get_index_count() const
std::unique_ptr< VA > vao_
std::unique_ptr< IB > ibo_
std::vector< Vertex > vertices
Mesh(const std::vector< Vertex > &vertices, const std::vector< unsigned int > &indices, bool defer_build)
std::unique_ptr< VB > vbo_
std::vector< unsigned int > indices
void draw_instanced(size_t amount) const
static std::unordered_map< std::string, std::weak_ptr< Texture > > cache_
static void clear_cache()
static size_t get_cache_size()
const std::string & get_path()
static std::string type_to_string(TextureType type)
Texture & operator=(const Texture &)=delete
Texture(Texture &&other) noexcept
TextureSettings settings_
static std::string get_uniform_name(TextureType type)
GLint get_gl_filter_mode(TextureFilter filter) const
Texture(const Texture &)=delete
TextureType get_type() const
void bind(unsigned int slot=0) const
void set_filter_mode(TextureFilter min_filter, TextureFilter mag_filter)
GLint get_gl_wrap_mode(TextureWrap wrap) const
void set_wrap_mode(TextureWrap wrap_s, TextureWrap wrap_t)
Texture & operator=(Texture &&other) noexcept
constexpr AssetID INVALID_ASSET_ID
static constexpr const char * EMISSIVE_COLOR
static constexpr const char * UV_ROTATION
static constexpr const char * ROUGHNESS_TEXTURE
static constexpr const char * DIFFUSE_TEXTURE
static constexpr const char * SPECULAR_COLOR
static constexpr const char * METALLIC
static const char * get_texture_flag_name(TextureType type)
static constexpr const char * NORMAL_TEXTURE
static constexpr const char * USE_SPECULAR_TEXTURE
static constexpr const char * SPECULAR_TEXTURE
static constexpr const char * USE_ROUGHNESS_TEXTURE
static constexpr const char * ROUGHNESS
static constexpr const char * SHININESS
static constexpr const char * DIFFUSE_COLOR
static constexpr const char * AMBIENT_COLOR
static constexpr const char * AO_TEXTURE
static constexpr const char * UV_TILING
static constexpr const char * USE_AO_TEXTURE
static constexpr const char * UV_OFFSET
static constexpr const char * USE_EMISSIVE_TEXTURE
static constexpr const char * METALLIC_TEXTURE
static constexpr const char * EMISSIVE_TEXTURE
static constexpr const char * USE_NORMAL_TEXTURE
static constexpr const char * USE_DIFFUSE_TEXTURE
static const char * get_texture_uniform_name(TextureType type)
static constexpr const char * USE_METALLIC_TEXTURE
static constexpr const char * OPACITY
std::variant< float, glm::vec2, glm::vec3, glm::vec4, Texture *, bool, int, glm::mat3, glm::mat4 > value
std::string fragment_path
std::unordered_map< std::string, std::string > uniform_mappings
std::unordered_set< std::string > defines
std::optional< std::string > geometry_path
static TextureSettings for_type(TextureType type)