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.
Inheritance
System.Object
SharedVertex
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
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
indexes |
The array to copy.
|
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
Type |
Description |
System.Int32 |
|
IsReadOnly
Declaration
public bool IsReadOnly { get; }
Property Value
Type |
Description |
System.Boolean |
|
Item[Int32]
Declaration
public int this[int i] { get; set; }
Parameters
Type |
Name |
Description |
System.Int32 |
i |
The index to access.
|
Property Value
Type |
Description |
System.Int32 |
|
Methods
Add(Int32)
Declaration
public void Add(int item)
Parameters
Type |
Name |
Description |
System.Int32 |
item |
|
Clear()
Declaration
Contains(Int32)
Declaration
public bool Contains(int item)
Parameters
Type |
Name |
Description |
System.Int32 |
item |
|
Returns
Type |
Description |
System.Boolean |
|
CopyTo(Int32[], Int32)
Declaration
public void CopyTo(int[] array, int arrayIndex)
Parameters
Type |
Name |
Description |
System.Int32[] |
array |
|
System.Int32 |
arrayIndex |
|
GetEnumerator()
Declaration
public IEnumerator<int> GetEnumerator()
Returns
Type |
Description |
System.Collections.Generic.IEnumerator<System.Int32> |
|
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 |
System.Collections.Generic.IList<SharedVertex> |
sharedVertices |
A collection of SharedVertex values.
|
System.Collections.Generic.Dictionary<System.Int32, System.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 |
System.Collections.Generic.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 |
System.Int32 |
item |
|
Returns
Type |
Description |
System.Boolean |
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.Object.ToString()