#include "ImportSTLSetup.h" #include #include "../OpenGLWindow/GLInstancingRenderer.h" #include "../OpenGLWindow/GLInstanceGraphicsShape.h" #include "btBulletDynamicsCommon.h" #include "../OpenGLWindow/SimpleOpenGL3App.h" #include "LoadMeshFromSTL.h" #include "../CommonInterfaces/CommonRigidBodyBase.h" class ImportSTLSetup : public CommonRigidBodyBase { public: ImportSTLSetup(struct GUIHelperInterface* helper); virtual ~ImportSTLSetup(); virtual void initPhysics(); }; ImportSTLSetup::ImportSTLSetup(struct GUIHelperInterface* helper) :CommonRigidBodyBase(helper) { } ImportSTLSetup::~ImportSTLSetup() { } void ImportSTLSetup::initPhysics() { m_guiHelper->setUpAxis(2); this->createEmptyDynamicsWorld(); m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld); m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe); const char* fileName = "l_finger_tip.stl"; char relativeFileName[1024]; const char* prefix[]={"./data/","../data/","../../data/","../../../data/","../../../../data/"}; int prefixIndex=-1; { int numPrefixes = sizeof(prefix)/sizeof(char*); for (int i=0;igetRenderInterface()->registerShape(&gfxShape->m_vertices->at(0).xyzw[0], gfxShape->m_numvertices, &gfxShape->m_indices->at(0), gfxShape->m_numIndices); m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling); } } class CommonExampleInterface* ImportSTLCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option) { return new ImportSTLSetup(helper); }