51 Commits

Author SHA1 Message Date
Marc Gilleron
80d7399fbb Added more region file tests 2022-02-28 22:17:28 +00:00
Marc Gilleron
072472bec5 Fix FlatMap was using the type of values to sort keys... 2022-02-19 23:09:01 +00:00
Marc Gilleron
8b8b991060 Fix FlatMap insert methods randomly failing to insert 2022-02-19 22:08:04 +00:00
Marc Gilleron
c844a65325 More explicit include guard 2022-02-19 22:07:11 +00:00
Marc Gilleron
8406299e2d Use a specific macro to check tests, so it can be swapped easily.
Also made it break by default so in debug we stop at the failing line.
2022-02-19 19:59:39 +00:00
Marc Gilleron
92474f8322 Use a FlatMap instead of Godot's Map to store voxel metadata.
Reasons:
- when switching to GDExtension, Map won't be available anymore
- FlatMap may be more efficient for small amounts of sparse items
2022-02-13 16:19:17 +00:00
Marc Gilleron
b3faec2bef Removed voxel_block_request.h, use specialized structs 2022-02-12 23:37:02 +00:00
Marc Gilleron
d18bbe0376 Made LodOctree more generic
- `update` now solely relies on predicates to split/join
- Removed some member variables only used in the older update
- Distance checks now use "octree space", elininates some coordinate
  conversions which are now done up-front
2022-02-12 18:09:46 +00:00
Marc Gilleron
3045e9a489 BlockSerializer is no longer a class 2022-01-16 04:01:22 +00:00
Marc Gilleron
f8b8b27ff2 Renamed Voxel => VoxelBlockyModel, VoxelLibrary => VoxelBlockyLibrary 2022-01-09 23:27:38 +00:00
Marc Gilleron
9c6118806f Namespaced remaining stuff 2022-01-09 22:46:26 +00:00
Marc Gilleron
e53dcf7c84 Re-namespaced VoxelConstants 2022-01-09 03:06:58 +00:00
Marc Gilleron
08cacc7ff4 Print SIMD level name in FastNoise2 test 2022-01-08 01:02:47 +00:00
Marc Gilleron
c0cb82888e Changed run_blocky_random_tick so it respects its given area instead of somehow snapping it 2022-01-06 22:06:43 +00:00
Marc Gilleron
64415a3c86 Configure clang-format to put a newline after template declarations 2022-01-04 22:15:57 +00:00
Marc Gilleron
e20684ce69 Namespaced math funcs 2022-01-03 23:14:18 +00:00
Marc Gilleron
a9476227cb Namespaced Interval 2022-01-03 22:29:39 +00:00
Marc Gilleron
2fdf0bf6df Namespaced VoxelBlockSerializerInternal 2022-01-03 02:52:06 +00:00
Marc Gilleron
404d2cd911 Namespace VoxelRegionFile 2022-01-03 02:17:41 +00:00
Marc Gilleron
6bbc1f898a Exposed tileable grid noise generation 2021-12-31 16:31:46 +00:00
Marc Gilleron
56b4920902 Updated and integrated FastNoise2 2021-12-31 05:06:00 +00:00
Marc Gilleron
e46b1a023d Added test for VoxelBlockSerializerInternal and RegionFile; added namespaces 2021-12-17 19:30:23 +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
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
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
884a5c38d4 Fix test 2021-10-01 21:20:49 +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
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
Marc Gilleron
e602b9bffe Merge branch 'master' into octree_compression
# Conflicts:
#	tests/tests.cpp
2021-09-19 20:15:16 +01:00
Marc Gilleron
3cf2e92483 Optimized Curve range analysis by dividing it into monotonic sections 2021-09-19 18:20:54 +01:00
Marc Gilleron
dea1d5eb41 Quick test addition for measuring time 2021-09-17 21:39:50 +01:00
Marc Gilleron
802188f876 Added octree tests 2021-09-16 21:03:44 +01:00
Marc Gilleron
9aa4c8242c Two boxes touching on the side but not overlapping should not be considered intersecting 2021-09-16 20:49:17 +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
149eb2a873 Added test for instance data serialization 2021-07-18 19:42:42 +01:00
Marc Gilleron
5fcd7f7363 Added mesh optimization option to Transvoxel, using MeshOptimizer 2021-07-11 16:19:49 +01:00
Marc Gilleron
fdcdfdf093 Added test for unordered_remove_if 2021-07-10 20:13:10 +01:00
Marc Gilleron
b538a0beb8 Moved noise tests to tests folder 2021-06-19 18:34:50 +01:00
Marc Gilleron
1ee5bcb80d Renamed Rect3i -> Box3i 2021-05-31 17:12:04 +01:00
Marc Gilleron
411be94559 Renamed ArraySlice -> Span 2021-05-31 16:48:49 +01:00
Marc Gilleron
2e9d817246 Moved VoxelDataMap to storage/ folder 2021-05-31 16:27:08 +01:00
Marc Gilleron
8975a93c9b Fixed bad buffer adresses when multiple outputs are used
This was mainly apparent when optimization was enabled.
It caused outputs to be left uninitialized and either work by chance
or provide the wrong values.
2021-05-31 00:05:42 +01:00
Marc Gilleron
4cc47b9036 Extracted some functions from VoxelBuffer, optimized copy/paste a little 2021-05-24 23:23:50 +01:00
Marc Gilleron
fc0239afc8 Fix test 2021-05-24 23:14:23 +01:00
Marc Gilleron
5d72f1fa66 Added test for encode_weights_packed_u16 2021-05-23 20:28:25 +01:00
Marc Gilleron
9b3263d68b Fix copy 2021-05-15 16:31:36 +01:00
Marc Gilleron
c19b60647c Fix paste() with mask 2021-05-08 20:37:54 +01:00