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

Separate shield meshes from ship models #5840

Merged
merged 12 commits into from
Aug 12, 2024

Conversation

Web-eWorks
Copy link
Member

Per discussion on IRC from quite a while ago, this PR implements the technical changes necessary to support ship shields being loaded from a separate SGM file and rendered as a separate entity. This solves some long-standing technical debt related to the very invasive process needed to prepare shields for rendering under the old architecture and opens the door to a more efficient architecture for the scenegraph system as a whole.

I've also removed the old Lua-based ship loading code, as we have not compiled with that code enabled in at least five years and it has been thoroughly deprecated at this point.

This PR also fixes a bug present in master (and likely present in many past releases) where the player's shields would not be visible when the player's ship is hit by projectiles or collides with objects.

CC @bszlrd as this PR should include or be closely followed by a set of changes separating shield meshes into their own models for all ships currently present in the game. I'm leaving the fallback path in this PR until we're ready to migrate all shields, but I'd like the old method to be completely removed before merge.

As this PR requires a savegame bump, it will not be merged until after we have released the accumulated set of hotfixes from the last few months.

@Web-eWorks Web-eWorks added Model system Savegame bump Rendering Everything related to rendering labels Jun 17, 2024
@impaktor
Copy link
Member

As this PR requires a savegame bump, it will not be merged until after we have released the accumulated set of hotfixes from the last few months.

When should we do the final bug-fix release?

@Web-eWorks
Copy link
Member Author

As this PR requires a savegame bump, it will not be merged until after we have released the accumulated set of hotfixes from the last few months.

When should we do the final bug-fix release?

Soon. I'm going through the issue list today and tomorrow to see if there are any other quick fixes we need to get in before we cut a release.

@bszlrd
Copy link
Contributor

bszlrd commented Jun 17, 2024

Okay,will do. I can't get to it for at least a couple of weeks unfortunately though.

@bszlrd bszlrd self-assigned this Jun 17, 2024
@fluffyfreak fluffyfreak self-requested a review June 20, 2024 10:58
@bszlrd bszlrd mentioned this pull request Jul 4, 2024
24 tasks
- It's the responsibility of the owning tool context to make changes to the model's structure if desired.
- The shield geometry node would contain a missing parent pointer due to violation of the single-parent constraint
- Can remove MatrixAccumVisitor due to new MatrixTransform::CalcGlobalTransform method
- StaticGeometry nodes are shared between instances of the same model, which breaks Shield material handling code
- The actual mesh and material assignments are still shared via RefCountedPtr, but the list of meshes and the StaticGeometry node has to be duplicated to support individual instances having unique material assignments as used for shield rendering.
Preperatory cleanup for separating shield and ship models
- Used for specifying separate shield model to be loaded when creating the ship.
- Exposed to Lua as shipDef.shieldModelName.
- Shorthand for constructing a 4x4 matrix from the render interpolated position+orientation of the body.
- Avoids bug potential from reconstructing the interpolated transform in callsites that require the full matrix.
- Move shield component from ModelBody (seriously?) to Ship where it belongs
- Temporary fallback to ship-model based shields when no separate shield model can be loaded
- Requires savegamebump as shield data is no longer saved in ModelBody JSON object
- Attempt to determine whether we're viewing a ship model or not
- If separate shield model is defined and available, load and display it along with the main ship model
- All shield meshes are expected to come from an external shield model; loading shield meshes from ship models is no longer supported.
- Shields class is now usable as a BodyComponent
- Shield meshes are loaded after component initialization, rather than at creation.
- Better support for an initialized Shields component without shield meshes to render
- Updated callsites to new Shields API
- Disable unused-include warning for JsonUtils.h
@Web-eWorks
Copy link
Member Author

Merging this - have given it local testing through development and pushed documentation related to the new shield model workflow to the dev docs repository.

@Web-eWorks Web-eWorks merged commit 9f8cad4 into pioneerspacesim:master Aug 12, 2024
5 checks passed
@Web-eWorks Web-eWorks deleted the separate-shield-mesh branch August 12, 2024 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Model system Rendering Everything related to rendering Savegame bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants