move b3RaycastInfo.h so it can be used without OpenCL dependency

add b3Assert to make sure m_maxShapeCapacityInBytes is not exceeded in GLInstancingRenderer
prepare for CpuSoftClothDemo
This commit is contained in:
erwincoumans
2013-09-02 22:31:48 -07:00
parent d0da37f3dd
commit 181a323631
8 changed files with 11 additions and 6 deletions

View File

@@ -665,6 +665,9 @@ int GLInstancingRenderer::registerShape(const float* vertices, int numvertices,
char* dest= (char*)glMapBuffer( GL_ARRAY_BUFFER,GL_WRITE_ONLY);//GL_WRITE_ONLY
int vertexStrideInBytes = 9*sizeof(float);
int sz = numvertices*vertexStrideInBytes;
int totalUsed = vertexStrideInBytes*gfxObj->m_vertexArrayOffset+sz;
b3Assert(totalUsed<this->m_maxShapeCapacityInBytes);
memcpy(dest+vertexStrideInBytes*gfxObj->m_vertexArrayOffset,vertices,sz);
glUnmapBuffer( GL_ARRAY_BUFFER);