-
Notifications
You must be signed in to change notification settings - Fork 151
unity(particlesys): Merge Particle System code #2153
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
unity(particlesys): Merge Particle System code #2153
Conversation
Greptile Overview
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp | Compiles out X/Y rotation support, optimizes alpha/wind updates, fixes visibility thresholds, adds SMUDGE type, refactors angleBetween function |
| GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp | Adds X/Y rotation guards, fixes visibility thresholds, improves formatting consistency |
| Generals/Code/GameEngine/Include/GameClient/ParticleSys.h | Adds PARTICLE_USE_XY_ROTATION macro, guards X/Y angle fields, adds SMUDGE type and setSkipParentXfrm method |
| GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h | Adds PARTICLE_USE_XY_ROTATION macro and guards X/Y angle fields for consistency with Generals |
Sequence Diagram
sequenceDiagram
participant PS as ParticleSystem
participant P as Particle
participant D as Drawable (removed)
Note over PS,D: Particle System Update Flow
PS->>PS: update()
PS->>PS: updateWindMotion() [if enabled]
PS->>PS: generateParticleInfo()
PS->>P: new Particle(info)
Note over P: Particle Update (per frame)
P->>P: update()
P->>P: Update position with velocity
P->>P: doWindMotion() [if enabled]
P->>P: Update orientation (Z-axis only)
alt particleUpTowardsEmitter
P->>P: angleBetween(&upVec, &emitterDir)
P->>P: Set m_angleZ
end
alt Shader != ADDITIVE
P->>P: Update alpha with keyframes
end
P->>P: Update size and color
P->>P: isInvisible() check
Note over D: Drawable particles removed
Note over P: No m_drawable member
Note over P: No X/Y rotation (PARTICLE_USE_XY_ROTATION=0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (2)
-
Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp, line 217-220 (link)logic: The null check calls
length()twice per vector unnecessarily, then calls it again below. Sincelength()involves a square root calculation (sqrt(x*x + y*y)), this is wasteful. Calculate once and check for zero length: -
GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp, line 217-220 (link)logic: The null check calls
length()twice per vector unnecessarily, then calls it again below. Sincelength()involves a square root calculation (sqrt(x*x + y*y)), this is wasteful. Calculate once and check for zero length:
14 files reviewed, 2 comments
|
Very fair comment, but this is EA code and outside the scope of this change. Edit: I have prepared an optimization for later. |
ff4e1b2 to
df1cc68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp, line 3457-3459 (link)style: inefficient to compute
vecA->length()andvecB->length()twice each - the guard condition calls.length(), then it's called again belowNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
14 files reviewed, 4 comments
Skyaero42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
…om Zero Hour (#2153)
…rm from Zero Hour (#2153)
…n Generals (#2153)
…Zero Hour (#2153)
…holds in Particle::isInvisible from Generals (#2153) This merge fixes 13 broken particle effects in Zero Hour: airCarrierExplosion2 airCarrierHotPillarArms airCarrierJet01Explosion airCarrierJetExplosion1 airCarrierJetExplosion2 airCarrierJetExplosion3 ArmExplosionSmall01 BarrelExplosion BuggyNewExplosionArms FireBaseHowitzerPillarArms HotPillarArms MammothTankExplosionArms SpectreHotPillarArms
…e when disabled from Zero Hour (#2153)
…ation with emitter direction from Zero Hour (#2153)
df1cc68 to
e39583d
Compare
…holds in Particle::isInvisible from Generals (#2153) This merge fixes 13 broken particle effects in Zero Hour: airCarrierExplosion2 airCarrierHotPillarArms airCarrierJet01Explosion airCarrierJetExplosion1 airCarrierJetExplosion2 airCarrierJetExplosion3 ArmExplosionSmall01 BarrelExplosion BuggyNewExplosionArms FireBaseHowitzerPillarArms HotPillarArms MammothTankExplosionArms SpectreHotPillarArms
…e when disabled from Zero Hour (#2153)
…ation with emitter direction from Zero Hour (#2153)
Merge with Rebase
This change merges all Particle System related code, including Particle Editor code. All individual changes are split into separate commits for best visibility.
Zero Hour gets
Particle::isInvisible. This is the code fix for what this data fix attempted to workaround: Fix: Missing particle effects GeneralsGamePatch#809Generals gets
TODO