Struct UnsafeVertexData
An managed, resizable vertex data, without any thread safety check features. 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.LowLevel.Unsafe
Assembly: ProjectDawn.Geometry.dll
Syntax
public struct UnsafeVertexData : IDisposable
Constructors
| Improve this Doc View SourceUnsafeVertexData(Int32, NativeArray<VertexAttributeDescriptor>, AllocatorManager.AllocatorHandle)
Declaration
public UnsafeVertexData(int initialCapacity, NativeArray<VertexAttributeDescriptor> attributes, AllocatorManager.AllocatorHandle allocator)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | initialCapacity | |
| Unity.Collections.NativeArray<UnityEngine.Rendering.VertexAttributeDescriptor> | attributes | |
| Unity.Collections.AllocatorManager.AllocatorHandle | allocator |
Properties
| Improve this Doc View SourceAttributesLength
Vertex attribute count.
Declaration
public int AttributesLength { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Capacity
The number of elements that fit in the current allocation.
Declaration
public int Capacity { get; }
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 mask 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; }
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 SourceClear()
Clears the container.
Declaration
public void Clear()
Remarks
Stack Capacity remains unchanged.
Create(Int32, NativeArray<VertexAttributeDescriptor>, AllocatorManager.AllocatorHandle)
Creates a new container with the specified initial capacity and type of memory allocation.
Declaration
public static UnsafeVertexData*Create(int initialCapacity, NativeArray<VertexAttributeDescriptor> attributes, AllocatorManager.AllocatorHandle allocator)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | initialCapacity | The initial capacity of the list. If the list grows larger than its capacity, the internal array is copied to a new, larger array. |
| Unity.Collections.NativeArray<UnityEngine.Rendering.VertexAttributeDescriptor> | attributes | |
| Unity.Collections.AllocatorManager.AllocatorHandle | allocator | A member of the Unity.Collections.Allocator enumeration. |
Returns
| Type | Description |
|---|---|
| UnsafeVertexData* |
Destroy(UnsafeVertexData*)
Destroys container.
Declaration
public static void Destroy(UnsafeVertexData*data)
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeVertexData* | data |
Dispose()
Releases all resources (memory and safety handles).
Declaration
public void Dispose()
ElementPointerAt(Int32)
Returns pointer to element at index.
Declaration
public void *ElementPointerAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | An index. |
Returns
| Type | Description |
|---|---|
| System.Void* | Returns pointer to element at index. |
GetUnsafePointer()
Returns pointer to data.
Declaration
public void *GetUnsafePointer()
Returns
| Type | Description |
|---|---|
| System.Void* | Returns pointer to data. |
GetVertexAttributesPointer()
Returns pointer to attributes.
Declaration
public VertexAttributeDescriptor*GetVertexAttributesPointer()
Returns
| Type | Description |
|---|---|
| UnityEngine.Rendering.VertexAttributeDescriptor* | Returns pointer to attributes. |
Resize(Int32, NativeArrayOptions)
Sets the length of this vertex data, increasing the capacity if necessary.
Declaration
public void Resize(int length, NativeArrayOptions options = NativeArrayOptions.UninitializedMemory)
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. |
SetCapacity(Int32)
Sets the capacity.
Declaration
public void SetCapacity(int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | capacity | The new capacity. |