61 Commits

Author SHA1 Message Date
Marc Gilleron
6cd143d392 Enable collisions by default on VoxelViewer 2021-10-15 22:51:53 +01:00
Marc Gilleron
c6b2275738 Fix some stats and add VoxelMemoryPool info 2021-10-02 18:31:48 +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
e4cb16e2a4 Comments 2021-09-25 16:27:53 +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
18e0a23d46 Fix task count when a stream is used 2021-09-24 02:06:00 +01:00
Marc Gilleron
94bb985704 Automatic thread count computation and project settings 2021-09-21 21:50:06 +01: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
0b4204f5be Put task result processing into virtual functions and remove downcasts 2021-09-19 20:13:29 +01:00
Marc Gilleron
c9b1840e99 Added max_lod_hint return value to block generators 2021-09-16 20:33:45 +01:00
Marc Gilleron
df33a77f72 Unnecessary includes 2021-09-05 22:48:50 +01:00
Marc Gilleron
411be94559 Renamed ArraySlice -> Span 2021-05-31 16:48:49 +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
1449560f29 Implemented decoupling on VoxelTerrain (no setter yet) 2021-04-13 23:48:35 +01:00
Marc Gilleron
9a131ed4ff Merge branch 'master' into block_size_decoupling
# Conflicts:
#	server/voxel_server.cpp
2021-04-06 22:00:55 +01:00
Marc Gilleron
c746031eba Fix used channels when copying data for meshing 2021-04-06 21:59:36 +01:00
Marc Gilleron
db8074c940 Merge branch 'master' into block_size_decoupling 2021-04-05 03:50:12 +01:00
Marc Gilleron
cc555b6573 Fix holes in terrain when LOD distance is set to a value non-multiple of block size 2021-04-05 03:49:36 +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
c86feda259 Replace lod_split_scale with lod_distance for better clarity 2021-03-27 16:38:20 +00:00
Marc Gilleron
4e1442cb0b Added clipping debug option 2021-03-27 01:46:07 +00:00
Marc Gilleron
fc9a1be3ab Use square root in distance-based priority
Otherwise it would not work with LOD modifier
2021-03-12 23:31:20 +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
d1207bdd96 Reorganized some utility files 2021-02-17 20:34:35 +00:00
Marc Gilleron
4639b8de3d Give names to threads so they show up in debugging tools 2021-02-09 00:52:26 +00:00
Marc Gilleron
b65b0b8045 Implemented saving and loading of modified instances in SQLite 2021-02-07 17:22:50 +00:00
Marc Gilleron
c6b169b978 Upgraded block serialized format, added some error handling 2021-01-30 01:36:37 +00:00
Marc Gilleron
01e5e18922 Implemented VoxelStreamSQLite 2021-01-28 22:02:49 +00:00
Marc Gilleron
3a0ebc73a7 Request saving of generated blocks if the option is enabled in VoxelStream 2021-01-17 22:22:10 +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
a0941cea83 Made all simple generators thread-safe 2021-01-16 13:41:46 +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
eb9a5b7e07 Added background tasks indicator when a terrain is selected 2020-12-20 00:14:08 +00:00
Marc Gilleron
418cf0e630 Streaming/LOD can be set to follow the editor camera instead of being centered on world origin 2020-12-19 23:16:10 +00:00
Marc Gilleron
71b4139fb3 Fix another warning about precedence clarity 2020-12-18 21:29:56 +00:00
Marc Gilleron
791bdafff1 Meshers are now resources assigned on terrain nodes 2020-12-18 21:01:50 +00:00
Marc Gilleron
2dfcc76600 Better fix for VoxelLodTerrain task drop 2020-10-20 23:58:55 +01:00
Marc Gilleron
30c6d7e436 Disabled task cancellation to make VoxelLodTerrain work, will need better option later.
VoxelLodTerrain's block requests were being cancelled constantly.

This commit also contains precision improvement for cancelling
block requests based on distance, which originally was an attempt to
"properly" fix the problem with VoxelLodTerrain, but it didnt fully
worked for that node.
I left it anyways, maybe it will change in the future once a
proper fix is figured out.
2020-10-19 23:21:14 +01:00
Marc Gilleron
6c80da0425 Moved VoxelBuffer and VoxelMemoryPool under storage/ directory 2020-09-14 19:33:02 +01:00
Marc Gilleron
7a235be108 Cancel block tasks if they are too far away 2020-09-06 23:57:41 +01:00
Marc Gilleron
7075773692 Fix tasks waiting suspecting an error too soon.
It was using seconds while measured time was milliseconds.
2020-09-06 23:56:36 +01:00
Marc Gilleron
9db2ced198 Fix out-of-bounds access in case all tasks got cancelled 2020-09-06 23:55:22 +01:00
Marc Gilleron
a4611031e1 Fix viewer not being unpaired when destroyed 2020-09-06 19:29:56 +01:00
Marc Gilleron
81e1872f8b Implemented viewers for VoxelTerrain 2020-09-06 19:01:12 +01:00
Marc Gilleron
b8c97ebc55 Switch VoxelLodTerrain to VoxelServer 2020-08-31 21:51:30 +01:00
Marc Gilleron
17ff16aa48 Neighbors are optional when sending meshing requests 2020-08-30 04:00:45 +01:00
Marc Gilleron
d81ffb95f4 Detect usage of Tracy, add some profiler scopes 2020-08-30 04:00:01 +01:00
Marc Gilleron
aa2b848102 Workaround crash on exit because the GDScript module is freed before voxel
See https://github.com/Zylann/godot_voxel/issues/189
2020-08-29 22:55:52 +01:00