Skip to content

Commit dd854ec

Browse files
authored
Remove the old CSG path and the BurstTriangulator dependency (#58)
The exact CSG has been the default for a while; the float CSG that made polygon loops was only reachable through an internal switch. - Removed the loop CSG (PerformCSGJob, the intersection loop, merge and loop vertex cache jobs), the loop triangulation and repair in GenerateSurfaceTrianglesJob, the kExactCSG switch, the propagation rounds, interned planes and the float brush intersection test. - GenerateSurfaceTrianglesJob is Burst compiled itself. - BurstTriangulator was only used by the loop triangulation: the submodule and its reference are gone. - Tests that compared the two paths, or only covered the old one, are gone; the concrete pad area checks now run. Fixes #57
1 parent addfc9e commit dd854ec

59 files changed

Lines changed: 169 additions & 9100 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitmodules‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "Dependencies/CustomAssetMetadata"]
22
path = Dependencies/CustomAssetMetadata
33
url = https://github.com/LogicalError/CustomAssetMetadata.git
4-
[submodule "Dependencies/BurstTriangulator"]
5-
path = Dependencies/BurstTriangulator
6-
url = https://github.com/RadicalCSG/BurstTriangulator.git

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Chisel is a Unity package. To work on it, put it in a Unity project as an embedd
2424
`git submodule update --init` in it.
2525
3. Open the project in Unity. The first time takes a while, because Burst compiles a lot of code.
2626

27-
The package's dependencies, BurstTriangulator and CustomAssetMetadata, are git submodules in `Dependencies`.
27+
The package's dependency, CustomAssetMetadata, is a git submodule in `Dependencies`.
2828

2929
## Where things are
3030

‎Components/Managers/ChiselModelManager.cs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,8 @@ public static Hash128 GetComponentInputHash(ChiselModelComponent model)
848848

849849
/// <summary>
850850
/// What both hashes have to cover and neither can see in the model: the version of the code that builds the
851-
/// meshes, which of its two CSG algorithms builds them, and the helper materials <c>FinishMeshUpdates</c> hands
852-
/// out, which no surface names. Without the code version a saved scene would keep meshes built by code that has
853-
/// since changed, and without the algorithm meshes built by the other one.
851+
/// meshes, and the helper materials <c>FinishMeshUpdates</c> hands out, which no surface names. Without the code
852+
/// version a saved scene would keep meshes built by code that has since changed.
854853
/// </summary>
855854
static void AppendEnvironment(ref Hash128 hash)
856855
{
@@ -861,9 +860,6 @@ static void AppendEnvironment(ref Hash128 hash)
861860
}
862861
hash.Append(ref s_CodeVersion);
863862

864-
int algorithm = CompactHierarchyManager.TreeUpdate.kExactCSG ? 1 : 0;
865-
hash.Append(ref algorithm);
866-
867863
AppendMaterialIdentity(ref hash, ChiselProjectSettings.ForceShadowOnlySurfacesMaterial);
868864
AppendMaterialIdentity(ref hash, ChiselProjectSettings.CollisionSurfacesMaterial);
869865
var debugVisualizationMaterials = ChiselProjectSettings.DebugVisualizationMaterials;

‎Core/2.Processing/CSGMath.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public static float3 EdgePlaneCrossing(float3 v0, float3 v1, float d0, float d1)
4242
public static double3 PlaneIntersection(double4 plane0, double4 plane1, double4 plane2)
4343
=> PlaneExtensions.Intersection(plane0, plane1, plane2);
4444

