VisimBox 1.0 VisimBox 3d simulation and visualisation ToolBox

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | Properties
VisimBox.Renderer.HWBuffer< T > Class Template Reference

Abstract base class for HW buffers. More...

Inheritance diagram for VisimBox.Renderer.HWBuffer< T >:

List of all members.

## Public Member Functions
virtual void | ReadCache ()
| Reads content of the buffer to cache.
virtual void | ReadCache (int start, int count)
| Reads part of the buffer to cache.
virtual void | WriteCache ()
| Writes content of the cache to index buffer.
abstract void | WriteCache (int start, int count)
| Writes content of the cache to the buffer.
abstract T | ReadElement (int position)
| Directly reads one element from the buffer (might be very slow)
virtual T[] | ReadElements (int position, int count)
| Directly reads several elements from the buffer (might be very slow)
virtual void | ReadElements (int position, int count, ref T[] dest, int start=0)
| Directly reads several elements from the buffer (might be very slow) to specified array.
abstract void | WriteElement (int position, ref T value)
| Directly writes element to the buffer.
virtual void | WriteElements (int position, T[] values)
| Directly writes array of elements to the buffer)
virtual void | WriteElements (int position, T[] values, int start, int count)
| Directly writes part of the array of elements to the buffer)
virtual void | AddReference (IResourceConsumer consumer)
| Adds reference to this resource.
virtual void | RemoveReference (IResourceConsumer consumer)
| Removes reference to this resource.
virtual bool | ReplaceReferences (IResource newresource)
| Manager wants to replace this resource by another - resource should inform all of it's consumers that it's being replaced and update references based on their response It should also check if new resource is of compatible type.
virtual void | Dispose ()
## Protected Member Functions
| HWBuffer (ResourceUsage usage)
| HWBuffer (int count, bool cache=false, ResourceUsage usage=ResourceUsage.Static)
| Initializes buffer with specified number of basic elements.
| HWBuffer (T[] values, bool cache=false, bool useArrayAsCache=false, ResourceUsage usage=ResourceUsage.Static)
| Initialized buffer from array of values.
| HWBuffer (ICollection< T > values, bool cache=false, ResourceUsage usage=ResourceUsage.Static)
| Constructs buffer from collection of values.
abstract void | ConstructBuffer (int count, bool justPrepare=false)
| Will construct buffer with specified number of elements. If HWbuffer already has some buffer assigned, it will be deleted.
virtual void | SetCache (bool value)
| Sets entire cache to true or false (recreates cache from buffer data or deletes it)
virtual void | CreateCache ()
| Creates cache.
virtual void | DisposeCache ()
| Disposes cache.
virtual void | DisposeConsumers ()
## Protected Attributes
T[] | _cache
bool | _cached = false
int | _count
ResourceUsage | _usage
uint | _internalID
List< IResourceConsumer > | Consumers = new List<IResourceConsumer>()
## Properties
virtual T | this[int index]`[get, set]`
| Allows access to buffer elements array style. If caching is enabled, reads/writes from cache, otherwise uses direct (and usually slow) access.
virtual int | Count`[get]`
| Number of elements in the buffer.
abstract uint | InternalID`[get]`
| Internal ID for the buffer.
virtual bool | Cached`[get, set]`
| If cached, index buffer will keep copy of the data in the system memory. All user read / write operations will be routed to cached copy. Use ReadCache / WriteCache to update buffer.
abstract ResourceType | ResourceType`[get]`
| Generic type of the resource.
virtual ResourceUsage | Usage`[get]`
| Type of the resource usage (static/dynamic)
virtual bool | AlwaysStay`[get, set]`
| If true, resource will stay in memory even if it's not referenced.
abstract string | FileName`[get, set]`
| File used to create the resource (if it was loaded from the disk)
int | References`[get]`
| Number of current references.
int | NullReferences`[get]`
| Returns number of null generic references.

## Detailed Description

### template<T>
class VisimBox::Renderer::HWBuffer< T >

Abstract base class for HW buffers.

Template Parameters:

  T | Type of element in the buffer (uint for index buffer, IVertex structure for vertex buffer)

## Member Function Documentation

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.AddReference | ( | IResourceConsumer | consumer | ) | `[virtual]`

Adds reference to this resource.

Parameters:

  consumer | Consumer of resource

Implements VisimBox.Resources.IResource.

template<T >

abstract void VisimBox.Renderer.HWBuffer< T >.ConstructBuffer | ( | int | count,
|  | bool | justPrepare = `false`
| ) |  | `[protected, pure virtual]`

Will construct buffer with specified number of elements. If HWbuffer already has some buffer assigned, it will be deleted.

Parameters:

  count | Required number of elements
  justPrepade | Only prepares buffer without setting it's size

Implemented in VisimRenderGL.GLIndexBuffer, and VisimRenderGL.GLVertexBuffer.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.CreateCache | ( |  | ) | `[protected, virtual]`

