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