Class MeshUtils
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
public static class MeshUtils
Properties
QuadMesh
Declaration
public static Mesh QuadMesh { get; }
Property Value
Type | Description |
---|---|
Mesh |
Methods
AppendLineTopologyData(IList<Vector3>, IList<int>, List<Vector3>)
Appends a new line to an existing index and vertex buffer (doesn't connect to the existing line).
Declaration
public static void AppendLineTopologyData(IList<Vector3> points, IList<int> indices, List<Vector3> vertices)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector3> | points | The points representing a new line to append to the passed buffers. |
IList<int> | indices | Resulting list of line indices of previous and new lines. |
List<Vector3> | vertices | Resulting list of vertices of previous and new lines. |
BendCollisionMeshAsync(MeshCollider, List<Matrix4x4>, (List<Matrix4x4> Matrices, AnimationCurve Curve)?, CancellationToken)
Bends a collision mesh.
Declaration
public static UniTask BendCollisionMeshAsync(MeshCollider meshCollider, List<Matrix4x4> bendingMatrices, (List<Matrix4x4> Matrices, AnimationCurve Curve)? innerInfo = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
MeshCollider | meshCollider | The collider providing the mesh to bend. |
List<Matrix4x4> | bendingMatrices | The bending matrices. |
(List<Matrix4x4> Matrices, AnimationCurve Curve)? | innerInfo | The inner bending matrices and interpolation curve for inner bending. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Cysharp.Threading.Tasks.UniTask | The bent mesh. |
BendMeshAsync(Mesh, List<Matrix4x4>, (List<Matrix4x4> Matrices, AnimationCurve Curve)?, CancellationToken)
Bends an arbitrary mesh.
Declaration
public static UniTask BendMeshAsync(Mesh mesh, List<Matrix4x4> bendingMatrices, (List<Matrix4x4> Matrices, AnimationCurve Curve)? innerInfo = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The mesh to bend. |
List<Matrix4x4> | bendingMatrices | The bending matrices. |
(List<Matrix4x4> Matrices, AnimationCurve Curve)? | innerInfo | The inner bending matrices and interpolation curve for inner bending. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Cysharp.Threading.Tasks.UniTask | The bent mesh. |
BendMeshAsync(MeshFilter, List<Matrix4x4>, (List<Matrix4x4> Matrices, AnimationCurve Curve)?, CancellationToken)
Bends an arbitrary mesh.
Declaration
public static UniTask BendMeshAsync(MeshFilter meshFilter, List<Matrix4x4> bendingMatrices, (List<Matrix4x4> Matrices, AnimationCurve Curve)? innerInfo = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
MeshFilter | meshFilter | The mesh filter providing the mesh to bend. |
List<Matrix4x4> | bendingMatrices | The bending matrices. |
(List<Matrix4x4> Matrices, AnimationCurve Curve)? | innerInfo | The inner bending matrices and interpolation curve for inner bending. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Cysharp.Threading.Tasks.UniTask | The bent mesh. |
BevelY(List<Vector3>, float)
Declaration
public static List<Vector3> BevelY(List<Vector3> points, float radius)
Parameters
Type | Name | Description |
---|---|---|
List<Vector3> | points | |
float | radius |
Returns
Type | Description |
---|---|
List<Vector3> |
BuildLineTopologyData(List<Vector3>, List<int>, List<Vector3>)
Uses the passed points to build a vertex and index buffer based on the Line MeshTopology.
Declaration
public static void BuildLineTopologyData(List<Vector3> points, List<int> indices, List<Vector3> vertices)
Parameters
Type | Name | Description |
---|---|---|
List<Vector3> | points | The points to create lines from. |
List<int> | indices | Resulting list of line indices {(0,1),(1,2),...}. |
List<Vector3> | vertices | Resulting list of vertices (same as input). |
ComputeBendingMatricesOnSpline(Mesh, Spline, double, int, Transform)
Computes the bending matrices from a spline.
Declaration
public static List<Matrix4x4> ComputeBendingMatricesOnSpline(Mesh mesh, Spline spline, double distanceOnSpline, int bendingResolution, Transform worldTransform)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The mesh to bend. |
Spline | spline | The spline to bend the mesh on. |
double | distanceOnSpline | The distance on the spline. |
int | bendingResolution | The number of bending matrices. |
Transform | worldTransform | The world transform to apply to the mesh. |
Returns
Type | Description |
---|---|
List<Matrix4x4> | A list of bending matrices. |
ExtrudeY(List<Vector3>, List<int>, List<Vector3>, List<Vector3>, List<Vector2>, List<Vector2>, float, float, bool, bool, bool)
Declaration
public static void ExtrudeY(List<Vector3> points, List<int> indices, List<Vector3> vertices, List<Vector3> normals, List<Vector2> stretchedUVs, List<Vector2> repeatingUVs, float height, float yOffset = 0, bool frontFace = true, bool backFace = true, bool smoothBevelNormals = false)
Parameters
Type | Name | Description |
---|---|---|
List<Vector3> | points | |
List<int> | indices | |
List<Vector3> | vertices | |
List<Vector3> | normals | |
List<Vector2> | stretchedUVs | |
List<Vector2> | repeatingUVs | |
float | height | |
float | yOffset | |
bool | frontFace | |
bool | backFace | |
bool | smoothBevelNormals |
TriangulateXZ(IList<Vector3>, IList<int>, IList<Vector3>, float)
Uses the 'ear clipping triangulation' approach to triangulate a list of points.
Declaration
public static void TriangulateXZ(IList<Vector3> points, IList<int> indices, IList<Vector3> vertices, float yOffset = 0)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector3> | points | The points to triangulate. |
IList<int> | indices | Resulting list of triangle indices. |
IList<Vector3> | vertices | Resulting list of vertices. |
float | yOffset | the added offset from the xz plane. |
TriangulateXZ(List<Vector3>, List<int>, List<Vector3>, List<Vector3>, List<Vector2>, List<Vector2>, float, bool, bool, float)
Uses the 'ear clipping triangulation' approach to triangulate a list of points.
Declaration
public static void TriangulateXZ(List<Vector3> points, List<int> indices, List<Vector3> vertices, List<Vector3> normals, List<Vector2> stretchedUVs, List<Vector2> repeatingUVs, float yOffset = 0, bool faceUp = true, bool faceDown = false, float repeatingUVsScale = 1)
Parameters
Type | Name | Description |
---|---|---|
List<Vector3> | points | The points to triangulate. |
List<int> | indices | Resulting list of triangle indices. |
List<Vector3> | vertices | Resulting list of vertices. |
List<Vector3> | normals | Resulting list of normals. |
List<Vector2> | stretchedUVs | Resulting list of stretchedUVs. |
List<Vector2> | repeatingUVs | Resulting list of repeatingUVs. |
float | yOffset | the added offset from the xz plane. |
bool | faceUp | Add normal for faces pointing up. |
bool | faceDown | Add normal for faces pointing down. |
float | repeatingUVsScale | The scale for repeating UVs. |