Commit graph

82 commits

Author SHA1 Message Date
PouleyKetchoupp 2ca94e51e4 Clean convex hull decomposition code
Remove unnecessary conversion between triangle data and vertex data
whenever possible.
2021-09-14 17:14:06 -07:00
Rémi Verschelde e13d8eda1b
Merge pull request #52266 from AndreaCatania/coll 2021-09-14 14:34:22 +02:00
Lyuma aca4b737f1 8 uvs for glTF2, URI decode and Vertex Custom api.
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>
2021-09-10 09:16:48 -07:00
AndreaCatania e3a06c3a9e Improve collision generation usability in the new 3D scene import workflow.
With this PR it's possible to add a collision during the Mesh import, directly in editor.
To generate the shape is possible to chose between the following options:
- Decompose Convex: The Mesh is decomposed in one or many Convex Shapes (Using the VHACD library).
- Simple Convex: Is generated a convex shape that enclose the entire mesh.
- Trimesh: Generate a trimesh shape using the Mesh faces.
- Box: Add a primitive box shape, where you can tweak the `size`, `position`, `rotation`.
- Sphere: Add a primitive sphere shape, where you can tweak the `radius`, `position`, `rotation`.
- Cylinder: Add a primitive cylinder shape, where you can tweak the `height`, `radius`, `position`, `rotation`.
- Capsule: Add a primitive capsule shape, where you can tweak the `height`, `radius`, `position`, `rotation`.

It's also possible to chose the generated body, so you can create:
- Rigid Body
- Static Body
- Area
2021-09-08 08:12:51 +02:00
Juan Linietsky 6dab6e4136
Revert " Improve collision generation usability in the new 3D scene import workflow." 2021-08-30 11:30:36 -03:00
AndreaCatania 2d2d24a538 Improve collision generation usability in the new 3D scene import workflow.
With this PR it's possible to add a collision during the Mesh import, directly in editor.
To generate the shape is possible to chose between the following options:
- Decompose Convex: The Mesh is decomposed in one or many Convex Shapes (Using the VHACD library).
- Simple Convex: Is generated a convex shape that enclose the entire mesh.
- Trimesh: Generate a trimesh shape using the Mesh faces.
- Box: Add a primitive box shape, where you can tweak the `size`, `position`, `rotation`.
- Sphere: Add a primitive sphere shape, where you can tweak the `radius`, `position`, `rotation`.
- Cylinder: Add a primitive cylinder shape, where you can tweak the `height`, `radius`, `position`, `rotation`.
- Capsule: Add a primitive capsule shape, where you can tweak the `height`, `radius`, `position`, `rotation`.

It's also possible to chose the generated body, so you can create:
- Rigid Body.
- Static Body.
- Area.
2021-08-28 08:34:15 +02:00
PouleyKetchoupp 1de995ae99 Options to clean/simplify convex hull generated from mesh
Clean: remove duplicate and interior vertices (uses Bullet algorithm)
Simplify: modify the geometry for further simplification (uses VHACD
algorithm)

In the editor, single convex hull now uses the clean option.
Added a new editor entry to create a simplified convex hull, can be
useful for creating convex hull from highly tessellated triangle meshes.
2021-07-07 12:14:12 -07:00
reduz 85cf99f28e Deprecate ImmediateGeometry
* Removed entirely from RenderingServer.
* Replaced by ImmediateMesh resource.
* ImmediateMesh replaces ImmediateGeometry, but could use more optimization in the future.
* Sprite3D and AnimatedSprite3D work again, ported from Godot 3.x (though a lot of work was needed to adapt them to Godot 4).
* RootMotionView works again.
* Polygon3D editor works again.
2021-06-30 14:14:41 -03:00
Aaron Franke de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
jfons 6995b0429c Assorted fixes to UV unwrapping and GPU lightmapper
Various fixes to UV2 unwrapping and the GPU lightmapper. Listed here for
context in case of git blame/bisect:

