Struct VertexData
An managed, resizable vertex data. Stores generic vertex information in interleaved array. As example if structure is created with Position+Normal attributes as result data will be stored in memory as follows: position0/normal0/position1/normal1...
Implements
Inherited Members
Namespace: ProjectDawn.Geometry3D
Assembly: ProjectDawn.Geometry.dll
Syntax
[NativeContainer]
public struct VertexData : INativeDisposable, IDisposable
Constructors
| Improve this Doc View SourceVertexData(Int32, NativeArray<VertexAttributeDescriptor>, Allocator)
Declaration
public VertexData(int initialCapacity, NativeArray<VertexAttributeDescriptor> attributes, Allocator allocator)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | initialCapacity | |
| Unity.Collections.NativeArray<UnityEngine.Rendering.VertexAttributeDescriptor> | attributes | |
| Unity.Collections.Allocator | allocator |
Properties
| Improve this Doc View SourceCapacity
The number of elements that fit in the current allocation.
Declaration
public int Capacity { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The number of elements that fit in the current allocation. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Thrown if the new capacity is smaller than the length. |
Flags
Vertex attribute flags used for creating this vertex data.
Declaration
public VertexAttributes Flags { get; }
Property Value
| Type | Description |
|---|---|
| VertexAttributes |
IsCreated
Whether this the vertex data has been allocated (and not yet deallocated).
Declaration
public bool IsCreated { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | True if this the vertex data has been allocated (and not yet deallocated). |
IsEmpty
Whether the vertex data is empty.
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | True if the list is empty or the list has not been constructed. |
Length
The count of elements.
Declaration
public int Length { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The current count of elements. Always less than or equal to the capacity. |
Remarks
To decrease the memory used by a list, set Capacity after reducing the length of the list.
Size
Size of the single vertex. It is a sum of all attributes size.
Declaration
public int Size { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
| Improve this Doc View SourceAsArray<T>()
Returns a native array that aliases the array at the index.
Declaration
public NativeArray<T> AsArray<T>()
where T : struct
Returns
| Type | Description |
|---|---|
| Unity.Collections.NativeArray<T> | A native array that aliases the content of this list. |
Type Parameters
| Name | Description |
|---|---|
| T |
Clear()
Clears the container.
Declaration
public void Clear()
Remarks
VertexData Capacity remains unchanged.
Dispose()
Releases all resources (memory and safety handles).
Declaration
public void Dispose()
Dispose(JobHandle)
Creates and schedules a job that releases all resources (memory and safety handles) of this vertex data.
Declaration
public JobHandle Dispose(JobHandle inputDeps)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Jobs.JobHandle | inputDeps | The dependency for the new job. |
Returns
| Type | Description |
|---|---|
| Unity.Jobs.JobHandle | The handle of the new job. The job depends upon |
ElementAt<T>(Int32)
Returns a reference to the element at an index.
Declaration
public T ElementAt<T>(int index)
where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | An index. |
Returns
| Type | Description |
|---|---|
| T | A reference to the element at the index. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| System.IndexOutOfRangeException | Thrown if index is out of bounds. |
GetUnsafeVertexData()
Returns the internal unsafe vertex data.
Declaration
public UnsafeVertexData*GetUnsafeVertexData()
Returns
| Type | Description |
|---|---|
| UnsafeVertexData* | The internal unsafe vertex data. |
Remarks
Internally, the elements of a VertexData are stored in an UnsafeVertexData.
GetVertexAt(Int32)
Returns vertex position at index.
Declaration
public float3 GetVertexAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | An index. |
Returns
| Type | Description |
|---|---|
| Unity.Mathematics.float3 | Returns vertex position at index. |
GetVertexAttributes()
Returns a native array of attributes used to create this vertex data structure.
Declaration
public NativeArray<VertexAttributeDescriptor> GetVertexAttributes()
Returns
| Type | Description |
|---|---|
| Unity.Collections.NativeArray<UnityEngine.Rendering.VertexAttributeDescriptor> | Returns a native array of attributes used to create this vertex data structure. |
Resize(Int32, NativeArrayOptions)
Sets the length of this vertex data, increasing the capacity if necessary.
Declaration
public void Resize(int length, NativeArrayOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | length | The new length of this vertex data. |
| Unity.Collections.NativeArrayOptions | options | Whether to clear any newly allocated bytes to all zeroes. |
ResizeUninitialized(Int32)
Sets the length of this list, increasing the capacity if necessary.
Declaration
public void ResizeUninitialized(int length)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | length | The new length of this list. |
Remarks
Does not clear newly allocated bytes.
SetCapacity(Int32)
Sets the capacity.
Declaration
public void SetCapacity(int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | capacity | The new capacity. |