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 00249 class SoFenceSlice : public SoSlice 00250 { 00251 SO_NODE_HEADER( SoFenceSlice ); 00252 00253 public: 00257 SoFenceSlice(); 00258 00268 SoMFVec2f points; 00269 00270 enum Axis { 00271 X, 00272 Y, 00274 Z 00275 }; 00276 00281 SoSFEnum axis; 00282 00289 static SbBool isSupported(SoState* state=NULL); 00290 00291 private: 00295 virtual void computeBBox( SoAction *action, SbBox3f &box, SbVec3f ¢er ); 00296 00297 virtual void computeBBox(SoAction *action, SbXfBox3d &box, SbVec3d ¢er); 00298 00300 bool intersectGeometry(const SoLDMTileID& tile) const; 00301 00302 virtual void doAction( SoAction *action ); 00303 00304 virtual void callback( SoCallbackAction *action ); 00305 00306 virtual void GLRender( SoGLRenderAction *action ); 00307 00308 virtual void rayPick( SoRayPickAction *action ); 00309 00310 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00311 00312 private: 00313 00314 static void initClass(); 00315 static void exitClass(); 00316 00320 virtual bool intersect( SoLDMNodeFrontManager* nfm, const SoLDMTileID& tileId ); 00321 00323 virtual void notify(SoNotList *list); 00324 00325 private: 00326 00330 virtual void generatePrimitives(SoAction *action); 00331 00335 virtual void doRendering(SoGLRenderAction *action); 00336 00340 virtual ~SoFenceSlice(); 00341 00342 SoINTERNAL private: 00343 00344 virtual void ldmAction( SoLdmValuationAction* action ); 00345 00346 private: 00347 00348 typedef std::vector<SbVec3f> VertexVector; 00349 typedef std::pair<float, float> FloatPair; 00350 00356 SoVolumeFaceSet* getGeometry( SoAction* action = NULL) const; 00357 00359 void computeVertexProperties( SoAction* action ); 00360 00368 bool intersectLine(const SbBox3f& tileBbox, const SbVec2f& p0, 00369 const SbVec2f& p1, SbVec2f* clippedLine, 00370 FloatPair& alpha) const; 00371 00372 SoVertexProperty *m_vertexProperty; 00373 mutable SoVolumeFaceSet* m_geometry; 00374 00376 std::vector<SbVec3f> m_normals; 00377 00378 bool m_needRecomputeGeom; 00379 00381 mutable SbThreadMutex m_mutex; 00382 00383 }; 00384 00385 #ifdef _WIN32 00386 #pragma warning( pop ) 00387 #endif 00388 #endif // _SO_FENCE_SLICE_ 00389 00390 00391