Fix missing namespace when Utils package is not installed.
This commit is contained in:
@@ -2,12 +2,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using Utils;
|
||||
|
||||
namespace MeshProcess
|
||||
{
|
||||
#if UTILS
|
||||
[HideScriptField]
|
||||
[Utils.HideScriptField]
|
||||
#endif
|
||||
public class VHACD : MonoBehaviour
|
||||
{
|
||||
@@ -31,61 +30,53 @@ namespace MeshProcess
|
||||
m_convexhullApproximation = 1;
|
||||
m_oclAcceleration = 0;
|
||||
m_maxConvexHulls = 1024;
|
||||
m_projectHullVertices = true; // This will project the output convex hull vertices onto the original source mesh to increase the floating point accuracy of the results
|
||||
m_projectHullVertices =
|
||||
true; // This will project the output convex hull vertices onto the original source mesh to increase the floating point accuracy of the results
|
||||
}
|
||||
|
||||
[Tooltip("Maximum concavity")]
|
||||
[Range(0, 1)]
|
||||
[Tooltip("Maximum concavity")] [Range(0, 1)]
|
||||
public double m_concavity;
|
||||
|
||||
[Tooltip("Controls the bias toward clipping along symmetry planes.")]
|
||||
[Range(0, 1)]
|
||||
[Tooltip("Controls the bias toward clipping along symmetry planes.")] [Range(0, 1)]
|
||||
public double m_alpha;
|
||||
|
||||
[Tooltip("Controls the bias toward clipping along revolution axes.")]
|
||||
[Range(0, 1)]
|
||||
[Tooltip("Controls the bias toward clipping along revolution axes.")] [Range(0, 1)]
|
||||
public double m_beta;
|
||||
|
||||
[Tooltip("Controls the adaptive sampling of the generated convex-hulls.")]
|
||||
[Range(0, 0.01f)]
|
||||
[Tooltip("Controls the adaptive sampling of the generated convex-hulls.")] [Range(0, 0.01f)]
|
||||
public double m_minVolumePerCH;
|
||||
|
||||
public void* m_callback;
|
||||
public void* m_logger;
|
||||
|
||||
[Tooltip("Maximum number of voxels generated during the voxelization stage.")]
|
||||
[Range(10000, 64000000)]
|
||||
[Tooltip("Maximum number of voxels generated during the voxelization stage.")] [Range(10000, 64000000)]
|
||||
public uint m_resolution;
|
||||
|
||||
[Tooltip("Controls the maximum number of triangles per convex-hull.")]
|
||||
[Range(4, 1024)]
|
||||
[Tooltip("Controls the maximum number of triangles per convex-hull.")] [Range(4, 1024)]
|
||||
public uint m_maxNumVerticesPerCH;
|
||||
|
||||
[Tooltip("Controls the granularity of the search for the \"best\" clipping plane")]
|
||||
[Range(1, 16)]
|
||||
[Tooltip("Controls the granularity of the search for the \"best\" clipping plane")] [Range(1, 16)]
|
||||
public uint m_planeDownsampling;
|
||||
|
||||
[Tooltip("Controls the precision of the convex-hull generation process during the clipping plane selection stage.")]
|
||||
[Tooltip(
|
||||
"Controls the precision of the convex-hull generation process during the clipping plane selection stage.")]
|
||||
[Range(1, 16)]
|
||||
public uint m_convexhullDownsampling;
|
||||
|
||||
[Tooltip("Enable/disable normalizing the mesh before applying the convex decomposition.")]
|
||||
[Range(0, 1)]
|
||||
[Tooltip("Enable/disable normalizing the mesh before applying the convex decomposition.")] [Range(0, 1)]
|
||||
public uint m_pca;
|
||||
|
||||
[Tooltip("0: voxel-based (recommended), 1: tetrahedron-based")]
|
||||
[Range(0, 1)]
|
||||
[Tooltip("0: voxel-based (recommended), 1: tetrahedron-based")] [Range(0, 1)]
|
||||
public uint m_mode;
|
||||
|
||||
[Range(0, 1)]
|
||||
public uint m_convexhullApproximation;
|
||||
[Range(0, 1)] public uint m_convexhullApproximation;
|
||||
|
||||
[Range(0, 1)]
|
||||
public uint m_oclAcceleration;
|
||||
[Range(0, 1)] public uint m_oclAcceleration;
|
||||
|
||||
public uint m_maxConvexHulls;
|
||||
|
||||
[Tooltip("This will project the output convex hull vertices onto the original source mesh to increase the floating point accuracy of the results.")]
|
||||
[Tooltip(
|
||||
"This will project the output convex hull vertices onto the original source mesh to increase the floating point accuracy of the results.")]
|
||||
public bool m_projectHullVertices;
|
||||
};
|
||||
|
||||
@@ -99,9 +90,11 @@ namespace MeshProcess
|
||||
public fixed double m_center[3];
|
||||
};
|
||||
|
||||
[DllImport("libvhacd")] static extern unsafe void* CreateVHACD();
|
||||
[DllImport("libvhacd")]
|
||||
static extern unsafe void* CreateVHACD();
|
||||
|
||||
[DllImport("libvhacd")] static extern unsafe void DestroyVHACD(void* pVHACD);
|
||||
[DllImport("libvhacd")]
|
||||
static extern unsafe void DestroyVHACD(void* pVHACD);
|
||||
|
||||
[DllImport("libvhacd")]
|
||||
static extern unsafe bool ComputeFloat(
|
||||
@@ -121,7 +114,8 @@ namespace MeshProcess
|
||||
uint countTriangles,
|
||||
Parameters* parameters);
|
||||
|
||||
[DllImport("libvhacd")] static extern unsafe uint GetNConvexHulls(void* pVHACD);
|
||||
[DllImport("libvhacd")]
|
||||
static extern unsafe uint GetNConvexHulls(void* pVHACD);
|
||||
|
||||
[DllImport("libvhacd")]
|
||||
static extern unsafe void GetConvexHull(
|
||||
@@ -131,7 +125,10 @@ namespace MeshProcess
|
||||
|
||||
public Parameters m_parameters;
|
||||
|
||||
public VHACD() { m_parameters.Init(); }
|
||||
public VHACD()
|
||||
{
|
||||
m_parameters.Init();
|
||||
}
|
||||
|
||||
public unsafe List<Mesh> GenerateConvexMeshes(Mesh mesh = null)
|
||||
{
|
||||
@@ -139,6 +136,7 @@ namespace MeshProcess
|
||||
{
|
||||
mesh = GetComponent<MeshFilter>().sharedMesh;
|
||||
}
|
||||
|
||||
var vhacd = CreateVHACD();
|
||||
var parameters = m_parameters;
|
||||
|
||||
@@ -188,9 +186,10 @@ namespace MeshProcess
|
||||
|
||||
convexMesh.Add(hullMesh);
|
||||
}
|
||||
|
||||
return convexMesh;
|
||||
}
|
||||
|
||||
|
||||
public unsafe List<MeshSafe> GenerateConvexMeshes(Vector3[] verts, int[] tris)
|
||||
{
|
||||
var vhacd = CreateVHACD();
|
||||
@@ -240,7 +239,8 @@ namespace MeshProcess
|
||||
|
||||
convexMesh.Add(hullMesh);
|
||||
}
|
||||
|
||||
return convexMesh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user