mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
adding caps for opaque and transparent draw jobs and the ui in js so we can debug the rendered items
This commit is contained in:
parent
f553243bb8
commit
b339aa683a
6 changed files with 45 additions and 8 deletions
|
@ -42,6 +42,12 @@ panel.newSlider("Num Drawn Opaques", 0, 1000,
|
|||
function(value) { return (value); }
|
||||
);
|
||||
|
||||
panel.newSlider("Max Drawn Opaques", -1, 1000,
|
||||
function(value) { Scene.setEngineMaxDrawnOpaqueItems(value); },
|
||||
function() { return Scene.getEngineMaxDrawnOpaqueItems(); },
|
||||
function(value) { return (value); }
|
||||
);
|
||||
|
||||
panel.newCheckbox("Enable Cull Transparent",
|
||||
function(value) { Scene.setEngineCullTransparent((value != 0)); },
|
||||
function() { return Scene.doEngineCullTransparent(); },
|
||||
|
@ -72,6 +78,12 @@ panel.newSlider("Num Drawn Transparents", 0, 1000,
|
|||
function(value) { return (value); }
|
||||
);
|
||||
|
||||
panel.newSlider("Max Drawn Transparents", -1, 1000,
|
||||
function(value) { Scene.setEngineMaxDrawnTransparentItems(value); },
|
||||
function() { return Scene.getEngineMaxDrawnTransparentItems(); },
|
||||
function(value) { return (value); }
|
||||
);
|
||||
|
||||
var tickTackPeriod = 500;
|
||||
|
||||
function updateCounters() {
|
||||
|
|
|
@ -3505,6 +3505,9 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
renderContext._sortTransparent = sceneInterface->doEngineSortTransparent();
|
||||
renderContext._renderTransparent = sceneInterface->doEngineRenderTransparent();
|
||||
|
||||
renderContext._maxDrawnOpaqueItems = sceneInterface->getEngineMaxDrawnOpaqueItems();
|
||||
renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems();
|
||||
|
||||
renderArgs->_shouldRender = LODManager::shouldRender;
|
||||
|
||||
renderContext.args = renderArgs;
|
||||
|
|
|
@ -154,14 +154,26 @@ void render::depthSortItems(const SceneContextPointer& sceneContext, const Rende
|
|||
}
|
||||
}
|
||||
|
||||
void render::renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems) {
|
||||
void render::renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems, int maxDrawnItems) {
|
||||
PerformanceTimer perfTimer("renderItems");
|
||||
auto& scene = sceneContext->_scene;
|
||||
RenderArgs* args = renderContext->args;
|
||||
// render
|
||||
for (auto id : inItems) {
|
||||
auto item = scene->getItem(id);
|
||||
item.render(args);
|
||||
if ((maxDrawnItems < 0) || (maxDrawnItems > inItems.size()) {
|
||||
for (auto id : inItems) {
|
||||
auto item = scene->getItem(id);
|
||||
item.render(args);
|
||||
}
|
||||
} else {
|
||||
int numItems = 0;
|
||||
for (auto id : inItems) {
|
||||
auto item = scene->getItem(id);
|
||||
item.render(args);
|
||||
numItems++;
|
||||
if (numItems >= maxDrawnItems) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,7 +274,7 @@ template <> void render::jobRun(const DrawOpaque& job, const SceneContextPointer
|
|||
batch._glDrawBuffers(bufferCount, buffers);
|
||||
}
|
||||
|
||||
renderItems(sceneContext, renderContext, renderedItems);
|
||||
renderItems(sceneContext, renderContext, renderedItems, renderContext->_maxDrawnOpaqueItems);
|
||||
|
||||
args->_context->render((*args->_batch));
|
||||
args->_batch = nullptr;
|
||||
|
@ -329,7 +341,7 @@ template <> void render::jobRun(const DrawTransparent& job, const SceneContextPo
|
|||
args->_alphaThreshold = MOSTLY_OPAQUE_THRESHOLD;
|
||||
}
|
||||
|
||||
renderItems(sceneContext, renderContext, renderedItems);
|
||||
renderItems(sceneContext, renderContext, renderedItems, renderContext->_maxDrawnTransparentItems);
|
||||
|
||||
{
|
||||
GLenum buffers[3];
|
||||
|
@ -340,7 +352,7 @@ template <> void render::jobRun(const DrawTransparent& job, const SceneContextPo
|
|||
}
|
||||
|
||||
|
||||
renderItems(sceneContext, renderContext, renderedItems);
|
||||
renderItems(sceneContext, renderContext, renderedItems, renderContext->_maxDrawnTransparentItems);
|
||||
|
||||
args->_context->render((*args->_batch));
|
||||
args->_batch = nullptr;
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef std::vector<Job> Jobs;
|
|||
|
||||
void cullItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems, ItemIDs& outITems);
|
||||
void depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemIDs& inItems, ItemIDs& outITems);
|
||||
void renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems);
|
||||
void renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems, int maxDrawnItems = -1);
|
||||
|
||||
|
||||
class DrawOpaque {
|
||||
|
|
|
@ -39,9 +39,11 @@ public:
|
|||
|
||||
int _numFeedOpaqueItems = 0;
|
||||
int _numDrawnOpaqueItems = 0;
|
||||
int _maxDrawnOpaqueItems = -1;
|
||||
|
||||
int _numFeedTransparentItems = 0;
|
||||
int _numDrawnTransparentItems = 0;
|
||||
int _maxDrawnTransparentItems = -1;
|
||||
|
||||
RenderContext() {}
|
||||
};
|
||||
|
|
|
@ -96,6 +96,10 @@ public:
|
|||
void setEngineFeedTransparentItems(int count) { _numFeedTransparentItems = count; }
|
||||
Q_INVOKABLE int getEngineNumFeedTransparentItems() { return _numFeedTransparentItems; }
|
||||
|
||||
Q_INVOKABLE void setEngineMaxDrawnOpaqueItems(int count) { _maxDrawnOpaqueItems = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnOpaqueItems() { return _maxDrawnOpaqueItems; }
|
||||
Q_INVOKABLE void setEngineMaxDrawnTransparentItems(int count) { _maxDrawnTransparentItems = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnTransparentItems() { return _maxDrawnTransparentItems; }
|
||||
|
||||
signals:
|
||||
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
|
||||
|
@ -120,6 +124,10 @@ protected:
|
|||
int _numDrawnOpaqueItems = 0;
|
||||
int _numFeedTransparentItems = 0;
|
||||
int _numDrawnTransparentItems = 0;
|
||||
|
||||
int _maxDrawnOpaqueItems = -1;
|
||||
int _maxDrawnTransparentItems = -1;
|
||||
|
||||
};
|
||||
|
||||
#endif // hifi_SceneScriptingInterface_h
|
||||
|
|
Loading…
Reference in a new issue