bool HullLibrary::NormalizeAndCleanupVertices(hacd::HaU32 svcount, const hacd::HaF32 *svertices, hacd::HaU32 stride, hacd::HaU32 &vcount, // output number of vertices hacd::HaF32 *vertices, // location to store the results. hacd::HaF32 normalepsilon, hacd::HaF32 *scale, hacd::HaF32 *center, hacd::HaU32 maxVertices) { bool ret = false; WuQuantizer *wq = createWuQuantizer(); if ( wq ) { const hacd::HaF32 *quantizedVertices = wq->kmeansQuantize3D(svcount,svertices,false,maxVertices,vcount); if ( quantizedVertices ) { memcpy(vertices,quantizedVertices,sizeof(HaF32)*3*vcount); const HaF32 *_scale = wq->getDenormalizeScale(); scale[0] = _scale[0]; scale[1] = _scale[1]; scale[2] = _scale[2]; const HaF32 *_center = wq->getDenormalizeCenter(); center[0] = _center[0]; center[1] = _center[1]; center[2] = _center[2]; ret = true; } wq->release(); } return ret; }
bool HullLibrary::NormalizeAndCleanupVertices(uint32_t svcount, const float *svertices, uint32_t /*stride*/, uint32_t &vcount, // output number of vertices float *vertices, // location to store the results. float /*normalepsilon*/, float *scale, float *center, uint32_t maxVertices, bool useWuQuantizer) { bool ret = false; WuQuantizer *wq = createWuQuantizer(); if ( wq ) { const float *quantizedVertices; if ( useWuQuantizer ) { quantizedVertices = wq->wuQuantize3D(svcount,svertices,false,maxVertices,vcount); } else { quantizedVertices = wq->kmeansQuantize3D(svcount,svertices,false,maxVertices,vcount); } if ( quantizedVertices ) { memcpy(vertices,quantizedVertices,sizeof(float)*3*vcount); const float *_scale = wq->getDenormalizeScale(); scale[0] = _scale[0]; scale[1] = _scale[1]; scale[2] = _scale[2]; const float *_center = wq->getDenormalizeCenter(); center[0] = _center[0]; center[1] = _center[1]; center[2] = _center[2]; ret = true; } wq->release(); } return ret; }