* Fix UV2 unwrapping on import, also cleaned up the unwrap cache code.
* Fix saving of RGBA images in EXR format.
* Fixes to the GPU lightmapper:
	- Added padding between atlas elements, avoids bleeding.
	- Remove old SDF generation code.
	- Fix baked attenuation for Omni/Spot lights.
	- Fix baking of material properties onto UV2 (wireframe was
	  wrongly used before).
	- Disable statically baked lights for objects that have a
	  lightmap texture to avoid applying the same light twice.
	- Fix lightmap pairing in RendererSceneCull.
	- Fix UV2 array generated from `RenderingServer::mesh_surface_get_arrays()`.
	- Port autoexposure fix for OIDN from 3.x.
	- Save debug textures as EXR when using floating point format.
2021-05-03 18:10:34 +02:00
reduz 90056460ad Implement Particle Trails
-Enable the trails and set the length in seconds
-Provide a mesh with a skeleton and a skin
-Or, alternatively use one of the built-in TubeTrailMesh/RibbonTrailMesh
-Works deterministically
-Fixed particle collisions (were broken)
-Not working in 2D yet (that will happen next)
2021-04-30 17:38:02 -03:00
Rémi Verschelde c2b7c69e2b
Merge pull request #42827 from lyuma/rename_bones_blendshapes
Allow renaming bones and blendshapes.
2021-04-01 00:20:07 +02:00
reduz f8d03b98e7 Improve resource load cache
-Added a new method in Resource: reset_state , used for reloading the same resource from disk
-Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type)
-Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
2021-02-11 15:44:28 -03:00
Rafał Mikrut 7961a1dea3 Initialize class variables with default values in scene/ [2/2] 2021-02-09 18:24:36 +01:00
reduz 51d8e32c93 Implement shadow meshes
-When importing, a vertex-only version of the mesh is created.
-This version is used when rendering shadows, and improves performance by reducing bandwidth
-It's automatic, but can optionally be used by users, in case they want to make special versions of geometry for shadow casting.
2021-01-25 15:03:15 -03: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
reduz bf77016c8a Reimplement skeletons and blend shapes
Uses compute shaders, which only once, on demand, and all in parallel.
2020-12-16 14:32:04 -03:00
reduz 77a045e902 Rework Mesh handling on scene importing.
-Reworked how meshes are treated by importer by using EditorSceneImporterMesh and EditorSceneImporterMeshNode. Instead of Mesh and MeshInstance, this allows more efficient processing of meshes before they are actually registered in the RenderingServer.
-Integrated MeshOptimizer
-Reworked internals of SurfaceTool to use arrays, making it more performant and easy to run optimizatons on.
2020-12-13 21:29:51 -03:00
Aaron Franke 40b81339d0
Rebind Mesh/ArrayMesh enums 2020-12-04 19:34:50 -05:00
reduz 70f5972905 Refactored Mesh internals and formats.
-Changed how mesh data is organized, hoping to make it more efficient on Vulkan and GLES.
-Removed compression, it now always uses the most efficient format.
-Added support for custom arrays (up to 8 custom formats)
-Added support for 8 weights in skeleton data.
-Added a simple optional versioning system for imported assets, to reimport if binary is newer
-Fixes #43979 (I needed to test)

WARNING:

-NOT backwards compatible with previous 4.x-devel, will most likely never be, but it will force reimport scenes due to version change.
-NOT backwards compatible with 3.x scenes, this will be eventually re-added.
-Skeletons not working any longer, will fix in next PR.
2020-12-02 13:07:59 -03:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Lyuma d13568a8d1 Allow renaming bones and blendshapes. 2020-10-15 07:53:18 -07:00
Lorenz Junglas 9367310e2b
Remove ArrayMesh::surface_remove declaration
Removal was omitted in 449df8f688
2020-09-04 16:27:59 +02:00
Marcel Admiraal 26fcf2b04c Add override keywords. 2020-07-10 13:56:54 +01: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
Juan Linietsky 1bea8e1eac New lightmapper
-Added LocalVector (needed it)
-Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too)
-Fixes and changes all around the place
-Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10 15:59:09 -03:00
JFonS f7dadc4796 Add caching the lightmap unwrapping on import
This commit adds caching to the lightmap mesh unwraps generated on
import. This speeds up re-imports of meshes that haven't changed and
also makes sure that the unwraps are consistent across imports.

