Skip to content

refactor(interior sun): rename interior sun shadows#1387

Merged
alandtse merged 1 commit into
community-shaders:devfrom
sicsix:is-refactor
Aug 11, 2025
Merged

refactor(interior sun): rename interior sun shadows#1387
alandtse merged 1 commit into
community-shaders:devfrom
sicsix:is-refactor

Conversation

@sicsix
Copy link
Copy Markdown
Collaborator

@sicsix sicsix commented Aug 11, 2025

  • renamed Interior Sun Shadows feature to Interior Sun
  • added slider to control interior shadow distance, default set to 5000, tested on SE/AE/VR
  • bumped VR address library version requirement

Summary by CodeRabbit

  • New Features
    • Added Interior Shadow Distance control in settings for interiors.
  • Refactor
    • Renamed “Interior Sun Shadows” to “Interior Sun” across the app, including UI labels and settings.
    • Updated internal flags and feature references to align with the new name (no behavioral changes expected).
  • Chores
    • Increased minimum VR Address Library requirement to 0.189.0.
  • Documentation
    • Updated user-facing text to reflect the new “Interior Sun” terminology.
  • Compatibility
    • Settings schema updated to include Interior Shadow Distance and new naming.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 11, 2025

Walkthrough

Renames InteriorSunShadows to InteriorSun across codebase, updates includes/usages, and adds an interior-specific shadow distance setting with setter and UI handling. Adjusts consumers (VolumetricLighting, Hooks, TruePBR) to new API/flags. Updates globals/feature registry accordingly. In VR path, bumps minimum Address Library version to 0.189.0.

Changes

Cohort / File(s) Summary
Core feature registry and globals
src/Feature.cpp, src/Globals.h, src/Globals.cpp
Replace InteriorSunShadows with InteriorSun in includes, forward declarations, externs, and global instance names; update feature list pointer.
InteriorSun implementation/API
src/Features/InteriorSun.h, src/Features/InteriorSun.cpp
Rename struct and all public methods from InteriorSunShadows to InteriorSun; add Settings.InteriorShadowDistance, gInteriorShadowDistance pointer, and SetShadowDistance(bool); update hooks, singletons, and strings; maintain behavior with new distance control.
Downstream consumers
src/Features/VolumetricLighting.h, src/Features/VolumetricLighting.cpp, src/Hooks.cpp, src/TruePBR.cpp
Update includes and symbol names to InteriorSun; rename inInteriorWithSunShadows to inInteriorWithSun; adjust checks/calls to InteriorSun::IsInteriorWithSun; use interiorSun for loaded/UpdateRasterStateCullMode and feature gating.
VR dependency check
src/XSEPlugin.cpp
Increase VR Address Library minimum version check from 0.182.0 to 0.189.0.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant UI as Settings UI
  participant IS as InteriorSun
  participant Game as Game Engine (relocation)

  User->>UI: Adjust Interior Shadow Distance
  UI->>IS: DrawSettings() update value
  IS->>IS: SetShadowDistance(inInterior)
  IS->>Game: Apply shadow distance (relocation)
  Game-->>IS: Distance applied
Loading
sequenceDiagram
  participant Engine as Engine
  participant IS as InteriorSun
  participant VL as VolumetricLighting

  Engine->>IS: GetWorldSpace::thunk()
  IS-->>Engine: enableInteriorSun / disableInteriorSun
  VL->>IS: IsInteriorWithSun(cell)
  IS-->>VL: bool
  VL->>VL: inInteriorWithSun = result
  VL-->>Engine: Use interior lighting path if enabled
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • alandtse
  • Pentalimbed

Poem

I hop through halls where sunbeams run,
Renamed my shadows—now simply “Sun.”
A slider sways the distance light,
Interiors glow, just set it right.
With version bumps and flags in tune,
I nap in radiance—bright as noon. 🌞🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

Using provided base ref: f925a5c
Using base ref: f925a5c
Base commit date: 2025-08-10T22:12:04-07:00 (Sunday, August 10, 2025 10:12 PM)
No actionable suggestions for changed features.

@alandtse alandtse changed the title refactor(interior sun): renamed from interior sun shadows refactor(interior sun): rename interior sun shadows Aug 11, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
src/Features/VolumetricLighting.cpp (1)

218-225: Bug: inInteriorWithSun not updated on interior-cell changes

EarlyPrepass returns early when currentlyInInterior == inInterior, so moving between two interior cells (one with sun, one without) won’t update inInteriorWithSun or re-run SetupVL. Track the interior cell pointer and update when it changes.

Apply this minimal diff to update when the interior cell changes:

-  if (initialised && currentlyInInterior == inInterior)
-    return;
+  static RE::TESObjectCELL* lastInteriorCell = nullptr;
+  const bool interiorCellChanged = (interiorCell != lastInteriorCell);
+  if (initialised && currentlyInInterior == inInterior && !interiorCellChanged)
+    return;

   initialised = true;
   inInterior = currentlyInInterior;
-  inInteriorWithSun = InteriorSun::IsInteriorWithSun(interiorCell);
+  lastInteriorCell = interiorCell;
+  inInteriorWithSun = InteriorSun::IsInteriorWithSun(interiorCell);
   SetupVL();

This ensures VL toggles correctly when entering/leaving interiors and when switching interior cells with different sun visibility.

