From b1adc0d9efbec8bae05baea95aa332606fa0dad3 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Tue, 24 May 2016 09:01:03 -0700 Subject: [PATCH] avoid API change in URDFImporterInterface fix .obj texture loading issue --- data/cube.mtl | 2 +- examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp | 2 +- examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp | 2 +- examples/Importers/ImportURDFDemo/BulletUrdfImporter.h | 2 +- examples/Importers/ImportURDFDemo/URDF2Bullet.cpp | 2 +- examples/Importers/ImportURDFDemo/URDFImporterInterface.h | 4 +++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/data/cube.mtl b/data/cube.mtl index aba4ddc5b..fca828974 100644 --- a/data/cube.mtl +++ b/data/cube.mtl @@ -10,5 +10,5 @@ newmtl cube Ks 0.0000 0.0000 0.0000 Ke 0.0000 0.0000 0.0000 map_Ka cube.tga - map_Kd cube_diffuse.tga + map_Kd floor_diffuse.tga diff --git a/examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp b/examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp index 810099bae..3f6553b81 100644 --- a/examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp +++ b/examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp @@ -95,7 +95,7 @@ int b3ImportMeshUtility::loadAndRegisterMeshFromFile(const std::string& fileName b3ImportMeshData meshData; if (b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(fileName, meshData)) { - int textureIndex = 0; + int textureIndex = -1; if (meshData.m_textureImage) { diff --git a/examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp b/examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp index d0238abea..1aac66af3 100644 --- a/examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp +++ b/examples/Importers/ImportURDFDemo/BulletUrdfImporter.cpp @@ -585,7 +585,7 @@ btCollisionShape* convertURDFToCollisionShape(const UrdfCollision* collision, co return shape; } -int BulletURDFImporter::convertLinkVisualShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame, class btCollisionShape* colShape) const +int BulletURDFImporter::convertLinkVisualShapes2(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame, class btCollisionShape* colShape) const { int graphicsIndex = -1; diff --git a/examples/Importers/ImportURDFDemo/BulletUrdfImporter.h b/examples/Importers/ImportURDFDemo/BulletUrdfImporter.h index 469c5a43c..c1a2b7c41 100644 --- a/examples/Importers/ImportURDFDemo/BulletUrdfImporter.h +++ b/examples/Importers/ImportURDFDemo/BulletUrdfImporter.h @@ -46,7 +46,7 @@ public: virtual bool getRootTransformInWorld(btTransform& rootTransformInWorld) const; - virtual int convertLinkVisualShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame, class btCollisionShape* colShape) const; + virtual int convertLinkVisualShapes2(int linkIndex, const char* pathPrefix, const btTransform& inertialFrame, class btCollisionShape* colShape) const; ///todo(erwincoumans) refactor this convertLinkCollisionShapes/memory allocation diff --git a/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp b/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp index 140cce62c..e3deca4cd 100644 --- a/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp +++ b/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp @@ -213,7 +213,7 @@ void ConvertURDF2BulletInternal(const URDFImporterInterface& u2b, MultiBodyCreat btCompoundShape* compoundShape = u2b.convertLinkCollisionShapes(urdfLinkIndex,pathPrefix,localInertialFrame); - int graphicsIndex = u2b.convertLinkVisualShapes(urdfLinkIndex,pathPrefix,localInertialFrame,compoundShape); + int graphicsIndex = u2b.convertLinkVisualShapes2(urdfLinkIndex,pathPrefix,localInertialFrame,compoundShape); if (compoundShape) diff --git a/examples/Importers/ImportURDFDemo/URDFImporterInterface.h b/examples/Importers/ImportURDFDemo/URDFImporterInterface.h index 25b1769dd..a5203d651 100644 --- a/examples/Importers/ImportURDFDemo/URDFImporterInterface.h +++ b/examples/Importers/ImportURDFDemo/URDFImporterInterface.h @@ -42,7 +42,9 @@ public: virtual bool getRootTransformInWorld(btTransform& rootTransformInWorld) const =0; ///quick hack: need to rethink the API/dependencies of this - virtual int convertLinkVisualShapes(int linkIndex, const char* pathPrefix, const btTransform& inertialFrame, class btCollisionShape* colShape) const = 0; + virtual int convertLinkVisualShapes(int linkIndex, const char* pathPrefix, const btTransform& inertialFrame) const { return -1;} + + virtual int convertLinkVisualShapes2(int linkIndex, const char* pathPrefix, const btTransform& inertialFrame, class btCollisionShape* colShape) const = 0; virtual class btCompoundShape* convertLinkCollisionShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame) const = 0; };