G3D::VAR Class ReferenceA pointer to an array of vertices, colors, or normals in video memory.
More...
#include <VAR.h>
List of all members.
|
Public Member Functions |
| size_t | maxSize () const |
| template<class T> |
| void | set (int index, const T &value) |
| template<class T> |
| void | update (const Array< T > &source) |
| template<class T> |
| void | update (const T *sourcePtr, int _numElements) |
| bool | valid () const |
| template<class T> |
| | VAR (const Array< T > &source, VARAreaRef _area) |
| template<class T> |
| | VAR (const T *sourcePtr, int _numElements, VARAreaRef _area) |
| | VAR () |
Friends |
| class | RenderDevice |
Detailed Description
A pointer to an array of vertices, colors, or normals in video memory.
It is safe to copy these (the pointer will be copied, not the video memory).
There is no destructor because the memory referenced is freed when the parent VARArea is reset or freed.
Constructor & Destructor Documentation
template<class T>
| G3D::VAR::VAR |
( |
const T * |
sourcePtr, |
|
|
int |
_numElements, |
|
|
VARAreaRef |
_area | |
|
) |
| | [inline] |
Uploads the memory.
The element type is inferred from the pointer type by the preprocessor. Sample usage:
Once at the beginning of the program
VARAreaRef area = VARArea::create(1024 * 1024);
----------
Store data in main memory
Array<Vector3> vertex;
Array<int> index;
... fill out vertex & index arrays
------------
Upload to graphics card every frame
area.reset();
VAR varray(vertex, area);
renderDevice->beginIndexedPrimitives();
renderDevice->setVertexArray(varray);
renderDevice->sendIndices(RenderDevice::TRIANGLES, index);
renderDevice->endIndexedPrimitives();
See GLG3D_Demo for examples.
Member Function Documentation
| size_t G3D::VAR::maxSize |
( |
|
) |
const [inline] |
Maximum size that can be loaded via update into this VAR.
template<class T>
| void G3D::VAR::set |
( |
int |
index, |
|
|
const T & |
value | |
|
) |
| | [inline] |
Overwrites a single element of an existing array without changing the number of elements.
This is faster than calling update for large arrays, but slow if many set calls are made. Typically used to change a few key vertices, e.g., the single dark cap point of a directional light's shadow volume.
template<class T>
| void G3D::VAR::update |
( |
const Array< T > & |
source |
) |
[inline] |
Overwrites existing data with data of the same size or smaller.
Convenient for changing part of a G3D::VARArea without reseting the area (and thereby deallocating the other G3D::VAR arrays in it).
template<class T>
| void G3D::VAR::update |
( |
const T * |
sourcePtr, |
|
|
int |
_numElements | |
|
) |
| | [inline] |
| bool G3D::VAR::valid |
( |
|
) |
const |
Returns true if this VAR can be used for rendering (i.e.
contains data and the parent VARArea has not been reset).
Friends And Related Function Documentation
The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:48 2007 for G3D by
1.5.2
Hosted by
|