Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

GLUpdaterGLGroupingVisitor.cpp

Go to the documentation of this file.
00001 #include "GLUpdaterGLGroupingVisitor.h"
00002 #include "GLGroup.h"
00003 #include "GLStaticGroup.h"
00004 #include "GLTransform.h"
00005 #include "Group.h"
00006 #include "StaticGroup.h"
00007 #include "Transform.h"
00008 
00009 using namespace X3DTK;
00010 
00011 GLUpdaterGLGroupingVisitor::GLUpdaterGLGroupingVisitor()
00012 : GLGroupingVisitor()
00013 {
00014   // Enter functions.
00015   defineNewEnterFunction<GLUpdaterGLGroupingVisitor, GLTransform>(&GLUpdaterGLGroupingVisitor::enterGLTransform);
00016 
00017   // GlobalVariables assignation.
00018   globalVariables = GVManager::getInstanceOf<GLUpdaterGlobalVariables>();
00019 }
00020 
00021 GLUpdaterGLGroupingVisitor::~GLUpdaterGLGroupingVisitor()
00022 {
00023 }
00024 
00025 void GLUpdaterGLGroupingVisitor::enterGLTransform(GLTransform *G) const
00026 {
00027   Transform *T = static_cast<Transform *>(G->getLink());
00028 
00029   //computing the transformMatrix
00030   SFMatrix34f Tr = translation(T->getTranslation());
00031   SFMatrix34f C = translation(T->getCenter());
00032   SFVec3f v(T->getRotation().x, T->getRotation().y, T->getRotation().z);
00033   SFMatrix34f R = rotation(T->getRotation().angle, v);
00034   SFVec3f vs(T->getScaleOrientation().x, T->getScaleOrientation().y, T->getScaleOrientation().z);
00035   SFMatrix34f SR = rotation(T->getScaleOrientation().angle, vs);
00036   SFMatrix34f S = scale34(T->getScale().x, T->getScale().y, T->getScale().z);
00037   SFMatrix34f iSR = rotation(-T->getScaleOrientation().angle, vs);
00038   SFMatrix34f iC = translation(-1.0f*T->getCenter());
00039   SFMatrix34f transform = Tr*C*R*SR*S*iSR*iC;
00040    
00041   transform.toFloat16(G->getTransformMatrix());
00042 }

Generated on Wed May 14 10:03:09 2003 for X3DToolKit by doxygen1.3