add segmentation mask rendering to TinyRenderer and shared memory API

similar to the zbuffer, but storing the object index (int) instead of float depth
This commit is contained in:
Erwin Coumans
2016-08-11 14:55:30 -07:00
parent f416644481
commit 3c30e2f821
23 changed files with 276 additions and 55 deletions

View File

@@ -23,6 +23,7 @@ struct TinyRendererSetupInternalData
TGAImage m_rgbColorBuffer;
b3AlignedObjectArray<float> m_depthBuffer;
b3AlignedObjectArray<int> m_segmentationMaskBuffer;
int m_width;
@@ -185,7 +186,9 @@ TinyRendererSetup::TinyRendererSetup(struct GUIHelperInterface* gui)
m_internalData->m_shapePtr.push_back(0);
TinyRenderObjectData* ob = new TinyRenderObjectData(
m_internalData->m_rgbColorBuffer,
m_internalData->m_depthBuffer);
m_internalData->m_depthBuffer,
m_internalData->m_segmentationMaskBuffer,
m_internalData->m_renderObjects.size(),0);
//ob->loadModel("cube.obj");
const int* indices = &meshData.m_gfxShape->m_indices->at(0);
ob->registerMeshShape(&meshData.m_gfxShape->m_vertices->at(0).xyzw[0],