diff --git a/examples/ExampleBrowser/CMakeLists.txt b/examples/ExampleBrowser/CMakeLists.txt index 9ad80df61..7dc6326b6 100644 --- a/examples/ExampleBrowser/CMakeLists.txt +++ b/examples/ExampleBrowser/CMakeLists.txt @@ -119,7 +119,6 @@ SET(ExtendedTutorialsSources SET(BulletExampleBrowser_SRCS - ../TinyRenderer/Bullet2TinyRenderer.cpp ../TinyRenderer/geometry.cpp ../TinyRenderer/model.cpp ../TinyRenderer/tgaimage.cpp diff --git a/examples/RenderingExamples/TinyRendererSetup.cpp b/examples/RenderingExamples/TinyRendererSetup.cpp index 33cc9e723..ff7d00358 100644 --- a/examples/RenderingExamples/TinyRendererSetup.cpp +++ b/examples/RenderingExamples/TinyRendererSetup.cpp @@ -207,7 +207,7 @@ void TinyRendererSetup::stepSimulation(float deltaTime) } - ATTRIBUTE_ALIGNED16(float modelMat[16]); + ATTRIBUTE_ALIGNED16(btScalar modelMat2[16]); ATTRIBUTE_ALIGNED16(float viewMat[16]); CommonRenderInterface* render = this->m_app->m_renderer; render->getActiveCamera()->getCameraViewMatrix(viewMat); @@ -216,15 +216,16 @@ void TinyRendererSetup::stepSimulation(float deltaTime) for (int o=0;om_internalData->m_renderObjects.size();o++) { - + const btTransform& tr = m_internalData->m_transforms[o]; - tr.getOpenGLMatrix(modelMat); + tr.getOpenGLMatrix(modelMat2); + for (int i=0;i<4;i++) { for (int j=0;j<4;j++) { - m_internalData->m_renderObjects[o]->m_modelMatrix[i][j] = modelMat[i+4*j]; + m_internalData->m_renderObjects[o]->m_modelMatrix[i][j] = float(modelMat2[i+4*j]); m_internalData->m_renderObjects[o]->m_viewMatrix[i][j] = viewMat[i+4*j]; } } diff --git a/examples/TinyRenderer/Bullet2TinyRenderer.cpp b/examples/TinyRenderer/Bullet2TinyRenderer.cpp deleted file mode 100644 index de4e0a758..000000000 --- a/examples/TinyRenderer/Bullet2TinyRenderer.cpp +++ /dev/null @@ -1,164 +0,0 @@ - - -#include "TinyRenderer.h" -#include -#include "LinearMath/btHashMap.h" -#include "BulletCollision/CollisionDispatch/btCollisionObject.h" -#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h" -#include "BulletCollision/CollisionShapes/btCollisionShape.h" - -class Bullet2TinyRenderer -{ - - btAlignedObjectArray m_swRenderObjects; - - btHashMap m_colObject2gfxIndex; - btHashMap m_colShape2gfxIndex; - - - int m_swWidth; - int m_swHeight; - TGAImage m_rgbColorBuffer; - - b3AlignedObjectArray m_depthBuffer; - int m_textureHandle; - unsigned char* m_image; - - -public: - Bullet2TinyRenderer (int swWidth, int swHeight): - m_swWidth(swWidth), - m_swHeight(swHeight), - m_rgbColorBuffer(swWidth,swHeight,TGAImage::RGB) - { - - m_depthBuffer.resize(swWidth*swHeight); - m_image=new unsigned char[m_swWidth*m_swHeight*4]; - - } - - virtual ~Bullet2TinyRenderer() - { - for (int i=0;igetCollisionShape()]; - - - - //if (colIndex>=0 && shapeIndex>=0) - //{ - // m_col2gfxIndex.insert(colIndex,shapeIndex); - //} - - } - - /* virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices) - { - - - if (shapeIndex>=0) - { - TinyRenderObjectData* swObj = new TinyRenderObjectData(m_swWidth,m_swHeight,m_rgbColorBuffer,m_depthBuffer); - swObj->registerMeshShape(vertices,numvertices,indices,numIndices); - //swObj->createCube(1,1,1); - m_swRenderObjects.insert(shapeIndex,swObj); - } - return shapeIndex; - } -*/ - virtual void render(const btDiscreteDynamicsWorld* rbWorld, float viewMat[16]) - { - //clear the color buffer - TGAColor clearColor; - clearColor.bgra[0] = 255; - clearColor.bgra[1] = 255; - clearColor.bgra[2] = 255; - clearColor.bgra[3] = 255; - - clearBuffers(clearColor); - - ATTRIBUTE_ALIGNED16(float modelMat[16]); - - - for (int i=0;igetNumCollisionObjects();i++) - { - btCollisionObject* colObj = rbWorld->getCollisionObjectArray()[i]; - - int* colObjIndexPtr = m_colObject2gfxIndex[colObj]; - - if (colObjIndexPtr) - { - int colObjIndex = *colObjIndexPtr; - TinyRenderObjectData* renderObj = m_swRenderObjects[colObjIndex]; - - //sync the object transform - const btTransform& tr = colObj->getWorldTransform(); - tr.getOpenGLMatrix(modelMat); - - for (int i=0;i<4;i++) - { - for (int j=0;j<4;j++) - { - renderObj->m_modelMatrix[i][j] = modelMat[i+4*j]; - renderObj->m_viewMatrix[i][j] = viewMat[i+4*j]; - } - } - TinyRenderer::renderObject(*renderObj); - } - } - - for(int y=0;y10) - { - counter=0; - getFrameBuffer().write_tga_file("/Users/erwincoumans/develop/bullet3/framebuf.tga",true); - } - - } - -}; - diff --git a/examples/TinyRenderer/Bullet2TinyRenderer.h b/examples/TinyRenderer/Bullet2TinyRenderer.h deleted file mode 100644 index e69de29bb..000000000