Creates cache.

Reimplemented in VisimBox.Renderer.VertexBuffer.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.Dispose | ( |  | ) | `[virtual]`

Reimplemented in VisimRenderGL.GLIndexBuffer, and VisimRenderGL.GLVertexBuffer.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.DisposeCache | ( |  | ) | `[protected, virtual]`

Disposes cache.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.DisposeConsumers | ( |  | ) | `[protected, virtual]`

template<T >

VisimBox.Renderer.HWBuffer< T >.HWBuffer | ( | ICollection< T > | values,
|  | bool | cache = `false`,
|  | ResourceUsage | usage = `ResourceUsage.Static`
| ) |  | `[protected]`

Constructs buffer from collection of values.

Parameters:

  values | Source values
  cache | If true, cache is constructed and used
  usage | Usage of the buffer, default is static (create once)

template<T >

VisimBox.Renderer.HWBuffer< T >.HWBuffer | ( | ResourceUsage | usage | ) | `[protected]`

template<T >

VisimBox.Renderer.HWBuffer< T >.HWBuffer | ( | int | count,
|  | bool | cache = `false`,
|  | ResourceUsage | usage = `ResourceUsage.Static`
| ) |  | `[protected]`

Initializes buffer with specified number of basic elements.

Parameters:

  count | Count of elements
  cache | If true, cache is constructed and used
  usage | Usage of the buffer, default is static (create once)

template<T >

VisimBox.Renderer.HWBuffer< T >.HWBuffer | ( | T[] | values,
|  | bool | cache = `false`,
|  | bool | useArrayAsCache = `false`,
|  | ResourceUsage | usage = `ResourceUsage.Static`
| ) |  | `[protected]`

Initialized buffer from array of values.

Parameters:

  values | Source values
  cache | If true, cache is constructed and used
  useArrayAsCache | If true, hw buffer will store reference to the source array as cache (so any direct read/write from/to array will be reflected in cache. Note, automatically sets cache using to true!
  usage | Usage of the buffer, default is static (create once)

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.ReadCache | ( |  | ) | `[virtual]`

Reads content of the buffer to cache.

Implements VisimBox.Renderer.IHWBuffer< T >.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.ReadCache | ( | int | start,
|  | int | count
| ) |  | `[virtual]`

Reads part of the buffer to cache.

Parameters:

  start | starting index
  count | number of elements to be read from the buffer

Implements VisimBox.Renderer.IHWBuffer< T >.

Reimplemented in VisimRenderGL.GLIndexBuffer, and VisimRenderGL.GLVertexBuffer.

template<T >

abstract T VisimBox.Renderer.HWBuffer< T >.ReadElement | ( | int | position | ) | `[pure virtual]`

Directly reads one element from the buffer (might be very slow)

Parameters:

  position | Index of the element to write

Returns:
  Element on the position

Implements VisimBox.Renderer.IHWBuffer< T >.

Implemented in VisimRenderGL.GLIndexBuffer, and VisimRenderGL.GLVertexBuffer.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.ReadElements | ( | int | position,
|  | int | count,
|  | ref T[] | dest,
|  | int | start = `0`
| ) |  | `[virtual]`

Directly reads several elements from the buffer (might be very slow) to specified array.

Parameters:

  position | Starting position
  count | Number of elements
  dest | Destination array
  start | Starting index in the array

Implements VisimBox.Renderer.IHWBuffer< T >.

template<T >

virtual T [] VisimBox.Renderer.HWBuffer< T >.ReadElements | ( | int | position,
|  | int | count
| ) |  | `[virtual]`

Directly reads several elements from the buffer (might be very slow)

Parameters:

  position | Starting position
  count | Number of elements

Returns:
  Array of elements from the buffer

Implements VisimBox.Renderer.IHWBuffer< T >.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.RemoveReference | ( | IResourceConsumer | consumer | ) | `[virtual]`

Removes reference to this resource.

Parameters:

  consumer | Consumer of resource

Implements VisimBox.Resources.IResource.

template<T >

virtual bool VisimBox.Renderer.HWBuffer< T >.ReplaceReferences | ( | IResource | newresource | ) | `[virtual]`

Manager wants to replace this resource by another - resource should inform all of it's consumers that it's being replaced and update references based on their response It should also check if new resource is of compatible type.

Parameters:

  newresource | New resource

Returns:
  True if resource is compatible type and all consumers accepted resource changing, false otherwise

Implements VisimBox.Resources.IResource.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.SetCache | ( | bool | value | ) | `[protected, virtual]`

Sets entire cache to true or false (recreates cache from buffer data or deletes it)

Parameters:

  value | cache on or off?

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.WriteCache | ( |  | ) | `[virtual]`

Writes content of the cache to index buffer.

Implements VisimBox.Renderer.IHWBuffer< T >.

Reimplemented in VisimRenderGL.GLIndexBuffer, and VisimRenderGL.GLVertexBuffer.

template<T >

abstract void VisimBox.Renderer.HWBuffer< T >.WriteCache | ( | int | start,
|  | int | count
| ) |  | `[pure virtual]`

Writes content of the cache to the buffer.

Parameters:

  start | starting index
  count | number of elements to be written to the buffer

Implements VisimBox.Renderer.IHWBuffer< T >.

Implemented in VisimRenderGL.GLIndexBuffer, and VisimRenderGL.GLVertexBuffer.

template<T >

abstract void VisimBox.Renderer.HWBuffer< T >.WriteElement | ( | int | position,
|  | ref T | value
| ) |  | `[pure virtual]`

Directly writes element to the buffer.

Parameters:

  position | Position of element
  value | New value for buffer

Implements VisimBox.Renderer.IHWBuffer< T >.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.WriteElements | ( | int | position,
|  | T[] | values,
|  | int | start,
|  | int | count
| ) |  | `[virtual]`

Directly writes part of the array of elements to the buffer)

