19 Commits

Author SHA1 Message Date
Marc Gilleron
a11a95bcce Renamed CHANNEL_ISOLEVEL => CHANNEL_SDF 2020-01-02 21:03:44 +00:00
Marc Gilleron
d4986489cf Fix rare bug with vertex sharing causing long spiky artifacts
Basically we were checking case code of the ReuseCell to know if we can
re-use a vertex from it, but sometimes the associated cell did not write
a re-usable vertex, and we were not resetting such vertex indices.
So in some cases, we were accessing a very old index.
The case code doesn't need to be remembered, we just reset the first vertex.
No need to check if the ReuseCell was empty, we can read the vertex directly,
as it will be -1 anyways if it isn't re-usable. At least, this fixed the bug
and did not reproduce after testing a lot of noise data sets.
2020-01-01 00:41:21 +00:00
Marc Gilleron
ee8a70bc75 Attempt to tweak normals calculation to avoid some cases of null normals 2019-12-31 20:00:39 +00:00
Marc Gilleron
ebc6be35d1 Implement LOD transitions in VoxelLodTerrain
- VoxelBlock contains 6 optional transition meshes
- VoxelLodTerrain calculates transition masks when block visibility changes
- VoxelMesher can now specify different min and max paddings
- Fix Cube::SIDE_POSITIVE/NEGATIVE_X/Y/Z enum not matching Cube::g_side_normals
- Convert transition masks to make up for the Cube:: inconsistency for now
2019-12-31 16:48:46 +00:00
Marc Gilleron
e8bb2fa5e1 Implement rotated transition meshes for all 6 sides,
and fix miscalculated secondary positions on max edges
2019-12-28 21:38:32 +00:00
Marc Gilleron
fe3475e81e Project secondary position along normal as described by the paper 2019-12-27 23:51:20 +00:00
Marc Gilleron
b226c14284 Compute secondary positions and a second border mask to deal with edges 2019-12-27 17:33:30 +00:00
Marc Gilleron
a9952179a7 Transition meshes WIP and bug fixes
- Allow meshers to specify compression flags
- Use uncompressed COLOR to fit extra vertex data for transition meshes
- Simplify a few interpolations
- Fix a few buffer overruns which were not detected by the debugger
- Use array wrappers to better detect overrun mistakes
2019-12-26 20:29:55 +00:00
Marc Gilleron
d768af5bdd Implemented transition meshes, in very basic form.
Work remains to be done:
- Transform the mesh into proper orientation
- Introduce secondary positions to make it fit in a regular block
- Make it available in the API and use it in terrain nodes
2019-12-23 21:44:25 +00:00
Marc Gilleron
3e52295279 Comment about asymetry 2019-12-15 03:24:03 +00:00
Marc Gilleron
a79404f96c Use proper name in include guard 2019-12-15 03:23:23 +00:00
Marc Gilleron
56dc78b8cc Align transvoxel with other meshers, its results were offset cuz its padding is asymetric 2019-12-15 03:22:37 +00:00
Marc Gilleron
add32f89a9 Invert SDF in Transvoxel mesher, otherwise it was producing inverted results... 2019-12-14 21:34:08 +00:00
Cory Petkovsek
f6a9c5761a Fix gcc sign comparison warnings 2019-06-18 14:24:56 +09:00
Cory Petkovsek
5ad555c439 Fix gcc multiline comments, uninitialized vars, unused vars warnings 2019-06-18 12:38:44 +09:00
Marc Gilleron
cae44985a8 Comments 2019-05-25 14:34:09 +01:00
Marc Gilleron
b9add5d671 Allow more than one thread for mesh updates, also made it generic 2019-05-19 18:27:49 +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