Commit graph

178 commits

Author SHA1 Message Date
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
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-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
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-14 16:54:55 +02:00
Rémi Verschelde dcd1151d77 Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Juan Linietsky 4ffc0d6b3f Refactored shadowmapping.
- Made shadow bias size independent, so it will remain when changing light or camera size.
- Implemented normal offset bias, which greatly enhances quality.
- Added transmission to subsurface scattering
- Reimplemented shadow filter modes

Closes #17260
2020-04-08 11:19:43 -03:00
Juan Linietsky c54f80d35c Re-implement subsurface scattering.
The size settings are more "just works", with default scale and depth scale
values that don't need much tweaking.

Additionally, a "skin" mode was added so skin looks better.
EDIT: Cleaned up SSR filter shader a bit.
2020-04-04 11:44:28 -03:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Juan Linietsky a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03: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
Andrii Doroshenko (Xrayez) fa766265a7 Fix MIMPAMPS typos in constants throughout the engine 2020-02-20 01:31:43 +02:00
Rémi Verschelde d2537407ef Fix various GCC compilation warnings after Vulkan merge
Part of #36132.
2020-02-14 10:02:31 +01:00
Rémi Verschelde 54ac8eaba6 Remove more deprecated methods and code 2020-02-13 12:37:45 +01:00
Rémi Verschelde 0bdd748d34 doc: Add BaseMaterial3D strings ported from SpatialMaterial
Follow-up to #36135.
2020-02-12 15:23:26 +01:00
Rémi Verschelde 0e3d625737 doc: Sync classref with current source
Lots of internal API changes and some docstrings were lost in the conversion.
I manually salvaged many of them but for all the rendering-related ones, an
additional pass is needed.

Added missing enum bindings in BaseMaterial3D and VisualServer.
2020-02-12 12:37:13 +01:00
Yuri Roubinsky ca66fec570 [Vulkan] Fix typo in shading modes 2020-02-11 12:02:24 +01:00
Juan Linietsky dd3682e5fe Modernized default 3D material, fixes material bugs. 2020-02-11 12:01:24 +01:00
Juan Linietsky 2d6a916835 Environment sky more or less working. 2020-02-11 12:01:05 +01:00
Juan Linietsky 50e9befb88 Changes to material required to add custom shaders in RD renderer 2020-02-11 11:53:28 +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
Hugo Locurcio ac3087eb4b
Don't connect ShaderMaterial's changed signal when not in the editor
This closes #34741.
2020-01-02 17:20:54 +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
clayjohn 2bc6302607 Properly update texture when roughness/metallic set 2019-11-17 11:11:25 -08:00
clayjohn 21e1f1df0f Force update SpatialMaterial when texture set and always use ALBEDO 2019-11-02 17:42:36 -07:00
Rémi Verschelde 63c5cd7eb8
Merge pull request #33104 from qarmin/fix_some_crashes
Fix some crashes and using null pointers
2019-10-28 08:37:59 +01:00
Rafał Mikrut e53e1c566a Fix some crashes and using null pointers 2019-10-28 08:07:29 +01:00
clayjohn 7b3d098b2b Fixed using compressed textures and add work around for firefox webgl mesa sampler limit 2019-10-27 23:53:52 -07:00
Yuri Roubinsky fa9148f343 Allows change Sprite3D scale if Billboard mode is enabled 2019-10-23 14:32:59 +03:00
Rémi Verschelde 9762372329
Merge pull request #30635 from KoBeWi/billbo_3dns
Add a Billboard property for Sprite3D
2019-08-29 13:06:37 +02:00
Tomasz Chabora b055ade1c3 Add a Billboard property for Sprite3D 2019-08-28 23:00:44 +02:00
Tomasz Chabora af5e0fff66 Remove ERR_EXPLAIN from scene/* code 2019-08-09 13:54:52 +02:00
Rémi Verschelde a1b4568ba9
Revert "Tweak SpatialMaterial's default metallic and roughness texture channels" 2019-07-22 11:56:41 +02:00
Bojidar Marinov bdffdd7e38
Fix binormal sign when using triplanar mapping
Fixes #30671
2019-07-18 19:31:45 +03:00
Rémi Verschelde b9f8e072ce
Merge pull request #26205 from Calinou/spatialmaterial-use-packed-channels
Tweak SpatialMaterial's default metallic and roughness texture channels
2019-06-20 11:46:01 +02:00
Hugo Locurcio c0b3e20ca7
Tweak some editor property hints to be more flexible and consistent
This partially addresses #19242.
2019-06-16 23:52:16 +02:00
Rémi Verschelde bf6f41e0b9
Merge pull request #26978 from qarmin/fix_recursive_bitmapfont_crash
Fix crash when trying to set as Bitmap Font fallback one of his parent
2019-05-28 13:49:34 +02:00
Bastiaan Olij 3ea778e66e Implement shadow to opacity 2019-05-21 20:07:46 +10:00
qarmin 4270403724 Fix crash when trying to set fallback or next pass with one of parent 2019-05-03 13:39:46 +02:00
Rémi Verschelde 9dc9434b1b
Merge pull request #24437 from mateusfccp/single_quotes_option
Add settings for single-quotes on completion
2019-04-30 14:58:33 +02:00
Juan Linietsky a32b26dfa2 Several fixes to make GLES2 on HTML5 work much better.
Changed math class error reporting to be a bit less paranoid.
2019-02-25 21:47:29 -03:00
Hein-Pieter van Braam a83e77fded Explicitly use floating point numbers in the our shaders
We need to be explicit about using floating point numbers in our shaders
for compatibility with mobile GLES drivers.
2019-02-24 23:35:10 +00:00
Juan Linietsky fd68bb2596 -Treat scalar conversions when calling functions as error, closes #24261
-Make shader editor display errors if exist when just opening it
-Make ShaderMaterial not lose parameters if opened in error.
2019-02-23 17:55:09 -03:00
Hugo Locurcio eb79833770
Tweak SpatialMaterial's default metallic and roughness texture channels
To follow the glTF 2.0 specification in all cases (including outside
of imported glTF scenes), the blue channel is now used for metallic
and the green channel is now used for roughness.
2019-02-23 19:10:31 +01:00
Juan Linietsky aab8f443f9 -Support DEPTH_TEXTURE in GLES2, fixes #25106
-Fix use of transparent framebuffers in GLES2
-Fix use of ambient color clearing in GLES2 when no environment exists.
2019-02-22 11:35:39 -03:00
JFonS 4d933b1530 Fix canvas particle material for old GLSL versions 2019-02-11 14:56:23 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Mateus Felipe C. C. Pinto ca1935d6f7 Add settings for single-quotes on completion 2018-12-18 12:48:36 -02:00