25 Commits

Author SHA1 Message Date
Marc Gilleron
61b27491f9 Initial implementation of binary search in Transvoxel.
It is very slow but seems to be working. It affines vertex positions,
but normals are not improved. Maybe more work will be done in the future
if that technique becomes more relevant.

Partly based on a prior experiment:
11f716f79d0ade59c0e9547a2333183e96b17b43
2022-03-27 21:36:30 +01:00
Marc Gilleron
d4b1178d61 Fix Transvoxel when the surface lines up with integer coordinates 2022-03-19 22:45:12 +00:00
Marc Gilleron
74ac820846 Remove zero-samples workaround for now.
It created gaps/unshared vertices in the mesh if the isosurface really has
to cross zero because it was done after the early cell rejection.
If we need it again, it will have to be done before the whole
algorithm, but could need more investigation.
2022-02-27 16:54:14 +00:00
Marc Gilleron
284c763a57 Use signed integers when decoding SDF 2022-02-27 04:08:01 +00:00
Marc Gilleron
493b93a051 SDF is now encoded with inorm8 and inorm16 2022-02-26 22:51:29 +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
c672e21ff3 Re-namespaced Transvoxel 2022-01-04 00:12:42 +00:00
Marc Gilleron
e20684ce69 Namespaced math funcs 2022-01-03 23:14:18 +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
148d5e4116 Comments 2021-11-12 21:42:39 +00:00
Marc Gilleron
c17914b2c8 Formatting due to update of Godot's clang-format 2021-11-12 21:42:28 +00: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
2fda5747c6 Comments 2021-09-13 00:19:51 +01:00
Marc Gilleron
5fcd7f7363 Added mesh optimization option to Transvoxel, using MeshOptimizer 2021-07-11 16:19:49 +01:00
Marc Gilleron
411be94559 Renamed ArraySlice -> Span 2021-05-31 16:48:49 +01:00
Marc Gilleron
a24c56e064 Fix unused var 2021-05-31 02:11:09 +01:00
Marc Gilleron
f9f7e07b33 Fix unused vars, unhandled cases and shadowing 2021-05-31 01:45:14 +01:00
Marc Gilleron
a4f01b096e Moved some storage functions out of VoxelBuffer 2021-05-29 23:23:18 +01:00
Marc Gilleron
f943339f31 Researching tri-channel weights storage
- No changes made for now, but the code is there if we want to switch
- Renamed functions to be more explicit
2021-05-23 20:28:06 +01:00
Marc Gilleron
f5446e3d69 Fix broken vertex sharing when texture mode is enabled 2021-05-03 00:10:24 +01:00
Marc Gilleron
7e905913c9 Unused functions 2021-04-30 01:34:59 +01:00
Marc Gilleron
0e2d7dc596 Comments and format 2021-04-25 20:23:52 +01:00
Marc Gilleron
8b017f460f Basic VoxelTool function to paint textures on buffers 2021-04-25 20:23:14 +01:00
Marc Gilleron
91c469bde5 Unused variable 2021-04-24 21:30:40 +01:00
Marc Gilleron
20547241cb Further optimizations and move to new file
- Moved Transvoxel implementation to its own file
- Optimized case where a whole block uses the same textures indices
2021-04-24 21:22:05 +01:00