TinyRenderer color pick: fix out-of-bounds issue

This commit is contained in:
Erwin Coumans
2018-01-25 16:02:47 -08:00
parent c6fefb1018
commit bddbb3f9dd

View File

@@ -590,6 +590,7 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(
int colorIndex = linkIndex;//colObj? colObj->getBroadphaseHandle()->getUid() & 3 : 0;
if (colorIndex<0)
colorIndex=0;
colorIndex &=3;
btVector4 color;
color = sColors[colorIndex];
float rgbaColor[4] = {color[0],color[1],color[2],color[3]};