Commit graph

53 commits

Author SHA1 Message Date
Haoyu Qiu
ed952f82bd Add is_zero_approx methods to Vector{2,3} 2024-04-10 19:02:42 +08:00
Ansraer
1e7c60174e fix crash on mat creation after orm refactor 2024-02-16 20:51:27 +01:00
Ansraer
b9cbffd957 add ORMSpatialMaterial 2024-02-08 20:34:11 +01:00
Rarysson Guilherme
db29b32cd6 Add missing include header to FBXCommon.h 2023-10-23 21:11:45 -03:00
Rémi Verschelde
55550da68b
SCons: Disable C++ exception handling
Upon investigating the extremely slow MSVC build times in #80513, I noticed
that while Godot policy is to never use exceptions, we weren't enforcing it
with compiler flags, and thus still included exception handling code and
stack unwinding.

This is wasteful on multiple aspects:

- Binary size: Around 20% binary size reduction with exceptions disabled
  for both MSVC and GCC binaries.
- Compile time:
  * More than 50% build time reduction with MSVC.
  * 10% to 25% build time reduction with GCC + LTO.
- Performance: Possibly, needs to be benchmarked.

Since users may want to re-enable exceptions in their own thirdparty code
or the libraries they compile with Godot, this behavior can be toggled with
the `disable_exceptions` SCons option, which defaults to true.
2023-08-16 10:34:10 +02:00
Rémi Verschelde
1426cd3b3a
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".

Backported from #70885.
2023-01-10 15:26:54 +01:00
Aaron Franke
3ec8296ffc Make "Godot source files" comment consistent in modules
(cherry picked from commit ce0080768c)
2022-08-08 09:47:24 +02:00
Rémi Verschelde
0a8d5d7098 Bump version to 3.6-beta 2022-08-05 18:51:38 +02:00
Rémi Verschelde
818f1eed31 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 14:53:37 +02:00
Haoyu Qiu
17ce0fcc7c Simplify FBX importer project settings registering 2022-03-29 15:00:31 +08:00
Aleksey Smirnov
ad0c4bf32d Replace copies with constant refs
(cherry picked from commit 1a13de0f8d)
2022-03-29 00:08:29 +02:00
Hugo Locurcio
b087538119
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-03-16 23:01:02 +01:00
Rémi Verschelde
7a16bb2ee4
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.

(cherry picked from commit 1bdb82c64e)
2022-02-11 09:50:59 +01:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Haoyu Qiu
e1f96d5ee8
Fix crash on importing FBX file
(cherry picked from commit af67e4c291)
2022-01-12 17:28:07 +01:00
Rémi Verschelde
14c366ddd7
Bump version to 3.5-beta 2021-11-05 16:10:17 +01:00
Omar El Sheikh
203295f17d Added Mesh Compression Import Options
Fleshed out the "Optimize Mesh" options found in the mesh import UI
Gave a checkbox to every vertex attribute that can be compressed

Surfaced option to enable/disable Octahedral compression for
normal/tangent vectors

Also surfaces the vertex position compression option which previously
inaccessible because the defaults did not compress vertex positions

Supports all current importers (obj, fbx, collada, gltf)
2021-11-01 12:54:28 -04:00
Rémi Verschelde
1b65550ec7
clang-format: Various fixes to comments alignment from clang-format 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 14:50:32 +02:00
Rémi Verschelde
42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Haoyu Qiu
70853fd669 Remove do{ } while(0) wrapper around error macros 2021-09-12 15:04:53 +08:00
Omar El Sheikh
d274284069 Octahedral Normal/Tangent Compression
Implement Octahedral Compression for normal/tangent vectors
*Oct32 for uncompressed vectors
*Oct16 for compressed vectors

Reduces vertex size for each attribute by
*Uncompressed: 12 bytes, vec4<float32> -> vec2<unorm16>
*Compressed: 2 bytes, vec4<unorm8> -> vec2<unorm8>

Binormal sign is encoded in the y coordinate of the encoded tangent

Added conversion functions to go from octahedral mapping to cartesian
for normal and tangent vectors

sprite_3d and soft_body meshes write to their vertex buffer memory
directly and need to convert their normals and tangents to the new oct
format before writing

Created a new mesh flag to specify whether a mesh is using octahedral
compression or not
Updated documentation to discuss new flag/defaults

Created shader flags to specify whether octahedral or cartesian vectors
are being used

Updated importers to use octahedral representation as the default format
for importing meshes

Updated ShaderGLES2 to support 64 bit version codes as we hit the limit
of the 32-bit integer that was previously used as a bitset to store
enabled/disabled flags
2021-07-30 10:29:09 -04:00
Rémi Verschelde
80e1585a6e
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.