🧹 Nitpick comments (1)
src/Features/VolumetricLighting.cpp (1)

3-3: Nit: include path consistency

Consider using a consistent include path with other files (e.g., "Features/InteriorSun.h") to keep includes uniform across the codebase. Current path is valid given the file’s location, this is just for consistency.

-#include "InteriorSun.h"
+#include "Features/InteriorSun.h"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f925a5c and 90cef5a.

📒 Files selected for processing (10)
  • src/Feature.cpp (2 hunks)
  • src/Features/InteriorSun.cpp (7 hunks)
  • src/Features/InteriorSun.h (5 hunks)
  • src/Features/VolumetricLighting.cpp (2 hunks)
  • src/Features/VolumetricLighting.h (1 hunks)
  • src/Globals.cpp (2 hunks)
  • src/Globals.h (2 hunks)
  • src/Hooks.cpp (2 hunks)
  • src/TruePBR.cpp (2 hunks)
  • src/XSEPlugin.cpp (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
📚 Learning: 2025-08-03T18:37:19.690Z
Learnt from: jiayev
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-08-03T18:37:19.690Z
Learning: ISReflectionsRayTracing.hlsl and ISWorldMap.hlsl in the skyrim-community-shaders repository are image-space post-processing shaders that perform color sampling and blending operations that need proper linear color space handling for the linear lighting system. ISReflectionsRayTracing handles screen-space reflections and should use conditional Color::IrradianceToLinear/Gamma conversions similar to ISCompositeLensFlareVolumetricLighting.hlsl. ISWorldMap performs 7x7 color accumulation that should be done in linear space similar to the pattern used in ISSAOComposite.hlsl.

Applied to files:

  • src/Globals.h
🔇 Additional comments (15)
src/XSEPlugin.cpp (1)

156-158: Couldn’t locate any calls to IsVRAddressLibraryAtLeastVersion or the XSEPlugin.cpp file in this branch—please verify that the VR Address Library version check exists and that its return value is handled appropriately (i.e., surface errors and disable VR features on failure as suggested).

src/Features/VolumetricLighting.h (1)

131-131: Rename acknowledgment: field is consistent with new API

The rename to inInteriorWithSun is clear and initialized correctly. Matches usage in the .cpp.

src/Globals.cpp (2)

22-22: Header rename to InteriorSun is consistent

Include updated to Features/InteriorSun.h aligns with the PR-wide rename.


66-66: Global feature object renamed and type-updated correctly

globals::features now exposes InteriorSun interiorSun{}; consistent with headers and consumers.

src/Globals.h (2)

12-12: Forward declaration updated to InteriorSun

Matches implementation and consumers.


67-67: Extern renamed to interiorSun with new type

Extern symbol matches Globals.cpp and downstream usage.

src/Feature.cpp (2)

13-13: Header include renamed to InteriorSun.h

Consistent with new feature name.


223-223: InteriorSun rename complete; no leftover references found

Ran rg -n "InteriorSunShadows|interiorSunShadows|Features/InteriorSunShadows.h" and confirmed there are no remaining references to the old symbols. All registry entries have been updated correctly.

src/TruePBR.cpp (2)

6-6: Header rename to InteriorSun.h

Aligned with global rename.


678-678: Lighting flags gated on InteriorSun state

The consolidated check against interiorSun.loaded && interiorSun.isInteriorWithSun before adding ShadowDir/DefShadow is appropriate and matches the feature’s intent.

src/Hooks.cpp (2)

12-12: Header include updated

Switched to Features/InteriorSun.h; consistent with project-wide rename.


903-905: Verify InteriorSun::UpdateRasterStateCullMode signature
Please confirm that the InteriorSun type defines a method matching

void UpdateRasterStateCullMode(/*pass type*/, /*technique type*/);

and that its name/signature aligns with this call site.

• File: src/Hooks.cpp
• Lines: 903–905

src/Features/VolumetricLighting.cpp (1)

231-234: Interior VL gating correctly respects InteriorSun state

Using settings.InteriorEnabled && inInteriorWithSun for both VR and non-VR paths is correct and aligns with the feature behavior.

src/Features/InteriorSun.h (1)

4-98: LGTM! Well-structured refactoring and feature addition.

The renaming from InteriorSunShadows to InteriorSun is consistently applied, and the new interior shadow distance feature follows the existing architectural patterns. The default value of 5000 for InteriorShadowDistance appears reasonable for typical interior spaces.

src/Features/InteriorSun.cpp (1)

64-66: Confirm interior shadow distance patch

The relocation in src/Features/InteriorSun.cpp (around lines 64–66) currently updates only gShadowDistance, yet the new feature introduces gInteriorShadowDistance. Please verify that the game’s SetShadowDistance implementation (called at line 21 and defined at lines 206–211) correctly switches between gShadowDistance and gInteriorShadowDistance for interior cells. If it does not, the patch should be updated to reference gInteriorShadowDistance when inside interiors.

Comment thread src/Features/InteriorSun.cpp
Comment thread src/Features/InteriorSun.cpp
@github-actions
Copy link
Copy Markdown

✅ A pre-release build is available for this PR:
Download

@alandtse alandtse merged commit 8b13499 into community-shaders:dev Aug 11, 2025
17 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Oct 2, 2025
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.

2 participants