mirror of
https://github.com/overte-org/overte.git
synced 2025-08-13 01:16:06 +02:00
Avoid copying Item before rendering
This commit is contained in:
parent
1b3e144395
commit
e809c4f89d
2 changed files with 4 additions and 6 deletions
|
@ -214,13 +214,12 @@ void render::renderLights(const SceneContextPointer& sceneContext, const RenderC
|
|||
RenderArgs* args = renderContext->getArgs();
|
||||
|
||||
for (const auto& itemDetails : inItems) {
|
||||
// FIXME: Every item is copied because item.render cannot mutate a const
|
||||
auto item = scene->getItem(itemDetails.id);
|
||||
auto& item = scene->getItem(itemDetails.id);
|
||||
item.render(args);
|
||||
}
|
||||
}
|
||||
|
||||
void renderShape(RenderArgs* args, const ShapePipelineLib& shapeContext, Item& item) {
|
||||
void renderShape(RenderArgs* args, const ShapePipelineLib& shapeContext, const Item& item) {
|
||||
assert(item.getKey().isShape());
|
||||
const auto& key = item.getShapeKey();
|
||||
if (key.isValid() && !key.hasOwnPipeline()) {
|
||||
|
@ -242,8 +241,7 @@ void render::renderShapes(const SceneContextPointer& sceneContext, const RenderC
|
|||
|
||||
auto numItemsToDraw = glm::max((int)inItems.size(), maxDrawnItems);
|
||||
for (auto i = 0; i < numItemsToDraw; ++i) {
|
||||
// FIXME: Every item is copied because item.render cannot mutate a const
|
||||
auto item = scene->getItem(inItems[i].id);
|
||||
auto& item = scene->getItem(inItems[i].id);
|
||||
renderShape(args, shapeContext, item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ public:
|
|||
int getLayer() const { return _payload->getLayer(); }
|
||||
|
||||
// Render call for the item
|
||||
void render(RenderArgs* args) { _payload->render(args); }
|
||||
void render(RenderArgs* args) const { _payload->render(args); }
|
||||
|
||||
// Shape Type Interface
|
||||
const ShapeKey getShapeKey() const { return _payload->getShapeKey(); }
|
||||
|
|
Loading…
Reference in a new issue