-
Notifications
You must be signed in to change notification settings - Fork 145
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
base: main
Are you sure you want to change the base?
Conversation
…article::isInvisible for Zero Hour
… emitter direction in Generals
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Include/GameClient/ParticleSys.h | Added PARTICLE_USE_XY_ROTATION macro, conditionally compiled X/Y rotation fields, added SMUDGE particle type, and setSkipParentXfrm method |
| Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp | Removed drawable particle support, conditionally compiled X/Y rotation code, optimized wind motion and alpha updates, changed angle calculation math - contains logic issue in angleBetween function |
| Generals/Code/GameEngine/Include/GameClient/Drawable.h | Removed particle system attachment methods and m_particle member field |
| GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp | Conditionally compiled X/Y rotation code, fixed particle visibility thresholds in isInvisible, improved whitespace formatting - contains logic issue in angleBetween function |
Sequence Diagram
sequenceDiagram
participant PS as ParticleSystem
participant P as Particle
participant PI as ParticleInfo
participant D as Drawable (removed)
Note over PS,D: Before: Particle System with Drawable Support
PS->>PI: generateParticleInfo()
PI->>P: new Particle(system, info)
P->>D: Create Drawable if type==DRAWABLE
D-->>P: Attach to particle
P->>P: update() - update drawable position/rotation
P->>D: setInstanceMatrix(), setPosition()
Note over PS,D: After: Unified Particle System (No Drawables)
PS->>PI: generateParticleInfo()
Note over PI: X/Y rotation compiled out (PARTICLE_USE_XY_ROTATION=0)
PI->>P: new Particle(system, info)
Note over P,D: No drawable creation
P->>P: update() - optimize wind motion check
P->>P: update() - optimize alpha update (skip if ADDITIVE)
P->>P: angleBetween() - calculate Z rotation for emitter direction
Note over PS: Additional Optimizations
PS->>PS: setSkipParentXfrm() - skip parent transform if in world space
P->>P: isInvisible() - fixed thresholds (0.01 vs 0.02/0.06)
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. |
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