NVIDIAGameWorks / PhysX-3.4

NVIDIA PhysX SDK 3.4
https://www.nvidia.com/
2.35k stars 274 forks source link

ConvexMeshBuilder::loadConvexHull bug for 16-bit indices #49

Closed GregSlazinski closed 6 years ago

GregSlazinski commented 6 years ago

https://github.com/NVIDIAGameWorks/PhysX-3.4/blob/7f12de60542edc8f1c6683e6b4cdce8570e51456/PhysX_3.4/Source/PhysXCooking/src/convex/ConvexMeshBuilder.cpp#L264 cooking always fails when 16-bit indices are provided because it tries to process 3 at a time

                *dest++ = trig16[0];
                *dest++ = trig16[1];
                *dest++ = trig16[2];

should be replaced with; *dest++ = *trig16;

AlesBorovicka commented 6 years ago

I dont follow what the issue here is? while (dest < pastLastDest) { const PxU16 trig16 = reinterpret_cast<const PxU16>(source); dest++ = trig16[0]; dest++ = trig16[1]; *dest++ = trig16[2]; source += desc.indices.stride; } That code does parse triangles and then the source is increased by stride, looks ok.

GregSlazinski commented 6 years ago

This code should process indices! not triangles.

AlesBorovicka commented 6 years ago

I see what you mean, we will fix that.

GregSlazinski commented 6 years ago

Thank you

AlesBorovicka commented 6 years ago

This fix should come with next release.