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

class VertexBufferCache in Tinman.Terrain.Rendering

An LRU cache for blocks of vertices in an IVertexBuffer.

sealed class VertexBufferCache extends Disposable
  implements IBeginEnd
  ICapacity
  IResource
  IVertexElements

Public / Attributes

BlockCount

Returns the block count.

public property BlockCount { get }
type int32
value [>0] The block count.

BlockSize

Returns the block size.

public property BlockSize { get }
type int32
value [>0] The block size, in vertices.

Capacity

Returns the capacity of this object.

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

LifecycleState

Returns the lifecycle state of this object.

public virtual property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited Disposable.LifecycleState

MemoryConsumption

Returns the estimated memory consumption of this object.

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

VertexBuffer

public property VertexBuffer { get }
type IVertexBuffer
value

VertexElements

Returns the vertex declaration elements.

public property VertexElements { get }
type VertexElements
value [not-null] The vertex declaration elements.
implements IVertexElements.VertexElements

Public / Constructors

VertexBufferCache

Creates a new instance of VertexBufferCache.

public constructor VertexBufferCache ([Owner] IVertexBuffer buffer, int32 blockSize = 1024)
params buffer [not-null] The vertex buffer to use for caching data.
  blockSize [>0] The block size, in vertices. Defaults to 1024.

Public / Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
public method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited Disposable.AcquireTry

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry 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.

Begin

Begins an access to this object.

public method Begin ()
implements IBeginEnd.Begin

Remarks:

See the documentation of the class which implements this interface for details on the operations that must be wrapped in Begin and End calls.

See also:

BeginEnd

BlockId

public method BlockId (int32 blockIndex)
type int64
params blockIndex

BlockIndex

Fetches a block from the cache.

public method BlockIndex (int64 blockId, bool loadIfNecessary)
type int32
params blockId The user-defined block ID.
  loadIfNecessary Load the block into the cache, if necessary?
returns The return value R can be interpreted as follows:
>= 0: The block is present in the cache, R is the block index.
= -1: The block is not present in the cache and loadIfNecessary is false.
<=-2: The block is not present in the cache and -2-R is the block index to use for loading its data.

Buffer

Returns the write buffer for loading a block.

public method Buffer (int32 index, int32 count = 0)
type ByteBuffer
params index The block index, see return value of BlockIndex.
  count [0..BlockSize] Optional buffer limit, in vertices. If 0, the block size will be used. Defaults to 0.
returns [not-null] The write buffer.

Clear

Clears all blocks from the cache.

public method Clear ()

Clears the given block from the cache.

public method Clear (int64 blockId)
params blockId The user-defined block ID.

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]
public method Dispose ()
inherited Disposable.Dispose

Remarks:

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

End

Ends the current access to this object.

public method End ()
implements IBeginEnd.End

Remarks:

See the documentation of the class which implements this interface for details on the operations that must be wrapped in Begin and End calls.

See also:

BeginEnd