diff --git a/Demos3/AllBullet2Demos/CMakeLists.txt b/Demos3/AllBullet2Demos/CMakeLists.txt index 5b520c32a..06fbe615f 100644 --- a/Demos3/AllBullet2Demos/CMakeLists.txt +++ b/Demos3/AllBullet2Demos/CMakeLists.txt @@ -4,6 +4,7 @@ INCLUDE_DIRECTORIES( ${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/btgui ${BULLET_PHYSICS_SOURCE_DIR}/btgui/lua-5.2.3/src + ${BULLET_PHYSICS_SOURCE_DIR}/Demos3/FiniteElementMethod ) SET(App_AllBullet2Demos_SRCS @@ -48,6 +49,7 @@ SET(App_AllBullet2Demos_SRCS ../ImportSTLDemo/ImportSTLSetup.cpp ../Wavefront/tiny_obj_loader.cpp ../Wavefront/tiny_obj_loader.h + ../FiniteElementMethod/FiniteElementDemo.cpp ../../btgui/Bullet3AppSupport/b3Clock.cpp ../../btgui/Bullet3AppSupport/b3Clock.h ../../btgui/urdf/urdfdom/urdf_parser/src/pose.cpp diff --git a/Demos3/FiniteElementMethod/FiniteElementDemo.cpp b/Demos3/FiniteElementMethod/FiniteElementDemo.cpp index 87e81914e..090879726 100644 --- a/Demos3/FiniteElementMethod/FiniteElementDemo.cpp +++ b/Demos3/FiniteElementMethod/FiniteElementDemo.cpp @@ -185,7 +185,7 @@ void FiniteElementDemo::physicsDebugDraw() //inline void DrawPointsT4Mesh( point_container const& points, t4mesh const& mesh, double const& scale = 0.95, bool wireframe = false) { //geometry::Tetrahedron T; // From OpenTissue/core/geometry/geometry_tetrahederon.h - btAlignedObjectArray m_linePoints; + btAlignedObjectArray m_linePoints; btAlignedObjectArray m_lineIndices; //geometry::Tetrahedron tet; @@ -199,11 +199,16 @@ void FiniteElementDemo::physicsDebugDraw() btVector3 v1(v1d(0),v1d(1),v1d(2)); btVector3 v2(v2d(0),v2d(1),v2d(2)); btVector3 v3(v3d(0),v3d(1),v3d(2)); + btVector3FloatData vf0,vf1,vf2,vf3; + v0.serializeFloat(vf0); + v1.serializeFloat(vf1); + v2.serializeFloat(vf2); + v3.serializeFloat(vf3); unsigned int baseIndex = m_linePoints.size(); - m_linePoints.push_back(v0); - m_linePoints.push_back(v1); - m_linePoints.push_back(v2); - m_linePoints.push_back(v3); + m_linePoints.push_back(vf0); + m_linePoints.push_back(vf1); + m_linePoints.push_back(vf2); + m_linePoints.push_back(vf3); m_lineIndices.push_back(baseIndex+0); m_lineIndices.push_back(baseIndex+1); m_lineIndices.push_back(baseIndex+0); @@ -220,8 +225,8 @@ void FiniteElementDemo::physicsDebugDraw() } float debugColor[4]={0,0,0.4,1}; - m_app->m_renderer->drawLines(&m_linePoints[0].x(),debugColor, - m_linePoints.size(),sizeof(btVector3), + m_app->m_renderer->drawLines(&m_linePoints[0].m_floats[0],debugColor, + m_linePoints.size(),sizeof(btVector3FloatData), &m_lineIndices[0], m_lineIndices.size(), 1);