first step in refactoring/cleaning up demos
This commit is contained in:
@@ -22,22 +22,10 @@ subject to the following restrictions:
|
||||
#include "SimdQuaternion.h"
|
||||
#include "SimdTransform.h"
|
||||
#include "GL_ShapeDrawer.h"
|
||||
#ifdef WIN32 //needed for glut.h
|
||||
#include <windows.h>
|
||||
#endif
|
||||
//think different
|
||||
#if defined(__APPLE__) && !defined (VMDMESA)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
#include "GlutStuff.h"
|
||||
|
||||
|
||||
|
||||
#include "NarrowPhaseCollision/VoronoiSimplexSolver.h"
|
||||
#include "SimplexDemo.h"
|
||||
#include "GlutStuff.h"
|
||||
|
||||
VoronoiSimplexSolver simplexSolver;
|
||||
|
||||
@@ -61,34 +49,26 @@ PolyhedralConvexShape* shapePtr[maxNumObjects];
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
|
||||
simplex.SetSimplexSolver(&simplexSolver);
|
||||
SimplexDemo* demo = new SimplexDemo();
|
||||
|
||||
simplex.AddVertex(SimdPoint3(-2,0,-2));
|
||||
simplex.AddVertex(SimdPoint3(2,0,-2));
|
||||
simplex.AddVertex(SimdPoint3(0,0,2));
|
||||
simplex.AddVertex(SimdPoint3(0,2,0));
|
||||
|
||||
shapePtr[0] = &simplex;
|
||||
|
||||
SimdTransform tr;
|
||||
tr.setIdentity();
|
||||
|
||||
return glutmain(argc, argv,screenWidth,screenHeight,"SimplexDemo");
|
||||
demo->initPhysics();
|
||||
|
||||
return glutmain(argc, argv,screenWidth,screenHeight,"SimplexDemo",demo);
|
||||
}
|
||||
|
||||
//to be implemented by the demo
|
||||
|
||||
void clientMoveAndDisplay()
|
||||
void SimplexDemo::clientMoveAndDisplay()
|
||||
{
|
||||
|
||||
clientDisplay();
|
||||
displayCallback();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void clientDisplay(void) {
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
void SimplexDemo::displayCallback()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
GL_ShapeDrawer::DrawCoordSystem();
|
||||
@@ -121,26 +101,18 @@ void clientDisplay(void) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
void clientResetScene()
|
||||
void SimplexDemo::initPhysics()
|
||||
{
|
||||
|
||||
}
|
||||
simplex.SetSimplexSolver(&simplexSolver);
|
||||
|
||||
void clientSpecialKeyboard(int key, int x, int y)
|
||||
{
|
||||
defaultSpecialKeyboard(key,x,y);
|
||||
}
|
||||
simplex.AddVertex(SimdPoint3(-2,0,-2));
|
||||
simplex.AddVertex(SimdPoint3(2,0,-2));
|
||||
simplex.AddVertex(SimdPoint3(0,0,2));
|
||||
simplex.AddVertex(SimdPoint3(0,2,0));
|
||||
|
||||
void clientKeyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
defaultKeyboard(key, x, y);
|
||||
}
|
||||
shapePtr[0] = &simplex;
|
||||
|
||||
|
||||
void clientMouseFunc(int button, int state, int x, int y)
|
||||
{
|
||||
|
||||
}
|
||||
void clientMotionFunc(int x,int y)
|
||||
{
|
||||
}
|
||||
SimdTransform tr;
|
||||
tr.setIdentity();
|
||||
}
|
||||
36
Demos/SimplexDemo/SimplexDemo.h
Normal file
36
Demos/SimplexDemo/SimplexDemo.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
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.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#ifndef SIMPLEX_DEMO_H
|
||||
#define SIMPLEX_DEMO_H
|
||||
|
||||
#include "DemoApplication.h"
|
||||
|
||||
///SimplexDemo shows the working of the sub-distance algorithm, used inside GJK
|
||||
class SimplexDemo : public DemoApplication
|
||||
{
|
||||
public:
|
||||
|
||||
void initPhysics();
|
||||
|
||||
virtual void clientMoveAndDisplay();
|
||||
|
||||
virtual void displayCallback();
|
||||
|
||||
virtual void clientResetScene()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif //SIMPLEX_DEMO_H
|
||||
Reference in New Issue
Block a user