summaryrefslogtreecommitdiff
path: root/scene/resources/particles_material.cpp
AgeCommit message (Collapse)Author
2021-11-07Rename `GradientTexture` to `GradientTexture1D`Andrii Doroshenko (Xrayez)
1. Explicit and unambiguous when comparing to `GradientTexture2D` 2. Consistent with other class names where 1D is used in the engine.
2021-09-21Prevent shaders from generating code before the constructor finishes.Tom Coxon
Fixes #43733: "creating SpatialMaterial in a separate thread creates invalid shaders (temporarily)." The bug occurred because various setters called in materials' constructors add materials to queues that are processed on the main thread. This means that when the materials are created in another thread, they can be processed on the main thread before the constructor has finished. The fix adds a flag to affected materials that prevents them from being added to the queue until their constructors have finished initialising all the members.
2021-08-22moved particle parameters to minmax and split scale axisQbieShay
This commit adds quite a chunk of modifications to particles - particle (value + randomness) now use min and max instead - passing a curveXYZtexture is now possible and will scale particles per-axis - CPUParticle3D have an optional parameter to split the scale curve per-axis
2021-08-16Add a comment at the top of generated shadersHugo Locurcio
This comment is useful to determine the origin of ShaderMaterials converted from built-in material types (such as CanvasItemMaterial or StandardMaterial3D). The Godot version is also included in case the shader needs to be regenerated with a newer engine version.
2021-08-12Use real_t and double where appropriate in ParticlesAaron Franke
2021-08-12Fix regressions caused by recent particle spread refactorMorris Tabor
Caused by https://github.com/godotengine/godot/pull/47228 Same as https://github.com/godotengine/godot/pull/51553 but for master.
2021-07-21Merge pull request #50370 from QbieShay/circle-emitter-particleRémi Verschelde
Ring emitter for 4.0
2021-07-14Merge pull request #49348 from Geometror/fix-particles-hidden-basecolorRémi Verschelde
Fix color properties of particle nodes/material
2021-07-11This commits adds a new emitter type for particles materialQbieShay
and 3D CPU particles. The new emitter is called "ring" and it can emit either in a ring or cylinder fashion. This adds the following properties for the emitter: 1. emission_ring_axis: the axis along which the ring/cylinder will be constructed 2. emission_ring_radius: outer radius of the ring/cylinder 3. emission_ring_inner_radius: inner radius of the cylinder. when set to zero, particles will emit in the full volume. 4. emission_ring_height: height of the ring/cylinder emitter.
2021-07-07Fix Command Queue Crashreduz
* No longer allow sending an object (texture) to the server as material parameter * Keep a parameter cache locally in ShaderMaterial
2021-07-04Fix color properties of particle nodes/materialHendrik Brucker
2021-07-01Use PROPERTY_USAGE_NONE instead of 0 for no property usageAaron Franke
Also use const more often.
2021-06-30Fix editor suffixes and degrees conversionreduz
* Functions to convert to/from degrees are all gone. Conversion is done by the editor. * Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees. * Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m" * In general, can add suffixes for EditorSpinSlider Not covered by this PR, will have to be addressed by future ones: * Ability to switch radians/degrees in the inspector for angle properties (if actually wanted). * Animations previously made will most likely break, need to add a way to make old ones compatible. * Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes. * Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-05-25Merge pull request #48955 from Calinou/editor-tweak-property-hintsRémi Verschelde
Tweak dozens of editor property hints for consistency
2021-05-25Tweak dozens of editor property hints for consistencyHugo Locurcio
- Update Viewport MSAA property hints to match the currently exposed values. - Add some performance hints to property hints.
2021-05-23Support for 2D particles to collide against SDFreduz
-Added SDF collision support for 2D particles -Changed the SDF generation to be fully signed
2021-04-28Merge pull request #46688 from QbieShay/fix-particle-rotate-y-4Rémi Verschelde
Fixed rotate_y property of particle shaders
2021-04-17Split particle shader entry pointsreduz
* Particle shaders now have start() and process() * Particle collision happens between them. * The RESTART property is kept, so porting an old shader is still possible. This fixes the problem of particle collisions not functioning on the first particle frame.
2021-04-14Refactor GLSL shader compilationreduz
-Used a more consistent set of keywords for the shader -Remove all harcoded entry points -Re-wrote the GLSL shader parser, new system is more flexible. Allows any entry point organization. -Entry point for sky shaders is now sky(). -Entry point for particle shaders is now process().
2021-03-25Fix ParticlesMaterial spreadMorris Tabor
2021-03-12Fixes small typos and grammar correctionAnshul7sp1
2021-03-05fixed particle rotate y flagQbieShay
2021-02-10Removed _change_notifyreduz
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap. -For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed() -Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-09Initialize class variables with default values in scene/ [2/2]Rafał Mikrut
2021-01-27Fix particles not properly modified by their lifetimeYuri Roubinsky
2021-01-12Renamed `emit_particle` to `emit_subparticle` shader functionYuri Roubinsky
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-04Rename Particles/ParticlesMaterial "Flags" enum to "ParticleFlags"Aaron Franke
"Flags" was a bit too ambiguous, and in 3D it hid GeometryInstance.Flags
2020-10-09Implement GPU Particle Collisionsreduz
-Sphere Attractor -Box Attractor -Vector Field -Sphere Collider -Box Collider -Baked SDF Collider -Heightmap Collider
2020-09-11doc: Sync classref with current sourceRémi Verschelde
Bind missing enums.
2020-09-06Implement manual particle emission and particle sub emitters.reduz
2020-09-02Re-Implement GPU particles on master.Juan Linietsky
-No new features yet -Unlike godot 3.x, sorting happens using GPU
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-27Renaming of servers for coherency.Juan Linietsky
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
2020-02-26Reimplement Mutex with C++'s <mutex>Pedro J. Estébanez
Main: - It's now implemented thanks to `<mutex>`. No more platform-specific implementations. - `BinaryMutex` (non-recursive) is added, as an alternative for special cases. - Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes. - Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts. - A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this. - `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`. - Thread-safe utilities are therefore simpler now. Misc.: - `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same. - Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock). - `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
2020-02-23Replace FALLTHROUGH macro by C++17 [[fallthrough]]Rémi Verschelde
This attribute is now part of the standard we target so we no longer need compiler-specific hacks. Also enables -Wimplicit-fallthrough for Clang now that we can properly support it. It's already on by default for GCC's -Wextra. Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-11Texture refactorJuan Linietsky
-Texture renamed to Texture2D -TextureLayered as base now inherits 2Darray, cubemap and cubemap array -Removed all references to flags in textures (they will go in the shader) -Texture3D gone for now (will come back later done properly) -Create base rasterizer for RenderDevice, RasterizerRD
2020-02-09Fix GPU Particleszxcvdev
The special case atan(y,0) of the built-in shader function atan(y,x) returns different results on different devices. So this commit will add checks when the atan(y,x) function is used in ParticlesMaterial to set the direction of GPU Particles to make sure the desired values are returned (act as atan2(y,x)).
2020-01-16Validate input in (CPU)Particles set_emission_shape()Rémi Verschelde
Fixes #29777. Co-authored-by: Cameron Reikes <cameronreikes@gmail.com>
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-11-08Fixed prematurely ending animation of particles.Simon Hardt
2019-09-24fix particles scale randomizationclayjohn
2019-07-14added individual particle random lifetimeclayjohn
2019-07-06particles: Return uniform density spheres.Simon Puchert
This matches the previous change for cpu_particles.
2019-07-02Merge pull request #26613 from KoBeWi/direction_of_particlesRémi Verschelde
Add a Direction property to ParticlesMaterial