45-
// One vertex-pair term of Newell's polygon-normal accumulation, in double. Matches
46-
// CalculatePlaneNormal in PerformCSGJob. Accumulate over consecutive (prev,curr) verts, normalize.
45+
// One vertex-pair term of Newell's polygon-normal accumulation, in double. Accumulate over consecutive
46+
// (prev,curr) verts, normalize.
4747
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4848
public static float3 NewellTerm(float3 prev, float3 curr)
4949
{

‎Core/2.Processing/Cache/ChiselLookup.cs‎

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ public class Data
2626
public NativeList<MinMaxAABB> brushTreeSpaceBoundCache;
2727
public NativeList<BlobAssetReference<BrushTreeSpacePlanes>> brushTreeSpacePlaneCache;
2828
public NativeList<BlobAssetReference<BrushesTouchedByBrush>> brushesTouchedByBrushCache;
29-
public NativeList<UnsafeList<float3>> loopVerticesCache;
3029
// Each brush as the exact CSG sees it (ExactBrush: exact planes, corners, bounds), rebuilt when the brush
31-
// changes (ExactInputJob). Only kept up to date while the tree is built exactly (builtExact).
30+
// changes (ExactInputJob).
3231
public NativeList<BlobAssetReference<ExactBrush>> exactBrushCache;
3332

3433
public NativeList<ChiselDecalInstance> decalInstances;
@@ -44,9 +43,6 @@ public class Data
4443

4544
public NativeParallelHashMap<CompactNodeID, BlobAssetReference<ChiselBrushRenderBuffer>> brushRenderBufferLookup;
4645

47-
// Whether the tree's output was last built by the exact CSG (TreeUpdate.kExactCSG). An update by the other
48-
// algorithm rebuilds every brush of the tree, so the two never mix in one tree's output.
49-
public bool builtExact;
5046
// What each hotspot layout was at the last update (ChiselHotspotStore.LayoutHashes, by id - 1)
5147
public NativeList<uint> hotspotLayoutHashes;
5248
// Where the weld's last step moved the corners it moved at the last update (from, to; OutputModelWeld)
@@ -79,7 +75,6 @@ internal void Initialize()
7975
brushTreeSpacePlaneCache = new NativeList<BlobAssetReference<BrushTreeSpacePlanes>>(1000, Allocator.Persistent); // Confirmed to get disposed
8076
brushesTouchedByBrushCache = new NativeList<BlobAssetReference<BrushesTouchedByBrush>>(1000, Allocator.Persistent); // Confirmed to get disposed
8177
brushRenderBufferCache = new NativeList<BlobAssetReference<ChiselBrushRenderBuffer>>(1000, Allocator.Persistent); // Confirmed to get disposed
82-
loopVerticesCache = new NativeList<UnsafeList<float3>>(1000, Allocator.Persistent); // Confirmed to get disposed
8378
exactBrushCache = new NativeList<BlobAssetReference<ExactBrush>>(1000, Allocator.Persistent);
8479

8580
decalInstances = new NativeList<ChiselDecalInstance>(16, Allocator.Persistent);
@@ -132,9 +127,6 @@ internal void EnsureCapacity(int brushCount)
132127
if (brushRenderBufferCache.Capacity < brushCount)
133128
brushRenderBufferCache.Capacity = brushCount;
134129

135-
if (loopVerticesCache.Capacity < brushCount)
136-
loopVerticesCache.Capacity = brushCount;
137-
138130
if (exactBrushCache.Capacity < brushCount)
139131
exactBrushCache.Capacity = brushCount;
140132
}
@@ -235,18 +227,6 @@ internal void Dispose()
235227
brushRenderBufferCache.Dispose();
236228
}
237229
brushRenderBufferCache = default;
238-
if (loopVerticesCache.IsCreated)
239-
{
240-
for (int i = 0; i < loopVerticesCache.Length; i++)
241-
{
242-
if (loopVerticesCache[i].IsCreated)
243-
loopVerticesCache[i].Dispose();
244-
loopVerticesCache[i] = default;
245-
}
246-
loopVerticesCache.Clear();
247-
loopVerticesCache.Dispose();
248-
}
249-
loopVerticesCache = default;
250230
if (exactBrushCache.IsCreated)
251231
{
252232
for (int i = 0; i < exactBrushCache.Length; i++)
@@ -307,7 +287,6 @@ internal void Dispose()
307287
if (brushRenderBufferLookup.IsCreated)
308288
brushRenderBufferLookup.Dispose();
309289
brushRenderBufferLookup = default;
310-
builtExact = false;
311290
}
312291
}
313292

‎Core/2.Processing/Containers/InternedPlanes.cs‎

Lines changed: 0 additions & 242 deletions
This file was deleted.

‎Core/2.Processing/Containers/InternedPlanes.cs.meta‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎Core/2.Processing/Exact/ExactFace.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ int Route(ref ExactList<byte> inside, ref ExactList<ushort> routingRows, ref Exa
723723
int row = lookupStart[k] + input;
724724
if (row < lookupStart[k] || row >= lookupEnd[k])
725725
{
726-
// the same as PerformCSGJob: a lookup without a row for this input leaves the input as it is
726+
// a lookup without a row for this input leaves the input as it is
727727
routingErrors++;
728728
continue;
729729
}

0 commit comments

Comments
 (0)