Initial barn and omni2 light support#1104
Merged
Merged
Conversation
xPaw
reviewed
Mar 6, 2026
kristiker
reviewed
Mar 8, 2026
Comment on lines
+24
to
+48
| private ShadowAtlasRegion[] regions = []; | ||
| private (int Height, int Width, int Index)[] sortBuffer = []; | ||
|
|
||
| public Span<ShadowAtlasRegion> Pack(int atlasSize, List<ShadowRequest> requests) | ||
| { | ||
| var count = requests.Count; | ||
| if (count == 0) | ||
| { | ||
| return []; | ||
| } | ||
|
|
||
| if (regions.Length < count) | ||
| { | ||
| regions = new ShadowAtlasRegion[int.Max(count, regions.Length * 2)]; | ||
| } | ||
|
|
||
| if (sortBuffer.Length < count) | ||
| { | ||
| sortBuffer = new (int, int, int)[int.Max(count, sortBuffer.Length * 2)]; | ||
| } | ||
|
|
||
| for (var i = 0; i < count; i++) | ||
| { | ||
| sortBuffer[i] = (requests[i].Height, requests[i].Width, i); | ||
| } |
Member
There was a problem hiding this comment.
Seems like a max size can be figured out, then trimmed accordingly so we don't re allocate.
| float m_fBarnLightShadowScale; | ||
| // PathTraceIndex (short) is not used | ||
| uint m_nPathTraceIndex_BarnLightFlags; | ||
| mat4x3 m_mBarnIlluminationFromWorld; |
| GL.BindSampler((int)ReservedTextureSlots.LightCookieTexture, CookieSamplerClampBorder); | ||
|
|
||
| shader.SetTexture((int)ReservedTextureSlots.LightCookieTextureWrap, "g_tLightCookieTextureWrap", BarnLightCookieAtlas); | ||
| GL.BindSampler((int)ReservedTextureSlots.LightCookieTextureWrap, CookieSamplerWrap); |
Member
There was a problem hiding this comment.
Wonder if we could have used sampler objects, (g_sWrapSampler)
| } | ||
|
|
||
| entry.DrawCalls ??= CreateDepthOnlyDrawCallCollection(); | ||
| CollectShadowDrawCalls(lightFrustum, includeStatic: true, includeDynamic: true, entry.DrawCalls); |
Member
There was a problem hiding this comment.
Cached results should be cleared when octree gets dirty. Actually caching makes no sense for dynamic objects... But it makes cpu time increase a lot from inefficient octree queries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Known issues / missing features: