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
|
Pooled scratch for the per-caster |
Full Usage:
this.BonePaletteScratch
|
Pooled bone-palette staging array for skinned casters (B12). Shader's MAX_BONES is 128. |
Full Usage:
this.CollectedDrawCount
|
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
|
|
Full Usage:
this.CollectedModelPartCount
|
|
Full Usage:
this.CollectedSkinnedCount
|
|
Full Usage:
this.Draws
|
Pooled caster mesh draws collected from the buffer (gated by EnableShadows/DisableShadows). |
Full Usage:
this.Effect
|
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.
|
Full Usage:
this.InstanceStaging
|
CPU staging array for the per-instance |
Full Usage:
this.InstanceVertexBuffer
|
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. |
Full Usage:
this.InstancedDraws
|
Pooled instanced-caster draws (the world's block grid etc.). Grows on demand. |
Full Usage:
this.ModelPartDraws
|
Pooled static-ModelMeshPart caster draws (DrawModel/DrawModelWith). Grows on demand. |
Full Usage:
this.Origin
|
The frame's shadow-origin override (SetShadowOrigin); ValueNone = use the atlas strategy. |
Full Usage:
this.Params
|
Cached depth-effect parameter handles (built when the effect loads). |
Full Usage:
this.PointShadowSlots
|
Per-light shadow slot mapping, indexed by lights.PointLights/SpotLights position; -1 = no shadow. |
Full Usage:
this.Raster
|
Cached RasterizerState (polygon-offset bias + back-face culling). Created once on first shadow pass; disposed by the pipeline. Avoids per-frame GPU-state allocation. |
Full Usage:
this.ShadowResult
|
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. |
Full Usage:
this.SkinnedDraws
|
Pooled skinned-caster draws (B12). Grows on demand. |
Full Usage:
this.SpotShadowSlots
|
Per-light shadow slot mapping for spot lights; -1 = no shadow. |
Full Usage:
this.UVOffsetsScratch
|
Pooled scratch for the multi-caster shadowUVOffsets upload. |
Full Usage:
this.ViewProjsScratch
|
Pooled scratch for the multi-caster shadowViewProjs upload. |
Mibo