(cherry picked from commit c1c76850cb)
2021-06-07 12:06:59 +02:00
Rémi Verschelde
eb78f80f03
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
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
```
2021-05-20 12:56:56 +02:00
Rémi Verschelde
140350d767
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
2021-05-05 15:02:01 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde
c3272997cd
doc: Update classref headers with 3.4 version 2021-04-26 13:15:29 +02:00
Rémi Verschelde
2a00a6bfca
fbx: Fix include for zlib that broke unbundling
It's possible to link against system zlib on Linux, so we should use system paths.

(cherry picked from commit 93b7406138)
2021-04-22 17:22:18 +02:00
Lyuma
5cf5e7e3d3 Fix crash on importing empty .fbx file for 3.x 2021-04-08 02:52:15 -07:00
Alex Hirsch
6a7ee81610
Always dynamically allocate PropertyTable
- `Texture::~Texture` expects `props` to be dynamically allocated.

- `GetPropertyTable` returned a pointer to an existing `PropertyTable`
  but is expected to return a newly, dynamically allocated one.

- `PropertyTable::PropertyTable()` suggests that an empty `element`
  property is valid.

fix #46876
fix #45573

(cherry picked from commit 09bda3f140)
2021-04-07 11:26:19 +02:00
Rémi Verschelde
1aba997d75
doc: Sync classref with 3.3 version bump 2021-03-23 13:40:34 +01:00
Alex Hirsch
44855c40da
FBX Import: Normalize rotation quaternions
fix #47174

(cherry picked from commit 72d3bfc88c)
2021-03-23 13:16:09 +01:00
Alex Hirsch
2c93256432
FBX Import: Check bone map access for valid cluster target node id
fix #47184

(cherry picked from commit d03f4cefea)
2021-03-20 23:09:02 +01:00
Bastiaan Olij
9c296bcb59 Fix duplicate check for bone names in FBX import 2021-03-02 10:55:29 +11:00
Gordon MacPherson
53aee600d3 fixed bug in vertex duplication breaking meshes 2021-02-09 16:33:46 +00:00
Andy Maloney
77f045db99 Fix const warnings in FBX (build failure on macOS)
Fixes several instances of error: 'const' type qualifier on return type has no effect [-Werror,-Wignored-qualifiers]

This looks like it was fixed in 6607fc7da9
when FBX was merged into the 4.0 master branch:

"- fixed const correctness with C++/C version change"
2021-01-21 11:18:44 -05:00
Rémi Verschelde
49646383f1
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 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Gordon MacPherson
31bc1af82a Preliminary Blender FBX support
limitations:
- always has to use generated normal's.
- some animations won't be compatible (yet)

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-01-05 21:56:21 +00:00
Rémi Verschelde
10cc044ea5
FBX: Clarify outdated format error
See #44780.

(cherry picked from commit 1dd75f41e5)
2020-12-29 16:02:03 +01:00
Rémi Verschelde
65c1db3131
Merge pull request #44305 from RevoluPowered/fbx-update-plugin
[fbx] Implement ColorIndex for Vertex Colors to ensure they are correct and duplicate vertexes correctly for multiple color attributes.
2020-12-17 21:19:59 +01:00
Gordon MacPherson
18d1898309 [fbx] Fix #44371 #44376 File crash and Buffer Overflow
Fixes:
- Element collection will only contain valid elements.
- Fixes buffer overflow in the FBX document
2020-12-14 21:57:41 +00:00
Gordon MacPherson
8ffad0d8bd ColorIndex supported now for vertex colors.
Other properties should index override where appropriate in future.
2020-12-14 16:51:15 +00:00
Gordon MacPherson
de61cfe7c5 [fbx] bugfixes skinning, materials and debugging info, merry xmas 🎄
Better materials:
- default values will no longer trigger things like emission,
clear coat being enabled etc incorrectly, mostly importers misunderstand
this value, a value of 1 is not actually enabled emission, it must have a
non zero setting other than emission value for the emission flags to
actually be enabled correctly in our engine #42386
- lambert materials are warned against significantly,
do not use Lambert in Godot, use a PBR material like Ai Standard Surface
 (it's like going from low quality to high definition in terms of output
 in scenes and on assets)
- roughness values are calculated correctly in this version

Fixes for normal's array - some normal's from some files were dropped and
generated, this is now fixed.
- FBX indexing for items with (-1) index, for normal data is supported,
this is super helpful at increasing our range of compatibility of
FBX meshes.

Fix bone rest data **no longer requiring go to bind pose in Maya and various applications**
- Partial fix for #43688

Validation tools added for validating large projects

Provide package name, vendor and FBX vendor in the log.

Implemented metadata properties so we can read extra document
info required for bug reporting

**FBX 2011 (version 7200)** is unsupported now,
you must re-export your file in Maya or Max to upgrade the file format.

Fixes skin bind poses being generated based on node xforms in the scene
Fixes duplicate bones being added to skin and prevents add_bones from
registering skeleton bones it now registers skin bind poses,
but this should really be documented in the engine correctly right now
 it doesn't tell you this is the case.
2020-12-10 19:30:17 +00:00
Rémi Verschelde
a57b6eb211
doc: Sync classref with current source
Move EditorSceneImporterFBX doc to its module folder.
2020-11-11 17:00:41 +01:00
Gordon
866c8de0ac Revert partial "FBX add roughness mappings and fixes general some material bugs"
This reverts partial commit b624e13681.

This resolves a bug with pivots and skinning breaking with this change.
2020-11-09 18:03:06 +00:00
Gordon
b624e13681 FBX add roughness mappings and fixes general some material bugs
- Fixed bug with FBX so we can import material values from the document for PBR when using StingRay (not Arnold *yet*)
- Adds more explicit errors and makes things simpler to read. Has more sanity checks to be sure things are working correctly
- Lazy Properties fixed items not loading due to capital letter errors in FBX parser
- Added debug tools to the materials so you know explicitly what material mapping is assigned to a texture and where it came from. (enable verbose printing to use this)
- Fix broken material mappings and debug entries properly
- Fix make embedded images properly detected
- Spam less errors for unsupported shading models with materials.

Future plans:
- Arnold materials need converted to PBR model, if possible.
2020-11-07 14:34:09 +00:00
Rémi Verschelde
8135fdd382
Merge pull request #43298 from RevoluPowered/fbx-bugfix-mesh-compression-flags
FBX respect mesh compression flags
2020-11-03 22:53:46 +01:00