The unwrapping process is not deterministic, so one could end up with
a different mapping every time the scene was imported, breaking any
previously baked lightmaps. The changes in this commit prevent that
from happening.
2020-04-22 15:34: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
Juan Linietsky eaae4b6408 Renamed 2D and 3D nodes to make their types explicit
Fixes #30736.
2020-03-27 14:54:04 +01:00
Rémi Verschelde cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +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 449df8f688 Base 3D engine done, still untested, though. 2020-02-11 11:59:25 +01:00
Juan Linietsky 9b0dd4f571 A lot of progress with canvas rendering, still far from working. 2020-02-11 11:53:27 +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
IAmActuallyCthulhu 82b9557803
Remove redundant author doc comments 2019-08-12 04:26:38 -05:00
Rémi Verschelde 0dac4d6db6
Merge pull request #25522 from aqnuep/MeshLibrary_improvements
MeshLibrary export improvements
2019-06-03 13:59:43 +02:00
Juan Linietsky 5823b5d77d Bundled VHACD library for convex decomposition.
Modified both MeshInstance tools as well as importer to use it instead of QuickHull.
2019-04-10 17:47:28 -03:00
Juan Linietsky 4b679f7f16 Remove old method that makes no sense today, fixes #25566 2019-03-01 18:02:45 -03:00
Daniel Rakos 6df53e0401 MeshLibrary export improvements
- From now materials assigned to the MeshInstance (not the Mesh) get exported
  into the MeshLibrary when such materials exist. This enables workflows where
  the MeshLibrary is exported from an imported scene (e.g. GLTF) where the
  materials assigned to the Mesh (not the MeshInstance) get overwritten on
  re-import, thus can't use editor set materials in the exported MeshLibrary
  unless they are assigned to the MeshInstance whose materials get saved with
  the inherited scene thus persist across re-imports.
- When appending to an existing MeshLibrary only generate previews for newly
  added or modified meshes.
- During preview generation transform camera and lights instead of the mesh
  and use the source MeshInstance's transform for the mesh to avoid weird
  previews being generated for meshes with a position dependent material
  (e.g. when using triplanar mapping).
- Adjust the camera angle and light directions used in mesh preview generation
  for better results.
2019-02-03 22:48:35 +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
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
JFonS 216ba4cc8b Fix SoftBody gizmo slowness, add ConcaveShape wireframe 2018-09-09 19:39:34 +02:00
Bastiaan Olij d41a4089c6 Added a method to find the index for a surface with a given name 2018-07-28 19:14:41 +10:00
AndreaCatania 17ebbfb56d Implemented Soft body
- Soft Body Physics node
- Soft Body Rendering
- Soft body Editor
- Soft body importer
2018-07-23 20:50:23 +02:00
Juan Linietsky e179bf0726 Ensure, if a texture meant for a normal map is imported and size limit exists, that it's renormalized after resize. 2018-07-03 10:56:31 -03:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Juan Linietsky 65fb961b8b -Ability to and unwrap lightmap coordinates on import
-Added unwrap functionality to Mesh
-Ability to display and debug mesh UVs
-Added multiline draw, so it's easier and faster to draw UVs
-Many fixes to SurfaceTool
-Fixes to Thekla Unwrap, but it's a piece of ass and it keeps crashing. Will have to go away
2017-12-09 14:18:14 -03:00