LDM buffer object optimized for uniform (single value) tile data. More...
#include <LDM/tiles/SoCpuBufferUniform.h>
Public Member Functions | |
SoCpuBufferUniform () | |
SoCpuBufferUniform (const double value, SbDataType valueType) | |
virtual void | map (SoBufferObject *targetBufferObject, AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL) |
virtual void | map (SoCpuBufferObject *targetBufferObject, AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL) |
virtual void | map (SoGLBufferObject *targetBufferObject, AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL) |
virtual void | unmap (SoCpuBufferObject *bufferObject) |
virtual void | unmap (SoGLBufferObject *bufferObject) |
virtual void | unmap (SoBufferObject *bufferObject) |
virtual void * | map (AccessMode accessMode) |
virtual void | unmap () |
virtual void | memset (void *data, size_t dataSize=1, size_t offset=0, size_t count=SO_BUFFER_SIZE_ALL) |
virtual void | memcpy (SoBufferObject *sourceBufferObject, size_t destOffset, size_t sourceOffset, size_t copySize) |
virtual bool | setSize (size_t size) |
virtual bool | getMinMax (double &min, double &max) |
virtual double | getValue () const |
virtual SbDataType | getType () const |
void | setValue (const double &value, const SbDataType &dataType) |
virtual size_t | getRealSize () const |
virtual void | setRealSize (const size_t &realSize) |
This type of buffer efficiently represents a uniform tile, in other words a tile in which every value is the same. The buffer can be used like any other buffer, but uses very little memory when its contents are not actually being accessed.
SoBufferPropertiesInterface, SoCpuBufferObject
SoCpuBufferUniform::SoCpuBufferUniform | ( | ) |
Default constructor.
SoCpuBufferUniform::SoCpuBufferUniform | ( | const double | value, | |
SbDataType | valueType | |||
) |
Constructor.
value | Initial value of uniform buffer. | |
valueType | Initial value type of uniform buffer. |
virtual bool SoCpuBufferUniform::getMinMax | ( | double & | min, | |
double & | max | |||
) | [virtual] |
Get the min and max values in the buffer, if they are known.
Returns false if these values have not been set or computed. Returns true if values are available.
min | user variable to store min value | |
max | user variable to store max value |
Implements SoBufferPropertiesInterface.
virtual size_t SoCpuBufferUniform::getRealSize | ( | ) | const [virtual] |
Returns the real size of the buffer in bytes.
Implements SoBufferPropertiesInterface.
virtual SbDataType SoCpuBufferUniform::getType | ( | ) | const [virtual] |
Get the type of the value of the uniform tile.
virtual double SoCpuBufferUniform::getValue | ( | ) | const [virtual] |
Get the value of the uniform tile.
virtual void* SoCpuBufferUniform::map | ( | AccessMode | accessMode | ) | [virtual] |
Returns a pointer to the memory array used for the storage of the buffer.
Reimplemented from SoCpuBufferObject.
virtual void SoCpuBufferUniform::map | ( | SoGLBufferObject * | targetBufferObject, | |
AccessMode | accessMode, | |||
size_t | startPosition = 0 , |
|||
size_t | mappingSize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Map the current buffer object into the specified GL buffer object.
See the general map method for more information.
Reimplemented from SoCpuBufferObject.
virtual void SoCpuBufferUniform::map | ( | SoCpuBufferObject * | targetBufferObject, | |
AccessMode | accessMode, | |||
size_t | startPosition = 0 , |
|||
size_t | mappingSize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Map the current buffer object into the specified CPU buffer object.
See the general map method for more information.
Implements SoBufferObject.
virtual void SoCpuBufferUniform::map | ( | SoBufferObject * | targetBufferObject, | |
AccessMode | accessMode, | |||
size_t | startPosition = 0 , |
|||
size_t | mappingSize = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
Map the current buffer object into the specified buffer object.
It is useful in order to use a buffer in multiple contexts (e.g. OpenGL and CUDA).
targetBufferObject | The buffer object which will be the mapped version of this buffer. | |
accessMode | The access mode used for the mapping. Support only READ_ONLY mode | |
startPosition | offset in source buffer to map from (default is start of buffer). | |
mappingSize | size from the startPosition, if SO_BUFFER_SIZE_ALL then the whole buffer is mapped. |
Reimplemented from SoCpuBufferObject.
virtual void SoCpuBufferUniform::memcpy | ( | SoBufferObject * | sourceBufferObject, | |
size_t | destOffset, | |||
size_t | sourceOffset, | |||
size_t | copySize | |||
) | [virtual] |
Memcpy the contents of sourceBufferObject into this buffer object.
Reimplemented from SoCpuBufferObject.
virtual void SoCpuBufferUniform::memset | ( | void * | data, | |
size_t | dataSize = 1 , |
|||
size_t | offset = 0 , |
|||
size_t | count = SO_BUFFER_SIZE_ALL | |||
) | [virtual] |
This function sets the contents of (or a portion of) the buffer object to the specified value.
The dataSize parameter provides a way to do a memset with float, short, byte, etc values.
data | A pointer to the value to set in the buffer. | |
dataSize | The size in bytes of the data value. Default is 1 byte. | |
offset | The offset in bytes (where to start setting values). Default is 0. | |
count | The number of values to set. Default is number of bytes in buffer. |
Reimplemented from SoCpuBufferObject.
virtual void SoCpuBufferUniform::setRealSize | ( | const size_t & | realSize | ) | [virtual] |
Set the real size of the buffer object in bytes.
virtual bool SoCpuBufferUniform::setSize | ( | size_t | size | ) | [virtual] |
Sets the size in bytes of the buffer object.
Returns false if allocation failed, true otherwise.
size | The size in bytes of the raw buffer object. |
Reimplemented from SoCpuBufferObject.
void SoCpuBufferUniform::setValue | ( | const double & | value, | |
const SbDataType & | dataType | |||
) |
Set the value and data type for this uniform buffer.
virtual void SoCpuBufferUniform::unmap | ( | ) | [virtual] |
Unmap a mapped buffer.
No error is reported if the buffer was not mapped.
Reimplemented from SoCpuBufferObject.
virtual void SoCpuBufferUniform::unmap | ( | SoBufferObject * | bufferObject | ) | [virtual] |
Remove the specified bufferObject from the list of buffers which map the current buffer.
If the access mode supports writing the specified buffer is sync'd with the buffer.
bufferObject | Buffer to be unmapped. |
Reimplemented from SoCpuBufferObject.
virtual void SoCpuBufferUniform::unmap | ( | SoGLBufferObject * | bufferObject | ) | [virtual] |
Unmap the specified GL buffer object
It is defined just to speed up the call when the type of the object is known.
If the access mode supports writing the specified buffer is sync'd with the buffer.
See the general unmap function for more information.
bufferObject | Buffer to be unmapped. |
Reimplemented from SoCpuBufferObject.
virtual void SoCpuBufferUniform::unmap | ( | SoCpuBufferObject * | bufferObject | ) | [virtual] |
Unmap the specified CPU buffer object
It is defined just to speed up the call when the type of the object is known.
Remove the specified bufferObject from the list of buffers which map the current buffer.
See the general unmap function for more information.
Implements SoBufferObject.