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/SoSFBox3i32.h>
00028 #include <Inventor/fields/SoSFBitMask.h>
00029 #include <Inventor/fields/SoSFBool.h>
00030 #include <Inventor/sensors/SoNodeSensor.h>
00031
00032
00033 class SoGLRenderAction;
00034 class SoCallbackAction;
00035 class SoWriteAction;
00036
00315 class SoROI : public SoNode {
00316 SO_NODE_HEADER( SoROI );
00317
00318 public:
00325 SoSFBox3i32 box;
00326
00331 SoSFBitMask flags;
00332
00336 enum Flags {
00338 ENABLE_X0 = 0x1,
00340 ENABLE_Y0 = 0x2,
00342 ENABLE_Z0 = 0x4,
00344 INVERT_0 = 0x8,
00345
00347 ENABLE_X1 = 0x10,
00349 ENABLE_Y1 = 0x20,
00351 ENABLE_Z1 = 0x40,
00353 INVERT_1 = 0x80,
00354
00356 ENABLE_X2 = 0x100,
00358 ENABLE_Y2 = 0x200,
00360 ENABLE_Z2 = 0x400,
00362 INVERT_2 = 0x800,
00363
00368 OR_SELECT = 0x1000,
00369
00374 INVERT_OUTPUT = 0x2000,
00375
00377 SUB_VOLUME = ENABLE_X0 | ENABLE_Y0 | ENABLE_Z0,
00378 EXCLUSION_BOX = SUB_VOLUME | INVERT_OUTPUT,
00379 CROSS = ENABLE_X0 | ENABLE_Y0 | ENABLE_Y1 | ENABLE_Z1 | ENABLE_X2 | ENABLE_Z2 | OR_SELECT,
00380 CROSS_INVERT = CROSS | INVERT_OUTPUT,
00381 FENCE = ENABLE_X0 | ENABLE_Y1 | ENABLE_Z2 | OR_SELECT,
00382 FENCE_INVERT = FENCE | INVERT_OUTPUT
00383 };
00384
00389 SoSFBox3i32 subVolume;
00390
00397 SoSFBool relative;
00398
00402 SoROI();
00403
00404 private:
00405 virtual void doAction( SoAction *action );
00406 virtual void callback( SoCallbackAction *action );
00407 virtual void GLRender( SoGLRenderAction *action );
00408 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00409 virtual void pick(SoPickAction *action) ;
00410 virtual void write(SoWriteAction *action);
00411
00412
00413
00414
00415 private:
00416 static void initClass();
00417 static void exitClass();
00418
00425 int getVisibleBoxes(SbBox3i32* &boxes, const SbVec3i32 &dim);
00426
00432 void getVisibleBoundingBox(SbBox3i32& box, const SbVec3i32 &dim);
00433
00434 virtual SoNode* getAlternateRep( SoAction* action );
00435
00436 private:
00437
00438 virtual ~SoROI();
00439
00440 private:
00441 SoNodeSensor *m_FiedsNS;
00442 int m_NumVisBoxes;
00443 SbBox3i32 *m_VisBoxes;
00444 SbVec3i32 m_dim;
00445 unsigned int getVisibleParts();
00446 static void fieldsChangedCB(void *, SoSensor *);
00447
00448 };
00449
00450
00451 #endif // _SO_ROI_
00452
00453
00454