pass on rigid body name in btBulletWorldImporter, to make it easier to bind physics and graphics objects.
moved some obsolete files to Extras/obsolete, and removed freeglut moved ColladaDemo to Dynamica Maya plugin repository (it has COLLADA_DOM and libxml), see http://dynamica.googlecode.com Added new .bullet file Minor update in Bullet_User_Manual.pdf, removed obsolete Bullet_Faq.pdf
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
# This is basically the overall name of the project in Visual Studio this is the name of the Solution File
|
||||
|
||||
|
||||
# For every executable you have with a main method you should have an add_executable line below.
|
||||
# For every add executable line you should list every .cpp and .h file you have associated with that executable.
|
||||
|
||||
|
||||
|
||||
# You shouldn't have to modify anything below this line
|
||||
########################################################
|
||||
|
||||
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/Extras/BulletColladaConverter ${BULLET_PHYSICS_SOURCE_DIR}/Extras/LibXML ${BULLET_PHYSICS_SOURCE_DIR}/Extras/LibXML/include ${BULLET_PHYSICS_SOURCE_DIR}/Extras/COLLADA_DOM/include/1.4 ${BULLET_PHYSICS_SOURCE_DIR}/Extras/COLLADA_DOM/include ${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
|
||||
)
|
||||
|
||||
LINK_LIBRARIES(
|
||||
BulletColladaConverter ColladaDom XML OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(AppColladaDemo
|
||||
ColladaDemo.cpp
|
||||
)
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include "LinearMath/btQuickprof.h"
|
||||
#include "LinearMath/btIDebugDraw.h"
|
||||
#include "GLDebugDrawer.h"
|
||||
|
||||
#include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
|
||||
|
||||
//COLLADA_DOM and LibXML source code are included in Extras/ folder.
|
||||
//COLLADA_DOM should compile under all platforms, and is enabled by default.
|
||||
|
||||
#include "ColladaConverter.h"
|
||||
|
||||
#include "GLDebugFont.h"
|
||||
#include <stdio.h> //printf debugging
|
||||
|
||||
float deltaTime = 1.f/60.f;
|
||||
|
||||
#include "ColladaDemo.h"
|
||||
#include "GL_ShapeDrawer.h"
|
||||
#include "GlutStuff.h"
|
||||
|
||||
|
||||
///custom version of the converter, that creates physics objects/constraints
|
||||
class MyColladaConverter : public ColladaConverter
|
||||
{
|
||||
DemoApplication* m_demoApp;
|
||||
|
||||
public:
|
||||
MyColladaConverter(DemoApplication* demoApp)
|
||||
: ColladaConverter(demoApp->getDynamicsWorld()),
|
||||
m_demoApp(demoApp)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void setCameraInfo(const btVector3& camUp,int forwardAxis)
|
||||
{
|
||||
m_demoApp->setCameraUp(camUp);
|
||||
m_demoApp->setCameraForwardAxis(forwardAxis);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
MyColladaConverter* gColladaConverter = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
GLDebugDrawer debugDrawer;
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
|
||||
/// Import Collada 1.4 Physics objects
|
||||
/// also can pass filename in as argument
|
||||
const char* filename = "jenga.dae";
|
||||
printf("argc=%i\n",argc);
|
||||
{
|
||||
for (int i=0;i<argc;i++)
|
||||
{
|
||||
printf("argv[%i]=%s\n",i,argv[i]);
|
||||
}
|
||||
}
|
||||
if (argc>1)
|
||||
{
|
||||
filename = argv[1];
|
||||
}
|
||||
|
||||
ColladaDemo* colladaDemo = new ColladaDemo();
|
||||
|
||||
colladaDemo->initPhysics(filename);
|
||||
|
||||
|
||||
// colladaDemo->clientResetScene();
|
||||
|
||||
colladaDemo->setCameraDistance(26.f);
|
||||
|
||||
return glutmain(argc, argv,640,480,"Bullet COLLADA Physics Viewer http://bulletphysics.org",colladaDemo);
|
||||
}
|
||||
|
||||
void ColladaDemo::initPhysics()
|
||||
{
|
||||
const char* filename = "jenga.dae";
|
||||
initPhysics(filename);
|
||||
}
|
||||
|
||||
void ColladaDemo::initPhysics(const char* filename)
|
||||
{
|
||||
m_cameraUp = btVector3(0,0,1);
|
||||
m_ele = 60;
|
||||
m_forwardAxis = 1;
|
||||
|
||||
btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
|
||||
btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
|
||||
btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
|
||||
|
||||
btVector3 worldMin(-1000,-1000,-1000);
|
||||
btVector3 worldMax(1000,1000,1000);
|
||||
btBroadphaseInterface* pairCache = new btAxisSweep3(worldMin,worldMax);
|
||||
btConstraintSolver* constraintSolver = new btSequentialImpulseConstraintSolver();
|
||||
m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration);
|
||||
|
||||
//m_dynamicsWorld = new btSimpleDynamicsWorld();
|
||||
|
||||
m_dynamicsWorld->setDebugDrawer(&debugDrawer);
|
||||
|
||||
|
||||
MyColladaConverter* converter = new MyColladaConverter(this);
|
||||
|
||||
bool result = converter->load(filename);
|
||||
if (result)
|
||||
{
|
||||
gColladaConverter = converter;
|
||||
} else
|
||||
{
|
||||
gColladaConverter = 0;
|
||||
printf("gColladaConverter = 0\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColladaDemo::clientMoveAndDisplay()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float dt = getDeltaTimeMicroseconds() * 0.000001f;
|
||||
|
||||
m_dynamicsWorld->stepSimulation(dt);
|
||||
|
||||
//optional but useful: debug drawing
|
||||
m_dynamicsWorld->debugDrawWorld();
|
||||
|
||||
renderme();
|
||||
|
||||
glFlush();
|
||||
glutSwapBuffers();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ColladaDemo::displayCallback(void) {
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
||||
if (m_dynamicsWorld)
|
||||
m_dynamicsWorld->debugDrawWorld();
|
||||
|
||||
renderme();
|
||||
|
||||
|
||||
glFlush();
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ColladaDemo::keyboardCallback(unsigned char key, int x, int y)
|
||||
{
|
||||
if (key =='e')
|
||||
{
|
||||
//save a COLLADA .dae physics snapshot
|
||||
if (gColladaConverter)
|
||||
{
|
||||
if (gColladaConverter->getLastFileName())
|
||||
{
|
||||
//deal with the name pre/post fixing etc.
|
||||
char saveName[550];
|
||||
static int saveCount=1;
|
||||
sprintf(saveName,"%s%i",gColladaConverter->getLastFileName(),saveCount++);
|
||||
char* name = &saveName[0];
|
||||
if (name[0] == '/')
|
||||
{
|
||||
name = &saveName[1];
|
||||
}
|
||||
gColladaConverter->save(name);
|
||||
|
||||
} else
|
||||
{
|
||||
gColladaConverter->save("brandNew.dae");
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
DemoApplication::keyboardCallback(key,x,y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
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 COLLADA_PHYSICS_DEMO_H
|
||||
#define COLLADA_PHYSICS_DEMO_H
|
||||
|
||||
#include "GlutDemoApplication.h"
|
||||
|
||||
///ColladaDemo shows the loading and exporting of COLLADA physics xml files.
|
||||
///It uses COLLADA DOM
|
||||
class ColladaDemo : public GlutDemoApplication
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void initPhysics();
|
||||
|
||||
void initPhysics(const char* filename);
|
||||
|
||||
virtual void clientMoveAndDisplay();
|
||||
|
||||
virtual void displayCallback();
|
||||
|
||||
|
||||
virtual void keyboardCallback(unsigned char key, int x, int y);
|
||||
|
||||
};
|
||||
|
||||
#endif //COLLADA_PHYSICS_DEMO_H
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
SubDir TOP Demos ColladaDemo ;
|
||||
|
||||
#some demos need extra functionality, Collada / ConvexDecomposition etc.
|
||||
|
||||
rule ExtraDemo3
|
||||
|
||||
{
|
||||
Application $(<) : $(>) : noinstall console nomanifest ;
|
||||
LinkWith $(<) : BulletColladaConverter colladadom libxml bulletopenglsupport bulletdynamics bulletcollision bulletmath ;
|
||||
CFlags $(<) :
|
||||
[ FIncludes $(TOP)/Demos/OpenGL ]
|
||||
[ FIncludes $(TOP)/Extras/BulletColladaConverter ]
|
||||
[ FIncludes $(TOP)/Extras/COLLADA_DOM/include ]
|
||||
[ FIncludes $(TOP)/Extras/COLLADA_DOM/include/1.4 ]
|
||||
[ FIncludes $(TOP)/Extras/LibXML ]
|
||||
|
||||
[ FIncludes $(TOP)/Extras/LibXML/include ]
|
||||
|
||||
;
|
||||
|
||||
MsvcIncDirs $(<) :
|
||||
"../../Demos/OpenGL"
|
||||
"../../Extras/BulletColladaConverter"
|
||||
"../../Extras/COLLADA_DOM/include"
|
||||
"../../Extras/COLLADA_DOM/include/1.4"
|
||||
"../../Extras/LibXML"
|
||||
"../../Extras/LibXML/include" ;
|
||||
}
|
||||
|
||||
ExtraDemo3 ColladaDemo : [ Wildcard *.h *.cpp ] ;
|
||||
|
||||
MsvcIncDirs ColladaDemo : "../../Extras/FCollada" ;
|
||||
@@ -1,5 +0,0 @@
|
||||
noinst_PROGRAMS=ColladaDemo
|
||||
|
||||
ColladaDemo_SOURCES=ColladaDemo.cpp ColladaDemo.h
|
||||
ColladaDemo_CXXFLAGS=-I@top_builddir@/src -I@top_builddir@/Demos/OpenGL -I@top_builddir@/Extras -I@top_builddir@/Extras/BulletColladaConverter $(CXXFLAGS)
|
||||
ColladaDemo_LDADD=-L../OpenGL -L../../Extras -L../../src -lbulletcolladaconverter -lbulletopenglsupport -lbulletdynamics -lbulletcollision -lbulletmath -lcollada_dom -lxml @opengl_LIBS@
|
||||
@@ -76,8 +76,7 @@ IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET AppSerializeDemo
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/testFileOriginal.bullet ${CMAKE_CURRENT_BINARY_DIR}/testFile.bullet
|
||||
####### COMMAND copy /Y \"${BULLET_PHYSICS_SOURCE_DIR}/Demos/SerializeDemo/testFile.bullet\" \"${CMAKE_CURRENT_BINARY_DIR}\"
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/SerializeDemo/testFile.bullet ${CMAKE_CURRENT_BINARY_DIR}/testFile.bullet
|
||||
)
|
||||
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user