32 void set_perspective(
float fov,
float aspect,
float near_plane,
float far_plane);
35 void set_orthographic(
float left,
float right,
float bottom,
float top,
float near_plane,
float far_plane);
78 void look_at(
const glm::vec3 &target);
90 float near_plane = 0.1f,
float far_plane = 100.0f);
93 float near_plane = 0.1f,
float far_plane = 100.0f);
Shader(const uint32_t program_id)
Shader & operator=(const Shader &)=delete
void set_vec3(const std::string &name, const glm::vec3 &value) const
void set_directional_light(const int index, const glm::vec3 &direction, const glm::vec3 &color, const float intensity=1.0f) const
hellfire::ShaderUniformBinder get_binder() const
static Shader from_id(const uint32_t shader_id)
void set_time(const float time) const
Shader & operator=(Shader &&other) noexcept
void set_bool(const std::string &name, const bool value) const
void set_mat2(const std::string &name, const glm::mat2 &value) const
bool has_uniform(const std::string &name) const
void set_float(const std::string &name, const float value) const
void set_view_projection(const glm::mat4 &view, const glm::mat4 &projection) const
void set_mat3(const std::string &name, const glm::mat3 &value) const
Shader(Shader &&other) noexcept
void set_transform_matrices(const glm::mat4 &model, const glm::mat4 &view, const glm::mat4 &projection) const
void set_camera_position(const glm::vec3 &position) const
void set_mat4(const std::string &name, const glm::mat4 &value) const
void set_int(const std::string &name, const int value) const
void set_vec3(const std::string &name, const float x, const float y, const float z) const
void set_point_light(const int index, const glm::vec3 &position, const glm::vec3 &color, const float constant=1.0f, const float linear=0.09f, const float quadratic=0.032f) const
void set_vec4(const std::string &name, float x, float y, float z, float w) const
void set_vec4(const std::string &name, const glm::vec4 &value) const
void set_vec2(const std::string &name, const float x, const float y) const
void set_uint(const std::string &name, const uint32_t value) const
Shader(const Shader &)=delete
void set_light_counts(const int directional_lights, const int point_lights) const
uint32_t get_program_id() const
void set_vec2(const std::string &name, const glm::vec2 &value) const
void set_texture(const std::string &name, const int texture_unit) const
std::vector< std::unique_ptr< IApplicationPlugin > > plugins_
std::function< bool()> exit_condition_
AppInfo & get_window_info()
void on_mouse_move(float x, float y) override
void set_exit_condition(std::function< bool()> condition)
ShaderManager shader_manager_
std::unique_ptr< IWindow > window_
ShaderRegistry shader_registry_
bool call_plugins_until_consumed(Func &&func)
void on_render() override
std::unique_ptr< InputManager > input_manager_
Application(int width=800, int height=600, std::string title="hellfire Application")
void handle_cursor_warping(float x, float y) const
bool handle_first_mouse_movement(float x, float y)
void on_key_up(int key) override
void on_key_down(int key) override
void on_window_minimize(bool minimized) override
void register_plugin(std::unique_ptr< IApplicationPlugin > plugin)
Method for registering plugins.
Shader * ensure_fallback_shader()
void on_mouse_button(int button, bool pressed) override
void call_plugins(Func &&func)
uint32_t create_minimal_fallback_shader()
void on_window_resize(int width, int height) override
float get_far_plane() const
void set_camera_type(CameraType type)
void update_view_matrix() const
void update_orthographic_bounds()
glm::vec3 get_right_vector() const
void look_at(const glm::vec3 &target)
void set_orthographic(float left, float right, float bottom, float top, float near_plane, float far_plane)
static CameraComponent * create_orthographic(float size=10.0f, float aspect=16.0f/9.0f, float near_plane=0.1f, float far_plane=100.0f)
glm::mat4 get_projection_matrix() const
void set_clip_planes(float near_plane, float far_plane)
static CameraComponent * create_perspective(float fov=45.0f, float aspect=16.0f/9.0f, float near_plane=0.1f, float far_plane=100.0f)
void update_projection_matrix() const
CameraType get_camera_type() const
void invalidate_view() const
glm::mat4 get_view_matrix() const
float get_mouse_sensitivity() const
float get_near_plane() const
void set_pitch(float pitch)
float get_aspect_ratio() const
glm::vec3 get_front_vector() const
glm::vec3 get_target() const
CameraComponent(CameraType type=CameraType::PERSPECTIVE)
void set_mouse_sensitivity(float sensitivity)
glm::vec3 get_up_vector() const
glm::mat4 projection_matrix_
void set_aspect_ratio(float aspect)
void set_perspective(float fov, float aspect, float near_plane, float far_plane)
void set_target(const glm::vec3 &target)
void update_camera_vectors()
Entity & get_owner() const
void attach_texture_by_id(uint32_t texture_id, GLenum attachment, GLenum target)
std::vector< FrameBufferAttachmentSettings > color_settings_
uint32_t get_width() const
uint32_t get_height() const
void resize(uint32_t width, uint32_t height)
FrameBufferAttachmentSettings stencil_settings_
void attach_depth_texture(const FrameBufferAttachmentSettings &settings={})
const std::vector< uint32_t > & get_color_attachments() const
uint32_t get_depth_attachment() const
void attach_color_texture(const FrameBufferAttachmentSettings &settings={})
FrameBufferAttachmentSettings depth_settings_
void attach_stencil_texture(const FrameBufferAttachmentSettings &settings={})
std::vector< uint32_t > color_attachments_
uint32_t read_pixel_from_texture(uint32_t texture_id, int x, int y)
Reads a pixel from an external texture using this framebuffer.
size_t get_color_attachment_count() const
void create_framebuffer()
uint32_t stencil_attachment_
Framebuffer(const Framebuffer &)=delete
uint32_t get_color_attachment(const size_t index=0) const
Framebuffer & operator=(const Framebuffer &)=delete
uint32_t depth_attachment_
virtual bool on_mouse_move(float x, float y, float x_offset, float y_offset)
virtual bool on_mouse_button(int button, bool pressed)
virtual void on_end_frame()
virtual bool on_key_down(int key)
virtual void on_begin_frame()
virtual Entity * get_render_camera_override()
virtual void on_initialize(Application &app)
virtual void on_window_resize(int width, int height)
virtual void on_key_up(int keycode)
virtual void on_mouse_move(float x, float y)
virtual void on_window_resize(int width, int height)
virtual ~IWindowEventHandler()=default
virtual void on_key_down(int keycode)
virtual void on_window_minimize(bool minimized)
virtual void on_mouse_button(int button, bool pressed)
virtual void on_mouse_wheel(float delta)
virtual void set_event_handler(IWindowEventHandler *event_handler)=0
virtual bool is_key_pressed(int keycode) const =0
virtual bool should_close() const =0
virtual glm::vec2 get_mouse_position() const =0
virtual ~IWindow()=default
virtual void set_size(int width, int height)=0
virtual void poll_events()=0
virtual glm::ivec2 get_framebuffer_size() const =0
virtual void set_title(const std::string &title)=0
virtual void swap_buffers()=0
virtual void enable_vsync(bool vsync)=0
virtual glm::ivec2 get_size() const =0
virtual void * get_native_handle()=0
virtual void warp_cursor(double x, double y)=0
virtual void set_cursor_mode(CursorMode mode)=0
virtual bool create(int width, int height, const std::string &title)=0
virtual float get_elapsed_time()=0
virtual void wait_for_events()=0
virtual void make_current()=0
void upload_directional_to_shader(Shader &shader, const int light_index) const
void set_outer_cone_angle(const float angle)
void set_intensity(const float intensity)
float get_inner_cone_angle() const
float get_attenuation() const
void set_color(const glm::vec3 &color)
LightComponent(const LightType type=DIRECTIONAL)
float get_outer_cone_angle() const
LightType get_light_type() const
void look_at(const glm::vec3 &target)
void look_at(const float x, const float y, const float z)
void upload_to_shader(Shader &shader, const int light_index) const
void set_inner_cone_angle(const float angle)
void set_range(const float range)
void set_attenuation(const float attenuation)
bool should_cast_shadows() const
glm::mat4 light_view_proj_matrix
const glm::vec3 & get_color() const
void upload_spot_to_shader(Shader &shader, int light_index) const
void set_direction(const float x, const float y, const float z)
void set_cast_shadows(const bool cast_shadows)
void set_light_type(const LightType type)
const glm::vec3 & get_direction()
void set_light_view_proj_matrix(const glm::mat4 &lvpm)
void set_direction(const glm::vec3 &direction)
const float & get_intensity() const
void upload_point_to_shader(Shader &shader, const int light_index) const
const glm::mat4 & get_light_view_proj_matrix() const
Entity * directional_light_entities[4]
int num_directional_lights
CameraComponent * camera_component
Entity * point_light_entities[8]
void draw_render_command(const RenderCommand &cmd, const glm::mat4 &view, const glm::mat4 &projection)
ShaderRegistry & get_shader_registry()
void ensure_shadow_map(Entity *light_entity, const LightComponent &light)
Shader & get_shader_for_material(const std::shared_ptr< Material > &material)
SkyboxRenderer skybox_renderer_
ShaderRegistry shader_registry_
void set_render_to_framebuffer(bool enable)
ShadowSettings shadow_settings_
std::vector< InstancedRenderCommand > opaque_instanced_objects_
bool render_to_framebuffer_
void execute_skybox_pass(Scene *scene, const glm::mat4 &view, const glm::mat4 &projection, CameraComponent *camera_comp) const
uint32_t get_object_id_texture() const
glm::mat4 calculate_light_view_proj(Entity *light_entity, LightComponent *light, const CameraComponent &camera)
std::shared_ptr< Material > shadow_material_
void draw_instanced_command(const InstancedRenderCommand &cmd, const glm::mat4 &view, const glm::mat4 &projection)
void render(Scene &scene, const Entity *camera_override)
void collect_geometry_from_scene(Scene &scene, const glm::vec3 camera_pos)
void execute_shadow_passes(Scene &scene, CameraComponent &camera)
std::unique_ptr< Framebuffer > scene_framebuffers_[2]
Shader * fallback_shader_
uint32_t fallback_program_
std::vector< RenderCommand > opaque_objects_
uint32_t get_main_output_texture() const
void resize_main_framebuffer(uint32_t width, uint32_t height)
ShaderManager shader_manager_
void execute_transparency_pass(const glm::mat4 &view, const glm::mat4 &proj)
void reset_framebuffer_data()
void execute_main_pass(Scene &scene, CameraComponent &camera)
ShadowSettings & get_shadow_settings()
uint32_t framebuffer_width_
void render_frame(Scene &scene, CameraComponent &camera)
void execute_geometry_pass(const glm::mat4 &view, const glm::mat4 &proj)
void collect_lights_from_scene(Scene &scene, CameraComponent &camera)
void store_lights_in_context(const std::vector< Entity * > &light_entities, CameraComponent &camera)
uint32_t framebuffer_height_
std::vector< RenderCommand > transparent_objects_
void draw_shadow_geometry(const glm::mat4 &light_view_proj)
std::unordered_map< Entity *, ShadowMapData > shadow_maps_
void set_fallback_shader(Shader &fallback_shader)
std::unique_ptr< OGLRendererContext > context_
void collect_render_commands_recursive(EntityID entity_id, const glm::vec3 &camera_pos)
std::vector< InstancedRenderCommand > transparent_instanced_objects_
void create_main_framebuffer(uint32_t width, uint32_t height)
Shader * get_fallback_shader() const
uint32_t compile_material_shader(std::shared_ptr< Material > material)
ShaderManager & get_shader_manager()
bool has_active_scene() const
void destroy_scene(Scene *scene)
CameraComponent * get_active_camera() const
void save_current_scene()
bool save_scene(Scene *scene)
Scene * create_scene(const std::string &name="GameScene")
Scene * load_scene(const std::filesystem::path &filename)
void create_default_scene()
std::optional< AssetID > get_scene_asset_id(Scene *scene) const
void set_active_camera(EntityID camera) const
void set_scene_asset_id(Scene *scene, AssetID id)
std::optional< AssetID > get_active_scene_asset_id() const
SceneActivatedCallback scene_activated_callback_
Scene * get_active_scene() const
void set_active_scene(Scene *scene, bool should_play=true)
bool save_scene_as(const std::string &filename, Scene *scene)
std::vector< Scene * > scenes_
std::vector< Scene * > get_scenes()
std::unordered_map< Scene *, AssetID > scene_asset_ids_
EntityID find_entity_by_name(const std::string &name)
std::vector< EntityID > get_camera_entities() const
Scene * load_scene(AssetID asset_id, const std::filesystem::path &filename)
void set_scene_activated_callback(SceneActivatedCallback callback)
void update(float delta_time)
Manages a collection of entities and their hierarchical relationships.
std::vector< uint32_t > get_all_shader_ids() const
std::unordered_map< std::string, std::string > include_cache_
std::unordered_map< std::string, uint32_t > compiled_shaders_
uint32_t load_shader_from_files(const std::string &vertex_path, const std::string &fragment_path)
std::string trim(const std::string &str)
uint32_t load_shader(const ShaderVariant &variant)
std::string get_directory_from_path(const std::string &file_path)
std::string process_includes(const std::string &source, const std::string &base_path="shaders/")
bool has_shader(const std::string &key) const
std::string clean_shader_content(const std::string &content, const std::string &filepath)
uint32_t compile_shader_program(const std::string &vertex_source, const std::string &fragment_source)
std::string load_shader_file(const std::string &path)
uint32_t get_shader_for_material(Material &material)
uint32_t get_shader(const std::string &key) const
std::string load_include_file(const std::string &path, const std::string &base_path)
void load_skybox_shader()
void render(const Skybox &skybox, const CameraComponent *camera) const
void setup_skybox_geometry()
bool operator<(const RenderCommand &other) const
InstancedRenderableComponent * instanced_renderable
std::shared_ptr< Material > material
std::shared_ptr< Material > material
std::shared_ptr< Mesh > mesh
bool operator<(const RenderCommand &other) const
std::unordered_set< std::string > defines
std::string get_key() const
std::string fragment_path
std::unique_ptr< Framebuffer > framebuffer
glm::mat4 light_view_proj