Parameters:

  position | Position of element
  values | Array of elements
  count | Number of elements to write
  start | Starting position in the source array

Implements VisimBox.Renderer.IHWBuffer< T >.

template<T >

virtual void VisimBox.Renderer.HWBuffer< T >.WriteElements | ( | int | position,
|  | T[] | values
| ) |  | `[virtual]`

Directly writes array of elements to the buffer)

Parameters:

  position | Position of element
  values | Array of elements

Implements VisimBox.Renderer.IHWBuffer< T >.

## Member Data Documentation

template<T >

T [] VisimBox.Renderer.HWBuffer< T >._cache`[protected]`

template<T >

bool VisimBox.Renderer.HWBuffer< T >._cached = false`[protected]`

template<T >

int VisimBox.Renderer.HWBuffer< T >._count`[protected]`

template<T >

uint VisimBox.Renderer.HWBuffer< T >._internalID`[protected]`

template<T >

ResourceUsage VisimBox.Renderer.HWBuffer< T >._usage`[protected]`

template<T >

List<IResourceConsumer> VisimBox.Renderer.HWBuffer< T >.Consumers = new List<IResourceConsumer>()`[protected]`

## Property Documentation

template<T >

virtual bool VisimBox.Renderer.HWBuffer< T >.AlwaysStay`[get, set]`

If true, resource will stay in memory even if it's not referenced.

Implements VisimBox.Resources.IResource.

template<T >

virtual bool VisimBox.Renderer.HWBuffer< T >.Cached`[get, set]`

If cached, index buffer will keep copy of the data in the system memory. All user read / write operations will be routed to cached copy. Use ReadCache / WriteCache to update buffer.

Implements VisimBox.Renderer.IHWBuffer< T >.

template<T >

virtual int VisimBox.Renderer.HWBuffer< T >.Count`[get]`

Number of elements in the buffer.

Implements VisimBox.Renderer.IHWBuffer< T >.

template<T >

abstract string VisimBox.Renderer.HWBuffer< T >.FileName`[get, set]`

File used to create the resource (if it was loaded from the disk)

Implements VisimBox.Resources.IResource.

Reimplemented in VisimRenderGL.GLIndexBuffer, and VisimRenderGL.GLVertexBuffer.

template<T >

abstract uint VisimBox.Renderer.HWBuffer< T >.InternalID`[get]`

Internal ID for the buffer.

Implements VisimBox.Renderer.IHWBuffer< T >.

Reimplemented in VisimRenderGL.GLIndexBuffer, and VisimRenderGL.GLVertexBuffer.

template<T >

int VisimBox.Renderer.HWBuffer< T >.NullReferences`[get]`

Returns number of null generic references.

Implements VisimBox.Resources.IResource.

template<T >

int VisimBox.Renderer.HWBuffer< T >.References`[get]`

Number of current references.

Implements VisimBox.Resources.IResource.

template<T >

abstract ResourceType VisimBox.Renderer.HWBuffer< T >.ResourceType`[get]`

Generic type of the resource.

Implements VisimBox.Resources.IResource.

Reimplemented in VisimBox.Renderer.IndexBuffer, and VisimBox.Renderer.VertexBuffer.

template<T >

virtual T VisimBox.Renderer.HWBuffer< T >.this[int index]`[get, set]`

Allows access to buffer elements array style. If caching is enabled, reads/writes from cache, otherwise uses direct (and usually slow) access.

Parameters:

  index | index of the element

Returns:

Implements VisimBox.Renderer.IHWBuffer< T >.

template<T >

virtual ResourceUsage VisimBox.Renderer.HWBuffer< T >.Usage`[get]`

Type of the resource usage (static/dynamic)

Implements VisimBox.Resources.IResource.

The documentation for this class was generated from the following file:

- HWBuffers.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events