33 {{+1, +0, +0}, {+0, +1, +0}, {+0, +0, +1}},
34 {{+0, +0, -1}, {-1, +0, +0}, {+0, +1, +0}},
35 {{+0, +0, +1}, {+1, +0, +0}, {+0, +1, +0}},
36 {{+1, +0, +0}, {+0, +0, -1}, {+0, +1, +0}},
37 {{-1, +0, +0}, {+0, +0, +1}, {+0, +1, +0}},
38 {{+1, +0, +0}, {+0, -1, +0}, {+0, +0, -1}},
209 bool update_casters_ =
false;
215 PassSimple tilemap_setup_ps_ = {
"TilemapSetup"};
216 PassMain tilemap_usage_ps_ = {
"TagUsage"};
217 PassSimple tilemap_update_ps_ = {
"TilemapUpdate"};
220 gpu::Batch *box_batch_ =
nullptr;
222 GPUTexture *src_depth_tx_ =
nullptr;
224 Framebuffer usage_tag_fb;
226 PassSimple caster_update_ps_ = {
"CasterUpdate"};
227 PassSimple jittered_transparent_caster_update_ps_ = {
"TransparentCasterUpdate"};
229 StorageVectorBuffer<uint, 128> past_casters_updated_ = {
"PastCastersUpdated"};
230 StorageVectorBuffer<uint, 128> curr_casters_updated_ = {
"CurrCastersUpdated"};
231 StorageVectorBuffer<uint, 128> jittered_transparent_casters_ = {
"JitteredTransparentCasters"};
233 StorageVectorBuffer<uint, 128> curr_casters_ = {
"CurrCasters"};
240 StorageArrayBuffer<uint, SHADOW_RENDER_MAP_SIZE, true> dst_coord_buf_ = {
"dst_coord_buf"};
242 StorageArrayBuffer<uint, SHADOW_RENDER_MAP_SIZE, true> src_coord_buf_ = {
"src_coord_buf"};
244 StorageArrayBuffer<uint, SHADOW_RENDER_MAP_SIZE, true> render_map_buf_ = {
"render_map_buf"};
248 int3 dispatch_depth_scan_size_;
249 int2 usage_tag_fb_resolution_;
250 int usage_tag_fb_lod_ = 5;
251 int max_view_per_tilemap_ = 1;
252 int2 input_depth_extent_;
255 SwapChain<ShadowStatisticsBuf, 5> statistics_buf_;
265 Texture atlas_tx_ = {
"shadow_atlas_tx_"};
274 int3 copy_dispatch_size_;
275 int3 scan_dispatch_size_;
276 int rendering_tilemap_;
278 bool do_full_update_ =
true;
286 class ShadowView :
public View {
301 bool debug_freeze)
override;
305 ShadowView shadow_multi_view_ = {
"ShadowMultiView", inst_, render_view_buf_};
307 Framebuffer render_fb_ = {
"shadow_write_framebuffer"};
312 Texture shadow_depth_fb_tx_ = {
"shadow_depth_fb_tx_"};
313 Texture shadow_depth_accum_tx_ = {
"shadow_depth_accum_tx_"};
316 std::array<int4, 16> multi_viewports_;
332 float global_lod_bias_ = 0.0f;
338 bool enabled_ =
true;
352 bool has_transparent_shadows);
380 return global_lod_bias_;
386 do_full_update_ =
true;
395 void remove_unused();
396 void debug_page_map_call(
DRWPass *pass);
397 bool shadow_update_finished(
int loop_count);
400 float tilemap_pixel_radius();
403 int max_view_per_tilemap();
423 : shadows_(other.shadows_), tilemaps_(std::move(other.tilemaps_)){};
452 : shadows_(other.shadows_), tilemaps_(std::move(other.tilemaps_)){};
491 void cascade_tilemaps_distribution(
Light &light,
const Camera &camera);
492 void clipmap_tilemaps_distribution(
Light &light,
const Camera &camera);
494 void cascade_tilemaps_distribution_near_far_points(
const Camera &camera,
detail::PassBase< command::DrawMultiBuf > Sub
A running instance of the engine.
static float coverage_get(int lvl)
ShadowDirectional(ShadowModule &module)
static float tile_size_get(int lvl)
void end_sync(Light &light, const Camera &camera)
ShadowDirectional(ShadowDirectional &&other)
void release_excess_tilemaps(const Light &light, const Camera &camera)
ShadowModule(Instance &inst, ShadowSceneData &data)
ShadowTileMapPool tilemap_pool
const ShadowSceneData & get_data()
float global_lod_bias() const
Pool< ShadowDirectional > directional_pool
void bind_resources(PassType &pass)
void debug_draw(View &view, GPUFrameBuffer *view_fb)
static float screen_pixel_radius(const float4x4 &wininv, bool is_perspective, const int2 &extent)
void set_view(View &view, int2 extent)
Pool< ShadowPunctual > punctual_pool
static ShadowTechnique shadow_technique
void sync_object(const Object *ob, const ObjectHandle &handle, const ResourceHandle &resource_handle, bool is_alpha_blend, bool has_transparent_shadows)
ShadowPunctual(ShadowPunctual &&other)
ShadowPunctual(ShadowModule &module)
void release_excess_tilemaps(const Light &light)
void end_sync(Light &light)
#define SHADOW_TILEMAP_RES
#define SHADOW_MAX_TILEMAP
#define SHADOW_TILEMAP_PER_ROW
#define SHADOW_TILEDATA_PER_TILEMAP
#define SHADOW_ATLAS_TEX_SLOT
#define SHADOW_TILEMAPS_TEX_SLOT
SHADOW_TILEMAP_RES tiles_buf[] statistics_buf render_view_buf[SHADOW_VIEW_MAX] GPU_R32UI
detail::Pass< command::DrawCommandBuf > PassSimple
StorageArrayBuffer< ObjectBounds, 128 > ObjectBoundsBuf
StorageArrayBuffer< ObjectInfos, 128 > ObjectInfosBuf
draw::StorageBuffer< ShadowPagesInfoData > ShadowPagesInfoDataBuf
static constexpr const float shadow_face_mat[6][3][3]
draw::StorageBuffer< DrawCommand, true > DrawIndirectBuf
draw::StorageArrayBuffer< uint2, SHADOW_MAX_PAGE, true > ShadowPageCacheBuf
draw::StorageArrayBuffer< ShadowRenderView, SHADOW_VIEW_MAX, true > ShadowRenderViewBuf
static constexpr const float shadow_clipmap_scale_mat[4][4]
draw::StorageBuffer< DispatchCommand > DispatchIndirectBuf
draw::StorageVectorBuffer< uint, SHADOW_MAX_PAGE > ShadowPageHeapBuf
VecBase< uint32_t, 2 > uint2
VecBase< int32_t, 2 > int2
static struct PyModuleDef module
ResourceHandle resource_handle
ShadowTileMapDataBuf tilemaps_data
ShadowTileMapDataBuf tilemaps_unused
ShadowTileDataBuf tiles_data
void release(Span< ShadowTileMap * > free_list)
ShadowTileMapClipBuf tilemaps_clip
void end_sync(ShadowModule &module)
ShadowTileMap * acquire()
Vector< uint > free_indices
Pool< ShadowTileMap > tilemap_pool
static constexpr int64_t maps_per_row
void sync_orthographic(const float4x4 &object_mat_, int2 origin_offset, int clipmap_level, eShadowProjectionType projection_type_, uint2 shadow_set_membership_=~uint2(0))
static constexpr int64_t tile_map_resolution
static constexpr int64_t tiles_count
ShadowTileMap(int tiles_index_)
void sync_cubeface(eLightType light_type_, const float4x4 &object_mat, float near, float far, eCubeFace face, uint2 shadow_set_membership_=~uint2(0))