Fix attached entities staying too bright#4984
Open
TheCrazy17 wants to merge 1 commit into
Open
Conversation
CObject::PreRender only recalculates an entity's contact surface brightness while it isn't attached to anything, so an attached entity keeps whatever value it had at attach time (the constructor default, which renders much too bright) forever. DoAttaching now copies the lighting value from whatever an entity is attached to every frame, mirroring what vanilla hand-held objects already do with their owning ped. Fixes multitheftauto#2203
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CObject::PreRenderonly recalculates an entity's contact-surface brightness ("lighting") while it isn't attached to anything, so an attached entity keeps whatever value it had at attach time (the constructor default, which renders much too bright) forever.CClientEntity::DoAttachingnow copies the lighting value from whatever the entity is attached to, every frame, mirroring what vanilla hand-held objects already do with their owning ped.Any entity attached to another (e.g. via
attachElements) renders visibly too bright/washed-out compared to its surroundings, because it's stuck with its default lighting value instead of picking up the lighting of whatever it's attached to.Motivation
Fixes #2203.
Test plan
Checklist