00001 #ifndef _SO_FENCE_SLICE_ 00002 #define _SO_FENCE_SLICE_ 00003 00004 #ifdef _WIN32 00005 #pragma warning( push ) 00006 #pragma warning(disable:4251) 00007 #endif 00008 00009 #include <Inventor/fields/SoMFVec2f.h> 00010 #include <Inventor/SbBox.h> 00011 #include <Inventor/STL/vector> 00012 #include <Inventor/STL/pair> 00013 00014 #include <LDM/SoLDMTileID.h> 00015 00016 00017 #include <VolumeViz/nodes/SoSlice.h> 00018 00019 class SoCache ; 00020 class SoLDMNodeFrontManager; 00021 class SoVolumeData; 00022 class SoVolumeStateFenceSlice; 00023 class SoVolumeFaceSet; 00024 class SoVertexProperty; 00025 00250 class SoFenceSlice : public SoSlice 00251 { 00252 SO_NODE_HEADER( SoFenceSlice ); 00253 00254 public: 00258 SoFenceSlice(); 00259 00269 SoMFVec2f points; 00270 00271 enum Axis { 00272 X, 00273 Y, 00275 Z 00276 }; 00277 00282 SoSFEnum axis; 00283 00287 virtual bool intersect(SoLDMNodeFrontManager* nfm, const SoLDMTileID& tileId); 00288 00295 static SbBool isSupported(SoState* state=NULL); 00296 00297 private: 00301 virtual void computeBBox( SoAction *action, SbBox3f &box, SbVec3f ¢er ); 00302 00303 virtual void computeBBox(SoAction *action, SbXfBox3d &box, SbVec3d ¢er); 00304 00306 virtual void notify(SoNotList *list); 00307 00309 bool intersectGeometry(const SoLDMTileID& tile) const; 00310 00311 virtual void doAction( SoAction *action ); 00312 00313 virtual void callback( SoCallbackAction *action ); 00314 00315 virtual void GLRender( SoGLRenderAction *action ); 00316 00317 virtual void rayPick( SoRayPickAction *action ); 00318 00319 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00320 00321 private: 00322 00323 static void initClass(); 00324 static void exitClass(); 00325 00326 private: 00327 00331 virtual void generatePrimitives(SoAction *action); 00332 00336 virtual void doRendering(SoGLRenderAction *action); 00337 00341 virtual ~SoFenceSlice(); 00342 00343 SoINTERNAL private: 00344 00345 virtual void ldmAction( SoLdmValuationAction* action ); 00346 00347 private: 00348 00349 typedef std::vector<SbVec3f> VertexVector; 00350 typedef std::pair<float, float> FloatPair; 00351 00357 SoVolumeFaceSet* getGeometry( SoAction* action = NULL) const; 00358 00360 void computeVertexProperties( SoAction* action ); 00361 00369 bool intersectLine(const SbBox3f& tileBbox, const SbVec2f& p0, 00370 const SbVec2f& p1, SbVec2f* clippedLine, 00371 FloatPair& alpha) const; 00372 00373 SoVertexProperty *m_vertexProperty; 00374 mutable SoVolumeFaceSet* m_geometry; 00375 00377 std::vector<SbVec3f> m_normals; 00378 00379 bool m_needRecomputeGeom; 00380 00382 mutable SbThreadMutex m_mutex; 00383 00384 }; 00385 00386 #ifdef _WIN32 00387 #pragma warning( pop ) 00388 #endif 00389 #endif // _SO_FENCE_SLICE_ 00390 00391 00392