Commit graph

64 commits

Author SHA1 Message Date
Rémi Verschelde
f742dabafe Signals: Manually port most of remaining connect_compat uses
It's tedious work...

Some can't be ported as they depend on private or protected methods
of different classes, which is not supported by callable_mp (even if
it's a class inherited by the current one).
2020-02-28 14:24:09 +01:00
Rémi Verschelde
01afc442c7 Signals: Port connect calls to use callable_mp
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.

No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
2020-02-28 14:24:09 +01:00
Pedro J. Estébanez
18fbdbb456 Reimplement Mutex with C++'s <mutex>
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-26 20:40:10 +01:00
Juan Linietsky
33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- 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-25 12:55:53 +01:00
Juan Linietsky
69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky
3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Juan Linietsky
a95fb114ba Fixed 2D and 3D CPU Particles 2020-02-11 12:03:50 +01:00
Juan Linietsky
6deffa62fb Several fixes to 3D rendering, and multimesh implementation. 2020-02-11 12:01:22 +01:00
Juan Linietsky
3f335ce3d4 Texture refactor
-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-11 11:53:26 +01:00
Rémi Verschelde
3bd3462d61
Merge pull request #32496 from bitstopper/master
Fixes broken CPUParticles2D AtlasTextures usage
2020-02-07 21:12:19 +01:00
Rémi Verschelde
ba177ccaec doc: Misc updates for AnimationNode* and others
- Add some missing descriptions.
- Add links to tutorials for ARVR and AnimationTree.
- Style fixes.
- Engine changes:
  * Make `AnimationNodeTransition.input_<number>` properties internal
    so that they don't appear in the docs. They still appear in the
    inspector based on the actual number of inputs requested.
  * Drop unimplemented `CPUParticles.flatness`. It's only used for 3D
    particles in `ParticlesMaterial`, and thus only relevant for
    `CPUParticles3D`.
2020-01-23 12:37:33 +01:00
Rémi Verschelde
1de633205f Validate input in (CPU)Particles set_emission_shape()
Fixes #29777.

Co-authored-by: Cameron Reikes <cameronreikes@gmail.com>
2020-01-16 11:08:51 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
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.
2020-01-01 11:16:22 +01:00
Mikolaj Kaczmarek
a245bab78d Fixed disconnecting not connected signal 2019-10-29 00:53:48 +01:00
PouleyKetchoupp
1e0f37a70f Fixed emitting not initialized correctly in cpu particles 2d/3d
Fixes uninitialized variable caused by PR #32921
2019-10-24 21:38:01 +02:00
PouleyKetchoupp
5bf516a062 Fixed delay when CPUParticles & CPUParticles2D start being emitted
Particles were processed only on the next frame after the emission started, causing a one frame delay in rendering. Now the first process cycle is started during the same frame, which makes them consistent with Particles & Particles2D.

Fixes #32890
2019-10-20 09:50:00 +02:00
bitstopper
36d9906d6a Fixes broken CPUParticles2D AtlasTextures usage 2019-10-07 10:54:36 +02:00
Rémi Verschelde
9327eb226a
Revert "Fixes CPUParticles2D not making use of AtlasTextures" 2019-10-02 09:44:06 +02:00
bitstopper
9f21fcf879 Fixes CPUParticles2D not making use of AtlasTextures
Fixes CPUParticles2D not making use of AtlasTextures #2
2019-10-01 14:04:37 +02:00
Rémi Verschelde
dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin
17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
clayjohn
bc94203add fix particles scale randomization 2019-09-24 08:03:53 -07:00
clayjohn
cb4d145c22 toggle CPUParticles2D visibility when redrawing 2019-07-28 18:31:52 -07:00
Rémi Verschelde
d15cf7b672
Merge pull request #30576 from qarmin/lgtm_coverage
Changed some code reported by LGTM and Coverity
2019-07-20 12:00:13 +02:00
qarmin
6cbaf7662f Changed some code showed in LGTM and Coverage 2019-07-20 08:09:57 +02:00
clayjohn
5ef3374258 added individual particle random lifetime 2019-07-14 23:22:40 -07:00
Simon Puchert
18ba1bc824 cpu_particles: Return uniform density spheres.
The current implementation normalizes points from a uniform distribution
on a cube. This creates a non-uniform distribution on the sphere.
2019-07-06 00:13:03 +02:00
Rémi Verschelde
c08877777d
Merge pull request #26613 from KoBeWi/direction_of_particles
Add a Direction property to ParticlesMaterial
2019-07-02 11:33:34 +02:00
Rémi Verschelde
26f99beac3 CPUParticles2D: Fix gravity to be the same as in Particles2D and Area2D
This was likely a typo, 10 times the standard gravity is 98.0665
(ca. 98), not 98.8.
2019-06-30 13:58:07 +02:00
Rémi Verschelde
0636f709af
Merge pull request #29937 from clayjohn/particles-one-shot-bug
Update emitting status on one-shot particles
2019-06-27 17:29:40 +02:00
Tomasz Chabora
00b15c19b7 Add a Direction property to ParticlesMaterial 2019-06-26 20:37:39 +02:00
clayjohn
d59dbda24f update emitting status on one-shot particles 2019-06-25 22:07:29 -07:00
Rémi Verschelde
25022a1d89
Merge pull request #29974 from clayjohn/particles_restart
Properly set emitting when particles restart
2019-06-24 13:48:56 +02:00
clayjohn
64ecc8a5a3 properly set emitting when particles restart 2019-06-21 22:33:11 -07:00
Rémi Verschelde
b3fe249e94 CPUParticles: Set linear velocity to 0, like GPU Particles 2019-06-21 15:23:48 +02:00
Rémi Verschelde
fae3df1204 Particles: Properly initialize angular velocity parameter
Right now it would take garbage values when loading scenes,
which could end up written to the scene file.
2019-06-21 15:23:10 +02:00
clayjohn
7d1ee6d3c3 change emit shape circle to sphere in CPUParticles2D 2019-06-17 11:59:31 -07:00
Rémi Verschelde
9d3342545d
Merge pull request #29700 from clayjohn/cpuparticles_transform_bug
Fix CPU particles bug with local_coords and transform
2019-06-16 10:49:30 +02:00
clayjohn
52696e98b4 fix CPU particles bug with local_coords and transform 2019-06-14 13:22:19 -07:00
Rémi Verschelde
52dd0f8751 Implement missing orbit velocity for CPUParticles and CPUParticles2D
The relevant code was copied from (GPU) ParticlesMaterial but commented
out initially, and never ported.

Closes #29580.
2019-06-13 11:35:07 +02:00
Rémi Verschelde
f160c81f68
Merge pull request #29696 from akien-mga/cpuparticles-randomness
CPUParticles: Do randomness ratio computations in phase instead of time
2019-06-12 10:54:02 +02:00
Rémi Verschelde
d0c2005da1 CPUParticles: Do randomness ratio computations in phase instead of time
The original shader code uses a phase (ratio from 0 to 1 for the particle
lifetime) for the randomness ratio computations, and this code was ported
over but converted to time computations.

The seeding/cycle logic was thus invalid, so we're going back to phase
for these computations, thus fixing the previous non-working time/emission
randomness property.

Part of #29692. Follow-up to #26859.
2019-06-11 23:40:56 +02:00
Rémi Verschelde
9206bcabaa CPUParticles: Fix inconsistent tangential acceleration
The tangential acceleration for both CPUParticles2D and CPUParticles had been
badly converted from their GPU counterpart (ParticlesMaterial).
This fixes it and ensures that both GPU and CPU particles behave the same with
regard to tangential acceleration.
2019-06-11 18:56:07 +02:00
Rémi Verschelde
e0574e1d98 Fix typos with codespell
Using codespell 1.15.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
doubleclick
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-05-19 13:10:35 +02:00
Daeil Kim
24b7f08892 Ensure non-emitting particles not processed on entering tree
Also removed non-active CPUParticles(3d) from render list
Fixes #27066
2019-03-20 21:54:00 +09:00
JFonS
c13ac398f6 Fix resetting of CPUParticles (2D and 3D) 2019-03-10 00:33:08 +01:00
Daeil Kim
608af1a786 Prevent invisible/inactive cpupparticles2d to redraw 2019-03-08 16:05:00 +09:00
clayjohn
0fec83bc92 allowing setting particles lifetime greater than 600 2019-02-18 10:46:41 -08:00
JFonS
fe6123fca4 Fix local_delta when resetting CPUParticles 2019-02-01 17:16:09 +01:00
Rémi Verschelde
7c8f55f857
Merge pull request #25207 from clayjohn/cpu_particle_2d_aligny_bug
Fix bug with CpuParticles2D AlignY
2019-01-22 12:19:00 +01:00