00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined SOOPENCLCONVERTION_H
00024 #define SOOPENCLCONVERTION_H
00025
00026 #include <Inventor/SbString.h>
00027 #include <Inventor/SbDataType.h>
00028
00029 #include <Inventor/STL/vector>
00030 #include <Inventor/STL/map>
00031
00032 #include <Inventor/algorithms/SoConversion.h>
00033
00034 #include <Inventor/OpenCL/algorithms/SoOpenCLAlgorithmsDefs.h>
00035
00036 class SoOpenCLHandle;
00037 class SoOpenCLBufferObject;
00038
00059 class INVENTOROPENCLALGORITHMS_API SoOpenCLConversion : public SoConversion
00060 {
00061 private:
00063 static void initClass();
00064
00066 static void exitClass();
00067
00069 ~SoOpenCLConversion();
00070
00071 public:
00073 SoOpenCLConversion();
00074
00091 virtual int convertFloatToRGBA(
00092 SoBufferObject* sourceBufferObject,
00093 SoBufferObject* targetBufferObject,
00094 const size_t size, const float dataMin, const float dataMax
00095 );
00096
00101 int convertFloatToRGBA(
00102 SoOpenCLBufferObject* sourceBufferObject,
00103 SoOpenCLBufferObject* targetBufferObject,
00104 const size_t size, const float dataMin, const float dataMax
00105 );
00106
00125 virtual int convert(
00126 SoBufferObject* sourceBufferObject, const SbDataType src_type,
00127 SoBufferObject* targetBufferObject, const SbDataType dst_type,
00128 const size_t size
00129 );
00130
00135 int convert(
00136 SoOpenCLBufferObject* sourceBufferObject, const SbDataType src_type,
00137 SoOpenCLBufferObject* targetBufferObject, const SbDataType dst_type,
00138 const size_t size
00139 );
00140
00141 private:
00143 int convertToFloat(
00144 SoBufferObject* sourceBufferObject, const SbDataType src_type,
00145 SoBufferObject* targetBufferObject,
00146 const size_t size
00147 );
00149 int convertToFloat(
00150 SoOpenCLBufferObject* sourceBufferObject, const SbDataType src_type,
00151 SoOpenCLBufferObject* targetBufferObject,
00152 const size_t size
00153 );
00155 int convertToUChar(
00156 SoBufferObject* sourceBufferObject, SbDataType src_type,
00157 SoBufferObject* targetBufferObject,
00158 const size_t size );
00160 int convertToUChar(
00161 SoOpenCLBufferObject* sourceBufferObject, SbDataType src_type,
00162 SoOpenCLBufferObject* targetBufferObject,
00163 const size_t size );
00164
00165 private:
00169 void mapDataRangeToIndex(
00170 SoBufferObject *sourceBufferObject, const SbDataType src_type,
00171 SoBufferObject *targetBufferObject, const SbDataType dst_type,
00172 const double dataRangeMin, const double dataRangeMax, const bool dataRangeMap,
00173 const int shift, const int offset
00174 );
00175
00179 void mapDataRangeToIndex(
00180 SoOpenCLBufferObject *sourceBufferObject, const SbDataType src_type,
00181 SoOpenCLBufferObject *targetBufferObject, const SbDataType dst_type,
00182 const double dataRangeMin, const double dataRangeMax, const bool dataRangeMap,
00183 const int shift, const int offset
00184 );
00185
00189 void mapDataToIndex(
00190 SoBufferObject *sourceBufferObject, const SbDataType src_type,
00191 SoBufferObject *targetBufferObject, const SbDataType dst_type,
00192 const int numSigBits, const int shift, const int offset
00193 );
00194
00198 void mapDataToIndex(
00199 SoOpenCLBufferObject *sourceBufferObject, const SbDataType src_type,
00200 SoOpenCLBufferObject *targetBufferObject, const SbDataType dst_type,
00201 const int numSigBits, const int shift, const int offset
00202 );
00203
00207 void mapDataRangeToRgba(
00208 SoBufferObject *sourceBufferObject, const SbDataType src_type,
00209 SoBufferObject *targetBufferObject, const SbDataType dst_type,
00210 const double dataRangeMin, const double dataRangeMax, const bool dataRangeMap,
00211 const int shift, const int offset,
00212 SoBufferObject *rgbaBufferObject, const int numRgba
00213 );
00214
00218 void mapDataRangeToRgba(
00219 SoOpenCLBufferObject *sourceBufferObject, const SbDataType src_type,
00220 SoOpenCLBufferObject *targetBufferObject, const SbDataType dst_type,
00221 const double dataRangeMin, const double dataRangeMax, const bool dataRangeMap,
00222 const int shift, const int offset,
00223 SoOpenCLBufferObject *rgbaBufferObject, const int numRgba
00224 );
00225
00229 void mapDataToRgba(
00230 SoBufferObject *sourceBufferObject, const SbDataType src_type,
00231 SoBufferObject *targetBufferObject, const SbDataType dst_type,
00232 const int numSigBits, const int shift, const int offset,
00233 SoBufferObject *rgbaBufferObject, const int numRgba
00234 );
00235
00239 void mapDataToRgba(
00240 SoOpenCLBufferObject *sourceBufferObject, const SbDataType src_type,
00241 SoOpenCLBufferObject *targetBufferObject, const SbDataType dst_type,
00242 const int numSigBits, const int shift, const int offset,
00243 SoOpenCLBufferObject *rgbaBufferObject, const int numRgba
00244 );
00245
00246 private:
00247
00248
00249 std::map<SbDataType,SoOpenCLHandle*> m_convertHandles;
00250
00251
00252 SoOpenCLHandle* m_floatToRGBAHandle;
00253 SoOpenCLHandle* m_floatToUCharHandle;
00254 SoOpenCLHandle* m_mapDataRangeToIndexHandle;
00255 SoOpenCLHandle* m_mapDataToIndexHandle;
00256 SoOpenCLHandle* m_mapDataToRgbaHandle;
00257 SoOpenCLHandle* m_mapDataRangeToRgbaHandle;
00258 };
00259
00260 #endif //SOOPENCLCONVERTION_H
00261
00262