108 Commits
Author SHA1 Message Date
BMagnu 856e676e79 Add render path to dispatch Particles as Decals (#7507)
* Add path to dispatch particles as decals

* Testing and bugfixing

* Address feedback

* Fix Typo

* Fix obj attachment
2026-07-17 13:38:45 +09:00
BMagnu fcaa9dd998 Allow trail particles to be parented to their spawner (#7528)
* Adapt particle at runtime

* Refactor EffectHosts

* fix issues

* cleanup

* Remove live transitive particles

* paticle hosts now do local correctly

* Fix effecthostparticle local mode

* again

* Set particle host orientation

* I don't like mixed local and global vectors

* agaiiin

* Fix validity check

* parent foo

* Fix bugs, hopefully finally

* refactor

* Flip new table option for intuitiveness

* Fix support for GCC9 due to issues with LWG3052

* Address feedback
2026-07-15 15:10:15 +09:00
BMagnu 7da707de7f Add particles on death of particles (#7504) 2026-07-05 04:14:41 +02:00
Kestrellius cb19fecc36 Fix culling for particles that have length (#7136)
* fix culling

* further check

* rotate check

* fix error

* bithackery
2025-12-05 13:29:56 +09:00
wookieejedi 4d184d501a Two 1-line fixes for new particle lights (#7125)
* Two 1-line fixes for new particle lights

This PR provides 2 semi-fixes for the particle lights with 2 simple conditionals.

------------
First, it fixes #7124. In sum, it fixes the issue that new particle lights not affected by light quality slider. This fix is done by adding a conditional check so that particle lights only render when weapon lights do, at the highest lighting setting. This ensures that lower end machines can properly turn off particle lights to help with performance.

------------
Second, this PR adds an extra conditional to ensure that the system does not attempt to render particle lights if the radii is <= 0.

Light emitters logically do not cast light if the light emit radius is <= 0. In 2015, there are assertations in each of the `light_add` functions that trigger if the radii are <= 0.

With the new particle lights and addition of curves for particle lights, this can make result in light radii <= 0. This approach is useful to allow things like hit effects to only give off light if the hit effect is large enough (IE if it hits a large ship scale the radii to be larger, and if it is too far away or a small ship scale the radii to 0). So, in those situations of <= 0 light radii, the modder would expect that the light point is just not shown and simply not attempted to be rendered. Unfortunately, this is not quite the case, as any light radii <= for particle lights will trigger the assertation within the `light_add` functions.

The fix for this is simply to have early conditional checks for light radii. There is already precent for this in the code in 3 locations--1) within the weapon light code in `object.cpp` line `1365`; 2) within the beam light code in `beam.cpp` at line `2009`; and 3) within the fireball light code in `object.cpp` line `1457`. Note these sections also early out if the light intensity is <= 0 as an optimization step, which also makes sense.

This PR simply follows that precedence for particle lights by adding an early out if the light radii are 0. This allows modders to properly use a range of radii and helps ensure internal consistency with the code mentioned above that already does this early out for weapon and beam lights.

----------
Given the benefits listed above, having this PR in before stable would be fantastic (or a relatively quick point release after stable).

Tested and fixes the issue as expected. Happy to answer any questions and/or discuss!

* comment signpost
2025-11-26 22:38:26 +01:00
wookieejedi 349b353bbe Fix 'has parent' case for apparent size input curve (#7094)
Thanks for lafiel for catching this: the "has parent" case of that #7090 needs to account for the parents rotation
2025-10-17 12:30:02 +00:00
Kestrellius c0cc43f558 add input (#7090) 2025-10-17 07:43:50 -04:00
BMagnu 2c04313c59 Fix copy and paste error (#7066) 2025-09-27 12:55:22 +00:00
BMagnu 5903dc7e9d Filter out invalid particles (#7055) 2025-09-23 04:06:09 +02:00
BMagnu 3c939f5cc4 Particle Curves with access to host object & ship properties (#7047)
* Add parent / host input curves

* reorder some includes to allow particles access to ship.h

* Allow modular_curves to deal with functions returning optionals

* Add convenience function to return an optional from an objp and an instance type

* Add a bunch of particle curve inputs

* Fix internal linkage warning

* Add hitpoint and shield fraction (albeit limited to ships)
2025-09-21 02:52:22 +02:00
BMagnu 973bd5570e Small particle copy-paste fixes (#7044)
* Use correct curve

* Properly init animation data
2025-09-18 12:49:46 +00:00
BMagnu 15445408f9 Particles can now emit light (#7040)
* Add backend for paticles to emit light

* Parse new light options

* Modular Curves account for light

* Actually apply curves

* remove comment

* Add cone mode
2025-09-18 13:39:12 +02:00
wookieejedi 58ff297495 Update to #7023 (#7042)
From Sept 15 onward in fast debug I hit this error when using weapon create
ASSERTION: "cur_frame < part->nframes" at particle.cpp:371

Assert: "cur_frame < part->nframes"
File: particle.cpp
Line: 371

Thanks to lafiel, `that assert should have an `|| (part->nframes == 0 && cur_frame == 0) appended beaause while we need to stay inbounds for animations, frame 0 for both is valid for static images`
2025-09-17 15:16:24 +09:00
BMagnu 1e7431a044 Give Particles Access to Their Spawner Effect (#7034)
* Make particles aware of the effect that spawned them

* Allow modular curves to call global functions from submember inputs

* Add more in and outputs for particle lifetime curves

* Allow post-curve velocity as a curve input

* fix warning and incorrect assig

* Disable CheckTriviallyCopyableMove

* Clang Tidy
2025-09-15 04:42:06 +02:00
Kestrellius 4e75114479 Fix parented line sprite particles appearing in the wrong place (#6950)
* account for parenting

* fix p1 position
2025-08-18 16:45:17 -04:00
Kestrellius 5cd3b3a308 Extend particle interpolation to lifetime (#6910)
* the naive method

* the correct method
2025-08-08 07:29:59 -04:00
BMagnu 0a7fac447d Add particle curve input for number of existing particles (#6889)
* Add code to process global starts for modular curves

* Add particle curve input for number of existing particles
2025-08-01 02:05:08 +02:00
Goober5000 596f6e75da check in more places in the particle code 2025-04-12 15:38:57 -04:00
BMagnu 5ce7881a27 Merge branch 'master' into particle_cleanup 2025-01-19 19:56:18 +09:00
Mike Nelson 4dfaa85b6f Default settings tbl (#6491)
* initial version of default_settings.tbl

* Add a way to change player detail level defaults and implement a couple more options to detail_settings.tbl

* support the rest of 2d.cpp options

* Allow enforcing options to a specific value

* modernize detail defaults, levels, and values

* Fix parsing issue and remove lambda capture by reference

* fix print

* clang

* More efficient +Enforce parsing

* cleanup

* typo

* don't negate this

* error_display

* clarify language between presets, levels, and values

* add default case

* small fix

* use a map to minimize string lookups
2025-01-12 11:29:11 -05:00
Birk Magnussen ec0e55d077 De-movify random ranges 2024-12-16 14:22:29 +01:00
Birk Magnussen e955a7f1be Merge branch 'master' into particle_cleanup 2024-12-10 23:41:07 +01:00
Birk Magnussen 50ac2b8105 remove redundant function 2024-11-21 23:43:27 +01:00
Goober5000 31a86e3f3d all the consts!
Some experimentation resulted in a lot of const-cascading.  This PR applies `const` to a large number of functions.
2024-11-07 23:33:13 -05:00
BMagnu c937bc6bbb Actually get rid of particle emitters 2024-10-23 17:04:35 +02:00
BMagnu 2f2e8b2e14 Remove particle_effect and ParticleType 2024-09-24 17:23:00 +02:00
BMagnu 97dbd2fa83 Removal of effects, pt. 2 2024-09-24 17:23:00 +02:00
Birk Magnussen 7d10ed44fa Removal of effects, pt. 1 2024-09-24 17:22:59 +02:00
Goober5000 c03207f141 address 6010
I took a close look at the code involved in parsing particle tables.  There is no smoking gun, but there are several ways to polish the code which I have implemented here.  The most likely culprits for the slowdown, IMO, are the repeated conversions between SCP_string and C-string, especially in `ParticleManager::getEffectByName()`; followed by the omission of `std::move` in several places.
2024-07-03 15:06:33 -04:00
Goober5000 66be185d0c allow finer control of particle rotation randomization
This adds a new field to particle effects so that particle rotation can be configured on a per-type basis, not just on a blanket basis.  Implements #5941.
2024-01-29 22:05:23 -05:00
ETP 5fd439fb60 Clean now-unused batch rendering flag. 2023-11-18 16:26:10 -05:00
ETP 2043f836ed Clean extra batched buffer run in particles 2023-11-18 15:53:47 -05:00
Asteroth a9fc7bab8a fix for particle culling (#5719) 2023-10-26 16:08:09 -04:00
wookieejedi 5a1ac87802 Update recent particle optimizations to fix edge case slowdowns (#5385)
#5328 added a very useful culling for particles created by specific particle effects (ie weapons, now beams), though in an effort to simplify the culling process, that PR removed the necessary culling of default smoke on ships. This PR restores the culling of default smoke while also keeping the new culling of particle specific effects. Tested and works as expected, including fixing the slowdowns caused by the aforementioned removal of smoke effect culls.
2023-04-30 15:15:37 -04:00
Asteroth 56f010a231 Add arbitrary curves support (#5323)
* Add arbitrary curves support

* review tweaks

* pretty sure i dont need this anymore
2023-04-19 08:13:06 -04:00
Asteroth 4bbc9f3eb3 Improve particle culling and performance (#5328)
* better particle culling

* remove range on emitters

* explicit cast

* bit more efficient
2023-04-17 08:03:41 -04:00
Asteroth 7c4b9272d5 Randomize particle rotation (#5335)
* randomize particle rotation

* spelling

* initialize it, dummy
2023-04-17 07:37:38 -04:00
BMagnu 2f0e2f591f Adjust alpha of neb-affected effects 2023-02-28 14:17:49 +01:00
Goober5000 e2dbfca1c3 allow customizing of debug particle color 2022-09-26 18:45:19 -04:00
Taylor Richards 5e2a4c05a3 make sure particles don't get processed on standalone 2022-01-18 06:38:35 -05:00
Asteroth d079d7fad2 Expose nebula visibility factors (#3676)
* Expose nebula visibility factors

* separately expose size factors

* naming changes
2021-11-10 13:07:04 -05:00
Baezon 29846e2101 make particle alpha distance fade be based in part on radius 2021-06-07 20:50:12 -04:00
Joshua Glatt 144d484c85 Replace rand() calls with a Random class (#3332) 2021-05-04 18:26:06 -07:00
Baezon 6e54ed3dfc more exponential fog 2021-03-08 00:09:42 -05:00
Baezon 3c53b74e5e switch to exponential nebula fog 2021-03-04 23:02:24 -05:00
Baezon 13f911528f no implicit magic number, and initialize 0 2020-10-12 13:39:05 -04:00
Baezon 773d6f9710 v1 2020-10-12 01:13:29 -04:00
asarium ea73ea33ca Add support for looping particles
This introduces support for keeping particles around forever and letting
them be controlled by a Lua script.
2018-09-17 09:26:20 +02:00
asarium d1a6b48beb Improve handling of non-persistent particles
The current particle system uses dynamic allocation of particle
instances for keeping track of particle instances. This adds unnecessary
overhead in case the code does not need a handle to this particle which
is the case in pretty much all instances.

The new non-persistent particles are stored in a standard vector without
dynamic allocation which should make the processing steps using this
vector much faster and allow better scalability in case more particles
are used by a mission.
2018-04-22 16:22:28 +02:00
Fabian Woltermann 0af2736327 Load the Fire particle animations (#1251)
Load the Fire particle animations too. Fixes #1245.
2017-02-21 16:20:35 -08:00