summaryrefslogtreecommitdiffstats
path: root/scene/resources/surface_tool.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge commit godotengine/godot@87318a2fb7fffeb72adca934e31915be077c3d1fSpartan3222024-11-061-1/+1
|\
| * Rewrite index optimization code for maximum efficiencyArseny Kapoulkine2024-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While all the previous fixes to optimizeVertexCache invocation fixed the vertex transform efficiency, the import code still was missing two crucial recommendations from meshoptimizer documentation: - All meshes should be optimized for vertex cache (this reorders vertices for maximum fetch efficiency) - When LODs are used with a shared vertex buffer, the vertex order should be generated by doing a vertex fetch optimization on the concatenated index buffer from coarse to fine LODs; this maximizes fetch efficiency for coarse LODs The last point is especially crucial for Mali GPUs; unlike other GPUs where vertex order affects fetch efficiency but not shading, these GPUs have various shading quirks (depending on the GPU generation) that really require consecutive index ranges for each LOD, which requires the second optimization mentioned above. However all of these also help desktop GPUs and other mobile GPUs as well. Because this optimization is "global" in the sense that it affects all LODs and all vertex arrays in concert, I've taken this opportunity to isolate all optimization code in this function and pull it out of generate_lods and create_shadow_mesh; this doesn't change the vertex cache efficiency, but makes the code cleaner. Consequently, optimize_indices should be called after other functions like create_shadow_mesh / generate_lods. This required exposing meshopt_optimizeVertexFetchRemap; as a drive-by, meshopt_simplifySloppy was never used so it's not exposed anymore - this will simplify future meshopt upgrades if they end up changing the function's interface.
* | Fix copyright headers referring to GodotSpartan3222024-10-271-2/+2
| |
* | Rebrand preambles to RedotDubhghlas McLaughlin2024-10-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Credits: Co-authored-by: Skogi <skogi.b@gmail.com> Co-authored-by: Spartan322 <Megacake1234@gmail.com> Co-authored-by: swashberry <swashdev@pm.me> Co-authored-by: Christoffer Sundbom <christoffer_karlsson@live.se> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: McDubh <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: radenthefolf <radenthefolf@gmail.com> Co-authored-by: John Knight <80524176+Tekisasu-JohnK@users.noreply.github.com> Co-authored-by: Adam Vondersaar <adam.vondersaar@uphold.com> Co-authored-by: decryptedchaos <nixgod@gmail.com> Co-authored-by: zaftnotameni <122100803+zaftnotameni@users.noreply.github.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: wesam <108880473+wesamdev@users.noreply.github.com> Co-authored-by: Mister Puma <MisterPuma80@gmail.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: SingleError <isaaconeoneone@gmail.com> Co-authored-by: Bioblaze Payne <BioblazePayne@gmail.com>
* | Rebrand Godot to RedotRandolph W. Aarseth II2024-10-111-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Linux Editor tests workflow matrix Add Windows Editor w/ Mono workflow matrix Add Generate Glue Code job to Windows workflow Add Build GodotSharp job to Windows workflow Add godot compatibility version references Add Godot author info Add Godot version compatibility info Add Godot donor info Add Godot authors and donors to editor_about.cpp Credits: Co-authored-by: Skogi <skogi.b@gmail.com> Co-authored-by: Spartan322 <Megacake1234@gmail.com> Co-authored-by: swashberry <swashdev@pm.me> Co-authored-by: Christoffer Sundbom <christoffer_karlsson@live.se> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: McDubh <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: radenthefolf <radenthefolf@gmail.com> Co-authored-by: John Knight <80524176+Tekisasu-JohnK@users.noreply.github.com> Co-authored-by: Adam Vondersaar <adam.vondersaar@uphold.com> Co-authored-by: decryptedchaos <nixgod@gmail.com> Co-authored-by: zaftnotameni <122100803+zaftnotameni@users.noreply.github.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: wesam <108880473+wesamdev@users.noreply.github.com> Co-authored-by: Mister Puma <MisterPuma80@gmail.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: SingleError <isaaconeoneone@gmail.com> Co-authored-by: Bioblaze Payne <BioblazePayne@gmail.com>
* Cleanup of raw `nullptr` checks with `Ref`A Thousand Ships2024-08-311-4/+4
| | | | Using `is_valid/null` over checks with `nullptr` or `ERR_FAIL_NULL` etc.
* Improve SurfaceTool::generate_tangents UV error messagemaski2024-06-201-1/+1
| | | | Fixes #92395.
* Fix `SurfaceTool.create_from_arrays` crash with bad indexjsjtxietian2024-04-261-0/+2
|
* Expose create_from_arrays in SurfaceTool and cleanup some namingLyuma2024-04-191-4/+9
|
* Merge pull request #88890 from clayjohn/SurfaceTool-tangent-hashRémi Verschelde2024-02-271-0/+4
|\ | | | | | | Include tangent in SurfaceTool vertex compare operator
| * Include tangent in SurfaceTool vertex compare operatorclayjohn2024-02-261-0/+4
| |
* | Properly calculate binormal when creating SurfaceTool from arraysclayjohn2024-02-231-3/+3
|/
* Replace error checks against `size` with `is_empty`A Thousand Ships2024-02-091-5/+5
|
* Cleanup instances of using uint32_t for mesh formatsClay2023-10-121-4/+4
| | | | And tidy up some leftovers from the attribute compression PR
* Vertex and attribute compression to reduce the size of the vertex format.clayjohn2023-10-051-6/+6
| | | | | | | | | | | | | This allows Godot to automatically compress meshes to save a lot of bandwidth. In general, this requires no interaction from the user and should result in no noticable quality loss. This scheme is not backwards compatible, so we have provided an upgrade mechanism, and a mesh versioning mechanism. Existing meshes can still be used as a result, but users can get a performance boost by reimporting assets.
* [Scene,Main] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicableA Thousand Ships2023-09-121-2/+2
|
* Fix parameters passing to `add_triangle_fan` method.Kirill Diduk2023-06-081-1/+1
| | | | | | Pass `p_uvs` parameter properly (instead of passing `p_uv2s` twice). This commit fixes #77542
* Merge pull request #77902 from dalexeev/doc-unify-deprecationsRémi Verschelde2023-06-071-0/+2
|\ | | | | | | Documentation: Unify deprecations
| * Documentation: Unify deprecationsDanil Alexeev2023-06-071-0/+2
| |
* | Single Compilation Unit build.lawnjelly2023-06-061-2/+2
|/ | | | | Adds support for simple SCU build (DEV_ENABLED only). This speeds up compilation by compiling multiple cpp files within a single translation unit.
* Merge pull request #76418 from reduz/method-bind-validated-callRémi Verschelde2023-05-081-1/+5
|\ | | | | | | Add ValidatedCall to MethodBind
| * Add ValidatedCall to MethodBindJuan Linietsky2023-04-301-1/+5
| | | | | | | | | | | | | | * This should optimize GDScript function calling _enormously_. * It also should simplify the GDScript VM considerably. NOTE: GDExtension calling performance has most likely been affected until going via ptrcall is fixed.
* | Fix SurfaceTool::create_from_blend_shape()smix82023-05-021-3/+15
|/ | | | Fixes SurfaceTool::create_from_blend_shape().
* Fix SurfaceTool crash with invalid bone/weight countRémi Verschelde2023-02-121-2/+2
| | | | Fixes #53191.
* meshoptimizer: Sync with upstream commit 4a287848fRémi Verschelde2023-01-311-1/+2
| | | | https://github.com/zeux/meshoptimizer/commit/4a287848fd664ae1c3fc8e5e008560534ceeb526
* Make SurfaceTool.generate_normals() behave in a consistent manner in regard ↵Mark Riedesel2023-01-261-10/+36
| | | | to smoothing groups, imply group 0 is flat
* Use range iterators in LocalVector loopskobewi2023-01-211-18/+16
|
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | 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".
* Fix usages of mesh simplification functions in float=64 buildsMarc Gilleron2022-11-121-1/+1
|
* Remove usage of unitialized variablesRafał Mikrut2022-10-011-1/+1
|
* Clean up Hash Functionsreduz2022-06-201-1/+2
| | | | | | | Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934 * Clean up usage of murmur3 * Fixed usages of binary murmur3 on floats (this is invalid) * Changed DJB2 to use xor (which seems to be better)
* `SurfaceTool.set_custom_format` Fixes and documentation.Lyuma2022-06-141-29/+34
| | | | | | | Fix mistake making `set_custom_format` impossible to use. Automatically forward custom flags in `SurfaceTool.commit`. Add documentation in `SurfaceTool` and `Mesh` for custom channels. Deprecate `SurfaceTool.generate_lod` and expose `ImporterMesh.generate_lods`.
* Add a new HashMap implementationreduz2022-05-121-1/+1
| | | | | | | | | | | | | | | | | Adds a new, cleaned up, HashMap implementation. * Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing). * Keeps elements in a double linked list for simpler, ordered, iteration. * Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much for performance vs keeping the key, but helps replace old code). * Uses a more modern C++ iterator API, deprecates the old one. * Supports custom allocator (in case there is a wish to use a paged one). This class aims to unify all the associative template usage and replace it by this one: * Map<> (whereas key order does not matter, which is 99% of cases) * HashMap<> * OrderedHashMap<> * OAHashMap<>
* Style: Cleanup single-line blocks, semicolons, dead codeRémi Verschelde2022-02-161-9/+18
| | | | | Remove currently unused implementation of TextureBasisU, could be re-added later on if needed and ported.
* Improvements and fixes to occludersjfons2022-02-071-0/+79
| | | | | | | | | | | | | | | Improvements: * Occluder3D is now an abstract type inherited by: ArrayOccluder3D, QuadOccluder3D, BoxOccluder3D, SphereOccluder3D and PolygonOccluder3D. ArrayOccluder3D serves the same purpose as the old Occluder3D (triangle mesh occluder) while the rest are primitives that can be used to manually place simple occluders. * Occluder baking can now apply simplification. The "bake_simplification_distance" property can be used to set a world-space distance as the desired maximum error, set to 0.1 by default. * Occluders can now be generated on import. Using the "occ" and "occonly" keywords (similar to "col" and "colonly" for colliders) or by enabling on MeshInstance3Ds in the scene's import window. Fixes: * Fixed saving of occluder files after bake. * Fixed a small error where occluders didn't correctly update in the rendering server. Bonus content: * Generalized "CollisionPolygon3DEditor" so it can also be used to edit Resources. Renamed it to "Polygon3DEditor" since it was already being used by other things, not just colliders. * Fixed a small bug in "EditorPropertyArray" where a call to "remove" was left after the "remove_at" rename.
* Rename or refactor macros to avoid leading underscoresOmar Polo2022-01-201-1/+0
| | | | | These are not used consistently and some can conflict with system-specific defines. While here, also delete some unused macros.
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* Add check to SurfaceTool.generate_lod(); ensure target index count between 0 ↵Mark Riedesel2021-10-161-0/+2
| | | | and source index count. Fixes #53876
* Validate before passing indices to meshoptimizerHaoyu Qiu2021-09-271-0/+1
|
* 8 uvs for glTF2, URI decode and Vertex Custom api.Lyuma2021-09-101-10/+39
| | | | | | | | | | | | | Add glTF2 uri decode for paths. Add vertex custom apis. Add scene importer api. Change Color to float; add support for float-based custom channels in SurfaceTool and EditorSceneImporterMesh Co-authored-by: darth negative hunter <thenegativehunter2@users.noreply.github.com>
* Fix crash when number of indices to optimize is not a multiple of 3Haoyu Qiu2021-08-021-0/+1
|
* Rename `instance()`->`instantiate()` when it's a verbLightning_A2021-06-191-1/+1
|
* Merge pull request #49401 from fire/8-weightsK. S. Ernest (iFire) Lee2021-06-161-2/+10
|\ | | | | Fix 8 bone weights in glTF2
| * Fix 8 bone weights in glTF2K. S. Ernest (iFire) Lee2021-06-071-2/+10
| | | | | | | | | | Don't spam in glTF2 import either. Clear() in SurfaceTool does not keep 8 weights.
* | Fix tangents array in SurfaceTooljfons2021-06-121-4/+4
|/
* Rename Transform to Transform3D in coreAaron Franke2021-06-031-1/+1
|
* Update with experimental mesh optimizer.K. S. Ernest (iFire) Lee2021-05-221-0/+1
| | | | | | Normals being optimized has better quality now. Test simplify once and then use a slightly less tolerant error for the target error.
* Fix SurfaceTool crash when passing invalid Meshrafallus2021-05-011-0/+8
|
* Core: Drop custom `copymem`/`zeromem` definesRémi Verschelde2021-04-271-1/+1
| | | | | | | | We've been using standard C library functions `memcpy`/`memset` for these since 2016 with 67f65f66391327b2967a20a89c3627e1dd6e84eb. There was still the possibility for third-party platform ports to override the definitions with a custom header, but this doesn't seem useful anymore.
* Improved 3D Scene ImporterJuan Linietsky2021-03-221-0/+9
| | | | | | | | | | | | * Added option for importers to show an Advanced settings dialog * Created advanced settings dialog for Scene Importer * Cleaned up importers (remove many old/unused options) * Added the ability to customize every node, material, mesh and animation individually * Saving to animations and meshes to files is now a manual process, making it more predictable * Added the ability for materials to be replaced by external files (or to be made external, up to you). * When doubleclicking an impoted scene in the filesystem dock, it automatically shows the import settings instead of asking to open it. WARNING: Lightmap UV unwrap is not working, it needs to be re-made.