Voxel turret & multi-section shadow reimplementation
Originally authored by @chaserli
- Attempt to fix the math of shadow projection (turrets being off kilter etc).
- Attempt to make multi-section shadows consider frame index.
- Fix shadow flickering with multi-section voxels using the HVA transform section swap method.
- Airborne voxel shadow scaling.
TODO:
- Regression tests with lots of voxels
- Doc
Update from @chaserli 02/29:
- Considered Ares turrets/barrels, fixed wrong voxel selection especially in charging turret cases
- Added 2 new tags for the hva frame of each you want to render the shadow.
- If you only want to render the ShadowIndex as usual but the VXL used the socalled hva section swap method, then naturally the hva matrix for the first frame is not null, so ShadowIndex.Frame is default to 0
- If you set ShadowIndex to an invalid number the body's shadow will not be rendered, just for fail-safe, but you can exploit that since the turret will still do since the index for it is always 0
- For multiple indices the default value is -1 since perhaps you want them to animate
- If you only want to render the ShadowIndex as usual but the VXL used the socalled hva section swap method, then naturally the hva matrix for the first frame is not null, so ShadowIndex.Frame is default to 0
- Mathematically speaking there's no solution for the projection, but it's been tested that it's possible to just adjust the vxl and get a visually appropriate shadow
Update from @chaserli 03/05:
- Add a simple method for calculating the shadow projection on the ground when being flipped
- Dynamic scaling is restored, provided you invalidate the cache, yeah
- Took NoSpawnAlt vxl from Ares into account, ehh I'll hand over the rest to you @Starkku , bonne chance. What I suggest:
- Make a compromise between caching and dynamic scaling for aircrafts
- Try if it's possible to cache the turret shadow, or prove it's not a potential perf issue
- Extensive regression tests, compare if the shadow even for the body locates differently than before, in air and on ground, since I didn't do the height check since IDK what's actually going on in there
Walkthrough
The recent modifications involve enhancing shadow rendering and data structure optimization for TechnoType entities. Specifically, shadow indices are now managed more efficiently with a shift from vectors to a map, facilitating better alignment and access. Additionally, the handling of shadows has been refined to accommodate frame-specific rendering, alongside adjustments in matrix operations and conditional logic for improved visual fidelity in game components.
Changes
| Files | Change Summary |
|---|---|
.../TechnoType/Body.cpp |
Updated ShadowIndices handling, added ShadowIndex_Frame processing, and ShadowSizeCharacteristicHeight handling. |
.../TechnoType/Body.h |
Restructured ShadowIndices to std::map<int, int>, introduced ShadowIndex_Frame and ShadowSizeCharacteristicHeight. |
.../TechnoType/Hooks.cpp |
Adjusted matrix operations, turret offsets, and shadow rendering logic for improved unit shadow rendering. |
🐇✨
In the realm of code, where shadows play,
A rabbit hopped, making changes today.
From vectors to maps, in structures so deep,
Ensuring the shadows, in memory, we keep.
With each line refined, and bugs kept at bay,
A hop, skip, and jump, we're on our way!
🌟🐾
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
Note: Auto-reply has been disabled for this repository by the repository owner. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin 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 generate interesting stats about this repository and render them as a table. -
@coderabbitai show all the console.log statements in this repository. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (invoked as PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
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.
Nightly build for this pull request:
- compiled-dll-1087a84270f5dc74b7caecdc8af873859a23ec79.zip These artifacts will expire in 90 days and will not be available for download after that time.
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.
Updated with changes to shadow scaling (now opt-in, more customization options) and docs.
Is it possible to also slightly change a position of the shadow?
I believe, it's Point2D why to adjust.