Commit Graph

409 Commits (0bf72badbd3f129e6472c81f0ec5a4c0f5f19835)

Author SHA1 Message Date
Marc Gilleron 0bf72badbd Fix dangling mesh block position upon removal from map, when such block had a pending update 2021-12-16 22:59:31 +00:00
Marc Gilleron 0bea05824a Formatting 2021-12-16 22:17:52 +00:00
Marc Gilleron f67077b698 Fix wrong condition for unloading mesh blocks 2021-12-16 22:17:20 +00:00
Marc Gilleron 03d3016ecf Remove some pre-set resource properties to fix a Godot4 warning (sorry) 2021-12-16 01:30:31 +00:00
Marc Gilleron 267bde13fb Added gi_mode property to VoxelNode to specify GI behavior 2021-12-16 00:11:11 +00:00
Marc Gilleron 35f09b7f72 Fix stack overflow when instancing a terrain node in editor 2021-12-14 01:28:10 +00:00
Marc Gilleron 3596c13475 Renamed set_process_mode to set_process_callback to fix conflict with newly renamed Godot4 Node method 2021-12-14 00:10:09 +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 758aa07280 Fix shadowing issues (including a crash-worthy one) 2021-12-12 00:16:18 +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 c17914b2c8 Formatting due to update of Godot's clang-format 2021-11-12 21:42:28 +00:00
Marc Gilleron 801545c68d Unnecessary include 2021-11-06 23:24:52 +00:00
Marc Gilleron d32dfc9c67 Fixed collision shapes not being saved 2021-10-31 20:13:44 +00:00
Marc Gilleron 536d1f11da Fixed scene property neither being exposed nor being saved 2021-10-31 20:13:27 +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 325406ede1 Decrease MAX_LOD to avoid potential integer overflows
I preferred doing this instead of using 64-bit integers,
because I tink there are no use cases for LOD blocks that big
2021-10-28 23:55:46 +01:00
Marc Gilleron b2315a6cc4 Check earlier for invalid extents 2021-10-28 23:51:30 +01:00
Marc Gilleron 3133834a17 Check AABB size before using it 2021-10-27 19:49:37 +01:00
Marc Gilleron 6cd143d392 Enable collisions by default on VoxelViewer 2021-10-15 22:51:53 +01:00
Marc Gilleron a99d166112 Should not be in the repo 2021-10-14 19:38:50 +01:00
Marc Gilleron fcca722d52 Fix signedness 2021-10-13 22:00:42 +01: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 62447c7133 Moved some temporary vectors away from members.
They can be static thread locals since the whole point is to
re-use their allocated capacity. We don't need them to retain
any state between two calls to _process.
2021-10-06 18:34:02 +01:00
Marc Gilleron 123a3e3c9d Split VoxelLodTerrain::_process into sub-functions 2021-10-05 20:47:28 +01:00
Marc Gilleron ceb8553e4a Avoid crash if the argument is invalid (though it's not really a public function) 2021-10-04 20:15:32 +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 c5972a420e Fix compilation and gizmos 2021-10-03 15:47:56 +01:00
Marc Gilleron bb7311b282 Merge branch 'master' into full_load_mode 2021-10-03 02:48:46 +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 16b7445d1d Changing data block size is not supported at the moment 2021-10-03 01:28:29 +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 6faf5b29f3 Allow to configure main thread time limit 2021-09-25 02:13:03 +01:00
Marc Gilleron 3197eaba35 Move main thread tasks into one runner in VoxelServer
So the timing budget is better respected even if there are multiple
voxel nodes in the scene
2021-09-25 00:02:41 +01:00
Marc Gilleron 44f00176d3 Use std::unordered_set instead of Godot Set in VoxelLodTerrain 2021-09-23 23:49:18 +01:00
Marc Gilleron 0838cab251 Don't schedule loadings when streaming is disabled, don't crash when it still happens, log an error instead 2021-09-19 23:12:42 +01:00
Marc Gilleron c18262d3f8 Added option to turn off random rotation 2021-09-19 21:41:16 +01:00
Marc Gilleron fd8d107280 Fix `is_area_editable` converting twice from voxels to blocks 2021-09-19 03:29:09 +01:00
Marc Gilleron 0c31f5a525 Show octree node gizmos with a color gradient based on LOD 2021-09-18 19:54:54 +01:00
Marc Gilleron 8e53fbaa47 Merge branch 'master' into octree_compression 2021-09-18 18:18:09 +01:00
Marc Gilleron 6a6682dfd5 Fixed crash occurring after a few edits when LOD count is set to 1 2021-09-18 01:36:44 +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 ff4e7f9560 Added debug drawing of mesh octree using multimesh (not exposed for now) 2021-09-16 21:54:04 +01:00
Marc Gilleron d901eb66b6 Added functions to LodOctree and use squared distances 2021-09-16 21:03:02 +01:00
Marc Gilleron f68eeac22c Switch to octree child position formula not involving access to an array 2021-09-16 20:56:56 +01:00
Marc Gilleron 0604a3492d Comments and formatting 2021-09-16 20:46:55 +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 3ee79ec068 Should have been min 2021-09-12 00:55:15 +01:00