-
Notifications
You must be signed in to change notification settings - Fork 33
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
1330 add active component for all kinds of disabling purposes #1357
base: main
Are you sure you want to change the base?
1330 add active component for all kinds of disabling purposes #1357
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/2)
engine/include/cubos/engine/render/active_component/active_component.hpp
Outdated
Show resolved
Hide resolved
engine/include/cubos/engine/render/active_component/active_component.hpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (2/2)
engine/include/cubos/engine/render/active_component/active_component.hpp
Outdated
Show resolved
Hide resolved
engine/include/cubos/engine/render/active_component/active_component.hpp
Outdated
Show resolved
Hide resolved
engine/include/cubos/engine/render/active_component/active_component.hpp
Outdated
Show resolved
Hide resolved
engine/include/cubos/engine/render/active_component/active_component.hpp
Outdated
Show resolved
Hide resolved
engine/include/cubos/engine/render/active_component/active_component.hpp
Outdated
Show resolved
Hide resolved
engine/include/cubos/engine/render/active_component/active_component.hpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
04d3499
to
b2b2d03
Compare
6b21468
to
b3ce57a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's already implemented LGTM! Here's what should need to be done for the lights. (GitHub doesn't let me add comments to unchanged lines of code so I'll try to do this manually)
engine/src/render/deferred_shading/plugin.cpp
In each of the loops that initialize lights in the shader (there is one for each type of light: directional, point, spot), check if the light is active, and continue
if it's not.
for (auto [lightLocalToWorld, light, lightActive, caster] : directionalLights)
{
if (!lightActive.active)
{
continue;
}
auto& perLight = perScene.directionalLights[perScene.numDirectionalLights++];
engine/src/render/shadow_atlas/plugin.cpp
No need to reserve space in the shadow atlas for lights that aren't active.
for (auto [caster, active] : casters)
{
if (!active.active)
{
continue;
}
bool foundSlot = false;
The entity that has the caster is the same one that has the light, so adding the Active
component to the caster query allows checking if the light is active.
.call([](ShadowAtlas& atlas, Query<SpotShadowCaster&, const Active&> casters) {
engine/src/render/cascaded_shadow_maps/plugin.cpp
Same as above.
for (auto [caster, active] : query)
{
if (!active.active)
{
continue;
}
// Remove shadow maps for cameras that no longer exist
engine/src/render/shadow_atlas_rasterizer/plugin.cpp
No need to draw shadows for lights that aren't active.
for (auto [caster, light, localToWorld, active] : lights)
{
if (!active.active)
{
continue;
}
// Get light viewport
engine/src/render/cascaded_shadow_maps_rasterizer/plugin.cpp
Same as above.
for (auto [caster, light, localToWorld, lightActive] : lights)
{
if (!lightActive.active)
{
continue;
}
auto& shadowMap = caster.shadowMaps.at(cameraEntity);
Little sidenote unrelated to the PR.
engine/src/render/ssao/plugin.cpp has several includes that don't seem to be used for anything, such as lights and HDR. Maybe these can be removed?
b3ce57a
to
a236f4e
Compare
Added Tomas' changes to the files related to light, that should use the Active component. Also removed the unnecessary includes mentioned by Tomas. |
…isabling-purposes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me just very small changes to maintain consistency.
Aside from that I'm just concern about some implications of this implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some small things that should be changed, but otherwise looks good!
…rposes' of https://github.com/GameDevTecnico/cubos into 1330-add-active-component-for-all-kinds-of-disabling-purposes
All the new changes proposed by the reviewers have been made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, pointed out some details that we should sort out before merging.
Ty for working on this 😌
@@ -0,0 +1,20 @@ | |||
/// @file | |||
/// @brief Component @ref cubos::engine::Active | |||
/// @ingroup render-active-plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this plugin should be a render-plugin. It is also relevant outside it. We'll use it for audio, and probably for collisions too later on. So, it would be better to put it in engine-plugin
, and move to active
dir to cubos/engine/
@@ -26,9 +27,14 @@ void cubos::engine::cascadedShadowMapsPlugin(Cubos& cubos) | |||
|
|||
cubos.system("create cascaded shadow maps") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you also need to add cubos.depends(cameraPlugin) here, and the same goes for the other plugins.
Have you tested running the shadows sample? It probably crashes
Description
add active component for all kinds of disabling purposes
Checklist