fix various warning

add b3ResourcePath utility, to locate resources relative to executable
This commit is contained in:
Erwin Coumans (Google)
2015-07-03 18:17:14 -07:00
parent 4a9441c5fd
commit 8517e85b21
18 changed files with 176 additions and 92 deletions

View File

@@ -24,6 +24,7 @@ subject to the following restrictions:
#include "../OpenGLWindow/SimpleOpenGL3App.h"
#include "LoadMeshFromCollada.h"
#include "Bullet3Common/b3FileUtils.h"
#include "../../Utils/b3ResourcePath.h"
#include "../CommonInterfaces/CommonRigidBodyBase.h"
@@ -86,9 +87,9 @@ void ImportColladaSetup::initPhysics()
char relativeFileName[1024];
b3FileUtils f;
if (!f.findFile(fileName,relativeFileName,1024))
return;
if (!b3ResourcePath::findResourcePath(fileName,relativeFileName,1024))
return;
btVector3 shift(0,0,0);
btVector3 scaling(1,1,1);
@@ -209,4 +210,4 @@ void ImportColladaSetup::initPhysics()
class CommonExampleInterface* ImportColladaCreateFunc(struct CommonExampleOptions& options)
{
return new ImportColladaSetup(options.m_guiHelper);
}
}

View File

@@ -169,7 +169,7 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
const char* sem = input->Attribute("semantic");
std::string semName(sem);
// printf("sem=%s\n",sem);
const char* src = input->Attribute("source");
// const char* src = input->Attribute("source");
// printf("src=%s\n",src);
const char* srcIdRef = input->Attribute("source");
std::string source_name;
@@ -192,12 +192,12 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
std::string normalSourceName;
int primitiveCount;
primitive->QueryIntAttribute("count", &primitiveCount);
bool positionAndNormalInVertex=false;
int indexStride=1;
int posOffset = 0;
int normalOffset = 0;
int numIndices = 0;
{
for (TiXmlElement* input = primitive->FirstChildElement("input");input != NULL;input = input->NextSiblingElement("input"))
{
const char* sem = input->Attribute("semantic");
@@ -206,7 +206,8 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
if ((offset+1)>indexStride)
indexStride=offset+1;
//printf("sem=%s\n",sem);
const char* src = input->Attribute("source");
// const char* src = input->Attribute("source");
//printf("src=%s\n",src);
const char* srcIdRef = input->Attribute("source");
std::string source_name;
@@ -226,7 +227,6 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
{
normalSourceName = vs->m_normalArrayId;
normalOffset = offset;
positionAndNormalInVertex = true;
}
}
if (semName=="NORMAL")
@@ -234,7 +234,6 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
btAssert(normalSourceName.length()==0);
normalSourceName = source_name;
normalOffset = offset;
positionAndNormalInVertex = false;
}
}
numIndices = primitiveCount * 3;
@@ -418,7 +417,7 @@ void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shap
int* shapeIndexPtr = name2Shape[geomUrl];
if (shapeIndexPtr)
{
int index = *shapeIndexPtr;
// int index = *shapeIndexPtr;
printf("found geom with index %d\n", *shapeIndexPtr);
ColladaGraphicsInstance& instance = visualShapeInstances.expand();
instance.m_shapeIndex = *shapeIndexPtr;
@@ -555,7 +554,7 @@ void getUnitMeterScalingAndUpAxisTransform(TiXmlDocument& doc, btTransform& tr,
void LoadMeshFromCollada(const char* relativeFileName, btAlignedObjectArray<GLInstanceGraphicsShape>& visualShapes, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances, btTransform& upAxisTransform, float& unitMeterScaling,int clientUpAxis)
{
GLInstanceGraphicsShape* instance = 0;
// GLInstanceGraphicsShape* instance = 0;
//usually COLLADA files don't have that many visual geometries/shapes
visualShapes.reserve(32);
@@ -745,4 +744,4 @@ void LoadMeshFromColladaAssimp(const char* relativeFileName, btAlignedObjectArra
}
#endif //COMPARE_WITH_ASSIMP
#endif //COMPARE_WITH_ASSIMP

View File

@@ -117,7 +117,7 @@ ATTRIBUTE_ALIGNED16(class) btMatrix4x4
return m_el[0].w() * v.x() + m_el[1].w() * v.y() + m_el[2].w() * v.z() + m_el[3].w() * v.w();
}
SIMD_FORCE_INLINE btMatrix4x4
SIMD_FORCE_INLINE btMatrix4x4 &
operator*=(const btMatrix4x4& m)
{
setValue(
@@ -125,6 +125,7 @@ ATTRIBUTE_ALIGNED16(class) btMatrix4x4
m.tdotx(m_el[1]), m.tdoty(m_el[1]), m.tdotz(m_el[1]),m.tdotw(m_el[1]),
m.tdotx(m_el[2]), m.tdoty(m_el[2]), m.tdotz(m_el[2]),m.tdotw(m_el[2]),
m.tdotx(m_el[3]), m.tdoty(m_el[3]), m.tdotz(m_el[3]),m.tdotw(m_el[3]));
return *this;
}