00001 00002 // GLBuilderShapeVisitor.h // 00004 00005 #ifndef GLBUILDERSHAPEVISITOR_H 00006 #define GLBUILDERSHAPEVISITOR_H 00007 00008 #include "ShapeVisitor.h" 00009 #include "GLBuilderGlobalVariables.h" 00010 00011 namespace X3DTK { 00012 namespace X3D { 00013 00014 class Appearance; 00015 class FillProperties; 00016 class LineProperties; 00017 class Material; 00018 class Shape; 00019 00021 00022 class GLBuilderShapeVisitor : public ShapeVisitor 00023 { 00024 public: 00026 GLBuilderShapeVisitor(); 00028 virtual ~GLBuilderShapeVisitor(); 00029 00030 /* 00031 virtual void enterAppearance(Appearance *A) const; 00033 virtual void enterFillProperties(FillProperties *F) const; 00035 virtual void enterLineProperties(LineProperties *L) const; 00037 virtual void enterMaterial(Material *M) const; 00039 virtual void enterShape(Shape *S) const;*/ 00040 00041 template<class T, class G> 00042 void enterNode(T *N) const 00043 { 00044 GL::SFNode GN = globalVariables->getNode(N); 00045 if (GN == 0) 00046 { 00047 GN = new G(); 00048 GN->setX3DReference(N); 00049 globalVariables->addCoupleNode(N, GN); 00050 } 00051 globalVariables->pushNode(GN); 00052 }; 00053 00054 protected: 00055 GLBuilderGlobalVariables *globalVariables; 00056 }; 00057 00058 } 00059 } 00060 00061 #endif