00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SO_ROI_
00024 #define _SO_ROI_
00025
00026 #include <Inventor/nodes/SoNode.h>
00027 #include <Inventor/fields/SoSFInt32.h>
00028 #include <Inventor/fields/SoSFBox3i32.h>
00029 #include <Inventor/fields/SoSFBitMask.h>
00030 #include <Inventor/fields/SoSFBool.h>
00031 #include <Inventor/sensors/SoNodeSensor.h>
00032
00033
00034 class SoGLRenderAction;
00035 class SoCallbackAction;
00036 class SoWriteAction;
00037
00320 class SoROI : public SoNode {
00321 SO_NODE_HEADER( SoROI );
00322
00323 public:
00335 SoSFInt32 dataSetId;
00336
00343 SoSFBox3i32 box;
00344
00349 SoSFBitMask flags;
00350
00354 enum Flags {
00356 ENABLE_X0 = 0x1,
00358 ENABLE_Y0 = 0x2,
00360 ENABLE_Z0 = 0x4,
00362 INVERT_0 = 0x8,
00363
00365 ENABLE_X1 = 0x10,
00367 ENABLE_Y1 = 0x20,
00369 ENABLE_Z1 = 0x40,
00371 INVERT_1 = 0x80,
00372
00374 ENABLE_X2 = 0x100,
00376 ENABLE_Y2 = 0x200,
00378 ENABLE_Z2 = 0x400,
00380 INVERT_2 = 0x800,
00381
00386 OR_SELECT = 0x1000,
00387
00392 INVERT_OUTPUT = 0x2000,
00393
00395 SUB_VOLUME = ENABLE_X0 | ENABLE_Y0 | ENABLE_Z0,
00396 EXCLUSION_BOX = SUB_VOLUME | INVERT_OUTPUT,
00397 CROSS = ENABLE_X0 | ENABLE_Y0 | ENABLE_Y1 | ENABLE_Z1 | ENABLE_X2 | ENABLE_Z2 | OR_SELECT,
00398 CROSS_INVERT = CROSS | INVERT_OUTPUT,
00399 FENCE = ENABLE_X0 | ENABLE_Y1 | ENABLE_Z2 | OR_SELECT,
00400 FENCE_INVERT = FENCE | INVERT_OUTPUT
00401 };
00402
00407 SoSFBox3i32 subVolume;
00408
00415 SoSFBool relative;
00416
00420 SoROI();
00421
00422 private:
00424 virtual void doAction( SoAction *action );
00426 virtual void callback( SoCallbackAction *action );
00428 virtual void GLRender( SoGLRenderAction *action );
00430 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00432 virtual void pick(SoPickAction *action) ;
00434 virtual void write(SoWriteAction *action);
00435
00437 virtual SoNode* getAlternateRep( SoAction* action );
00438
00439
00440
00441 private:
00442 static void initClass();
00443 static void exitClass();
00444
00451 int getVisibleBoxes(SbBox3i32* &boxes, const SbVec3i32 &dim);
00452
00458 void getVisibleBoundingBox(SbBox3i32& box, const SbVec3i32 &dim);
00459
00460 private:
00461
00462 virtual ~SoROI();
00463
00464 private:
00465 SoNodeSensor *m_FiedsNS;
00466 int m_NumVisBoxes;
00467 SbBox3i32 *m_VisBoxes;
00468 SbVec3i32 m_dim;
00469 unsigned int getVisibleParts();
00470 static void fieldsChangedCB(void *, SoSensor *);
00471
00472 };
00473
00474
00475 #endif // _SO_ROI_
00476
00477
00478