Commit Graph

99 Commits (0bf72badbd3f129e6472c81f0ec5a4c0f5f19835)

Author SHA1 Message Date
Marc Gilleron ed5bca22c7 Fix missing change some compilers did not trip on 2021-12-16 17:41:15 +00:00
Marc Gilleron 922f361cb0 Made it compile in Godot 4
- Made a bunch of changes to comply with Godot 4 API
- Use Godot's Vector3i and add the missing stuff with helper functions
- Transvoxel uses custom attributes API, the old way would not work
- Wrap MeshOptimizer in a unique namespace (see build script why)
- Added clang-format file for the module as some rules now differ
- Prevent thirdparty code and lookup tables from being clang-formatted
- Very likely full of runtime bugs that need fixing
2021-12-13 21:38:10 +00:00
Marc Gilleron 43df211e8e Fix conversion warning 2021-12-11 23:25:22 +00:00
Marc Gilleron 380e295d94 Merge branch 'master' into full_load_mode
# Conflicts:
#	meshers/transvoxel/transvoxel.h
#	server/voxel_server.cpp
#	terrain/voxel_lod_terrain.cpp
2021-12-11 22:59:24 +00:00
Marc Gilleron 4be341e69e Fix wrong size used for allocation 2021-11-14 19:22:13 +00:00
Marc Gilleron 308dfe01a0 Fix macro 2021-11-14 18:54:21 +00:00
Marc Gilleron 7ca67e9e89 Added some checks 2021-11-14 18:40:50 +00:00
Marc Gilleron f735bf30e1 Fix signedness warning and make a few things more explicit 2021-11-13 00:10:14 +00:00
Marc Gilleron b9f774c1c4 Merge branch 'master' of https://github.com/Zylann/godot_voxel 2021-11-12 23:40:05 +00:00
Marc Gilleron 2fd4c22c54 Rewrote memory pool to use arenas per power of two.
Using per-size arenas behaves like a memory leak when
the user creates many VoxelBuffers of random sizes repeatedly.
Now memory blocks of the next power of two are used instead.
VoxelBuffers with power-of-two size will fit best, while also being
the most common. Non-power-of-two will use a bit more memory,
but such buffers are often temporary and less numerous.
2021-11-12 23:39:50 +00:00
Marc Gilleron 801545c68d Unnecessary include 2021-11-06 23:24:52 +00:00
Alex 8c7730230f missing include for shared_ptr type 2021-11-06 08:16:10 +02:00
Alex 633e9ab307 added missing include for shared_ptr 2021-11-06 08:04:41 +02:00
Marc Gilleron ca7ac42cde Merge branch 'master' into full_load_mode
# Conflicts:
#	edition/voxel_tool_lod_terrain.cpp
#	generators/graph/voxel_generator_graph.cpp
#	terrain/voxel_lod_terrain.cpp
2021-10-31 16:17:27 +00:00
Marc Gilleron 6441d1b864 Deprecate Vector3i(Vector3) constructor, make conversions explicit
Some conversions were wrong/unintented.
This is also in prevision of using Godot 4 Vector3i,
which default behavior differs from this module.
2021-10-31 16:01:47 +00:00
Marc Gilleron 375c68b0de Merge branch 'master' into full_load_mode 2021-10-13 20:29:58 +01:00
Marc Gilleron a226111818 Run edits after preloads without a sync point on the main thread
- Still room for improvement, more parallelism is possible
- Started moving the data into its own structure
- Added locks to secure access to the data map (not truly used yet)
- Tasks with a tracker can schedule next ones when they complete
- Data loading responses also come with a callback, no buffer anymore
- Use new data grid to cache map access
2021-10-13 20:28:20 +01:00
Marc Gilleron 1d62649b9a Fix leaking Pool objects 2021-10-04 01:36:15 +01:00
Marc Gilleron c921922a44 Fix missing assignment 2021-10-04 01:33:32 +01:00
Marc Gilleron c5972a420e Fix compilation and gizmos 2021-10-03 15:47:56 +01:00
Marc Gilleron e04091f3cb Added full load mode to VoxelLodTerrain
With this mode enabled, editing anywhere becomes possible.
All edited blocks are loaded at once when the stream is assigned.
The generator is used on the fly to fill the gaps, instead of being
pre-emptively cached only nearby the viewer to allow editing.
Editing is still on the main thread, so this can cause stalls if
the generator is complex. There is also no controlled limit on how
much data gets loaded, so if edited data is larger than RAM, it will
not be playable. The feature is already quite usable, but more work
may be done for wider viability.
2021-10-03 01:48:07 +01:00
Marc Gilleron e6f1be6ac3 Use same defaults as VoxelBuffer 2021-10-02 18:53:04 +01:00
Marc Gilleron c6b2275738 Fix some stats and add VoxelMemoryPool info 2021-10-02 18:31:48 +01:00
Marc Gilleron 228e41b71e Fixed writing out of bounds when the whole buffer is copied 2021-10-01 19:31:30 +01:00
Marc Gilleron bfc4c0d363 Fix memory corruption occurring after writing out of bounds.
Found this after using VoxelBufferInternal in a pattern that was never
used before. Added reproduction as a test.
2021-10-01 00:54:34 +01:00
Marc Gilleron 100b6d1816 Switch to unordered_map, slightly better performance 2021-09-28 22:37:37 +01:00
Marc Gilleron 30db0c5193 Split VoxelBuffer in two, script-facing wrapper and internal.
The internal is the main use within the voxel engine,
and does not inherit Reference.
2021-09-26 04:14:50 +01:00
Marc Gilleron 979e5c9c47 VoxelTool.paste now only expects 0xffffffff to turn off masking.
Before it was 0xffffffffffffffff, which the GDScript parser no longer
accepts because it is greater than INT64_MAX.
In the future we may rework this API.
2021-09-24 02:09:58 +01:00
Scott Wadden 511422c30d Fixed macos build errors 2021-09-22 09:48:35 -03:00
Marc Gilleron 176f46440f Merge meshing and generation thread pools, expecting better usage of available threads 2021-09-21 19:32:29 +01:00
Marc Gilleron 8e53fbaa47 Merge branch 'master' into octree_compression 2021-09-18 18:18:09 +01:00
Marc Gilleron 2971334e85 Changed VoxelToolLodTerrain to use write_box
- Should be faster than get/set_voxel
- No longer expose internal data map
2021-09-17 20:01:15 +01:00
Marc Gilleron cf00db1908 Should not exist yet 2021-09-16 22:16:57 +01:00
Marc Gilleron 8aaee73157 Merge branch 'master' into octree_compression 2021-09-16 20:52:32 +01:00
Marc Gilleron 0604a3492d Comments and formatting 2021-09-16 20:46:55 +01:00
Marc Gilleron c9b1840e99 Added `max_lod_hint` return value to block generators 2021-09-16 20:33:45 +01:00
Marc Gilleron 3cfb7f510b Fix lambda capture defaulting to const when it should be writable 2021-09-13 00:21:27 +01:00
Marc Gilleron 32beb6f8a8 Stop printing in map destructors 2021-09-13 00:20:30 +01:00
Marc Gilleron 2fda5747c6 Comments 2021-09-13 00:19:51 +01:00
Marc Gilleron 58d365d2bf Profiling scopes 2021-09-09 18:53:22 +01:00
Marc Gilleron 5959699b9b Fix reorder GCC warning 2021-09-05 23:55:57 +01:00
Marc Gilleron 7cb1e4008e Use accessor 2021-08-15 17:27:55 +01:00
Marc Gilleron f9ba660c86 Fix warnings 2021-08-14 18:28:15 +01:00
Marc Gilleron 026c14fcb5 Added importer to import vox files into a single mesh
- New importer, needs restart to switch but it's a limitation of Godot
- Might blow up if the scene spans a really big area, may be optimized in the future.
- The scene importer remains the default choice
- Promoted some ints to 64-bit to avoid oveflowing with large volumes or distances
- Handle a few cases of malloc failure
2021-08-14 16:49:46 +01:00
Marc Gilleron 6ea6ce9581 Initialize to the same defaults as in VoxelBuffer 2021-08-01 15:41:23 +01:00
Marc Gilleron f74d29280a Fix channel enum names 2021-06-16 23:35:05 +01:00
Marc Gilleron 19f440527e Implemented VoxelToolTerrain.for_each_voxel_metadata_in_area 2021-06-16 23:31:00 +01:00
Marc Gilleron da8dc36590 Return all channels supported with region files and SQLite
This fixes a node configuration warning,
because before these were always returning no channels at all.
2021-06-14 18:51:19 +01:00
Marc Gilleron dc4569408d Fix wrong conditional 2021-06-11 18:43:57 +01:00
Marc Gilleron 1ee5bcb80d Renamed Rect3i -> Box3i 2021-05-31 17:12:04 +01:00