Skip to content
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

refactor: simplify feature implementation #326

Merged
merged 9 commits into from
Jul 23, 2024

Conversation

FlayaN
Copy link
Collaborator

@FlayaN FlayaN commented Jul 4, 2024

Refactor:

  • Remove feature->Draw
  • Make feature->Reset optional
  • Make feature->SetupResources optional
  • Remove unnecessary override
  • Simplify feature::Save/Load and made them optional
  • Add virtual and override keywords to features
  • Make feature->DrawSettings optional
  • Make feature->RestoreDefaultSettings optional

Created it as as a draft due to some more testing needed before publishing it Tested now, works like before

@FlayaN
Copy link
Collaborator Author

FlayaN commented Jul 4, 2024

fixes #186

@FlayaN FlayaN force-pushed the refactor-clean-up-feature branch from 8b62f79 to 2844da4 Compare July 19, 2024 20:01
@FlayaN FlayaN marked this pull request as ready for review July 19, 2024 21:06
@FlayaN FlayaN marked this pull request as draft July 19, 2024 23:59
@FlayaN FlayaN marked this pull request as ready for review July 21, 2024 00:14
@doodlum
Copy link
Owner

doodlum commented Jul 22, 2024

This needs to be updated to support other PRs I believe.

@FlayaN FlayaN force-pushed the refactor-clean-up-feature branch from aba4b45 to d44d5d4 Compare July 23, 2024 15:16
@FlayaN
Copy link
Collaborator Author

FlayaN commented Jul 23, 2024

This needs to be updated to support other PRs I believe.

@doodlum Updated to latest dev now!

@doodlum doodlum merged commit 0ffb136 into doodlum:dev Jul 23, 2024
5 checks passed

virtual void DrawSettings() = 0;
virtual void Draw(const RE::BSShader* shader, const uint32_t descriptor) = 0;
virtual void DrawSettings() {}
virtual void DrawDeferred() {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DrawDeferred and DrawPreProcess can be removed, too, since they are not referenced.
On a side note, some static analysis tools that find dead code would be convenient

@@ -91,22 +91,15 @@ struct DynamicCubemaps : Feature

virtual inline std::string GetName() { return "Dynamic Cubemaps"; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are GetName and GetShortName not marked override?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to not have the override due to them being pure virtual so not really "overring" another "empty" implementation. But maybe it's best practice to mark that with override as well? Not sure

}

void ScreenSpaceGI::Save([[maybe_unused]] json& o_json)
void ScreenSpaceGI::SaveSettings([[maybe_unused]] json& o_json)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly my fault but you can delete [[maybe_unused]] here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants