#include "X3D_MyGLBuilderGeometry3DVisitor.h" #include "X3D_Icosahedron.h" #include "GL_Icosahedron.h" #include using namespace std; namespace X3DTK { namespace X3D { MyGLBuilderGeometry3DVisitor::MyGLBuilderGeometry3DVisitor() : GLBuilderGeometry3DVisitor() { // Define new enter function for Icosahedron. Note that it is the instanciation of a template method // with implicit parameters. define(Recorder::getEnterFunction(&MyGLBuilderGeometry3DVisitor::enterIcosahedron)); } void MyGLBuilderGeometry3DVisitor::enterIcosahedron(Icosahedron *I) { // StateVariables assignation GLBuilderStateVariables *stateVariables = Singleton::getInstance(); // Checking whether I has been visited or not. GL::X3DNode *GI = stateVariables->getNode(I); if (GI == 0) { // Creating a new GL::Icosahedron. GI = new GL::Icosahedron(); GI->setX3DReference(I); // Recording the couple (I, GI) to avoid to create a new GL::Icosahedron // if I is visited a second time. stateVariables->addCoupleNode(I, GI); } // Pushing GI in the GL nodes stack. stateVariables->pushNode(GI); } } }