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 SOCUDACONVERTION_H
00024 #define SOCUDACONVERTION_H
00025
00026 #include <Inventor/SbString.h>
00027 #include <Inventor/SbDataType.h>
00028
00029 #include <Inventor/STL/vector>
00030
00031 #include <Inventor/algorithms/SoConversion.h>
00032
00033 #include <Inventor/cuda/algorithms/SoCudaAlgorithmsDefs.h>
00034
00035 class SoCudaHandle;
00036 class SoCudaBufferObject;
00037
00058 class SoCudaConversion : public SoConversion
00059 {
00060 private:
00062 static void initClass();
00063
00065 static void exitClass();
00066
00068 ~SoCudaConversion();
00069
00070 public:
00072 SoCudaConversion();
00073
00090 virtual int convertFloatToRGBA(
00091 SoBufferObject* sourceBufferObject,
00092 SoBufferObject* targetBufferObject,
00093 const size_t size, const float dataMin, const float dataMax
00094 );
00095
00100 int convertFloatToRGBA(
00101 SoCudaBufferObject* sourceBufferObject,
00102 SoCudaBufferObject* targetBufferObject,
00103 const size_t size, const float dataMin, const float dataMax
00104 );
00105
00124 virtual int convert(
00125 SoBufferObject* sourceBufferObject, const SbDataType src_type,
00126 SoBufferObject* targetBufferObject, const SbDataType dst_type,
00127 const size_t size
00128 );
00129
00134 int convert(
00135 SoCudaBufferObject* sourceBufferObject, const SbDataType src_type,
00136 SoCudaBufferObject* targetBufferObject, const SbDataType dst_type,
00137 const size_t size
00138 );
00139
00140 private:
00142 int convertToFloat(
00143 SoBufferObject* sourceBufferObject, const SbDataType src_type,
00144 SoBufferObject* targetBufferObject,
00145 const size_t size
00146 );
00148 int convertToFloat(
00149 SoCudaBufferObject* sourceBufferObject, const SbDataType src_type,
00150 SoCudaBufferObject* targetBufferObject,
00151 const size_t size
00152 );
00154 int convertToUChar(
00155 SoBufferObject* sourceBufferObject, SbDataType src_type,
00156 SoBufferObject* targetBufferObject,
00157 const size_t size );
00159 int convertToUChar(
00160 SoCudaBufferObject* sourceBufferObject, SbDataType src_type,
00161 SoCudaBufferObject* targetBufferObject,
00162 const size_t size );
00163
00164 private:
00168 void mapDataRangeToIndex(
00169 SoBufferObject *sourceBufferObject, const SbDataType src_type,
00170 SoBufferObject *targetBufferObject, const SbDataType dst_type,
00171 const double dataRangeMin, const double dataRangeMax, const bool dataRangeMap,
00172 const int shift, const int offset
00173 );
00174
00178 void mapDataRangeToIndex(
00179 SoCudaBufferObject *sourceBufferObject, const SbDataType src_type,
00180 SoCudaBufferObject *targetBufferObject, const SbDataType dst_type,
00181 const double dataRangeMin, const double dataRangeMax, const bool dataRangeMap,
00182 const int shift, const int offset
00183 );
00184
00188 void mapDataToIndex(
00189 SoBufferObject *sourceBufferObject, const SbDataType src_type,
00190 SoBufferObject *targetBufferObject, const SbDataType dst_type,
00191 const int numSigBits, const int shift, const int offset
00192 );
00193
00197 void mapDataToIndex(
00198 SoCudaBufferObject *sourceBufferObject, const SbDataType src_type,
00199 SoCudaBufferObject *targetBufferObject, const SbDataType dst_type,
00200 const int numSigBits, const int shift, const int offset
00201 );
00202
00206 void mapDataRangeToRgba(
00207 SoBufferObject *sourceBufferObject, const SbDataType src_type,
00208 SoBufferObject *targetBufferObject, const SbDataType dst_type,
00209 const double dataRangeMin, const double dataRangeMax, const bool dataRangeMap,
00210 const int shift, const int offset,
00211 SoBufferObject *rgbaBufferObject, const int numRgba
00212 );
00213
00217 void mapDataRangeToRgba(
00218 SoCudaBufferObject *sourceBufferObject, const SbDataType src_type,
00219 SoCudaBufferObject *targetBufferObject, const SbDataType dst_type,
00220 const double dataRangeMin, const double dataRangeMax, const bool dataRangeMap,
00221 const int shift, const int offset,
00222 SoCudaBufferObject *rgbaBufferObject, const int numRgba
00223 );
00224
00228 void mapDataToRgba(
00229 SoBufferObject *sourceBufferObject, const SbDataType src_type,
00230 SoBufferObject *targetBufferObject, const SbDataType dst_type,
00231 const int numSigBits, const int shift, const int offset,
00232 SoBufferObject *rgbaBufferObject, const int numRgba
00233 );
00234
00238 void mapDataToRgba(
00239 SoCudaBufferObject *sourceBufferObject, const SbDataType src_type,
00240 SoCudaBufferObject *targetBufferObject, const SbDataType dst_type,
00241 const int numSigBits, const int shift, const int offset,
00242 SoCudaBufferObject *rgbaBufferObject, const int numRgba
00243 );
00244
00245 private:
00246
00247 SoCudaHandle* m_floatToRGBAHandle;
00248 SoCudaHandle* m_convertHandles[ 6 ];
00249 SoCudaHandle* m_floatToUCharHandle;
00250 SoCudaHandle* m_mapDataRangeToIndexHandle;
00251 SoCudaHandle* m_mapDataToIndexHandle;
00252 SoCudaHandle* m_mapDataToRgbaHandle;
00253 SoCudaHandle* m_mapDataRangeToRgbaHandle;
00254 };
00255
00256 #endif //SOCUDACONVERTION_H
00257
00258