00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #ifndef  _SO_CSG_GROUP_
00025 #define  _SO_CSG_GROUP_
00026 
00027 #include <SolidViz/SoSolidViz.h>
00028 
00029 #include <Inventor/fields/SoSFString.h>
00030 #include <Inventor/nodes/SoGroup.h>
00031 #include <Inventor/fields/SoSFBool.h>
00032 #include <Inventor/SbViewportRegion.h>
00033 
00034 #include <Inventor/sys/SoGLType.h>
00035 
00036 class SoSeparator ;
00037 class SoFieldSensor ;
00038 class SoDEPRECATED SoCSGGroup : public SoGroup {
00133   SO_NODE_HEADER( SoCSGGroup );
00134 
00135  public:
00140   SoSFString      expression; 
00141 
00150   SoSFBool        isShapesBefore;
00151 
00157   SoSFBool        isActive ;
00158 
00170   SoSFBool    boundingBoxPruningEnabled ;
00171 
00175   SoCSGGroup();
00179   SoCSGGroup(int nChildren);
00180 
00181 #ifndef HIDDEN_FROM_DOC
00182   
00183   SoNode* getGeometry() const ;
00184 #endif
00185 
00186  private:
00187   
00188   virtual void GLRender(SoGLRenderAction *action);
00189 
00190   
00191 
00192  private:
00193   static void initClass() ;
00194   static void exitClass() ;
00195 
00196  private:
00197   virtual ~SoCSGGroup();
00198 
00199  private:
00200   struct SoCSGProduct {
00201     int       targetPrim ;
00202     SbBool    frontFace ;
00203     int       whichSurface ;
00204     int       targetConvexity ;
00205     SbIntList trimmingPrims ;
00206     SbIntList isComplemented ;
00207   };
00208 
00209   SbBool            m_isShapesBefore ;
00210   SbBool            m_isReinterpretExpression;
00211   SbBool            m_shouldInvalidateCache ;
00212   GLuint            m_viewportRegion[4] ;
00213   SoFieldSensor    *m_expressionSensor, *m_isActiveSensor ;
00214   SoGLRenderAction *m_action;
00215   SoState          *m_state ;
00216   GLint             m_stenSize;
00217   int               m_numProducts;
00218   GLfloat          *m_depthResults;
00219   int               m_sCountMask;
00220   int               m_sPMask;
00221   int               m_sPShift;
00222   
00223   SoCSGProduct     *m_products;
00224   SbBox3f          *m_solidBBoxList ;
00225   
00226   uint64_t          m_lastNodeId ;
00227 
00228   
00229   void interpretExpression( void );
00230 
00231   
00232   void computeSolidsBBox(void) ;
00233 
00234   
00235   void pruneCSGProducts(void) ;
00236 
00237 #ifdef _WIN32
00238   HANDLE m_bufferRegionHandle;
00239 #endif
00240 
00241  private:
00242   void drawFarRect(void);
00243   void redrawCSG(void);
00244   void saveDepth(void);
00245   SbBool markProductPixels(int product, int accumBit);
00246   void restoreDepth(void);
00247   SbBool drawProduct(int product, int accumBit);
00248   SbBool renderPrimDepths(const SoCSGProduct *p);
00249   SbBool trimWithPrimitive(int trimPrim, int isComplemented);
00250   void pushOrthoView(float left, float right, float bottom, float top,float znear, float zfar) ;
00251   void popView(void);
00252   void drawPrim(int i);
00253   void commontInit(void) ;
00254 
00255   static unsigned char countNeededBits(unsigned char byte) ;
00256 
00257   static void parseExpressionError(int number) ;
00258   static void isActiveSensorCB(void *data, SoSensor *) ;
00259   static void expressionSensorCB(void *data, SoSensor *) ;
00260 
00261 };
00262 
00263 #endif // _SO_CSG_GROUP_
00264 
00265