sealed class Tinman.Terrain.Rendering.VertexBufferCache

An LRU cache for blocks of vertices in an IVertexBuffer.

Public / Constructors


public constructor VertexBufferCache → (2)

buffer in : IVertexBuffer

The vertex buffer to use for caching data.

blockSize opt : int32 = 1024

The block size, in vertices.

Creates a new instance of VertexBufferCache.

Public / Methods


public method BlockId → (1)

blockIndex in : int32

The block index.

returns → int64

The block ID.

Returns the block ID for the given block index.


public method BlockIndex → (2)

blockId in : int64

The user-defined block ID.

loadIfNecessary in : bool

Load the block into the cache, if necessary?

returns → int32

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 in is false.
<=-2 : The block is not present in the cache and -2-R is the block index to use for loading its data.

Fetches a block from the cache.


public method Buffer → (2)

index in : int32

The block index, see return value of BlockIndex.

count opt : int32 = 0

Optional buffer limit, in vertices. If 0, the block size will be used.

returns → ByteBuffer

The write buffer.

Returns the write buffer for loading a block.


2 overloads

public method Clear1 → ()

Clears all blocks from the cache.

public method Clear2 → (1)

blockId in : int64

The user-defined block ID.

Clears the given block from the cache.

Public / Attributes


public attribute BlockCount → (get)

value : int32

The block count.

Returns the block count.


public attribute BlockSize → (get)

value : int32

The block size, in vertices.

Returns the block size.


public attribute VertexBuffer → (get)

value : IVertexBuffer

The vertex buffer.

Returns the backing vertex buffer.