Commit graph

39 commits

Author SHA1 Message Date
BlueCube3310 bf919eafa7 Extract BasisUniversal code into its own files 2024-02-19 10:56:02 +01:00
Rémi Verschelde e457f41f9b
Remove code relative to obsoleted ETC texture format
Co-authored-by: BlueCube3310 <53150244+BlueCube3310@users.noreply.github.com>
2024-02-14 17:16:41 +01:00
BlueCube3310 51ad937532 Fix BasisUniversal ETC RA_AS_RG transcoding 2024-01-07 12:53:01 +01:00
A Thousand Ships 517e9f8aef [Modules] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-26 16:44:52 +02:00
cow-neaz 56cfde3a5c Fix Basic Universal compressing with normal maps. 2023-06-16 11:20:16 -07:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
Lyuma 0addf38047 basisu: Loop over the last mipmap lod 2023-02-26 16:01:54 -08:00
K. S. Ernest (iFire) Lee add503e71d Fix basisu mipmaps
Previously basisu was storing mip maps as an array of basisu in the internal format for Texture. The new work makes sense and it generates smaller files with one image.

This pull request fixes the basisu decompression and keep the approach of 1 image. If we need to change the format in 4.x, we can still support the old format with some limitations too. Basisu from gltfpack can only output with mipmaps.

The single image will not work for StreamedTexture. We should support both approaches for CompressedTexture we use one, and for StreamedTexture we use another.

Additional error checking for hdr images and for nullptr.
2023-02-25 13:48:51 -08:00
K. S. Ernest (iFire) Lee 39922d7167 Handle gltf binary
[ Ignore and Warn | Extract Textures (default) | Optimize Loading Embedded as Basisu ]

Enable compressed mip maps from Basis Universal for faster compressions.

Increase the quality of Basis to avoid corruption.

To keep compatibility use the first mip of the previous internal Godot format.

Because texture names may have invalid filename characters, adds String::validate_filename to sanitize filenames for import pipeline use.
2023-01-27 02:02:02 -08:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Hirotoshi Yoshitaka d144e278ac Fix Basis Universal format texture rendering failure
Fix "failed! on level 0" error message on exported projects with Basis Universal textures.
2022-12-21 17:29:38 +09:00
kobewi 072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
reduz de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
bruvzg f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
reduz 45f74ceb85 Add PortableCompressedTexture
* Resource that allows saving textures embedded in scenes or standalone.
* Supports only formats that are portable: Lossy, Lossles or BasisUniversal

This is something I wanted to add for a long time. I made it now because @fire
requires it for importing GLTF2 files with embedded textures, but also this
will allow saving Godot scenes as standalone binary files that will run
in all platforms (because textures will load everywhere).

This is ideal when you want to distribute individual standalone assets online
in games that can be built from Godot scenes.
2022-03-30 10:39:41 +02:00
K. S. Ernest (iFire) Lee 3529141b4b Update basis universal to version 1.16.3.
Enable basis universal uastc internal storage instead of etc1s for better quality.
2022-03-24 22:41:23 -07:00
Rémi Verschelde b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Hugo Locurcio ce97ddbcb1
Rename GLES2 driver to OpenGL to prepare for the upgrade to GLES3
- Use lowercase driver names for the `--rendering-driver`
  command line argument.
2021-10-30 02:05:49 +02:00
reduz 5ad4f26659 Implement the ability to disable classes
* This PR adds the ability to disable classes when building.
* For now it's only possible to do this via command like:
  `scons disable_classes=RayCast2D,Area3D`
* Eventually, a proper UI will be implemented to create a build config file to do this at large scale, as well as detect what is used in the project.
2021-07-13 09:25:14 -03:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde 2d133177e9
basis_universal: Update to upstream commit from Apr 16, 2021
BinomialLLC/basis_universal@ba1c3e40f1.
2021-05-07 17:26:11 +02:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
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 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal b4a190e0bc Consistently use normal_map 2020-12-29 08:04:19 +00:00
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 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
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde 0a2fa4d892 Fix more -Wmaybe-uninitialized warnings with target=release_debug
I have no idea why those don't get triggered in target=debug builds.

