1330 add active component for all kinds of disabling purposes - #1357
1330 add active component for all kinds of disabling purposes#1357RodrigoVintem wants to merge 5 commits into
Conversation
|
04d3499 to
b2b2d03
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1357 +/- ##
==========================================
- Coverage 41.95% 41.89% -0.07%
==========================================
Files 441 443 +2
Lines 33115 33163 +48
Branches 3870 3881 +11
==========================================
Hits 13893 13893
- Misses 19222 19270 +48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6b21468 to
b3ce57a
Compare
tomas7770
left a comment
There was a problem hiding this comment.
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
mkuritsu
left a comment
There was a problem hiding this comment.
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.
tomas7770
left a comment
There was a problem hiding this comment.
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. |
RiscadoA
left a comment
There was a problem hiding this comment.
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.
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.
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
|
Since this has been abandoned I will pick it up on the next milestone. |
Description
add active component for all kinds of disabling purposes
Checklist