Render the correct maxDrawnItems

This commit is contained in:
Zach Pomerantz 2016-01-28 11:42:54 -08:00
parent 85843cff39
commit 5cbb5000d2

View file

@ -155,7 +155,10 @@ void render::renderShapes(const SceneContextPointer& sceneContext, const RenderC
auto& scene = sceneContext->_scene;
RenderArgs* args = renderContext->args;
auto numItemsToDraw = glm::max((int)inItems.size(), maxDrawnItems);
int numItemsToDraw = (int)inItems.size();
if (maxDrawnItems != -1) {
numItemsToDraw = glm::min(numItemsToDraw, maxDrawnItems);
}
for (auto i = 0; i < numItemsToDraw; ++i) {
auto& item = scene->getItem(inItems[i].id);
renderShape(args, shapeContext, item);
@ -246,4 +249,4 @@ void DepthSortShapes::run(const SceneContextPointer& sceneContext, const RenderC
depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems->second);
}
}
}