VertexBufferCache

Description

sealed class Tinman.Terrain.Rendering.VertexBufferCache

An LRU cache for blocks of vertices in a IVertexBuffer.

Public / Constructors

Vertex​Buffer​Cache


public constructor VertexBufferCache → (2)

buffer in : IVertexBuffer own

[not-null]
The vertex buffer to use for caching data.

blockSize opt : int32 = 1024

[>0]
The block size, in vertices.

Creates a new instance of VertexBufferCache.

Public / Methods

Block​Id


public method BlockId → (1)

blockIndex in : int32

The block index.

returns → int64

The block ID.

Returns the block ID for the given block index.

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.

Buffer


public method Buffer → (2)

index in : int32

The block index, see return value of BlockIndex.

count opt : int32 = 0

[0..VertexBufferCache.BlockSize]
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.

Clear

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

Block​Count


public attribute BlockCount → (get)

value : int32

[>0]
The block count.

Returns the block count.

Block​Size


public attribute BlockSize → (get)

value : int32

[>0]
The block size, in vertices.

Returns the block size.

Vertex​Buffer


public attribute VertexBuffer → (get)

value : IVertexBuffer

[not-null]
The vertex buffer.

Returns the backing vertex buffer.