00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #pragma once
00024
00025 #include <Inventor/devices/SoCpuBufferObject.h>
00026 #include <LDM/tiles/SoBufferPropertiesInterface.h>
00027 #include <LDM/tiles/SoLDMBufferObjectInterface.h>
00028
00029 class SoGLBufferObject;
00030 class SoCpuBufferUniform;
00031 class SoCpuBufferBitSetImpl;
00032
00047 class SoCpuBufferBitSet: public SoCpuBufferObject, public SoBufferPropertiesInterface, public SoLDMBufferObjectInterface
00048 {
00049 SO_TYPED_CLASS_HEADER();
00050
00051
00052 public:
00053
00057 SoCpuBufferBitSet();
00058
00062 SoCpuBufferBitSet(SoCpuBufferObject* cpuBuffer);
00063
00069 virtual SoBufferObject* createInstance() const;
00070
00082 virtual void map( SoBufferObject* targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition = 0, size_t mappingSize = SO_BUFFER_SIZE_ALL );
00083
00089 virtual void map( SoCpuBufferObject* targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition = 0, size_t mappingSize = SO_BUFFER_SIZE_ALL);
00090
00096 virtual void map( SoGLBufferObject* targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition = 0, size_t mappingSize = SO_BUFFER_SIZE_ALL);
00097
00104 virtual void* map( SoBufferObject::AccessMode accessMode, size_t offset = 0, size_t count = SO_BUFFER_SIZE_ALL );
00105
00114 virtual void unmap( SoCpuBufferObject* bufferObject );
00115
00124 virtual void unmap( SoGLBufferObject* bufferObject );
00125
00134 virtual void unmap( SoBufferObject* bufferObject );
00135
00141 virtual void unmap();
00142
00144 virtual void memcpy( SoBufferObject* sourceBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
00145
00158 virtual void memset( void* value, size_t valueSize = 1, size_t offset = 0, size_t count = SO_BUFFER_SIZE_ALL );
00159
00168 virtual bool getMinMax( double& min, double& max);
00169
00176 virtual void setMinMax( const double& min, const double& max);
00177
00183 virtual size_t getRealSize() const;
00184
00185 private:
00186
00189 void memcpy( SoCpuBufferBitSet* sourceBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
00190
00193 void memcpy( SoCpuBufferUniform* sourceBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
00194
00197 void memcpyInternal( SoBufferObject* sourceBufferObject, size_t dataSize, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
00198
00201 unsigned char* mapRawBitSet(SoBufferObject::AccessMode accessMode);
00202
00204 void unmapRawBitSet();
00205
00207 static inline unsigned char getBit(unsigned char* dataPtr, const int pos)
00208 { return (((dataPtr[pos>>0x3]) >> (7- (pos & 0x7))) & 1); }
00209
00210
00211 virtual void setCacheSignature(const uint64_t& cacheSignature);
00212
00214 static inline void setBit(unsigned char* dataPtr, const size_t pos, bool v)
00215 {
00216 unsigned char& val = dataPtr[pos/8];
00217 const unsigned char mask = 0x80 >> pos%8;
00218 const unsigned char bitChar = (unsigned char)v << (7 - pos%8);
00219 val = (val & ~mask) | bitChar;
00220 }
00221
00222 SoINTERNAL private:
00223 friend class SoCpuBufferBitSetImpl;
00224
00225 SoCpuBufferBitSet(SoCpuBufferBitSetImpl* impl);
00226
00227 private:
00231 virtual ~SoCpuBufferBitSet();
00232 };
00233
00234