Commit Graph

45 Commits (a4abfc770ca082258d676609fbd0daf47103955f)

Author SHA1 Message Date
Marc Gilleron 0137ca3036 Namespaced VoxelBuffer in `gd::` because it is actually a wrapper 2022-02-15 21:49:20 +00:00
Marc Gilleron b3faec2bef Removed voxel_block_request.h, use specialized structs 2022-02-12 23:37:02 +00:00
Marc Gilleron 98eed9adba Remove some usages of Vector<T>. Also fixed some indexing issues in streams.
Reason: in a future port to GDExtension, that class won't be available.
This may also apply to Map and HashMap.

Note: the issues in streams were not hit so far because they are in
multi-block load/save functions. We've been loading and saving blocks
one by one at the moment.
2022-02-06 21:26:48 +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 f838adf26a Renamed emerge/imerge_block => load_voxel_block/save_voxel_block 2022-01-16 04:21:02 +00:00
Marc Gilleron e53dcf7c84 Re-namespaced VoxelConstants 2022-01-09 03:06:58 +00:00
Marc Gilleron 38baeae2d9 Namespaced VoxelBufferInternal 2022-01-08 22:49:59 +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 00c228851d Fix signedness 2021-09-26 16:36:08 +01:00
Marc Gilleron fb2dc3bc0f Fix unnecessary macro argument 2021-09-26 15:49:12 +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 411be94559 Renamed ArraySlice -> Span 2021-05-31 16:48:49 +01:00
Marc Gilleron ba5c0bcb17 Use common default 2021-03-12 23:38:37 +00:00
Marc Gilleron 76ec90fe34 Moved constants and tables under a folder 2021-02-21 23:58:00 +00:00
Marc Gilleron f1e2ea9ad4 Update to latest Godot's threading primitives 2021-02-19 01:30:22 +00:00
Marc Gilleron 7250e5a18c Fix warning 2021-02-16 21:44:01 +00:00
Marc Gilleron b65b0b8045 Implemented saving and loading of modified instances in SQLite 2021-02-07 17:22:50 +00:00
Marc Gilleron 0713016d9c Fix missing result in emerge_block() 2021-01-21 19:39:57 +00:00
Marc Gilleron 4ec60074bb Refactor generators and streams
- VoxelGenerator no longer inherit VoxelStream
- VoxelStream is now more focused on files
- Nodes have separate stream and generator properties
- Generators use 2 dedicated threads instead of sharing a single one with streams
- TODO Image.lock() is problematic for multithreading
- TODO Voxel graph can cause RWLock contention if edited while it runs
- TODO Saving generator output no longer works, need to put it back
2021-01-17 17:18:05 +00:00
Marc Gilleron 89750a20f8 Made file streams thread-safe (but still won't be used in more than one thread)
- Added a global file locker so threads can synchronize when accessing files
- Added mutexes to serialize access to file streams (i.e to call in series)
- VoxelStream API now expects implementations to be thread-safe
- Did some logic/data separation in RegionFile in case we need an
  in-memory implementation, however I might just use SQLite in the
  future instead
2021-01-16 13:34:45 +00:00
Marc Gilleron 10d6e5bd8a Script-based generators and streams have their own class, should fix C# API 2020-10-31 22:11:25 +00:00
Marc Gilleron 23ce65d789 Show terrain in editor, with option to turn it off. A scripted stream will turn it off by default. 2020-08-14 20:33:09 +01:00
Marc Gilleron 845fa465b8 Put model information within a struct 2020-08-11 20:29:27 +01:00
Marc Gilleron ac3e303818 Report script errors a bit better, I hope 2020-08-02 18:57:08 +01:00
Marc Gilleron f9e2d9cc12 Stop using NULL 2020-07-25 23:19:08 +01:00
Marc Gilleron 071c5ee5c0 Fix channel depth not being applied to VoxelMap::get_buffer_copy() 2020-07-11 18:05:26 +01:00
Marc Gilleron 60d32ec006 Make stream and generator script methods optional, fixes errors in editor 2020-05-09 00:46:17 +01:00
Cory Petkovsek 63514efd76 Update pr 2020-02-16 23:07:10 +08:00
Marc Gilleron 8879d9b2e7 Moved all generators under their own base class and folder 2020-01-26 22:34:26 +00:00
Marc Gilleron c493aec343 Use StringNames when applicable 2020-01-17 20:43:28 +00:00
Marc Gilleron 9dc09618be ZProfiler is now usable from anywhere including threads 2020-01-07 20:32:36 +00:00
Marc Gilleron 31f588c1a1 Add profiling scopes to VoxelLodTerrain, also fix usage in VoxelStream 2020-01-02 20:29:02 +00:00
Cory Petkovsek 4820998c56 Fix build errors due to Godot macro change 2019-11-13 13:20:05 +08:00
Marc Gilleron a0c7201fcd Rename `get_stats()` => `get_statistics()` 2019-08-25 17:40:19 +01:00
Marc Gilleron dc73977a1a Changed profiler to be more like a stack-based one, also made it super light (CPU-wise) 2019-08-18 23:13:12 +01:00
Marc Gilleron 0483413b80 Added stats to VoxelStream, tweak file handles and batch counts 2019-08-17 00:46:24 +01:00
Marc Gilleron 07d4deeaab Formatting 2019-08-15 01:40:27 +01:00
Marc Gilleron 01b1ee0170 Added first working version of region save format, still WIP 2019-08-14 20:34:06 +01:00
Marc Gilleron c272a37f1a Merge branch 'master' into persistence
# Conflicts:
#	terrain/block_thread_manager.h
#	terrain/voxel_terrain.cpp
2019-06-25 20:51:35 +01:00
Cory Petkovsek 1dff1f3e50 Fix gdscript emerge bug 2019-06-18 18:53:32 +09:00
Marc Gilleron 82502d3397 Simple file-per-block saving WIP. Compiles but didn't test. 2019-05-28 00:40:09 +01:00
Marc Gilleron 4a90ca10a5 Rename "provider" files to "stream" 2019-05-25 16:16:03 +01:00