rename ObsoleteDemos back to Demos
fix some relative path issues for loading assets
This commit is contained in:
59
Demos/SoftDemo/AMD/premake4.lua
Normal file
59
Demos/SoftDemo/AMD/premake4.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
hasCL = findOpenCL_AMD()
|
||||
|
||||
if (hasCL) then
|
||||
|
||||
project "AppSoftBodyDemo_AMD"
|
||||
|
||||
defines { "USE_AMD_OPENCL","CL_PLATFORM_AMD"}
|
||||
|
||||
initOpenCL_AMD()
|
||||
|
||||
language "C++"
|
||||
|
||||
kind "ConsoleApp"
|
||||
targetdir "../../.."
|
||||
|
||||
libdirs {"../../../Glut"}
|
||||
|
||||
links {
|
||||
"LinearMath",
|
||||
"BulletCollision",
|
||||
"BulletDynamics",
|
||||
"BulletSoftBody",
|
||||
"BulletSoftBodySolvers_OpenCL_AMD",
|
||||
"OpenGLSupport",
|
||||
"opengl32"
|
||||
}
|
||||
|
||||
configuration "x64"
|
||||
links {
|
||||
"glut64",
|
||||
"glew64s"
|
||||
}
|
||||
configuration "x32"
|
||||
links {
|
||||
"glut32",
|
||||
"glew32s"
|
||||
}
|
||||
|
||||
configuration{}
|
||||
|
||||
|
||||
includedirs {
|
||||
"../../SharedOpenCL",
|
||||
"../../../src",
|
||||
"../../../Glut",
|
||||
"../../OpenGL"
|
||||
}
|
||||
|
||||
files {
|
||||
"../SoftDemo.cpp",
|
||||
"../SoftDemo.h",
|
||||
"../main.cpp",
|
||||
"../../SharedOpenCL/btOpenCLUtils.cpp",
|
||||
"../../SharedOpenCL/btOpenCLUtils.h",
|
||||
"../../SharedOpenCL/btOpenCLInclude.h"
|
||||
}
|
||||
|
||||
end
|
||||
49
Demos/SoftDemo/CMakeLists.txt
Normal file
49
Demos/SoftDemo/CMakeLists.txt
Normal file
@@ -0,0 +1,49 @@
|
||||
# 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
|
||||
########################################################
|
||||
|
||||
IF (USE_GLUT)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/src
|
||||
../OpenGL
|
||||
${GLUT_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
LINK_LIBRARIES(
|
||||
OpenGLSupport BulletSoftBody BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
|
||||
)
|
||||
|
||||
IF (WIN32)
|
||||
ADD_EXECUTABLE(AppSoftBodyDemo
|
||||
main.cpp
|
||||
SoftDemo.cpp
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc
|
||||
)
|
||||
ELSE()
|
||||
ADD_EXECUTABLE(AppSoftBodyDemo
|
||||
main.cpp
|
||||
SoftDemo.cpp
|
||||
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
||||
ELSE(USE_GLUT)
|
||||
|
||||
ENDIF (USE_GLUT)
|
||||
|
||||
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
SET_TARGET_PROPERTIES(AppSoftBodyDemo PROPERTIES DEBUG_POSTFIX "_Debug")
|
||||
SET_TARGET_PROPERTIES(AppSoftBodyDemo PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
|
||||
SET_TARGET_PROPERTIES(AppSoftBodyDemo PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
|
||||
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||
5
Demos/SoftDemo/Makefile.am
Normal file
5
Demos/SoftDemo/Makefile.am
Normal file
@@ -0,0 +1,5 @@
|
||||
noinst_PROGRAMS=SoftDemo
|
||||
|
||||
SoftDemo_SOURCES=SoftDemo.cpp SoftDemo.h main.cpp
|
||||
SoftDemo_CXXFLAGS=-I@top_builddir@/src -I@top_builddir@/Demos/OpenGL $(CXXFLAGS)
|
||||
SoftDemo_LDADD=-L../OpenGL -lbulletopenglsupport -L../../src -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath @opengl_LIBS@
|
||||
2300
Demos/SoftDemo/SoftDemo.cpp
Normal file
2300
Demos/SoftDemo/SoftDemo.cpp
Normal file
File diff suppressed because it is too large
Load Diff
197
Demos/SoftDemo/SoftDemo.h
Normal file
197
Demos/SoftDemo/SoftDemo.h
Normal file
@@ -0,0 +1,197 @@
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
///btSoftBody implementation by Nathanael Presson
|
||||
|
||||
#ifndef SOFT_DEMO_H
|
||||
#define SOFT_DEMO_H
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "Win32DemoApplication.h"
|
||||
#define PlatformDemoApplication Win32DemoApplication
|
||||
#else
|
||||
#include "GlutDemoApplication.h"
|
||||
#define PlatformDemoApplication GlutDemoApplication
|
||||
#endif
|
||||
#include "LinearMath/btAlignedObjectArray.h"
|
||||
#include "BulletSoftBody/btSoftBody.h"
|
||||
|
||||
|
||||
class btBroadphaseInterface;
|
||||
class btCollisionShape;
|
||||
class btOverlappingPairCache;
|
||||
class btCollisionDispatcher;
|
||||
class btConstraintSolver;
|
||||
struct btCollisionAlgorithmCreateFunc;
|
||||
class btDefaultCollisionConfiguration;
|
||||
|
||||
///collisions between two btSoftBody's
|
||||
class btSoftSoftCollisionAlgorithm;
|
||||
|
||||
///collisions between a btSoftBody and a btRigidBody
|
||||
class btSoftRididCollisionAlgorithm;
|
||||
class btSoftRigidDynamicsWorld;
|
||||
|
||||
|
||||
///CcdPhysicsDemo shows basic stacking using Bullet physics, and allows toggle of Ccd (using key '1')
|
||||
class SoftDemo : public PlatformDemoApplication
|
||||
{
|
||||
public:
|
||||
|
||||
btAlignedObjectArray<btSoftSoftCollisionAlgorithm*> m_SoftSoftCollisionAlgorithms;
|
||||
|
||||
btAlignedObjectArray<btSoftRididCollisionAlgorithm*> m_SoftRigidCollisionAlgorithms;
|
||||
|
||||
btSoftBodyWorldInfo m_softBodyWorldInfo;
|
||||
|
||||
|
||||
|
||||
bool m_autocam;
|
||||
bool m_cutting;
|
||||
bool m_raycast;
|
||||
btScalar m_animtime;
|
||||
btClock m_clock;
|
||||
int m_lastmousepos[2];
|
||||
btVector3 m_impact;
|
||||
btSoftBody::sRayCast m_results;
|
||||
btSoftBody::Node* m_node;
|
||||
btVector3 m_goal;
|
||||
bool m_drag;
|
||||
|
||||
|
||||
//keep the collision shapes, for deletion/cleanup
|
||||
btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
|
||||
|
||||
btBroadphaseInterface* m_broadphase;
|
||||
|
||||
btCollisionDispatcher* m_dispatcher;
|
||||
|
||||
|
||||
btConstraintSolver* m_solver;
|
||||
|
||||
btCollisionAlgorithmCreateFunc* m_boxBoxCF;
|
||||
|
||||
btDefaultCollisionConfiguration* m_collisionConfiguration;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
void initPhysics();
|
||||
|
||||
void exitPhysics();
|
||||
|
||||
SoftDemo() : m_drag(false)
|
||||
{
|
||||
setTexturing(true);
|
||||
setShadows(true);
|
||||
}
|
||||
virtual ~SoftDemo()
|
||||
{
|
||||
exitPhysics();
|
||||
}
|
||||
|
||||
virtual void clientMoveAndDisplay();
|
||||
|
||||
virtual void displayCallback();
|
||||
|
||||
void createStack( btCollisionShape* boxShape, float halfCubeSize, int size, float zPos );
|
||||
|
||||
static DemoApplication* Create()
|
||||
{
|
||||
SoftDemo* demo = new SoftDemo;
|
||||
demo->myinit();
|
||||
demo->initPhysics();
|
||||
return demo;
|
||||
}
|
||||
|
||||
virtual void setDrawClusters(bool drawClusters);
|
||||
|
||||
virtual const btSoftRigidDynamicsWorld* getSoftDynamicsWorld() const
|
||||
{
|
||||
///just make it a btSoftRigidDynamicsWorld please
|
||||
///or we will add type checking
|
||||
return (btSoftRigidDynamicsWorld*) m_dynamicsWorld;
|
||||
}
|
||||
|
||||
virtual btSoftRigidDynamicsWorld* getSoftDynamicsWorld()
|
||||
{
|
||||
///just make it a btSoftRigidDynamicsWorld please
|
||||
///or we will add type checking
|
||||
return (btSoftRigidDynamicsWorld*) m_dynamicsWorld;
|
||||
}
|
||||
|
||||
//
|
||||
void clientResetScene();
|
||||
void renderme();
|
||||
void keyboardCallback(unsigned char key, int x, int y);
|
||||
void mouseFunc(int button, int state, int x, int y);
|
||||
void mouseMotionFunc(int x,int y);
|
||||
|
||||
};
|
||||
|
||||
#define MACRO_SOFT_DEMO(a) class SoftDemo##a : public SoftDemo\
|
||||
{\
|
||||
public:\
|
||||
static DemoApplication* Create()\
|
||||
{\
|
||||
SoftDemo* demo = new SoftDemo##a;\
|
||||
extern int current_demo;\
|
||||
current_demo=a;\
|
||||
demo->myinit();\
|
||||
demo->initPhysics();\
|
||||
return demo;\
|
||||
}\
|
||||
};
|
||||
|
||||
|
||||
MACRO_SOFT_DEMO(0) //Init_Cloth
|
||||
MACRO_SOFT_DEMO(1) //Init_Pressure
|
||||
MACRO_SOFT_DEMO(2)//Init_Volume
|
||||
MACRO_SOFT_DEMO(3)//Init_Ropes
|
||||
MACRO_SOFT_DEMO(4)//Init_Ropes_Attach
|
||||
MACRO_SOFT_DEMO(5)//Init_ClothAttach
|
||||
MACRO_SOFT_DEMO(6)//Init_Sticks
|
||||
MACRO_SOFT_DEMO(7)//Init_Collide
|
||||
MACRO_SOFT_DEMO(8)//Init_Collide2
|
||||
MACRO_SOFT_DEMO(9)//Init_Collide3
|
||||
MACRO_SOFT_DEMO(10)//Init_Impact
|
||||
MACRO_SOFT_DEMO(11)//Init_Aero
|
||||
MACRO_SOFT_DEMO(12)//Init_Friction
|
||||
MACRO_SOFT_DEMO(13)//Init_Torus
|
||||
MACRO_SOFT_DEMO(14)//Init_TorusMatch
|
||||
MACRO_SOFT_DEMO(15)//Init_Bunny
|
||||
MACRO_SOFT_DEMO(16)//Init_BunnyMatch
|
||||
MACRO_SOFT_DEMO(17)//Init_Cutting1
|
||||
MACRO_SOFT_DEMO(18)//Init_ClusterDeform
|
||||
MACRO_SOFT_DEMO(19)//Init_ClusterCollide1
|
||||
MACRO_SOFT_DEMO(20)//Init_ClusterCollide2
|
||||
MACRO_SOFT_DEMO(21)//Init_ClusterSocket
|
||||
MACRO_SOFT_DEMO(22)//Init_ClusterHinge
|
||||
MACRO_SOFT_DEMO(23)//Init_ClusterCombine
|
||||
MACRO_SOFT_DEMO(24)//Init_ClusterCar
|
||||
MACRO_SOFT_DEMO(25)//Init_ClusterRobot
|
||||
MACRO_SOFT_DEMO(26)//Init_ClusterStackSoft
|
||||
MACRO_SOFT_DEMO(27)//Init_ClusterStackMixed
|
||||
MACRO_SOFT_DEMO(28)//Init_TetraCube
|
||||
MACRO_SOFT_DEMO(29)//Init_TetraBunny
|
||||
|
||||
|
||||
#endif //CCD_PHYSICS_DEMO_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4
Demos/SoftDemo/bunny.inl
Normal file
4
Demos/SoftDemo/bunny.inl
Normal file
File diff suppressed because one or more lines are too long
4
Demos/SoftDemo/cube.inl
Normal file
4
Demos/SoftDemo/cube.inl
Normal file
File diff suppressed because one or more lines are too long
37
Demos/SoftDemo/main.cpp
Normal file
37
Demos/SoftDemo/main.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
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 "SoftDemo.h"
|
||||
#include "GlutStuff.h"
|
||||
#include "GLDebugDrawer.h"
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
|
||||
GLDebugDrawer gDebugDrawer;
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
|
||||
SoftDemo* softDemo = new SoftDemo();
|
||||
|
||||
softDemo->initPhysics();
|
||||
softDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||
|
||||
|
||||
glutmain(argc, argv,1024,768,"Bullet Physics Demo. http://bulletphysics.com",softDemo);
|
||||
|
||||
delete softDemo;
|
||||
return 0;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user