Light::Query and fixed light loop for shadows2#10399
Open
boxrocket6803 wants to merge 1 commit intoFacepunch:masterfrom
Open
Light::Query and fixed light loop for shadows2#10399boxrocket6803 wants to merge 1 commit intoFacepunch:masterfrom
boxrocket6803 wants to merge 1 commit intoFacepunch:masterfrom
Conversation
Light struct is now initialized for directional light and returned as part of loop rather than needing to deal with it separately, looping over lights now looks like this (faster)
```
LightRange query = Light::Query( ScreenPosition );
for ( uint x = 0; x < query.Count; x++ )
{
Light l = Light::Fetch( query, x, WorldPosition, ScreenPosition.xy );
...
}
```
Member
|
I don't really want the directional light in any form of loop at all. It's the global uniform sun light. |
Contributor
Author
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.




Summary
The light query stuff from #10148 but now it works with shadows2, also returns the directional light as part of the loop.
Implementation Details
Took the opportunity to remove Light::Count and Light::From since they run significantly worse and anyone who was using them would have to edit their shaders anyway, they are replaced with Light::Query returning a LightRange struct and Light::Fetch, the struct stores the Cluster::Query result so that it doesn't need to be queried twice per light. Looping over lights now looks like
The directional light (if enabled) is also stuck into a Light struct and fetched as part of the loop, presumably doesn't run quite as well but not in any notable way and seems worth it to let the Light class maintain its ease of use.
Screenshots
Checklist