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/fields/SoSFInt32.h> 00011 #include <Inventor/SbBox.h> 00012 #include <Inventor/STL/vector> 00013 #include <Inventor/STL/pair> 00014 00015 #include <LDM/SoLDMTileID.h> 00016 00017 00018 #include <VolumeViz/nodes/SoSlice.h> 00019 00020 class SoCache ; 00021 class SoLDMNodeFrontManager; 00022 class SoVolumeData; 00023 class SoVolumeStateFenceSlice; 00024 class SoVolumeFaceSet; 00025 class SoVertexProperty; 00026 00272 class SoFenceSlice : public SoSlice 00273 { 00274 SO_NODE_HEADER( SoFenceSlice ); 00275 00276 public: 00280 SoFenceSlice(); 00281 00293 SoSFInt32 dataSetId; 00294 00304 SoMFVec2f points; 00305 00306 enum Axis { 00307 X, 00308 Y, 00310 Z 00311 }; 00312 00317 SoSFEnum axis; 00318 00325 static SbBool isSupported(SoState* state=NULL); 00326 00327 private: 00331 virtual void computeBBox( SoAction *action, SbBox3f &box, SbVec3f ¢er ); 00332 00333 virtual void computeBBox(SoAction *action, SbXfBox3d &box, SbVec3d ¢er); 00334 00336 bool intersectGeometry(const SoLDMTileID& tile) const; 00337 00338 virtual void doAction( SoAction *action ); 00339 00340 virtual void callback( SoCallbackAction *action ); 00341 00342 virtual void GLRender( SoGLRenderAction *action ); 00343 00344 virtual void rayPick( SoRayPickAction *action ); 00345 00346 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00347 00348 private: 00349 00350 static void initClass(); 00351 static void exitClass(); 00352 00356 virtual bool intersect( SoLDMNodeFrontManager* nfm, const SoLDMTileID& tileId ); 00357 00359 virtual void notify(SoNotList *list); 00360 00361 private: 00362 00366 virtual void generatePrimitives(SoAction *action); 00367 00371 virtual void doRendering(SoGLRenderAction *action); 00372 00376 virtual ~SoFenceSlice(); 00377 00378 SoINTERNAL private: 00379 00380 virtual void ldmAction( SoLdmValuationAction* action ); 00381 00382 private: 00383 00384 typedef std::vector<SbVec3f> VertexVector; 00385 typedef std::pair<float, float> FloatPair; 00386 00392 SoVolumeFaceSet* getGeometry( SoAction* action = NULL) const; 00393 00395 void computeVertexProperties( SoAction* action ); 00396 00404 bool intersectLine(const SbBox3f& tileBbox, const SbVec2f& p0, 00405 const SbVec2f& p1, SbVec2f* clippedLine, 00406 FloatPair& alpha) const; 00407 00408 SoVertexProperty *m_vertexProperty; 00409 mutable SoVolumeFaceSet* m_geometry; 00410 00412 std::vector<SbVec3f> m_normals; 00413 00414 bool m_needRecomputeGeom; 00415 00417 mutable SbThreadMutex m_mutex; 00418 00419 }; 00420 00421 #ifdef _WIN32 00422 #pragma warning( pop ) 00423 #endif 00424 #endif // _SO_FENCE_SLICE_ 00425 00426 00427