Back to index

supertuxkart  0.5+dfsg1
GL_Simplex1to4.cpp
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 #include "GL_Simplex1to4.h"
00016 #include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h"
00017 #include "GL_ShapeDrawer.h"
00018 #ifdef WIN32
00019 #include <windows.h>
00020 #endif
00021 
00022 //think different
00023 #if defined(__APPLE__) && !defined (VMDMESA)
00024 #include <OpenGL/gl.h>
00025 #include <OpenGL/glu.h>
00026 #else
00027 #include <GL/gl.h>
00028 #endif
00029 #include "GlutStuff.h"
00030 #include "LinearMath/btTransform.h"
00031 
00032 GL_Simplex1to4::GL_Simplex1to4()
00033 :m_simplexSolver(0)
00034 {
00035 }
00036 
00040 void   GL_Simplex1to4::calcClosest(btScalar* m)
00041 {
00042        btTransform tr;
00043        tr.setFromOpenGLMatrix(m);
00044        
00045 
00046 
00047                      GL_ShapeDrawer::drawCoordSystem();
00048                      
00049                      if (m_simplexSolver)
00050                      {
00051                             m_simplexSolver->reset();
00052                             bool res;
00053 
00054                             btVector3 v;
00055 
00056                             for (int i=0;i<m_numVertices;i++)
00057                             {
00058                                    v =  tr(m_vertices[i]);
00059                                    m_simplexSolver->addVertex(v,v,btPoint3(0.f,0.f,0.f));
00060                                    res = m_simplexSolver->closest(v);
00061                             }
00062 
00063                             //draw v?
00064                             glDisable(GL_LIGHTING);
00065                             glBegin(GL_LINES);
00066                             btglColor3(1.f, 0.f, 0.f);
00067                             btglVertex3(0.f, 0.f, 0.f);
00068                             btglVertex3(v.x(),v.y(),v.z());
00069                             glEnd();
00070                             
00071                             glEnable(GL_LIGHTING);
00072 
00073 
00074                      }
00075 
00076 }