Fixes #37461.
2020-03-31 13:52:42 +02:00
Rémi Verschelde f097511b96 Fix another batch of -Wmaybe-uninitialized warnings
And simplify code in CSGShape.
2020-03-30 18:27:36 +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 f725bd99f4 Fix some -Wmaybe-uninitialized warnings
Namely:
```
modules/basis_universal/register_types.cpp: In function 'Ref<Image> basis_universal_unpacker(const Vector<unsigned char>&)':
modules/basis_universal/register_types.cpp:266:15: warning: 'imgfmt' may be used uninitialized in this function [-Wmaybe-uninitialized]
  266 |  image->create(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata);
      |  ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/basis_universal/register_types.cpp:255:39: warning: 'format' may be used uninitialized in this function [-Wmaybe-uninitialized]
  255 |    bool ret = tr.transcode_image_level(ptr, size, 0, i, dst + ofs, level.m_total_blocks - i, format);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

```
servers/visual_server.cpp: In member function 'Error VisualServer::_surface_set_data(Array, uint32_t, uint32_t*, uint32_t, Vector<unsigned char>&, int, Vector<unsigned char>&, int, AABB&, Vector<AABB>&)':
servers/visual_server.cpp:636:15: warning: 'iw' may be used uninitialized in this function [-Wmaybe-uninitialized]
  636 |       copymem(&iw[i * 2], &v, 2);
      |               ^
```

```
core/image.cpp: In member function 'Error Image::generate_mipmap_roughness(Image::RoughnessChannel, const Ref<Image>&)':
core/image.cpp:1683:11: warning: 'roughness' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1683 |     float roughness;
      |           ^~~~~~~~~
```
2020-03-27 14:33:06 +01:00
Rémi Verschelde 49fec646cb Fix compilation warnings and re-enable werror=yes on Travis
Fix -Wunused-variable, -Wunused-but-set-variable and -Wswitch warnings
raised by GCC 8 and 9.

Fix -Wunused-function, -Wunused-private-field and
-Wtautological-constant-out-of-range-compare raised by Clang.

Fix MSVC 2019 warning C4804 (unsafe use of type 'bool' in comparison
operation).

GCC -Wcpp warnings/Clang -W#warnings (`#warning`) are no longer raising
errors and will thus not abort compilation with `werror=yes`.

Treat glslang headers are system headers to avoid raising warnings.

Re-enables us to build with `werror=yes` on Linux and macOS, thus
catching warnings that would be introduced by new code.

Fixes #36132.
2020-02-18 20:51:25 +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
Rémi Verschelde b6d684ec65 basis_universal: Update to upstream commit from Jan 4, 2020
BinomialLLC/basis_universal@895ee8ee7e.
2020-02-13 16:09:00 +01:00
Rémi Verschelde db81928e08 Vulkan: Move thirdparty code out of drivers, style fixes
- `vk_enum_string_helper.h` is a generated file taken from the SDK
  (Vulkan-ValidationLayers).
- `vk_mem_alloc.h` is a library from GPUOpen:
  https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
2020-02-11 14:08:44 +01:00
Rémi Verschelde fff4240bb4 Fix code formatting issues and VS compilation
Also temporarily disable multicheck build so that we get a full build
even when there are style issues on Vulkan.

Fixes #33356.
2020-02-11 12:05:19 +01:00
Rémi Verschelde 3695c08782 basis_universal: Use proper basisu_transcoder.h header, fixes Clang build
Also renames bu to basisu to be more explicit and match upstream name.
2020-02-11 12:03:07 +01:00
Juan Linietsky d5cf1a872b Fixes to Basis Universal. 2020-02-11 12:02:59 +01:00
Juan Linietsky 4aea9f74e6 Rewritten StreamTexture for better code reuse, added basis universal support 2020-02-11 12:02:36 +01:00