00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SB_PROJECTION_
00025 #define _SB_PROJECTION_
00026
00027 #include <Inventor/SbLinear.h>
00028 #include <Inventor/SbString.h>
00029
00030 #include <Inventor/STL/vector>
00031
00032 #if defined(_WIN32)
00033 #pragma warning( push )
00034 #pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
00035 #endif
00036
00037 #define NUM_MAX_PARAMS 256
00038 #define MAX_PARAM_LENGTH 256
00039
00040 class SoProjection;
00041
00097 class SbProjection
00098 {
00099
00100 public:
00101
00105 SbProjection();
00106
00110 SbProjection(SoProjection *node);
00111
00115 SbProjection(const SbProjection &proj);
00116
00120 virtual ~SbProjection();
00121
00125 virtual void init(){}
00126
00130 virtual void exit(){}
00131
00135 virtual void inverse(SbVec3f &point);
00136
00147 virtual bool getProjectedBoundingBox(SbBox3f& bbox);
00148
00153 void project(SbVec3f &point);
00154
00159 void project( int numPoints, float *points);
00160
00166 void project(int32_t numCoords, const SbVec3f *coords, SbVec3f *projectedCoords);
00167
00171 inline SoProjection *getProjectionNode() const
00172 {return m_projection;}
00173
00177 virtual void setParameter( int parameterId, const SbString ¶meterString );
00178
00182 virtual void setParameter( int parameterId, const float ¶meterFloat );
00183
00187 void setNumStringParameters( int numParameters );
00188
00192 void setNumFloatParameters( int numParameters );
00193
00197 int getNumStringParameters() const;
00198
00202 int getNumFloatParameters() const;
00203
00208 SbBool getParameter( int pos, SbString& parameter ) const;
00209
00215 SbBool getParameter( int pos, float& parameter ) const;
00216
00217 SoEXTENDER_Documented private:
00221 virtual void apply(SbVec3f &point);
00222
00226 virtual void applyPreProjection( SbVec3f &point );
00227
00231 virtual void applyPostProjection( SbVec3f &point );
00232
00233 private:
00234
00239 virtual void internalSetParameter( int parameterId, const SbString ¶meterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE);
00240
00245 virtual void internalSetParameter( int parameterId, const float ¶meterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE);
00246
00251 virtual void internalSetParameterIn( int parameterId, const SbString ¶meterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE);
00252
00253
00254 void copyParams();
00255
00256 private:
00257
00258
00259 void initParameters();
00260
00261
00262 void afterSettingParameters( SbBool notifyNode, SbBool callInit );
00263
00264
00265 char *m_stringParameters[NUM_MAX_PARAMS];
00266
00267
00268 int m_numStringParams;
00269
00270
00271 char *m_stringParametersIn[NUM_MAX_PARAMS];
00272
00273
00274 int m_numStringParamsIn;
00275
00276
00277 std::vector< float > m_floatParameters;
00278
00279
00280 void applyMatrix(SbVec3f &point);
00281
00282 static const double deg2rad;
00283 static const double rad2deg;
00284
00285 private:
00287 SoProjection *m_projection;
00288 };
00289
00290
00291 inline void SbProjection::apply(SbVec3f &)
00292 {}
00293
00294 inline void SbProjection::inverse(SbVec3f &)
00295 {}
00296
00297 inline void SbProjection::applyPreProjection( SbVec3f &)
00298 {}
00299
00300 inline void SbProjection::applyPostProjection( SbVec3f &)
00301 {}
00302
00303 inline bool SbProjection::getProjectedBoundingBox(SbBox3f& )
00304 { return false; }
00305
00306 #if defined(_WIN32)
00307 #pragma warning( pop )
00308 #endif
00309
00310 #endif
00311
00312
00313