Commit Graph

153 Commits

Author SHA1 Message Date
Relintai 04b6bfa88f Added in some of the uv calculation stuff from my experimental voxel engine, to maybe help wilth better seeing the changes that I want. 2019-05-17 20:12:08 +02:00
Relintai eec55057c3 Created more bindings for the library, and reworked the way the voxel getters and setters are bound, so it's more in line with godot's internal classes. 2019-05-17 18:38:04 +02:00
Marc Gilleron 66d4a913bd Use std::vector for speed 2019-04-28 21:02:42 +01:00
Marc Gilleron faefde721a Add base class to all meshers, gather common things in it 2019-04-28 20:48:59 +01:00
Marc Gilleron 12a97cca5a Reorganize all files and rename a few things 2019-04-28 17:58:29 +01:00
Marc Gilleron c8fbf19814 Rename get/set_voxel_iso => get/set_voxel_f 2019-04-28 16:28:49 +01:00
Marc Gilleron ce57c656d5 Remove repetition 2019-04-28 04:27:37 +01:00
Marc Gilleron 00decc3a61 Update README since there is now a more recent marching cubes mesher 2019-04-28 04:25:27 +01:00
Marc Gilleron 766e3d882c Subtract should actually use inverted signed distance 2019-04-28 03:51:24 +01:00
Marc Gilleron 59c5a43915 Fixed VoxelMap::get/set_voxel_f bound to the wrong function 2019-04-28 02:27:50 +01:00
Marc Gilleron c837ca4dd0 Code formatting 2019-04-28 01:34:00 +01:00
Marc Gilleron d6bb354bd9 Added smooth_meshing option to VoxelTerrain and handle padding differences it introduces 2019-04-28 01:32:23 +01:00
Marc Gilleron fe37ed3674 Fix broken Terrain::raycast when it falls back to isolevel channel 2019-04-28 01:29:52 +01:00
Marc Gilleron 0f378fe218 Remove default channel from `is_uniform()` to prevent mistakes 2019-04-28 00:27:17 +01:00
Marc Gilleron 227bf5ad36 Added get/set_voxel_f in VoxelMap 2019-04-28 00:25:33 +01:00
Marc Gilleron 2e419db855 Fix default value for CHANNEL_ISOLEVEL, it should be the integer raw value, not the quantified one 2019-04-28 00:23:10 +01:00
Marc Gilleron a67ea390d5 Smooth VoxelProviderImage a little in isolevel mode, also properly repeat the heightmap if it's not power of two 2019-04-27 02:08:12 +01:00
Marc Gilleron 6d872160ab Added get_size() as Vector3 to VoxelBuffer 2019-04-27 02:06:09 +01:00
Marc Gilleron 10c2e69a0c Default values for CHANNEL_ISOLEVEL should be 1.0 (i.e maximum distance) 2019-04-27 02:05:40 +01:00
Marc Gilleron c86a5c53e1 Fixed VoxelMap.get_buffer_copy() introducing voxels in channel 0 even if they don't exist 2019-04-27 02:03:08 +01:00
Marc Gilleron 8c6defee09 Fixed bad VoxelBuffer indexing for non-cubic volumes 2019-04-26 03:35:00 +01:00
Marc Gilleron b85e696b7b Fixed bad position validation in VoxelBuffer 2019-04-26 02:52:32 +01:00
Marc Gilleron beace8709b Update DMC mesher to the API required to integrate to VoxelTerrain 2019-04-25 01:00:58 +01:00
Marc Gilleron 101f83234a Don't logspam if terrain library is not set 2019-04-25 00:58:23 +01:00
Marc Gilleron 9f0845759f Fix binding of VoxelIsoSurfaceTool::do_heightmap() 2019-04-25 00:57:18 +01:00
Marc Gilleron 9e13c68da7 Return empty mesh if blocky mesher doesnt find a type channel 2019-04-25 00:56:51 +01:00
Marc Gilleron fdb40ef3f4 Add quick support for isolevel in VoxelProviderImage 2019-04-25 00:54:14 +01:00
Marc Gilleron b3dd85bd36 Added VoxelIsoSurfaceTool::do_heightmap(), untested 2019-04-24 02:08:45 +01:00
Marc Gilleron 1a4c6ec33d Fixed compilation 2019-04-24 02:07:06 +01:00
Marc Gilleron 1b9e7257df Clang-format did things 2019-04-24 01:31:42 +01:00
Marc Gilleron 70881ce255 Use Godot Map, std::map doesnt appear to have any advantage 2019-04-23 23:38:15 +01:00
Marc Gilleron 9c3eb0e4b7 Added OCTREE_NODE mode to disable adaptivity, effectively providing classic marching cubes 2019-04-23 23:37:26 +01:00
Marc Gilleron 19329efaa6 Initialize stats before each meshing 2019-04-23 23:35:43 +01:00
Marc Gilleron b627a5736d Expose octree mode, mesh mode and geometric error as properties; initialize stats 2019-04-23 01:30:15 +01:00
Marc Gilleron a80ddc450b Make OP_ADD the default in VoxelIsoSurfaceTool 2019-04-23 01:28:51 +01:00
Marc Gilleron cead529f11 Use object pool to speed up octree construction 2019-04-23 00:47:52 +01:00
Marc Gilleron bfbe382a7d Snake case 2019-04-23 00:26:41 +01:00
Marc Gilleron 1070acf0be Count re-used vertices 2019-04-23 00:14:20 +01:00
Marc Gilleron 0e569df945 Re-use dualgrid memory 2019-04-22 23:36:42 +01:00
Marc Gilleron 3c366b1f09 Add stats 2019-04-22 23:03:57 +01:00
Marc Gilleron bed8ac8cb9 Drop gradient channels, fix misconception about what gradient is 2019-04-22 21:17:19 +01:00
Marc Gilleron 572dcbf680 Move this code closer to what uses it 2019-04-22 21:15:45 +01:00
Marc Gilleron 1defe3bdbd Added VoxelIsoSurfaceTool 2019-04-22 20:15:46 +01:00
Marc Gilleron 9108bfe0f6 Fix VoxelBuffer channel initialized with wrong value when allocated 2019-04-22 20:15:19 +01:00
Marc Gilleron 869b921ce8 Add VoxelBuffer::fill_iso() 2019-04-22 20:14:25 +01:00
Marc Gilleron 0808bf2691 Fix border dual cells not generating due to octree offset, implement alternative bottom-up octree 2019-04-22 01:28:53 +01:00
Marc Gilleron 91a5c7ffa8 A bit of reorganization and tweaks:
- Moved HermiteValue in its own file
- VoxelBuffer channels are now predefined
- Create DualGridGenerator for easier passing of data
- Chunk size is no longer hardcoded
- Respect padding when polygonizing voxels
- BUG: due to the above, the way we build the octree is now breaking the result as mentionned in the TODO
2019-04-21 19:31:35 +01:00
Marc Gilleron 35ff5fd546 Rename VoxelMesherSmooth => VoxelMesherTransvoxel 2019-04-21 14:47:50 +01:00
Marc Gilleron d53e43f115 Added function to compute gradients from isolevels 2019-04-21 02:54:35 +01:00
Marc Gilleron 9bb81f9bb7 Fix dependency in utility.h, move MeshBuilder to its own file, re-use vertex arrays 2019-04-21 01:14:28 +01:00