-
Notifications
You must be signed in to change notification settings - Fork 67
Light improvements #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
filipppavlov
wants to merge
14
commits into
main
Choose a base branch
from
light-improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0025a82
Add an option to disable light brightness scale based on its radius
filipppavlov 6b23c8c
Change light debug rendering: draw wireframe instead of solid and ren…
filipppavlov b01c8f4
Change "castShadows" member for Tr2Light descendants to a bitfield so…
filipppavlov 28d4be5
Add an option to switch light falloff curve between inverse and inver…
filipppavlov 6f97dd8
Add lighting quality setting; fix auto brightness scaling for lights …
filipppavlov 69adfac
Add an option to disable light brightness scale based on its radius
filipppavlov 1632345
Change light debug rendering: draw wireframe instead of solid and ren…
filipppavlov 5602459
Change "castShadows" member for Tr2Light descendants to a bitfield so…
filipppavlov d0b49ac
Add an option to switch light falloff curve between inverse and inver…
filipppavlov a8ce975
Add lighting quality setting; fix auto brightness scaling for lights …
filipppavlov 94023fa
Merge branch 'light-improvements' of https://github.com/carbonengine/…
filipppavlov 6201c8f
Address PR comments
filipppavlov 322b5ba
Try to fix cpp-format action failing to add comments to PRs
filipppavlov 114901a
Undo cpp-format change: it did not make a difference
filipppavlov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // Copyright © 2026 CCP ehf. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <cstdint> | ||
|
|
||
|
|
||
| /** | ||
| * @brief A filter for enum values stored as bits. | ||
| * @tparam Enum The enum type to filter. | ||
| * @tparam StorageType The underlying storage type for the filter bits. Needs to be large enough to hold all enum values. Defaults to uint8_t (up to 8 enum values). | ||
| */ | ||
| template <typename Enum, typename StorageType = uint8_t> | ||
| class EnumFilter | ||
| { | ||
| public: | ||
| EnumFilter() = default; | ||
| EnumFilter( const EnumFilter& other ) = default; | ||
| EnumFilter( Enum value ) : m_filter( StorageType( StorageType( 1 ) << StorageType( value ) ) ) | ||
| { | ||
| CCP_ASSERT_M( uint64_t( value ) < 8 * sizeof( StorageType ), "Enum value out of range for the chosen storage type" ); | ||
| } | ||
|
|
||
| EnumFilter& operator|=( Enum value ) | ||
| { | ||
| CCP_ASSERT_M( uint64_t( value ) < 8 * sizeof( StorageType ), "Enum value out of range for the chosen storage type" ); | ||
| m_filter |= StorageType( StorageType( 1 ) << StorageType( value ) ); | ||
| return *this; | ||
| } | ||
|
|
||
| EnumFilter operator|( const EnumFilter& other ) const | ||
| { | ||
| return EnumFilter( m_filter | other.m_filter ); | ||
| } | ||
|
|
||
| EnumFilter operator|( Enum value ) const | ||
| { | ||
| EnumFilter result( *this ); | ||
| result |= value; | ||
| return result; | ||
| } | ||
|
|
||
| bool HasBit( Enum value ) const | ||
| { | ||
| CCP_ASSERT_M( uint64_t( value ) < 8 * sizeof( StorageType ), "Enum value out of range for the chosen storage type" ); | ||
| return ( m_filter & StorageType( StorageType( 1 ) << StorageType( value ) ) ) != 0; | ||
| } | ||
|
|
||
| /// @brief Creates an EnumFilter with all bits set. | ||
| static EnumFilter AllBits() | ||
| { | ||
| EnumFilter filter; | ||
| filter.m_filter = ~StorageType( 0 ); | ||
| return filter; | ||
| } | ||
|
|
||
| // This variable should be private, but we need to access it for MAP_ATTRIBUTE macros | ||
| StorageType m_filter = 0; | ||
| }; |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.