00001 #include "GLCreatorCoreVisitor.h"
00002 #include "Scene.h"
00003 #include "X3DNode.h"
00004 #include "GLScene.h"
00005
00006 #include <iostream>
00007
00008 using namespace X3DTK;
00009 using namespace std;
00010
00011 GLCreatorCoreVisitor::GLCreatorCoreVisitor()
00012 : CoreVisitor()
00013 {
00014
00015 defineNewEnterFunction<GLCreatorCoreVisitor, Scene>(&GLCreatorCoreVisitor::enterScene);
00016 defineNewEnterFunction<GLCreatorCoreVisitor, X3DNode>(&GLCreatorCoreVisitor::enterX3DNode);
00017
00018 defineNewLeaveFunction<GLCreatorCoreVisitor, X3DNode>(&GLCreatorCoreVisitor::leaveX3DNode);
00019
00020
00021 globalVariables = GVManager::getInstanceOf<GLCreatorGlobalVariables>();
00022 }
00023
00024 GLCreatorCoreVisitor::~GLCreatorCoreVisitor()
00025 {
00026 }
00027
00028 void GLCreatorCoreVisitor::enterScene(Scene *S) const
00029 {
00030 GLScene *GS = new GLScene();
00031 GS->setLink(S);
00032 globalVariables->pushNode(GS);
00033 }
00034
00035 void GLCreatorCoreVisitor::enterX3DNode(X3DNode *N) const
00036 {
00037 cerr << "enterX3DNode must not be called for " << N->getTypeName() << " !" << endl;
00038 }
00039
00040 void GLCreatorCoreVisitor::leaveX3DNode(X3DNode *N) const
00041 {
00042 globalVariables->popNode();
00043 }
00044