Merge branch 'render-shape' of http://github.com/Atlante45/hifi into feat/render-shape

This commit is contained in:
Zach Pomerantz 2016-01-06 11:46:16 -08:00
commit bcb01feb94

View file

@ -235,27 +235,17 @@ void renderShape(RenderArgs* args, const Shape& shapeContext, Item& item) {
} }
} }
void render::renderShapes(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Shape& shapeContext, const ItemIDsBounds& inItems, int maxDrawnItems) { void render::renderShapes(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
const Shape& shapeContext, const ItemIDsBounds& inItems, int maxDrawnItems) {
auto& scene = sceneContext->_scene; auto& scene = sceneContext->_scene;
RenderArgs* args = renderContext->getArgs(); RenderArgs* args = renderContext->getArgs();
if ((maxDrawnItems < 0) || (maxDrawnItems > (int)inItems.size())) { auto numItemsToDraw = glm::max((int)inItems.size(), maxDrawnItems);
for (const auto& itemDetails : inItems) { for (auto i = 0; i < numItemsToDraw; ++i) {
// FIXME: Every item is copied because item.render cannot mutate a const // FIXME: Every item is copied because item.render cannot mutate a const
auto item = scene->getItem(itemDetails.id); auto item = scene->getItem(inItems[i].id);
renderShape(args, shapeContext, item); renderShape(args, shapeContext, item);
} }
} else {
int numItems = 0;
for (const auto& itemDetails : inItems) {
numItems++;
auto item = scene->getItem(itemDetails.id);
renderShape(args, shapeContext, item);
if (numItems >= maxDrawnItems) {
break;
}
}
}
} }
void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {