101 Commits

Author SHA1 Message Date
Marc Gilleron
493b93a051 SDF is now encoded with inorm8 and inorm16 2022-02-26 22:51:29 +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
48081faf03 Use real_t in most utils, use 32-bit floats in meshers.
This is a first step to supporting double-precision floats in Godot.
Meshers don't need doubles because vertices, normals and UVs should
never span large enough areas while needing such amount of precision.
Besides, it costs a lot more memory and processing.
2022-02-14 00:11:41 +00:00
Marc Gilleron
f1694b08ec Remove a few unnecessary usages of the wrapper version of VoxelBuffer 2022-02-03 00:02:10 +00:00
Marc Gilleron
1631e186b5 Fix compilation
- Node was not declared anymore in header
- Cannot implicitely cast Variant to Node* anymore
2022-01-30 15:21:59 +00:00
Marc Gilleron
f8b8b27ff2 Renamed Voxel => VoxelBlockyModel, VoxelLibrary => VoxelBlockyLibrary 2022-01-09 23:27:38 +00:00
Marc Gilleron
b67ca3d903 Namespaced every registered class 2022-01-09 22:16:44 +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
924d81f488 Unnecessary extra qualification 2022-01-08 21:24:01 +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
1d63067b6b Re-namespaced VoxelToolOps 2022-01-03 23:33:29 +00:00
Marc Gilleron
3eb6641c4f Namespace edition funcs 2022-01-03 23:26:02 +00:00
Marc Gilleron
e20684ce69 Namespaced math funcs 2022-01-03 23:14:18 +00:00
Marc Gilleron
24e9e36434 Namespace SDF functions 2022-01-03 03:18:58 +00:00
Marc Gilleron
82e9625bc8 Namespaced voxel_raycast() 2022-01-03 02:59:15 +00:00
Marc Gilleron
2efcbfc8fb Namespace IslandFinder 2022-01-03 01:29:41 +00:00
Marc Gilleron
0be0fb19b0 Moved task stuff to utilities 2021-12-29 19:08:23 +00:00
Marc Gilleron
12caefe577 Renamed VoxelThreadPool => ThreadedTaskRunner and namespace it 2021-12-29 18:25:47 +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
3133834a17 Check AABB size before using it 2021-10-27 19:49:37 +01:00
Marc Gilleron
daf7bf821a Fix compilation 2021-10-13 21:50:47 +01:00
Marc Gilleron
39184ddb61 Merge branch 'master' into full_load_mode 2021-10-13 21:04:17 +01:00
Marc Gilleron
1079a80bf8 Fixed (I hope) the error sometimes happening when using floating chunk separation 2021-10-13 21:03:59 +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
c5b0ac43fb Semi-async do_sphere() implementation. May change though.
It is a lot better than the fully synchronous do_sphere(),
but it would be a lot better if we could move everything async
2021-10-04 19:20:36 +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
a107e5f076 Fix enum comparisons (2) 2021-09-26 17:36:56 +01:00
Marc Gilleron
00d6190d3c Old comment 2021-09-26 17:20:43 +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
43adf2d6e7 Fix GCC warning 2021-09-25 17:38:36 +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
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
bd696b4caa Functions that should be const 2021-09-09 18:52:00 +01:00
Marc Gilleron
df33a77f72 Unnecessary includes 2021-09-05 22:48:50 +01:00
Marc Gilleron
7cb1e4008e Use accessor 2021-08-15 17:27:55 +01:00
Marc Gilleron
5fcd7f7363 Added mesh optimization option to Transvoxel, using MeshOptimizer 2021-07-11 16:19:49 +01:00
Marc Gilleron
3ffd07af47 Added copy to VoxelToolLodTerrain 2021-07-10 20:19:44 +01:00
Marc Gilleron
e05fb7a045 Does not need to be a non-const reference 2021-07-01 23:14:23 +01:00
Marc Gilleron
5fdf9e700f Exposed interpolated float voxel query 2021-07-01 22:44:27 +01:00
Marc Gilleron
c2248f9254 I don't remember why this was padded 2021-06-16 23:33:58 +01:00
Marc Gilleron
19f440527e Implemented VoxelToolTerrain.for_each_voxel_metadata_in_area 2021-06-16 23:31:00 +01:00
Marc Gilleron
1ee5bcb80d Renamed Rect3i -> Box3i 2021-05-31 17:12:04 +01:00
Marc Gilleron
2e9d817246 Moved VoxelDataMap to storage/ folder 2021-05-31 16:27:08 +01:00
Marc Gilleron
fbb39f6fcc Added falloff property to control sharpness of texture painting 2021-05-30 16:28:10 +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
d2d07904b8 Moved VoxelRaycastResult to its own file 2021-05-29 15:09:10 +01:00