ShadowResources Type
Owns the shadow atlas + depth effect + pooled scratch the shadow pass needs, reused across
frames. Constructed once by the pipeline; EnsureResources allocates the GPU atlas lazily
against the real device on the first shadow pass.
Constructors
| Constructor |
Description
|
Full Usage:
ShadowResources(atlasCfg, biasCfg)
Parameters:
ShadowAtlasConfig
biasCfg : ShadowBiasConfig
Returns: ShadowResources
|
|
Instance members
| Instance member |
Description
|
|
The shadow atlas (owns the R32F RenderTarget2D, allocated lazily).
|
Full Usage:
this.BiasesScratch
Returns: float32 array
|
Pooled scratch for the per-caster
|
|
Pooled bone-palette staging array for skinned casters (B12). Shader's MAX_BONES is 128.
|
Full Usage:
this.CollectCastEnabled
Returns: bool
|
Running
|
Full Usage:
this.CollectedDrawCount
Returns: int
|
Opaque-geometry counts from the last unified collection. Populated whenever the
shadow pass or a scene-depth pass collected geometry. The scene-depth render reads the same
collected arrays (all entries), while the shadow render reads only
|
Full Usage:
this.CollectedInstancedCount
Returns: int
|
|
Full Usage:
this.CollectedModelPartCount
Returns: int
|
|
Full Usage:
this.CollectedSkinnedCount
Returns: int
|
|
Full Usage:
this.CollectedSkinnedInstancedCount
Returns: int
|
|
|
Pooled caster mesh draws collected from the buffer (gated by EnableShadows/DisableShadows).
|
|
The depth-only effect (DepthShadow.fx), loaded lazily on first shadow pass.
|
|
Reused per-caster frustum (updated in-place via .Matrix) to avoid per-frame allocation.
|
|
Pooled DX12 group descriptors ((start, count, null-texture) triples) for the grouped-uniform skinned + instanced depth path; grown on demand — see PaletteGroup.planGroups.
|
|
Pooled bone-palette scratch for the grouped-uniform skinned + instanced depth path (the DX12 fallback — DepthSkinnedInstancedGrouped). Sized to PaletteGroup.MaxMatricesDepth; grown on demand.
|
|
The isolated grouped-uniform depth effect (DepthShadowGrouped.fx), loaded lazily on DX12 only. On DX12 the main DepthShadow.fx's bonePaletteGroup params are dropped by mgfx reflection; this isolated effect carries them.
|
|
Cached grouped depth-effect parameter handles (built when the grouped effect loads).
|
|
Cached 2-slot binding array for SetVertexBuffers on the instanced paths (avoids the params-array allocation per call — thousands per frame on DX12). Contents are rewritten per call and consumed immediately.
|
|
CPU staging array for the per-instance
|
|
Growable per-instance vertex buffer for instanced shadow casters. Owned by the shadow pass (not shared with the forward-pass PBR instance VB) so the two passes never race on it. Disposed at shutdown; recreated when an instanced caster exceeds the current capacity.
|
|
Shared per-frame instance-world staging cache for skinned + instanced casters (aliased with the forward pass by ForwardPipeline — DX11/Vulkan only, see InstanceWorldCache).
|
|
Pooled instanced-caster draws (the world's block grid etc.). Grows on demand.
|
|
Scratch: original parts covered by a merged group during skinned + instanced caster collection; cleared per command.
|
|
Pooled static-ModelMeshPart caster draws (DrawModel/DrawModelWith). Grows on demand.
|
|
The frame's shadow-origin override (SetShadowOrigin); ValueNone = use the atlas strategy.
|
|
Shared per-frame palette-chunk cache for skinned + instanced casters (aliased with the forward pass by ForwardPipeline so each frame's palettes are staged + uploaded once, not per pass — see PaletteChunkCache).
|
|
Cached depth-effect parameter handles (built when the effect loads).
|
Full Usage:
this.PointShadowSlots
Returns: int[]
|
Per-light shadow slot mapping, indexed by lights.PointLights/SpotLights position; -1 = no shadow.
|
|
Cached RasterizerState (polygon-offset bias + back-face culling). Created once on first shadow pass; disposed by the pipeline. Avoids per-frame GPU-state allocation.
|
|
Grow-only scratch for save/restore of the caller's render-target bindings around
a shadow/depth pass — avoids a
|
|
The last frame's shadow pass output — read by the forward pass (Shade overrides + user-effect scopes) so a custom shader can opt into shadow sampling. ValueNone when no shadow-casting light exists or DepthShadow.fx is unavailable.
|
|
Pooled skinned-caster draws (B12). Grows on demand.
|
|
Pooled skinned + instanced caster draws (DrawAnimatedModelInstanced). Grows on demand.
|
|
CPU staging array for the per-instance
|
|
Growable per-instance vertex buffer for skinned + instanced shadow casters. Owned by the shadow pass (not shared with the forward-pass PBR buffers) so the two passes never race on it. Disposed at shutdown; recreated when a chunk exceeds the current capacity.
|
Full Usage:
this.SpotShadowSlots
Returns: int[]
|
Per-light shadow slot mapping for spot lights; -1 = no shadow.
|
|
Pooled scratch for the multi-caster shadowUVOffsets upload.
|
|
Pooled scratch for the multi-caster shadowViewProjs upload.
|
Mibo