TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

interface IVertexBuffer in Tinman.Terrain.Rendering

A vertex buffer, typically stored in high-performance GPU memory.

interface IVertexBuffer extends IGpuBuffer
  IVertexLayout

Remarks

Vertex data is written in binary form, usually formatted using an IVertexFormat object.

Attributes

AccessPattern

Returns the access pattern of this GPU resource.

property AccessPattern { get }
type ResourceAccessPattern
value The access pattern.
inherited IResource.AccessPattern

Capacity

Returns the capacity of this object.

property Capacity { get }
type int32
value [>=0] The capacity, in elements.
inherited ICapacity.Capacity

ElementSize

The fixed element size of this buffer.

property ElementSize { get }
type int32
value [>=0] The element size, in bytes; always a multiple of four. Will be 0 iff this buffer has an undefined structure and is used as a raw byte buffer. In this case, the capacity will give the buffer size in bytes (also always a multiple of four), instead of the element count.
inherited IGpuBuffer.ElementSize

IsSoleOwnership

Will this object be disposed upon the next call to Dispose?

[ThreadSafe]
property IsSoleOwnership { get }
type bool
value true if the object will be disposed when Dispose is called,
false if the object will not be disposed, because some other code is still holding shared ownership (see AcquireBase).
inherited IDisposable.IsSoleOwnership

LifecycleState

Returns the lifecycle state of this object.

property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited ILifecycleState.LifecycleState

MemoryConsumption

Returns the estimated memory consumption of this object.

property MemoryConsumption { get }
type int64
value [>=0] The estimated memory consumption, in bytes.
inherited IMemoryConsumption.MemoryConsumption

Name

A human-readable name for debugging and testing.

property Name { get set }
type string
value The name or null.
inherited IResource.Name

NativeHandle

Returns the raw handle value of the native resource that is contained in this object.

property NativeHandle { get }
type IntPtr
value The raw handle value.
inherited INativeHandle.NativeHandle

Remarks:

The documentation of the implementing class will contain information on how to interpret the raw handle value.

VertexLayout

Returns the elements of the vertex layout.

property VertexLayout { get }
type VertexElements
value [not-null] The vertex elements.
inherited IVertexLayout.VertexLayout

Methods

Acquire

Acquires a strong reference to this disposable object.

[OwnerReturn, Pure]
method Acquire (bool allowNull = false)
type T
params allowNull Depicts what to do when this object is no longer valid:
true: return null
false: throw an exception
returns The strong reference to this disposable object or null iff allowNull is true and this object is no longer valid.
inherited IDisposableGeneric.Acquire

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls this method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Exceptions:

AcquireBase

Acquires a strong reference to this disposable object.

[OwnerReturn, Pure]
method AcquireBase (bool allowNull = false)
type IDisposable
params allowNull Depicts what to do when this object is no longer valid:
true: return null
false: throw an exception
returns The strong reference to this disposable object or null iff allowNull is true and this object is no longer valid.
inherited IDisposable.AcquireBase

Remarks:

The object will not be actually disposed by calls to IDisposable when there is at least one strong reference left. Code that calls this method is responsible for calling the IDisposable method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Using this method usually requires type casting. Subclasses may additionally implement IDisposableGeneric, in order to provide some syntactic sugar for that.

Exceptions:

Binding

Checks if there is at least one graphics API binding for this resource object.

method Binding ()
type bool
returns true if there is at least one graphics API binding,
false if this resource object is not bound to the graphics API.
inherited IResource.Binding

Updates the graphics API binding counter of this resource object.

method Binding (int32 balance)
params balance The binding counter delta.
inherited IResource.Binding

Exceptions:

BufferMap

Maps a region of this buffer for writing.

method BufferMap (GpuUpdateFlag flag, int32 countMax = -1)
type ByteBuffer
params flag The update flag to apply.
  countMax [-1..Capacity] Maximum value that will be passed to the count parameter of BufferPrepare. If -1, Capacity will be used. Defaults to -1.
returns [not-null] The byte buffer to use for writing updated values: the position is 0 (which points to the start of the first element resp. byte in this GPU buffer), the capacity encompasses at least countMax elements resp. bytes and the limit is 0. Before any data may be written, BufferPrepare must be called in order to prepare the returned buffer.
inherited IGpuBuffer.BufferMap

Remarks:

This is the preferred way of updating a GPU buffer with Mappable access.

This method can also be used on GPU buffers with Dynamic access. In this case, the implementing class will transparently map the API calls to BufferUpdate.

See also:

IGpuBuffer.BufferUnmap

Exceptions:

BufferPrepare

Prepares the buffer that has been returned by BufferMap for writing to a range of elements resp. bytes.

method BufferPrepare (int32 first = 0, int32 count = -1)
params first [0..Capacity] Index of the first element resp. byte in this buffer to update.
  count [-1..Capacity-first] Total number of elements resp. bytes to update in this buffer. If -1, the value min(countMax,Capacity-first) will be used, where countMax is the maximum count that has been passed to BufferMap.
returns [not-null] The mapped buffer region to use for writing updates values to.
inherited IGpuBuffer.BufferPrepare

Remarks:

This method may only be called between calls to BufferMap and BufferUnmap.

See also:

IGpuBuffer.ElementSize

BufferUnmap

Unmaps a this buffer.

method BufferUnmap ()
inherited IGpuBuffer.BufferUnmap

Remarks:

Calling BufferUnmap on a buffer that cannot be locked (i.e. Update is not present) or without a prior call to BufferMap does not have any effect, the method just returns silently.

See also:

IGpuBuffer.BufferMap

BufferUpdate

Updates a range of elements in the buffer.

method BufferUpdate (int32 first, ByteBuffer values, int32 offset, int32 count, GpuUpdateFlag flag = GpuUpdateFlag.Discard)
params first [>=0] Index of the first element resp. byte in this buffer to update.
  values [not-null] A buffer holding the updated elements resp. bytes. The buffer position and limit will neither be modified nor taken into account by this method.
  offset [>=0] Offset into values to first element resp. byte to read.
  count [>=0] Total number of elements resp. bytes to update in this buffer.
  flag The update flag to apply. Defaults to Discard.
inherited IGpuBuffer.BufferUpdate

Remarks:

This is the preferred way of updating a GPU buffer with Dynamic access.

This method can also be used on GPU buffers with Mappable access. In this case, the implementing class will transparently map the API calls to BufferMap, BufferPrepare and BufferUnmap.

See also:

IGpuBuffer.ElementSize

Exceptions:

BufferUpdateArray

Updates a range of 32-bit integer values in the buffer.

method BufferUpdateArray (int32 first, [] int32[] values, int32 offset, int32 count, GpuUpdateFlag flag = GpuUpdateFlag.Discard)
params first [>=0] Index of the first 32-bit integer value in the buffer to update.
  values [not-null] An array holding the updated 32-bit integer values.
  offset [>=0] Offset into values to first 32-bit integer value to read.
  count [>=0] Total number of 32-bit integer values to copy from values to this buffer.
  flag The update flag to apply. Defaults to Discard.
inherited IGpuBuffer.BufferUpdateArray

Remarks:

This method is usually used in conjunction with IIndexBuffer s, which have an element size of 4 bytes.

This is the preferred way of updating a GPU buffer with Dynamic access.

This method can also be used on GPU buffers with Mappable access. In this case, the implementing class will transparently map the API calls to BufferMap, BufferPrepare and BufferUnmap.

Exceptions:

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
method Dispose ()
inherited IDisposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

Implementing methods must not throw any exceptions.