Class SharedVertex
Defines associations between vertex positions that are coincident. The indexes stored in this collection correspond to the ProBuilderMesh.positions array.
Coincident vertices are vertices that despite sharing the same coordinate position, are separate entries in the vertex array.
Syntax
[Serializable]
public sealed class SharedVertex : ICollection<int>, IEnumerable<int>, IEnumerable
Constructors
SharedVertex(IEnumerable<Int32>)
Create a new SharedVertex from an int array.
Declaration
public SharedVertex(IEnumerable<int> indexes)
Parameters
SharedVertex(SharedVertex)
Declaration
public SharedVertex(SharedVertex sharedVertex)
Parameters
Type |
Name |
Description |
SharedVertex |
sharedVertex |
The array to copy.
|
Properties
Count
Declaration
public int Count { get; }
Property Value
IsReadOnly
Declaration
public bool IsReadOnly { get; }
Property Value
Item[Int32]
Declaration
public int this[int i] { get; set; }
Parameters
Type |
Name |
Description |
Int32 |
i |
The index to access.
|
Property Value
Methods
Add(Int32)
Declaration
public void Add(int item)
Parameters
Type |
Name |
Description |
Int32 |
item |
|
Clear()
Declaration
Contains(Int32)
Declaration
public bool Contains(int item)
Parameters
Type |
Name |
Description |
Int32 |
item |
|
Returns
CopyTo(Int32[], Int32)
Declaration
public void CopyTo(int[] array, int arrayIndex)
Parameters
Type |
Name |
Description |
Int32[] |
array |
|
Int32 |
arrayIndex |
|
GetEnumerator()
Declaration
public IEnumerator<int> GetEnumerator()
Returns
GetSharedVertexLookup(IList<SharedVertex>, Dictionary<Int32, Int32>)
A SharedVertex is used to associate discrete vertices that share a common position. A lookup
Dictionary provides a fast way to find the index of a SharedVertex in the
sharedVertices array with a vertex index.
Declaration
public static void GetSharedVertexLookup(IList<SharedVertex> sharedVertices, Dictionary<int, int> lookup)
Parameters
Type |
Name |
Description |
IList<SharedVertex> |
sharedVertices |
A collection of SharedVertex values.
|
Dictionary<Int32, Int32> |
lookup |
A Dictionary where the Key represents an index in the Mesh positions array, and the
Value is the index of it's placement in the sharedVertices array.
|
GetSharedVerticesWithPositions(IList<Vector3>)
Create a new array of SharedVertex objects by comparing points in the passed positions collection.
Declaration
public static SharedVertex[] GetSharedVerticesWithPositions(IList<Vector3> positions)
Parameters
Type |
Name |
Description |
IList<Vector3> |
positions |
A collection of Vector3 positions to be tested for equality.
|
Returns
Type |
Description |
SharedVertex[] |
A new SharedVertex[] where each SharedIndex is a list of indexes that are sharing the same position.
|
Examples
var mesh = gameObject.AdComponent<ProBuilderMesh>();
mesh.SetPositions(myNewPositions);
mesh.SetFaces(myNewFaces);
mesh.SetSharedIndexes(SharedVertex.GetSharedVerticesWithPositions(myNewPositions));
Remove(Int32)
Declaration
public bool Remove(int item)
Parameters
Type |
Name |
Description |
Int32 |
item |
|
Returns
ToString()
Declaration
public override string ToString()
Returns
Overrides