cleanup: remove obsolete Clod.cs file
This commit is contained in:
@@ -1,143 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Ghost.MeshOptimizer;
|
||||
|
||||
namespace Ghost.Clod;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct ClodConfig
|
||||
{
|
||||
public nuint MaxVertices;
|
||||
public nuint MinTriangles;
|
||||
public nuint MaxTriangles;
|
||||
|
||||
public bool PartitionSpatial;
|
||||
public bool PartitionSort;
|
||||
public nuint PartitionSize;
|
||||
|
||||
public bool ClusterSpatial;
|
||||
public float ClusterFillWeight;
|
||||
public float ClusterSplitFactor;
|
||||
|
||||
public float SimplifyRatio;
|
||||
public float SimplifyThreshold;
|
||||
|
||||
public float SimplifyErrorMergePrevious;
|
||||
public float SimplifyErrorMergeAdditive;
|
||||
|
||||
public float SimplifyErrorFactorSloppy;
|
||||
|
||||
public float SimplifyErrorEdgeLimit;
|
||||
|
||||
public bool SimplifyPermissive;
|
||||
|
||||
public bool SimplifyFallbackPermissive;
|
||||
public bool SimplifyFallbackSloppy;
|
||||
|
||||
public bool SimplifyRegularize;
|
||||
|
||||
public bool OptimizeBounds;
|
||||
|
||||
public bool OptimizeClusters;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct ClodMesh
|
||||
{
|
||||
public uint* Indices;
|
||||
public nuint IndexCount;
|
||||
|
||||
public nuint VertexCount;
|
||||
|
||||
public float* VertexPositions;
|
||||
public nuint VertexPositionsStride;
|
||||
|
||||
public float* VertexAttributes;
|
||||
public nuint VertexAttributesStride;
|
||||
|
||||
public byte* VertexLock;
|
||||
|
||||
public float* AttributeWeights;
|
||||
public nuint AttributeCount;
|
||||
|
||||
public uint AttributeProtectMask;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct ClodBounds
|
||||
{
|
||||
public fixed float Center[3];
|
||||
public float Radius;
|
||||
public float Error;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct ClodCluster
|
||||
{
|
||||
public int Refined;
|
||||
public ClodBounds Bounds;
|
||||
public uint* Indices;
|
||||
public nuint IndexCount;
|
||||
public nuint VertexCount;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct ClodGroup
|
||||
{
|
||||
public int Depth;
|
||||
public ClodBounds Simplified;
|
||||
}
|
||||
|
||||
public unsafe delegate int ClodOutputDelegate(void* outputContext, ClodGroup group, ClodCluster* clusters, nuint clusterCount);
|
||||
|
||||
public unsafe static class Clod
|
||||
{
|
||||
public static ClodConfig ClodDefaultConfig(nuint maxTriangles)
|
||||
{
|
||||
// assert(max_triangles >= 4 && max_triangles <= 256);
|
||||
ClodConfig config = new ClodConfig();
|
||||
config.MaxVertices = maxTriangles;
|
||||
config.MinTriangles = maxTriangles / 3;
|
||||
config.MaxTriangles = maxTriangles;
|
||||
|
||||
// Alignment note: implementation had MESHOPTIMIZER_VERSION < 1000 check. Assuming modern.
|
||||
|
||||
config.PartitionSpatial = true;
|
||||
config.PartitionSize = 16;
|
||||
|
||||
config.ClusterSpatial = false;
|
||||
config.ClusterSplitFactor = 2.0f;
|
||||
|
||||
config.OptimizeClusters = true;
|
||||
|
||||
config.SimplifyRatio = 0.5f;
|
||||
config.SimplifyThreshold = 0.85f;
|
||||
config.SimplifyErrorMergePrevious = 1.0f;
|
||||
config.SimplifyErrorFactorSloppy = 2.0f;
|
||||
config.SimplifyPermissive = true;
|
||||
config.SimplifyFallbackPermissive = false;
|
||||
config.SimplifyFallbackSloppy = true;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
public static ClodConfig ClodDefaultConfigRT(nuint maxTriangles)
|
||||
{
|
||||
ClodConfig config = ClodDefaultConfig(maxTriangles);
|
||||
|
||||
config.MinTriangles = maxTriangles / 4;
|
||||
config.MaxVertices = Math.Min((nuint)256, maxTriangles * 2);
|
||||
|
||||
config.ClusterSpatial = true;
|
||||
config.ClusterFillWeight = 0.5f;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
// clodBuild translation would go here, involving the implementation logic.
|
||||
// Given the complexity of the full implementation (std::vector, etc.), I will continue
|
||||
// implementing the translation logic iteratively or request for a multi-file approach if needed.
|
||||
// For now, these structs and headers provide the foundational API mapping requested.
|
||||
}
|
||||
Reference in New Issue
Block a user