Page MenuHomeWildfire Games

Refactors models and materials #1
ClosedPublic

Authored by vladislavbelov on Aug 22 2023, 9:02 AM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP27841: Refactors models and materials, part 1, reduces amount of mutable properties.
Summary

Current goal of the series of patches is to make CModel and SDecal storing immutable CMaterial to be in one-to-one relationship with art/materials (later we might introduce CMaterialInstance for per-object settings). The next step would be preparing for removing and removing AddFlagsRec and RemoveShadowsRec/RemoveShadows as they change the material.

Test Plan
  1. Apply the patch and compile the game
  2. Check that the game looks the same

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vladislavbelov requested review of this revision.Aug 22 2023, 9:02 AM
vladislavbelov created this revision.
phosit added a subscriber: phosit.Aug 26 2023, 12:13 PM
phosit added inline comments.
source/graphics/Model.cpp
41 ↗(On Diff #22166)
66 ↗(On Diff #22166)

m_Props.clear(); Doesn't has to be done manually.

source/graphics/Model.h
44 ↗(On Diff #22166)

What do you mean by "world information"?

233 ↗(On Diff #22166)

I would use direct initialization (with braces) instead of copy ititialization.

237 ↗(On Diff #22166)

This results in const std::shared_ptr<CModelDef> while it should be const std::shared_ptr<const CModelDef> i think.

source/graphics/ObjectEntry.cpp
136–155 ↗(On Diff #22166)

Could you extract this part into an own function.

vladislavbelov marked 6 inline comments as done.Sep 10 2023, 9:13 PM
vladislavbelov added inline comments.
source/graphics/Model.h
44 ↗(On Diff #22166)

It's an instance of CModelDef placed in the world.

237 ↗(On Diff #22166)

Yeah, but we don't have CConstModelDefPtr.

source/graphics/ObjectEntry.cpp
136–155 ↗(On Diff #22166)

Yeah, but not now. It's tightly coupled and I'd like to clean up it a bit first.

vladislavbelov marked 3 inline comments as done.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/7272/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8361/display/redirect

phosit added inline comments.Sep 13 2023, 4:40 PM
source/graphics/Model.h
237 ↗(On Diff #22166)

You don't have to use an alias.

vladislavbelov marked an inline comment as done.Sep 13 2023, 7:02 PM
vladislavbelov added inline comments.
source/graphics/Model.h
237 ↗(On Diff #22166)

It'd be consistent with other code. We use only CModelDefPtr, but I don't mind to change that in the future.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 14 2023, 10:37 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
vladislavbelov marked an inline comment as done.