111 Commits

Author SHA1 Message Date
Marc Gilleron
437540da0b Moved VoxelRefCount to utils 2022-01-31 21:29:08 +00:00
Marc Gilleron
d1250ef0ad Added support functions to help setting up basic multiplayer with VoxelTerrain.
These might change in the future. Will have to test that later,
when Godot 4 gets more stable.
2022-01-31 21:23:39 +00:00
Marc Gilleron
1fbe9c4731 Rename VoxelBuffer.optimize() => compress_uniform_channels() 2022-01-09 23:40:07 +00:00
Marc Gilleron
b67ca3d903 Namespaced every registered class 2022-01-09 22:16:44 +00:00
Marc Gilleron
e53dcf7c84 Re-namespaced VoxelConstants 2022-01-09 03:06:58 +00:00
Marc Gilleron
8166ebbfcf Namespaced VoxelDataBlock, VoxelDataGrid, VoxelDataMap 2022-01-08 23:04:49 +00:00
Marc Gilleron
38baeae2d9 Namespaced VoxelBufferInternal 2022-01-08 22:49:59 +00:00
Marc Gilleron
dcbb59b15c Namespaced storage funcs 2022-01-04 20:50:33 +00:00
Marc Gilleron
3ab9d4a50c Fix warning about unused variable 2022-01-04 20:09:08 +00:00
Marc Gilleron
0fee995c0f Namespaced godot utility funcs 2022-01-03 23:52:54 +00:00
Marc Gilleron
5ece3b840e Namespace VoxelMemoryPool 2022-01-03 23:20:38 +00:00
Marc Gilleron
e20684ce69 Namespaced math funcs 2022-01-03 23:14:18 +00:00
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