00001 #include "GLCreatorGroupingVisitor.h" 00002 #include "Group.h" 00003 #include "StaticGroup.h" 00004 #include "Transform.h" 00005 #include "GLGroup.h" 00006 #include "GLStaticGroup.h" 00007 #include "GLTransform.h" 00008 00009 #include <iostream> 00010 00011 using namespace X3DTK; 00012 using namespace std; 00013 00014 GLCreatorGroupingVisitor::GLCreatorGroupingVisitor() 00015 : GroupingVisitor() 00016 { 00017 // Enter functions. 00018 defineNewEnterFunction<GLCreatorGroupingVisitor, Group>(&GLCreatorGroupingVisitor::enterGroup); 00019 defineNewEnterFunction<GLCreatorGroupingVisitor, StaticGroup>(&GLCreatorGroupingVisitor::enterStaticGroup); 00020 defineNewEnterFunction<GLCreatorGroupingVisitor, Transform>(&GLCreatorGroupingVisitor::enterTransform); 00021 00022 // GlobalVariables assignation. 00023 globalVariables = GVManager::getInstanceOf<GLCreatorGlobalVariables>(); 00024 } 00025 00026 GLCreatorGroupingVisitor::~GLCreatorGroupingVisitor() 00027 { 00028 } 00029 00030 void GLCreatorGroupingVisitor::enterGroup(Group *G) const 00031 { 00032 GLGroup *GG = new GLGroup(); 00033 GG->setLink(G); 00034 globalVariables->getTop()->addChild(GG); 00035 globalVariables->pushNode(GG); 00036 } 00037 00038 void GLCreatorGroupingVisitor::enterStaticGroup(StaticGroup *S) const 00039 { 00040 GLStaticGroup *GS = new GLStaticGroup(); 00041 GS->setLink(S); 00042 globalVariables->getTop()->addChild(GS); 00043 globalVariables->pushNode(GS); 00044 } 00045 00046 void GLCreatorGroupingVisitor::enterTransform(Transform *T) const 00047 { 00048 GLTransform *GT = new GLTransform(); 00049 GT->setLink(T); 00050 globalVariables->getTop()->addChild(GT); 00051 globalVariables->pushNode(GT); 00052 } 00053