Commit Graph

185 Commits (master)

Author SHA1 Message Date
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
Marc Gilleron d53e7dd530 Fixed several bugs related to VoxelTool::paste()
- One of the Rect3i constructors was wrong
- Rewrite clipping logic of VoxelBuffer::copy_from
- Fix VoxelDataMap::paste to provide correct offsets
- Fix meshing data copy to account for clipping adjustments
2021-05-07 18:38:02 +01:00
Marc Gilleron ef448263c0 Merge branch 'master' into smooth_texturing
# Conflicts:
#	storage/voxel_buffer.cpp
2021-05-02 23:11:57 +01:00
Marc Gilleron 73aed51ea2 Optimized 16-bit voxel box copies (used when meshing) 2021-05-02 19:23:07 +01:00
Marc Gilleron 32f9006b75 Added initial support for texture weights in graph generators (not optimal) 2021-04-30 22:04:38 +01:00
Marc Gilleron 8b017f460f Basic VoxelTool function to paint textures on buffers 2021-04-25 20:23:14 +01:00
Marc Gilleron b33a432b3d Optimized `is_uniform` for the case a buffer has not been compressed yet 2021-04-24 21:23:40 +01:00
Marc Gilleron dc2f853b50 First version of texturing for Transvoxel. Needs optimization and tooling. 2021-04-21 18:26:40 +01:00
Marc Gilleron 966551fdfd Merge branch 'master' into block_size_decoupling 2021-04-03 23:51:18 +01:00
Marc Gilleron e274330164 Print absence of pools instead of nothing 2021-04-03 20:43:43 +01:00
Marc Gilleron 758e3bd227 Allow to use block size 32 for mesh blocks while using 16 for data blocks
Still hardcoded but a config should be added
2021-04-03 20:39:37 +01:00
Marc Gilleron 5766bc8b94 Merge branch 'master' into lod_fade_v2
# Conflicts:
#	README.md
#	editor/about_window.cpp
2021-03-27 01:48:36 +00:00
Marc Gilleron c90dc1b056 Formatting 2021-03-14 18:46:15 +00:00
Marc Gilleron e52df732bb Fix wrong default value when uniform channels are compressed 2021-03-12 23:41:57 +00:00
Marc Gilleron 2d283bcdfc Fix `1.f` not giving the maximum u16 value when set on a VoxelBuffer 2021-03-12 23:41:11 +00:00
Marc Gilleron ea1d617371 Implemented "chunking" of requested blocks in graph generator
so range analysis can remain precise enough even with larger blocks
2021-03-12 23:40:38 +00:00
Marc Gilleron 8adbe86da6 Formatting 2021-03-12 23:37:37 +00:00
great90 94755ae420 Fix dead loop in 'VoxelBuffer::for_each_voxel_metadata_in_area' and 'VoxelBuffer::clear_voxel_metadata_in_area' 2021-03-05 18:08:39 +08:00
Marc Gilleron 76ec90fe34 Moved constants and tables under a folder 2021-02-21 23:58:00 +00:00
Marc Gilleron 09c815e253 Implemented `copy` and `paste` for VoxelToolTerrain (untested) 2021-02-21 18:23:56 +00:00
Marc Gilleron 31e5130708 Remove unreachable return 2021-02-21 18:21:05 +00:00
Marc Gilleron a3fd0a1afd Print memory pool debug info only in verbose mode 2021-02-19 01:36:14 +00:00
Marc Gilleron f1e2ea9ad4 Update to latest Godot's threading primitives 2021-02-19 01:30:22 +00:00
Marc Gilleron d1207bdd96 Reorganized some utility files 2021-02-17 20:34:35 +00:00
Marc Gilleron 158715922d Fix retrieving from cache
It should have made a copy and the input should have been populated
instead of being replaced (because it wouldn't hold the ref)
2021-01-30 01:33:55 +00:00
Marc Gilleron 414f6cc305 Fix sdf_scale not defaulting according to the real default channel depth 2021-01-24 14:48:25 +00:00
Marc Gilleron 55a38957b5 Added SDF scale to VoxelTool. Default value should work best with default bit depth. 2021-01-24 13:54:38 +00:00
Marc Gilleron ca22dc5a29 Should not be there 2020-12-29 22:18:08 +00:00
Marc Gilleron 5fdc4b6485 Debug check and some formatting 2020-12-29 22:14:49 +00:00
Marc Gilleron c94cb9c4a1 Multiply instead of divide 2020-12-25 17:06:40 +00:00
Marc Gilleron c8c3886c6f Voxels now use 16-bit by default on the SDF and TYPE channels 2020-12-24 23:12:36 +00:00
Marc Gilleron a12144304f Optimized Transvoxel (nearly twice as fast), also allowing 16, 32 and 64 bit precision 2020-12-23 02:27:54 +00:00
Marc Gilleron 89abb37e0f consts 2020-12-18 20:52:09 +00:00
Marc Gilleron dec9b31801 Rename index() to get_index() to make it less like a variable name 2020-12-18 20:48:08 +00:00
Marc Gilleron 87e575e504 Use reinterpret_cast instead of ambiguous C-style cast 2020-12-18 20:46:54 +00:00
Marc Gilleron 6c80da0425 Moved VoxelBuffer and VoxelMemoryPool under storage/ directory 2020-09-14 19:33:02 +01:00