Marc Gilleron
e9af708c3b
Moved some utility functions
...
- sort goes to math funcs
- math funcs specializations for vector types go to vector files
- use ZN macros in a few more places
2022-04-14 21:22:22 +01:00
Marc Gilleron
4a0a5068f0
Use custom error macros in VoxelBuffer
2022-04-13 23:15:46 +01:00
Marc Gilleron
87d98e9162
Engine-agnostic error macros
2022-04-11 02:10:44 +01:00
Marc Gilleron
0cc3801655
Define smart pointers default allocator in a single place
2022-04-10 20:10:33 +01:00
Marc Gilleron
219c7bfda3
Changed prefix of profiling macros
2022-04-09 15:33:08 +01:00
Marc Gilleron
259a914cbf
Return a ref instead of pointer, it must not be null
2022-04-09 15:05:04 +01:00
Marc Gilleron
ab5d3a22d3
Abstract logging for verbose print
2022-04-09 15:00:34 +01:00
Marc Gilleron
5519054c01
Unify macro prefixes
2022-04-06 23:26:54 +01:00
Marc Gilleron
090d3485e5
Use unique pointers in ExpressionParser
2022-04-06 22:00:32 +01:00
Marc Gilleron
0c091a5fbd
Fix wrong macro
2022-03-31 22:49:53 +01:00
Marc Gilleron
dcc7d85a52
Fix Vector3i initialization from single integer
2022-03-31 22:40:39 +01:00
Marc Gilleron
61b27491f9
Initial implementation of binary search in Transvoxel.
...
It is very slow but seems to be working. It affines vertex positions,
but normals are not improved. Maybe more work will be done in the future
if that technique becomes more relevant.
Partly based on a prior experiment:
11f716f79d0ade59c0e9547a2333183e96b17b43
2022-03-27 21:36:30 +01:00
Marc Gilleron
f53f0a520d
Require explicit parameters (were also not used)
2022-03-27 17:06:43 +01:00
Marc Gilleron
cef16f670a
Use refs in VoxelDataBlock iteration, no null should be found
2022-03-20 19:28:50 +00:00
Marc Gilleron
5ddcbc2065
Added optional threaded execution of VoxelLodTerrain's process function
2022-03-15 00:29:39 +00:00
Marc Gilleron
80d7399fbb
Added more region file tests
2022-02-28 22:17:28 +00:00
Marc Gilleron
9adf996c2e
Fix wrong copypasta argument
2022-02-27 03:40:35 +00:00
Marc Gilleron
f894f50498
Fix false positives in pool leak detection
2022-02-26 22:51:53 +00:00
Marc Gilleron
493b93a051
SDF is now encoded with inorm8 and inorm16
2022-02-26 22:51:29 +00:00
Marc Gilleron
b72ffa260d
Rename for_all_blocks => for_each_block
2022-02-20 21:35:35 +00:00
Marc Gilleron
0137ca3036
Namespaced VoxelBuffer in `gd::` because it is actually a wrapper
2022-02-15 21:49:20 +00:00
Marc Gilleron
e958739759
Fix some narrowing conversions
2022-02-13 16:19:54 +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
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
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
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
efb6a26b5e
Fix GCC warnings (2)
2021-05-31 01:05:19 +01:00
Marc Gilleron
32e47a50e9
Fix GCC warnings
2021-05-31 00:34:53 +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
74e89b882e
Implemented texture painting on all VoxelTools using faster access to voxels
2021-05-29 23:28:11 +01:00
Marc Gilleron
c0955bb317
Use storage func, remove redundant one
2021-05-29 23:24:36 +01:00
Marc Gilleron
a4f01b096e
Moved some storage functions out of VoxelBuffer
2021-05-29 23:23:18 +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
f943339f31
Researching tri-channel weights storage
...
- No changes made for now, but the code is there if we want to switch
- Renamed functions to be more explicit
2021-05-23 20:28:06 +01:00
Marc Gilleron
983b7bd83d
Merge branch 'master' into smooth_texturing
...
# Conflicts:
# util/godot/funcs.h
2021-05-22 19:43:39 +01:00
Marc Gilleron
9b3263d68b
Fix copy
2021-05-15 16:31:36 +01:00
Marc Gilleron
40452c6d31
Getting a voxel out of bounds from a buffer is now an error
2021-05-08 20:36:58 +01:00
Marc Gilleron
d5bd6c794b
Merge branch 'master' into smooth_texturing
2021-05-07 21:48:11 +01:00