summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/BulletSoftBody/btSoftBodyHelpers.cpp131
-rw-r--r--src/BulletSoftBody/btSoftBodyHelpers.h4
-rw-r--r--src/LinearMath/btScalar.h2
-rw-r--r--src/LinearMath/btSerializer.h2
4 files changed, 4 insertions, 135 deletions
diff --git a/src/BulletSoftBody/btSoftBodyHelpers.cpp b/src/BulletSoftBody/btSoftBodyHelpers.cpp
index 35eb22ec1..fbb729830 100644
--- a/src/BulletSoftBody/btSoftBodyHelpers.cpp
+++ b/src/BulletSoftBody/btSoftBodyHelpers.cpp
@@ -1488,29 +1488,6 @@ void btSoftBodyHelpers::writeObj(const char* filename, const btSoftBody* psb)
fs.close();
}
-static inline bool isSpace(const char c)
-{
- return (c == ' ') || (c == '\t');
-}
-static inline bool isNewLine(const char c)
-{
- return (c == '\r') || (c == '\n') || (c == '\0');
-}
-static inline float parseFloat(const char*& token)
-{
- token += strspn(token, " \t");
- float f = (float)atof(token);
- token += strcspn(token, " \t\r");
- return f;
-}
-static inline void parseFloat3(
- float& x, float& y, float& z,
- const char*& token)
-{
- x = parseFloat(token);
- y = parseFloat(token);
- z = parseFloat(token);
-}
void btSoftBodyHelpers::writeState(const char* file, const btSoftBody* psb)
{
@@ -1542,114 +1519,6 @@ void btSoftBodyHelpers::writeState(const char* file, const btSoftBody* psb)
fs.close();
}
-std::string btSoftBodyHelpers::loadDeformableState(btAlignedObjectArray<btVector3>& qs, btAlignedObjectArray<btVector3>& vs, const char* filename, CommonFileIOInterface* fileIO)
-{
- {
- qs.clear();
- vs.clear();
- std::string tmp = filename;
- std::stringstream err;
-#ifdef USE_STREAM
- std::ifstream ifs(filename);
- if (!ifs)
- {
- err << "Cannot open file [" << filename << "]" << std::endl;
- return err.str();
- }
-#else
- int fileHandle = fileIO->fileOpen(filename, "r");
- if (fileHandle < 0)
- {
- err << "Cannot open file [" << filename << "]" << std::endl;
- return err.str();
- }
-#endif
-
- std::string name;
-
- int maxchars = 8192; // Alloc enough size.
- std::vector<char> buf(maxchars); // Alloc enough size.
- std::string linebuf;
- linebuf.reserve(maxchars);
-
-#ifdef USE_STREAM
- while (ifs.peek() != -1)
-#else
- char* line = 0;
- do
-#endif
- {
- linebuf.resize(0);
-#ifdef USE_STREAM
- safeGetline(ifs, linebuf);
-#else
- char tmpBuf[1024];
- line = fileIO->readLine(fileHandle, tmpBuf, 1024);
- if (line)
- {
- linebuf = line;
- }
-#endif
- // Trim newline '\r\n' or '\r'
- if (linebuf.size() > 0)
- {
- if (linebuf[linebuf.size() - 1] == '\n') linebuf.erase(linebuf.size() - 1);
- }
- if (linebuf.size() > 0)
- {
- if (linebuf[linebuf.size() - 1] == '\n') linebuf.erase(linebuf.size() - 1);
- }
-
- // Skip if empty line.
- if (linebuf.empty())
- {
- continue;
- }
-
- // Skip leading space.
- const char* token = linebuf.c_str();
- token += strspn(token, " \t");
-
- btAssert(token);
- if (token[0] == '\0') continue; // empty line
-
- if (token[0] == '#') continue; // comment line
-
- // q
- if (token[0] == 'q' && isSpace((token[1])))
- {
- token += 2;
- float x, y, z;
- parseFloat3(x, y, z, token);
- qs.push_back(btVector3(x, y, z));
- continue;
- }
-
- // v
- if (token[0] == 'v' && isSpace((token[1])))
- {
- token += 3;
- float x, y, z;
- parseFloat3(x, y, z, token);
- vs.push_back(btVector3(x, y, z));
- continue;
- }
-
- // Ignore unknown command.
- }
-#ifndef USE_STREAM
- while (line)
- ;
-#endif
-
- if (fileHandle >= 0)
- {
- fileIO->fileClose(fileHandle);
- }
- return err.str();
- }
-}
-
void btSoftBodyHelpers::duplicateFaces(const char* filename, const btSoftBody* psb)
{
std::ifstream fs_read;
diff --git a/src/BulletSoftBody/btSoftBodyHelpers.h b/src/BulletSoftBody/btSoftBodyHelpers.h
index d1fdf0450..e48d7b751 100644
--- a/src/BulletSoftBody/btSoftBodyHelpers.h
+++ b/src/BulletSoftBody/btSoftBodyHelpers.h
@@ -17,7 +17,6 @@ subject to the following restrictions:
#define BT_SOFT_BODY_HELPERS_H
#include "btSoftBody.h"
-#include "../../examples/CommonInterfaces/CommonFileIOInterface.h"
#include <fstream>
#include <string>
//
@@ -149,7 +148,8 @@ struct btSoftBodyHelpers
static void writeState(const char* file, const btSoftBody* psb);
- static std::string loadDeformableState(btAlignedObjectArray<btVector3>& qs, btAlignedObjectArray<btVector3>& vs, const char* filename, CommonFileIOInterface* fileIO);
+ //this code cannot be here, dependency on example code are not allowed
+ //static std::string loadDeformableState(btAlignedObjectArray<btVector3>& qs, btAlignedObjectArray<btVector3>& vs, const char* filename, CommonFileIOInterface* fileIO);
static void getBarycentricWeights(const btVector3& a, const btVector3& b, const btVector3& c, const btVector3& d, const btVector3& p, btVector4& bary);
diff --git a/src/LinearMath/btScalar.h b/src/LinearMath/btScalar.h
index e47baadd6..837696ced 100644
--- a/src/LinearMath/btScalar.h
+++ b/src/LinearMath/btScalar.h
@@ -25,7 +25,7 @@ subject to the following restrictions:
#include <float.h>
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
-#define BT_BULLET_VERSION 320
+#define BT_BULLET_VERSION 322
inline int btGetVersion()
{
diff --git a/src/LinearMath/btSerializer.h b/src/LinearMath/btSerializer.h
index 22bcac1be..cf0f53c55 100644
--- a/src/LinearMath/btSerializer.h
+++ b/src/LinearMath/btSerializer.h
@@ -481,7 +481,7 @@ public:
buffer[9] = '3';
buffer[10] = '2';
- buffer[11] = '1';
+ buffer[11] = '2';
}
virtual void startSerialization()