2#include "glm/ext/scalar_integer.hpp"
41 if(!depth || (depth && depth->get_size() != viewport_size))
43 depth = std::make_shared<gfx::texture>(viewport_size.
width,
47 gfx::texture_format::D32F,
57 if(!hiz || (hiz && hiz->get_size() != viewport_size))
60 hiz = std::make_shared<gfx::texture>(viewport_size.
width,
64 gfx::texture_format::R32F,
66 BGFX_TEXTURE_COMPUTE_WRITE |
67 BGFX_SAMPLER_MIN_POINT |
68 BGFX_SAMPLER_MAG_POINT |
69 BGFX_SAMPLER_MIP_POINT |
70 BGFX_SAMPLER_U_CLAMP |
82 auto& depth = create_or_resize_d_buffer(rview, viewport_size, params);
85 if(!fbo || (fbo && fbo->get_size() != viewport_size))
87 auto format = params.
fill_hdr_params ? gfx::texture_format::RGBA16F : gfx::texture_format::RGBA8;
89 auto tex0 = std::make_shared<gfx::texture>(viewport_size.
width,
93 gfx::texture_format::RGBA8,
94 BGFX_TEXTURE_COMPUTE_WRITE | BGFX_TEXTURE_RT);
96 auto tex1 = std::make_shared<gfx::texture>(viewport_size.
width,
103 auto tex2 = std::make_shared<gfx::texture>(viewport_size.
width,
107 gfx::texture_format::RGBA8,
110 auto tex3 = std::make_shared<gfx::texture>(viewport_size.
width,
114 gfx::texture_format::RGBA8,
117 fbo = std::make_shared<gfx::frame_buffer>();
118 fbo->populate({tex0, tex1, tex2, tex3, depth});
128 auto& depth = create_or_resize_d_buffer(rview, viewport_size, params);
131 if(!fbo || (fbo && fbo->get_size() != viewport_size))
133 auto format = params.
fill_hdr_params ? gfx::texture_format::RGBA16F : gfx::texture_format::RGBA8;
135 auto tex = std::make_shared<gfx::texture>(viewport_size.
width,
142 fbo = std::make_shared<gfx::frame_buffer>();
143 fbo->populate({tex});
146 fbo_depth = std::make_shared<gfx::frame_buffer>();
147 fbo_depth->populate({tex, depth});
158 if(!fbo || (fbo && fbo->get_size() != viewport_size))
160 auto format = params.
fill_hdr_params ? gfx::texture_format::RGBA16F : gfx::texture_format::RGBA8;
162 auto tex = std::make_shared<gfx::texture>(viewport_size.
width,
167 BGFX_TEXTURE_RT | BGFX_TEXTURE_COMPUTE_WRITE);
169 fbo = std::make_shared<gfx::frame_buffer>();
170 fbo->populate({tex});
179 auto& depth = create_or_resize_d_buffer(rview, viewport_size, params);
182 tex = std::make_shared<gfx::texture>(viewport_size.
width,
186 gfx::texture_format::RGBA8,
187 BGFX_TEXTURE_COMPUTE_WRITE | BGFX_TEXTURE_RT);
191 if(!fbo || (fbo && fbo->get_size() != viewport_size))
193 fbo = std::make_shared<gfx::frame_buffer>();
194 fbo->populate({tex, depth});
199 if(!fbo || (fbo && fbo->get_size() != viewport_size))
201 fbo = std::make_shared<gfx::frame_buffer>();
202 fbo->populate({tex});
209 const std::vector<urange32_t>& lod_limits,
210 std::size_t total_lods,
211 float transition_time,
215 const camera& cam) ->
bool
226 float percent = math::clamp((
float(
rect.
height()) /
float(viewport.height)) * 100.0f, 0.0f, 100.0f);
229 for(
size_t i = 0; i < lod_limits.size(); ++i)
231 const auto&
range = lod_limits[i];
238 lod = math::clamp<std::size_t>(lod, 0, total_lods - 1);
264 auto light_world_bounds =
math::bbox::mul(light_bounds, light_transform);
265 for(
const auto& element : visibility_set)
269 const auto& model_world_bounds = model_comp_ref.get_world_bounds();
271 bool result = light_world_bounds.intersect(model_world_bounds);
281auto deferred::get_light_program(
const light& l)
const ->
const color_lighting&
283 return color_lighting_[uint8_t(l.type)][uint8_t(l.shadow_params.depth)][uint8_t(l.shadow_params.type)];
286auto deferred::get_light_program_no_shadows(
const light& l)
const ->
const color_lighting&
288 return color_lighting_no_shadow_[uint8_t(l.type)];
291void deferred::submit_pbr_material(geom_program& program,
const pbr_material& mat)
300 const auto& albedo = color_map ? color_map : mat.default_color_map();
301 const auto&
normal = normal_map ? normal_map : mat.default_normal_map();
302 const auto& roughness = roughness_map ? roughness_map : mat.default_color_map();
303 const auto& metalness = metalness_map ? metalness_map : mat.default_color_map();
304 const auto& ao = ao_map ? ao_map : mat.default_color_map();
305 const auto& emissive = emissive_map ? emissive_map : mat.default_color_map();
330 auto state = mat.get_render_states(
true,
true,
true);
340 [&](
auto e,
auto&& transform_comp,
auto&& reflection_probe_comp,
auto&& active)
342 if(reflection_probe_comp.already_generated())
349 const auto& world_transform = transform_comp.get_transform_global();
351 const auto& bounds = reflection_probe_comp.get_bounds();
357 const auto&
probe = reflection_probe_comp.get_probe();
364 for(std::uint32_t face = 0; face < 6; ++face)
366 if(reflection_probe_comp.already_generated(face))
375 auto& rview = reflection_probe_comp.get_render_view(face);
376 const auto& cubemap_fbo = reflection_probe_comp.get_cubemap_fbo(face);
391 params.vflags = vflags;
396 auto env_cube = reflection_probe_comp.get_cubemap();
397 auto env_cube_prefiltered = reflection_probe_comp.get_cubemap_prefiltered();
402 prefilter_params.
apply_prefilter = reflection_probe_comp.get_apply_prefilter();
404 for(std::uint32_t face = 0; face < 6; ++face)
406 const auto& cubemap_fbo = reflection_probe_comp.get_cubemap_fbo(face);
407 prefilter_params.
input_faces[face] = cubemap_fbo->get_texture();
427 bool queried =
false;
435 [&](
auto e,
auto&& transform_comp,
auto&& light_comp)
437 const auto&
light = light_comp.get_light();
441 bool camera_dependant = is_directional || has_render_mask;
444 auto&
generator = light_comp.get_shadowmap_generator();
446 generator.set_altitude_scale_factor(0.4f);
447 if(!camera_dependant &&
generator.already_updated())
454 auto world_transform = transform_comp.get_transform_global();
455 world_transform.reset_scale();
456 const auto& light_direction = world_transform.z_unit_axis();
465 const auto& bounds = light_comp.get_bounds_precise(light_direction);
482 bool should_rebuild = should_rebuild_shadows(dirty_models,
light, bounds, world_transform);
488 APP_SCOPE_PERF(
"Rendering/Shadow Generation Pass Per Light After Cull");
490 generator.generate_shadowmaps(dirty_models);
502 const auto& obuffer = create_or_resize_o_buffer(rview, viewport_size, params);
504 run_pipeline_impl(obuffer, scn,
camera, rview, dt, params, pipeline_steps::full, render_mask);
520 pass_params.
input = obuffer;
521 pass_params.
output = output;
547 if(apply_reflecitons)
558 create_or_resize_d_buffer(rview, viewport_size, params);
559 create_or_resize_g_buffer(rview, viewport_size, params);
560 create_or_resize_l_buffer(rview, viewport_size, params);
561 create_or_resize_r_buffer(rview, viewport_size, params);
573 if(apply_reflecitons)
608 const auto& gbuffer = rview.
fbo_get(
"GBUFFER");
613 pass.
bind(gbuffer.get());
615 for(
const auto& e : visibility_set)
620 const auto&
model = model_comp.get_model();
628 const auto transition_time = 0.0f;
636 if(
false == update_lod_data(lod_runtime_data,
646 const auto current_time = lod_runtime_data.current_time;
647 const auto current_lod_index = lod_runtime_data.current_lod_index;
648 const auto target_lod_index = lod_runtime_data.target_lod_index;
650 const auto params = math::vec3{0.0f, -1.0f, (transition_time - current_time) / transition_time};
652 const auto params_inv = math::vec3{1.0f, 1.0f, current_time / transition_time};
654 const auto& submesh_transforms = model_comp.get_submesh_transforms();
655 const auto& bone_transforms = model_comp.get_bone_transforms();
656 const auto& skinning_matrices = model_comp.get_skinning_transforms();
663 geom_program& prog = submit_params.skinned ? geom_program_skinned_ : geom_program_;
665 prog.program->begin();
672 geom_program& prog = submit_params.skinned ? geom_program_skinned_ : geom_program_;
679 geom_program& prog = submit_params.
skinned ? geom_program_skinned_ : geom_program_;
681 bool submitted = mat.submit(prog.program.get());
686 const auto& pbr =
static_cast<const pbr_material&
>(mat);
687 submit_pbr_material(prog, pbr);
695 geom_program& prog = submit_params.
skinned ? geom_program_skinned_ : geom_program_;
707 if(math::epsilonNotEqual(current_time, 0.0f, math::epsilon<float>()))
711 geom_program& prog = submit_params.
skinned ? geom_program_skinned_ : geom_program_;
739 const auto& gbuffer = rview.
fbo_get(
"GBUFFER");
741 auto color_ao = gbuffer->get_texture(0);
742 auto normal = gbuffer->get_texture(1);
743 auto depth = gbuffer->get_texture(4);
746 params.
depth = depth.get();
769 const auto& gbuffer = rview.fbo_get(
"GBUFFER");
770 const auto& rbuffer = rview.fbo_safe_get(
"RBUFFER");
771 const auto& lbuffer = rview.fbo_get(
"LBUFFER");
773 const auto buffer_size = lbuffer->get_size();
776 pass.
bind(lbuffer.get());
778 pass.
clear(BGFX_CLEAR_COLOR, 0, 0.0f, 0);
781 [&](
auto e,
auto&& transform_comp_ref,
auto&& light_comp_ref,
auto&& active)
783 const auto&
light = light_comp_ref.get_light();
784 const auto&
generator = light_comp_ref.get_shadowmap_generator();
785 auto world_transform = transform_comp_ref.get_transform_global();
786 world_transform.reset_scale();
787 const auto& light_position = world_transform.get_position();
788 const auto& light_direction = world_transform.z_unit_axis();
790 const auto& bounds = light_comp_ref.get_bounds_precise(light_direction);
798 .compute_projected_sphere_rect(
rect, light_position, light_direction, camera_pos, view, proj) == 0)
805 const auto& lprogram = has_shadows ? get_light_program(
light) : get_light_program_no_shadows(
light);
807 lprogram.program->begin();
848 for(; i < gbuffer->get_attachment_count(); ++i)
863 gfx::set_state(topology | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_ADD);
867 lprogram.program->end();
884 const auto& gbuffer = rview.
fbo_get(
"GBUFFER");
885 const auto& rbuffer = rview.
fbo_get(
"RBUFFER");
887 const auto buffer_size = rbuffer->get_size();
890 pass.
bind(rbuffer.get());
892 pass.
clear(BGFX_CLEAR_COLOR, 0, 0.0f, 0);
893 std::vector<entt::entity> sorted_probes;
897 [&](
auto e,
auto&& transform_comp_ref,
auto&& probe_comp_ref,
auto&& active)
899 sorted_probes.emplace_back(e);
903 std::sort(std::begin(sorted_probes),
904 std::end(sorted_probes),
905 [&](
const auto& lhs,
const auto& rhs)
908 const auto& lhs_probe = lhs_comp.
get_probe();
911 const auto& rhs_probe = rhs_comp.
get_probe();
914 if(lhs_probe.method != rhs_probe.method)
916 return lhs_probe.method < rhs_probe.method;
920 return lhs_probe.get_max_range() > rhs_probe.get_max_range();
924 for(
const auto& e : sorted_probes)
929 const auto&
probe = probe_comp_ref.get_probe();
931 const auto& probe_position = world_transform.get_position();
932 const auto& probe_scale = world_transform.get_scale();
935 if(probe_comp_ref.compute_projected_sphere_rect(
rect, probe_position, probe_scale, camera_pos, view, proj) == 0)
940 const auto& cubemap = probe_comp_ref.get_cubemap_prefiltered();
942 ref_probe_program* ref_probe_program =
nullptr;
943 float influence_radius = 0.0f;
946 ref_probe_program = &sphere_ref_probe_program_;
948 math::max(probe_scale.x, math::max(probe_scale.y, probe_scale.z)) *
probe.sphere_data.range;
954 t.scale(
probe.box_data.extents);
956 float data2[4] = {
probe.box_data.extents.x,
957 probe.box_data.extents.y,
958 probe.box_data.extents.z,
959 probe.box_data.transition_distance};
961 ref_probe_program = &box_ref_probe_program_;
966 influence_radius = math::length(t.get_scale() +
probe.box_data.transition_distance);
969 if(ref_probe_program)
971 float mips = cubemap ? float(cubemap->info.numMips) : 1.0f;
979 float data1[4] = {mips,
probe.intensity, 0.0f, 0.0f};
984 for(
size_t i = 0; i < gbuffer->get_attachment_count(); ++i)
993 gfx::set_state(topology | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_ALPHA);
995 ref_probe_program->program->begin();
996 gfx::submit(pass.
id, ref_probe_program->program->native_handle());
998 ref_probe_program->program->end();
1017 bool found_sun =
false;
1021 [&](
auto e,
auto&& transform_comp_ref,
auto&& light_comp_ref,
auto&& active)
1023 auto entity = scn.create_handle(e);
1027 APPLOG_WARNING(
"[{}] More than one entity with this component. Others are ignored.",
"Skylight");
1030 const auto& cubemap = light_comp_ref.get_cubemap();
1031 auto cubemap_texture = cubemap.get();
1034 if(cubemap_texture->info.cubeMap)
1036 params_skybox.
cubemap = cubemap;
1040 mode = light_comp_ref.get_mode();
1042 if(
auto light_comp =
entity.template try_get<light_component>())
1044 const auto&
light = light_comp->get_light();
1048 const auto& world_transform = transform_comp_ref.get_transform_global();
1050 params.
turbidity = light_comp_ref.get_turbidity();
1053 params_perez.
turbidity = light_comp_ref.get_turbidity();
1067 auto lbuffer_depth = rview.fbo_get(
"LBUFFER_DEPTH");
1072 atmospheric_pass_perez_.run(lbuffer_depth, c, rview, dt, params_perez);
1075 atmospheric_pass_.run(lbuffer_depth, c, rview, dt, params);
1078 atmospheric_pass_skybox_.run(lbuffer_depth, c, rview, dt, params_skybox);
1090 if(!rparams.fill_ssr_params)
1097 ssr_params.
output = rview.fbo_get(
"RBUFFER");
1098 ssr_params.
g_buffer = rview.fbo_get(
"GBUFFER");
1100 ssr_params.
previous_frame = rview.fbo_get(
"LBUFFER")->get_texture();
1104 if(rparams.fill_ssr_params)
1106 rparams.fill_ssr_params(ssr_params);
1113 ssr_params.
hiz_buffer = rview.tex_get(
"HIZBUFFER");
1119 return ssr_pass_.run(rview, ssr_params);
1127 if(!rparams.fill_fxaa_params)
1138 rparams.fill_fxaa_params(params);
1140 return fxaa_pass_.run(rview, params);
1148 if(!rparams.fill_hdr_params)
1157 if(!rparams.fill_fxaa_params)
1162 rparams.fill_hdr_params(params);
1164 return tonemapping_pass_.run(rview, params);
1173 const auto& gbuffer = rview.
fbo_get(
"GBUFFER");
1178 pass.
bind(output.get());
1182 const auto output_size = output->get_size();
1184 debug_visualization_program_.program->begin();
1186 float u_params[4] = {float(debug_pass_), 0.0f, 0.0f, 0.0f};
1191 for(; i < gbuffer->get_attachment_count(); ++i)
1193 gfx::set_texture(debug_visualization_program_.s_tex[i], i, gbuffer->get_texture(i));
1200 gfx::set_state(topology | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A);
1201 gfx::submit(pass.
id, debug_visualization_program_.program->native_handle());
1203 debug_visualization_program_.program->end();
1212 auto& gbuffer = rview.fbo_get(
"GBUFFER");
1220 params.
output_hiz = rview.tex_get(
"HIZBUFFER");
1223 hiz_pass_.run(rview, params);
1241 auto load_program = [&](
const std::string& vs,
const std::string&
fs)
1243 auto vs_shader = am.get_asset<
gfx::shader>(
"engine:/data/shaders/" + vs +
".sc");
1244 auto fs_shadfer = am.get_asset<
gfx::shader>(
"engine:/data/shaders/" +
fs +
".sc");
1246 return std::make_unique<gpu_program>(vs_shader, fs_shadfer);
1249 geom_program_.program = load_program(
"vs_deferred_geom",
"fs_deferred_geom");
1250 geom_program_.cache_uniforms();
1252 geom_program_skinned_.program = load_program(
"vs_deferred_geom_skinned",
"fs_deferred_geom");
1253 geom_program_skinned_.cache_uniforms();
1255 sphere_ref_probe_program_.program = load_program(
"vs_clip_quad_ex",
"reflection_probe/fs_sphere_reflection_probe");
1256 sphere_ref_probe_program_.cache_uniforms();
1258 box_ref_probe_program_.program = load_program(
"vs_clip_quad_ex",
"reflection_probe/fs_box_reflection_probe");
1259 box_ref_probe_program_.cache_uniforms();
1261 debug_visualization_program_.program = load_program(
"vs_clip_quad",
"gbuffer/fs_gbuffer_visualize");
1262 debug_visualization_program_.cache_uniforms();
1267 color_lighting_no_shadow_[uint8_t(
light_type::spot)].program = load_program(
"vs_clip_quad",
"fs_deferred_spot_light");
1280 color_lighting_no_shadow_[uint8_t(
light_type::point)].program = load_program(
"vs_clip_quad",
"fs_deferred_point_light");
1293 color_lighting_no_shadow_[uint8_t(
light_type::directional)].program = load_program(
"vs_clip_quad",
"fs_deferred_directional_light");
1307 for(
auto& byLightType : color_lighting_no_shadow_)
1309 if(byLightType.program)
1311 byLightType.cache_uniforms();
1314 for(
auto& byLightType : color_lighting_)
1316 for(
auto& byDepthType : byLightType)
1318 for(
auto& bySmImpl : byDepthType)
1320 if(bySmImpl.program)
1322 bySmImpl.cache_uniforms();
1328 ibl_brdf_lut_ = am.get_asset<
gfx::texture>(
"engine:/data/textures/ibl_brdf_lut.png");
std::shared_ptr< texture > ptr
auto fbo_safe_get(const hpp::string_view &id) const -> const frame_buffer::ptr &
auto fbo_get_or_emplace(const hpp::string_view &id) -> frame_buffer::ptr &
auto fbo_get(const hpp::string_view &id) const -> const frame_buffer::ptr &
auto tex_get_or_emplace(const hpp::string_view &id) -> texture::ptr &
void run(const camera &camera, gfx::render_view &rview, const run_params ¶ms)
Manages assets, including loading, unloading, and storage.
auto run(const run_params ¶ms) -> gfx::frame_buffer::ptr
Executes the blit: copies params.input → params.output. Returns the actual output framebuffer.
Class representing a camera. Contains functionality for manipulating and updating a camera....
auto get_far_clip() const -> float
Retrieves the distance from the camera to the far clip plane.
auto test_obb(const math::bbox &bounds, const math::transform &t) const -> bool
Tests if the specified OBB is within the frustum.
auto get_viewport_size() const -> const usize32_t &
Retrieves the size of the viewport.
auto get_projection() const -> const math::transform &
Retrieves the current projection matrix.
static auto get_face_camera(std::uint32_t face, const math::transform &transform) -> camera
Retrieves a camera for one of six cube faces.
auto get_view() const -> const math::transform &
Retrieves the current view matrix.
void set_far_clip(float distance)
Sets the far plane distance.
auto get_position() const -> const math::vec3 &
Retrieves the current position of the camera.
void set_viewport_size(const usize32_t &viewportSize)
Sets the size of the viewport.
auto get_frustum() const -> const math::frustum &
Retrieves the current camera object frustum.
auto get_near_clip() const -> float
Retrieves the distance from the camera to the near clip plane.
Class that contains core light data, used for rendering and other purposes.
Base class for materials used in rendering.
Main class representing a 3D mesh with support for different LODs, submeshes, and skinning.
auto calculate_screen_rect(const math::transform &world, const camera &cam) const -> irect32_t
Calculates the screen rectangle of the mesh based on its world transform and the camera.
Class that contains core data for meshes.
Structure describing a LOD group (set of meshes), LOD transitions, and their materials.
auto get_lod(uint32_t lod) const -> asset_handle< mesh >
Gets the LOD (Level of Detail) mesh for the specified level.
auto is_valid() const -> bool
Checks if the model is valid.
auto get_lod_limits() const -> const std::vector< urange32_t > &
Gets the LOD limits.
void submit(const math::mat4 &world_transform, const pose_mat4 &submesh_transforms, const pose_mat4 &bone_transforms, const std::vector< pose_mat4 > &skinning_matrices, unsigned int lod, const submit_callbacks &callbacks) const
Submits the model for rendering.
auto get_lods() const -> const std::vector< asset_handle< mesh > > &
Gets all the LOD meshes.
Class for physically-based rendering (PBR) materials.
auto get_surface_data2() const -> math::vec4
Gets additional surface data for the material.
auto get_dither_threshold() const -> const math::vec2 &
Gets the dither threshold of the material.
auto get_emissive_map() const -> const asset_handle< gfx::texture > &
Gets the emissive map of the material.
auto get_subsurface_color() const -> const math::color &
Gets the subsurface color of the material.
auto get_color_map() const -> const asset_handle< gfx::texture > &
Gets the color map of the material.
auto get_surface_data() const -> const math::vec4 &
Gets the surface data of the material.
auto get_roughness_map() const -> const asset_handle< gfx::texture > &
Gets the roughness map of the material.
auto get_metalness_map() const -> const asset_handle< gfx::texture > &
Gets the metalness map of the material.
auto get_tiling() const -> const math::vec2 &
Gets the tiling factor of the material.
auto get_normal_map() const -> const asset_handle< gfx::texture > &
Gets the normal map of the material.
auto get_base_color() const -> const math::color &
Gets the base color of the material.
auto get_emissive_color() const -> const math::color &
Gets the emissive color of the material.
auto get_ao_map() const -> const asset_handle< gfx::texture > &
Gets the ambient occlusion map of the material.
auto run(const run_params ¶ms) -> gfx::texture::ptr
Execute prefilter. Returns the filtered cubemap (output_cube or created internally).
Class that contains core reflection probe data, used for rendering and other purposes.
auto get_probe() const -> const reflection_probe &
Gets the reflection probe object.
auto deinit(rtti::context &ctx) -> bool
void set_debug_pass(int pass) override
void build_shadows(scene &scn, const camera &camera, visibility_flags query=visibility_query::not_specified, layer_mask render_mask=layer_mask{layer_reserved::everything_layer})
void run_assao_pass(const visibility_set_models_t &visibility_set, const camera &camera, gfx::render_view &rview, delta_t dt, const run_params &rparams)
void run_reflection_probe_pass(scene &scn, const camera &camera, gfx::render_view &rview, delta_t dt)
auto run_lighting_pass(scene &scn, const camera &camera, gfx::render_view &rview, bool apply_shadows, delta_t dt) -> gfx::frame_buffer::ptr
void run_debug_visualization_pass(const camera &camera, gfx::render_view &rview, const gfx::frame_buffer::ptr &output)
auto run_ssr_pass(const camera &camera, gfx::render_view &rview, const gfx::frame_buffer::ptr &output, const run_params &rparams) -> gfx::frame_buffer::ptr
void build_reflections(scene &scn, const camera &camera, delta_t dt)
auto run_fxaa_pass(gfx::render_view &rview, const gfx::frame_buffer::ptr &input, const gfx::frame_buffer::ptr &output, const run_params &rparams) -> gfx::frame_buffer::ptr
void run_g_buffer_pass(const visibility_set_models_t &visibility_set, const camera &camera, gfx::render_view &rview, delta_t dt)
auto run_atmospherics_pass(gfx::frame_buffer::ptr input, scene &scn, const camera &camera, gfx::render_view &rview, delta_t dt) -> gfx::frame_buffer::ptr
auto run_tonemapping_pass(gfx::render_view &rview, const gfx::frame_buffer::ptr &input, const gfx::frame_buffer::ptr &output, const run_params &rparams) -> gfx::frame_buffer::ptr
auto run_hiz_pass(const camera &camera, gfx::render_view &rview, delta_t dt) -> gfx::texture::ptr
auto init(rtti::context &ctx) -> bool override
auto run_pipeline(scene &scn, const camera &camera, gfx::render_view &rview, delta_t dt, const run_params ¶ms, layer_mask render_mask=layer_mask{layer_reserved::everything_layer}) -> gfx::frame_buffer::ptr override
Renders the entire scene from the camera's perspective.
void run_pipeline_impl(const gfx::frame_buffer::ptr &output, scene &scn, const camera &camera, gfx::render_view &rview, delta_t dt, const run_params ¶ms, pipeline_flags pflags, layer_mask render_mask=layer_mask{layer_reserved::everything_layer})
virtual auto init(rtti::context &ctx) -> bool
virtual auto gather_visible_models(scene &scn, const math::frustum *frustum, visibility_flags query, const layer_mask &render_mask) -> visibility_set_models_t
Gathers visible models from the scene based on the given query.
@ not_specified
No specific visibility query.
@ is_dirty
Query for dirty entities.
@ is_reflection_caster
Query for reflection casting entities.
@ is_shadow_caster
Query for shadow casting entities.
prefilter_pass prefilter_pass_
virtual void ui_pass(scene &scn, const camera &camera, gfx::render_view &rview, const gfx::frame_buffer::ptr &output)
uint32_t visibility_flags
Type alias for visibility flags.
virtual auto create_run_params(entt::handle camera_ent) const -> rendering::pipeline::run_params
Class that contains sky light data.
sky_mode
Enumeration for sky modes.
@ standard
Standard sky mode.
size< std::uint32_t > usize32_t
std::chrono::duration< float > delta_t
#define APPLOG_WARNING(...)
void submit(view_id _id, program_handle _handle, int32_t _depth, bool _preserveState)
uint16_t set_scissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
void set_state(uint64_t _state, uint32_t _rgba)
void discard(uint8_t _flags)
void set_uniform(uniform_handle _handle, const void *_value, uint16_t _num)
uint32_t get_render_frame()
auto clip_quad(float depth, float width, float height) -> uint64_t
void set_texture(uint8_t _stage, uniform_handle _sampler, texture_handle _handle, uint32_t _flags)
auto inverse(transform_t< T, Q > const &t) noexcept -> transform_t< T, Q >
hpp::small_vector< entt::handle > visibility_set_models_t
@ sphere
Sphere type reflection probe.
@ box
Box type reflection probe.
@ environment
Environment reflection method.
#define APP_SCOPE_PERF(name)
Create a scoped performance timer that only accepts string literals.
Represents a handle to an asset, providing access and management functions.
void set_view_proj(const float *v, const float *p)
void clear(uint16_t _flags, uint32_t _rgba=0x000000ff, float _depth=1.0f, uint8_t _stencil=0) const
static void push_scope(const char *name)
void bind(const frame_buffer *fb=nullptr) const
Storage for box vector values and wraps up common functionality.
bbox & mul(const transform &t)
Transforms an axis aligned bounding box by the specified matrix.
bool contains(const T &val) const
math::vec3 light_direction
math::vec3 light_direction
asset_handle< gfx::texture > cubemap
gfx::frame_buffer::ptr input
Source framebuffer (must have a color texture).
gfx::frame_buffer::ptr output
Optional destination framebuffer. If null, will be created to match input.
static auto context() -> rtti::context &
gfx::frame_buffer::ptr output
gfx::frame_buffer::ptr input
gfx::texture::ptr depth_buffer
Source depth buffer.
const camera * cam
Camera for near/far plane information.
gfx::texture::ptr output_hiz
Output Hi-Z texture (must be R32F or R16F format with mips)
float range
The range of the point light.
float exponent_falloff
The exponent falloff for the point light.
float get_range() const
Gets the range of the spot light.
float get_outer_angle() const
Gets the outer angle of the spot light.
float get_inner_angle() const
Gets the inner angle of the spot light.
Struct representing a light.
bool casts_shadows
Whether the light casts shadows.
float intensity
The intensity of the light.
light_type type
The type of the light.
math::color color
The color of the light.
point point_data
Data specific to point lights.
float ambient_intensity
The ambient intensity of the light.
spot spot_data
Data specific to spot lights.
Parameters for the submit callbacks.
bool skinned
Indicates if the model is skinned.
Callbacks for submitting the model for rendering.
std::function< void(const params &info, const material &)> setup_params_per_submesh
Callback for setting up per submesh.
std::function< void(const params &info)> setup_begin
Callback for setup begin.
std::function< void(const params &info)> setup_params_per_instance
Callback for setting up per instance.
std::function< void(const params &info)> setup_end
Callback for setup end.
std::array< gfx::texture::ptr, 6 > input_faces
gfx::texture::ptr output_cube_prefiltered
Optional destination cubemap (will be created if null).
gfx::texture::ptr output_cube
Optional destination cubemap (will be created if null).
bool apply_prefilter
If false, copies mips from input to output.
Contains level of detail (LOD) data for an entity.
float current_time
Current time for LOD transition.
std::uint32_t target_lod_index
Target LOD index.
std::uint32_t current_lod_index
Current LOD index.
std::function< void(assao_pass::run_params ¶ms)> fill_assao_params
std::function< void(tonemapping_pass::run_params ¶ms)> fill_hdr_params
Represents a scene in the ACE framework, managing entities and their relationships.
std::unique_ptr< entt::registry > registry
The registry that manages all entities in the scene.
auto create_handle(entt::entity e) -> entt::handle
Creates an entity in the scene.
bool enable_cone_tracing
Enable cone tracing for glossy reflections.
gfx::frame_buffer::ptr output
Optional output buffer.
gfx::texture::ptr previous_frame
Previous frame color for reflection sampling.
gfx::frame_buffer::ptr g_buffer
G-buffer containing normals.
gfx::texture::ptr hiz_buffer
Hi-Z buffer texture.
fidelityfx_ssr_settings fidelityfx
FidelityFX SSR settings.
gfx::frame_buffer::ptr input
gfx::frame_buffer::ptr output