00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef SOTVIZRENDER_H
00024 #define SOTVIZRENDER_H
00025 
00026 #include <TerrainViz/nodes/SoTViz.h>
00027 #include <stdio.h>
00028 #include <TerrainViz/SbTVizData.h>
00029 #include <TerrainViz/SbTVizTextureList.h>
00030 #include <Inventor/fields/SoSFFloat.h>
00031 #include <Inventor/fields/SoSFInt32.h>
00032 #include <Inventor/fields/SoSFEnum.h>
00033 #include <Inventor/nodes/SoShape.h>
00034 #include <Inventor/actions/SoGLRenderAction.h>
00035 #include <TerrainViz/SbTVizColorScale.h>
00036 #include <Inventor/fields/SoSFNode.h> 
00037 
00038 class SiTVizFrustumManager;
00039 class SiTVizTextureManager;
00040 class SiTVizTesselator;
00041 class SiTVizContouringManager;
00042 class SoCache;
00043 
00044 class SoDEPRECATED SoTVizRender : public SoShape {
00207   SO_NODE_HEADER(SoTVizRender);
00208 
00209  public:
00210 
00211   enum MappingMode {
00215     TVIZ_TEXTURES = 0,
00219     TVIZ_COLORSCALE
00220   };
00221 
00222   enum NormalQuality {
00227     TVIZ_32BIT_NORMALS = 0,
00232     TVIZ_64BIT_NORMALS
00233   };
00234 
00235   enum CopyPolicy {
00239     COPY = 0,
00243     NO_COPY = 1,
00247     NO_COPY_AND_DELETE = 2
00248   };
00249   
00253   SoTVizRender();
00254 
00264   SbBool loadFromXML(const FILE* fd);
00271   SbBool loadFromXML(const char* fileName);
00272 
00277   void setData(const SbTVizData* data, CopyPolicy cp = SoTVizRender::NO_COPY);
00281   const SbTVizData* getData() const;
00286   void  setTextureList(const SbTVizTextureList* texList, CopyPolicy cp = SoTVizRender::NO_COPY);
00290   const SbTVizTextureList* getTextureList() const;
00295   void   setColorScale(const SbTVizColorScale* colorScale, CopyPolicy cp = SoTVizRender::NO_COPY);
00299   const  SbTVizColorScale* getColorScale() const;
00300 
00301 
00307   SbBool writeToXML(const SbString& fileName);
00313   SbBool writeToXML(const char* fileName);
00314 
00315         
00320   void showTarget(SbBool state);
00321 
00322 
00323   
00328   SoSFNode camera;
00329 
00330 
00331 
00336   SoSFInt32 maxRenderedTriangles;
00337 
00344   SoSFEnum  mappingMode;
00345 
00346 
00352   SoSFBool  frustumCulling;
00353 
00354 
00358   SoSFBool  normals;
00359 
00367   SoSFEnum  normalQuality;
00368 
00369 #if 1             SoDEPRECATED
00379   SoSFFloat triangleSizeAttenuation;
00380 SoDEPRECATED
00392   SoSFFloat distanceAttenuation;
00393 
00394 #endif 
00396  private:
00397   virtual void GLRender(SoGLRenderAction *action);
00398   virtual void generatePrimitives(SoAction *action);
00399   virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00400 
00401 
00402  private:
00403   static void initClass();
00404   static void exitClass();
00405 
00406  private:
00407   virtual ~SoTVizRender();
00408 
00409   
00410   virtual void  computeBBox(SoAction *action, SbBox3f &box,
00411                             SbVec3f ¢er);
00412 
00413 
00414  private:
00415   void firstRender(SoAction* action, SbBool useNormals);
00416   void updateFrustumManager(SoState *state, SbViewVolume *viewVolume);
00417   SbBool isCacheValid(SoState *state);
00418 
00419   SbTVizData*               m_data;
00420   SbTVizTextureList*        m_texList;
00421   SiTVizFrustumManager*     m_frustumMgr;
00422   SiTVizTextureManager*     m_textureMgr;
00423   SiTVizTesselator*         m_tesselator;
00424   SiTVizContouringManager*  m_contouringMgr;
00425   SbTVizColorScale*         m_colorScale;
00426   SbBool                    m_firstRender;
00427   SbMatrix                  m_currentModelMatrix;
00428   SbMatrix                  m_TVIZModelMatrix;
00429   SbBool                    m_showTarget;
00430   SbBool                    m_renderingFlag;
00431   SoCache*                  m_sceneCache;               
00432   uint64_t                  m_lastNodeId;
00433   float                     m_aspectRatio;
00434   char                      m_currentDir[2048];
00435 
00436   SbBool                    m_TVIZCompat20;
00437   CopyPolicy                m_deleteTextureListIfNewer;
00438   CopyPolicy                m_deleteDataIfNewer;
00439   CopyPolicy                m_deleteColorScaleIfNewer;
00440 
00442   
00443   
00444   
00445   
00446   
00447   
00449 
00450 };
00451 
00452 #endif
00453 
00454