rename ObsoleteDemos back to Demos
fix some relative path issues for loading assets
This commit is contained in:
@@ -44,10 +44,10 @@ IF(MSVC)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO ${replacementFlags}" )
|
||||
MESSAGE("CMAKE_EXE_LINKER_FLAGS_DEBUG=${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
# STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS})
|
||||
# SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2})
|
||||
# STRING(REPLACE "INCREMENTAL:YES" "" replacementFlags3 ${CMAKE_EXTRA_LINK_FLAGS})
|
||||
# SET(CMAKE_EXTRA_LINK_FLAGS ${replacementFlag3})
|
||||
STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS})
|
||||
SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2})
|
||||
STRING(REPLACE "INCREMENTAL:YES" "" replacementFlags3 ${CMAKE_EXTRA_LINK_FLAGS})
|
||||
SET(CMAKE_EXTRA_LINK_FLAGS ${replacementFlag3})
|
||||
|
||||
|
||||
STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags3 ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO})
|
||||
@@ -188,13 +188,13 @@ IF (USE_GLUT)
|
||||
ADD_DEFINITIONS(-DBT_USE_FREEGLUT)
|
||||
|
||||
IF (CMAKE_CL_64)
|
||||
message("Win64 using static freeglut in ObsoleteDemos/Glut/glut64.lib")
|
||||
SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/ObsoleteDemos/Glut/glut64.lib glu32.lib gdi32.lib winmm.lib user32.lib)
|
||||
message("Win64 using static freeglut in Demos/Glut/glut64.lib")
|
||||
SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/Demos/Glut/glut64.lib glu32.lib gdi32.lib winmm.lib user32.lib)
|
||||
ELSE(CMAKE_CL_64)
|
||||
message("Win32 using static freeglut in ObsoleteDemos/Glut/glut32.lib")
|
||||
SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/ObsoleteDemos/Glut/glut32.lib glu32.lib gdi32.lib winmm.lib user32.lib)
|
||||
message("Win32 using static freeglut in Demos/Glut/glut32.lib")
|
||||
SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/Demos/Glut/glut32.lib glu32.lib gdi32.lib winmm.lib user32.lib)
|
||||
ENDIF (CMAKE_CL_64)
|
||||
SET(GLUT_INCLUDE_DIR ${BULLET_PHYSICS_SOURCE_DIR}/ObsoleteDemos/Glut )
|
||||
SET(GLUT_INCLUDE_DIR ${BULLET_PHYSICS_SOURCE_DIR}/Demos/Glut )
|
||||
ELSE()
|
||||
FIND_PACKAGE(GLUT)
|
||||
IF (GLUT_FOUND)
|
||||
@@ -219,8 +219,8 @@ IF (USE_GLUT)
|
||||
ENDIF(USE_GLUT)
|
||||
|
||||
|
||||
IF(EXISTS ${BULLET_PHYSICS_SOURCE_DIR}/ObsoleteDemos AND IS_DIRECTORY ${BULLET_PHYSICS_SOURCE_DIR}/ObsoleteDemos)
|
||||
SUBDIRS(ObsoleteDemos)
|
||||
IF(EXISTS ${BULLET_PHYSICS_SOURCE_DIR}/Demos AND IS_DIRECTORY ${BULLET_PHYSICS_SOURCE_DIR}/Demos)
|
||||
SUBDIRS(Demos)
|
||||
ENDIF()
|
||||
ENDIF(BUILD_OBSOLETE_DEMOS)
|
||||
|
||||
@@ -232,6 +232,10 @@ IF(BUILD_BULLET3_DEMOS)
|
||||
ENDIF()
|
||||
ENDIF(BUILD_BULLET3_DEMOS)
|
||||
|
||||
OPTION(BUILD_EXTRAS "Set when you want to build the extras" ON)
|
||||
IF(BUILD_EXTRAS)
|
||||
SUBDIRS(Extras)
|
||||
ENDIF(BUILD_EXTRAS)
|
||||
|
||||
|
||||
#Maya Dynamica plugin is moved to http://dynamica.googlecode.com
|
||||
@@ -266,9 +270,9 @@ IF(INSTALL_LIBS)
|
||||
ENDIF(INSTALL_LIBS)
|
||||
|
||||
#INSTALL of other files requires CMake 2.6
|
||||
#IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
||||
# OPTION(INSTALL_EXTRA_LIBS "Set when you want extra libraries installed" OFF)
|
||||
#ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
||||
OPTION(INSTALL_EXTRA_LIBS "Set when you want extra libraries installed" OFF)
|
||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
|
||||
|
||||
OPTION(BUILD_UNIT_TESTS "Build Unit Tests" ON)
|
||||
|
||||
|
||||
@@ -171,31 +171,23 @@ void BspDemo::initPhysics(const char* bspfilename)
|
||||
|
||||
void* memoryBuffer = 0;
|
||||
|
||||
FILE* file = fopen(bspfilename,"r");
|
||||
if (!file)
|
||||
{
|
||||
//try again other path,
|
||||
//sight... visual studio leaves the current working directory in the projectfiles folder
|
||||
//instead of executable folder. who wants this default behaviour?!?
|
||||
bspfilename = "../../BspDemo.bsp";
|
||||
file = fopen(bspfilename,"r");
|
||||
}
|
||||
if (!file)
|
||||
{
|
||||
const char* filename = "BspDemo.bsp";
|
||||
|
||||
//try again other path, cmake needs 4 levels deep back...
|
||||
bspfilename = "../../../../BspDemo.bsp";
|
||||
file = fopen(bspfilename,"r");
|
||||
}
|
||||
if (!file)
|
||||
const char* prefix[]={"./","../","../../","../../../","../../../../", "BspDemo/", "Demos/BspDemo/",
|
||||
"../Demos/BspDemo/","../../Demos/BspDemo/"};
|
||||
int numPrefixes = sizeof(prefix)/sizeof(const char*);
|
||||
char relativeFileName[1024];
|
||||
FILE* file=0;
|
||||
|
||||
for (int i=0;i<numPrefixes;i++)
|
||||
{
|
||||
//try again other path,
|
||||
//sight... visual studio leaves the current working directory in the projectfiles folder
|
||||
//instead of executable folder. who wants this default behaviour?!?
|
||||
bspfilename = "BspDemo.bsp";
|
||||
file = fopen(bspfilename,"r");
|
||||
sprintf(relativeFileName,"%s%s",prefix[i],filename);
|
||||
file = fopen(relativeFileName,"r");
|
||||
if (file)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (file)
|
||||
{
|
||||
BspLoader bspLoader;
|
||||
@@ -35,7 +35,7 @@ IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET AppBspPhysicsDemo
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/ObsoleteDemos/BspDemo/BspDemo.bsp ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/BspDemo/BspDemo.bsp ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
|
||||
@@ -47,7 +47,27 @@ void BulletXmlImportDemo::initPhysics()
|
||||
|
||||
|
||||
btBulletXmlWorldImporter* importer = new btBulletXmlWorldImporter(m_dynamicsWorld);
|
||||
importer->loadFile("bullet_basic.xml");
|
||||
static const char* filename = "bullet_basic.xml";
|
||||
|
||||
const char* prefix[]={"./","../","../../","../../../","../../../../", "BulletXmlImportDemo/", "Demos/BulletXmlImportDemo/",
|
||||
"../Demos/BulletXmlImportDemo/","../../Demos/BulletXmlImportDemo/"};
|
||||
int numPrefixes = sizeof(prefix)/sizeof(const char*);
|
||||
char relativeFileName[1024];
|
||||
bool fileFound = false;
|
||||
|
||||
for (int i=0;i<numPrefixes;i++)
|
||||
{
|
||||
sprintf(relativeFileName,"%s%s",prefix[i],filename);
|
||||
FILE* f = fopen(relativeFileName,"r");
|
||||
if (f)
|
||||
{
|
||||
fclose(f);
|
||||
fileFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
importer->loadFile(relativeFileName);
|
||||
// importer->loadFile("bulletser.xml");
|
||||
// importer->loadFile("bullet_constraints.xml");
|
||||
|
||||
@@ -5,9 +5,9 @@ SUBDIRS( HelloWorld )
|
||||
IF (USE_GLUT)
|
||||
IF (GLUT_FOUND)
|
||||
IF(BUILD_CPU_DEMOS)
|
||||
# IF(BUILD_EXTRAS)
|
||||
# SUBDIRS( BulletXmlImportDemo ConcaveDemo ConstraintDemo ConvexDecompositionDemo SerializeDemo )
|
||||
# ENDIF()
|
||||
IF(BUILD_EXTRAS)
|
||||
SUBDIRS( BulletXmlImportDemo ConcaveDemo ConvexDecompositionDemo SerializeDemo )
|
||||
ENDIF()
|
||||
SET(SharedDemoSubdirs
|
||||
OpenGL
|
||||
CcdPhysicsDemo ConstraintDemo SliderConstraintDemo GenericJointDemo Raytracer
|
||||
@@ -46,7 +46,7 @@ IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET AppCharacterDemo
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/ObsoleteDemos/BspDemo/BspDemo.bsp ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/BspDemo/BspDemo.bsp ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
|
||||
@@ -101,35 +101,30 @@ void CharacterDemo::initPhysics()
|
||||
btTransform tr;
|
||||
tr.setIdentity();
|
||||
|
||||
const char* bspfilename = "BspDemo.bsp";
|
||||
const char* filename = "BspDemo.bsp";
|
||||
|
||||
const char* prefix[]={"./","../","../../","../../../","../../../../", "BspDemo/", "Demos/BspDemo/",
|
||||
"../Demos/BspDemo/","../../Demos/BspDemo/"};
|
||||
int numPrefixes = sizeof(prefix)/sizeof(const char*);
|
||||
char relativeFileName[1024];
|
||||
FILE* file=0;
|
||||
|
||||
for (int i=0;i<numPrefixes;i++)
|
||||
{
|
||||
sprintf(relativeFileName,"%s%s",prefix[i],filename);
|
||||
file = fopen(relativeFileName,"r");
|
||||
if (file)
|
||||
break;
|
||||
}
|
||||
void* memoryBuffer = 0;
|
||||
|
||||
FILE* file = fopen(bspfilename,"r");
|
||||
if (!file)
|
||||
{
|
||||
//cmake generated visual studio projects need 4 levels back
|
||||
bspfilename = "../../../../BspDemo.bsp";
|
||||
file = fopen(bspfilename,"r");
|
||||
}
|
||||
if (!file)
|
||||
{
|
||||
//visual studio leaves the current working directory in the projectfiles folder
|
||||
bspfilename = "../../BspDemo.bsp";
|
||||
file = fopen(bspfilename,"r");
|
||||
}
|
||||
if (!file)
|
||||
{
|
||||
//visual studio leaves the current working directory in the projectfiles folder
|
||||
bspfilename = "BspDemo.bsp";
|
||||
file = fopen(bspfilename,"r");
|
||||
}
|
||||
|
||||
if (file)
|
||||
{
|
||||
BspLoader bspLoader;
|
||||
int size=0;
|
||||
if (fseek(file, 0, SEEK_END) || (size = ftell(file)) == EOF || fseek(file, 0, SEEK_SET)) { /* File operations denied? ok, just close and return failure */
|
||||
printf("Error: cannot get filesize from %s\n", bspfilename);
|
||||
printf("Error: cannot get filesize from %s\n", filename);
|
||||
} else
|
||||
{
|
||||
//how to detect file size?
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
# This is basically the overall name of the project in Visual Studio this is the name of the Solution File
|
||||
|
||||
|
||||
@@ -53,7 +54,7 @@ IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
TARGET AppConvexDecompositionDemo
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/SerializeDemo/testFile.bullet ${CMAKE_CURRENT_BINARY_DIR}/testFile.bullet
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/file.obj ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/ConvexDecompositionDemo/file.obj ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
|
||||
@@ -178,20 +178,19 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
|
||||
|
||||
ConvexDecomposition::WavefrontObj wo;
|
||||
|
||||
tcount = wo.loadObj(filename);
|
||||
tcount = 0;
|
||||
const char* prefix[]={"./","../","../../","../../../","../../../../", "ConvexDecompositionDemo/", "Demos/ConvexDecompositionDemo/",
|
||||
"../Demos/ConvexDecompositionDemo/","../../Demos/ConvexDecompositionDemo/"};
|
||||
int numPrefixes = sizeof(prefix)/sizeof(const char*);
|
||||
char relativeFileName[1024];
|
||||
|
||||
if (!tcount)
|
||||
for (int i=0;i<numPrefixes;i++)
|
||||
{
|
||||
//when running this app from visual studio, the default starting folder is different, so make a second attempt...
|
||||
tcount = wo.loadObj("../../file.obj");
|
||||
sprintf(relativeFileName,"%s%s",prefix[i],filename);
|
||||
tcount = wo.loadObj(relativeFileName);
|
||||
if (tcount)
|
||||
break;
|
||||
}
|
||||
if (!tcount)
|
||||
{
|
||||
//cmake generated msvc files need 4 levels deep back... so make a 3rd attempt...
|
||||
tcount = wo.loadObj("../../../../file.obj");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3578
Demos/ConvexDecompositionDemo/file.obj
Normal file
3578
Demos/ConvexDecompositionDemo/file.obj
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user