mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 19:55:07 +02:00
Merge branch 'yellow' of https://github.com/samcake/hifi into stats
This commit is contained in:
commit
23979cce8f
13 changed files with 91 additions and 26 deletions
|
@ -66,6 +66,12 @@ panel.newSlider("Max Drawn Overlay3Ds", -1, 100,
|
|||
function(value) { return (value); }
|
||||
);
|
||||
|
||||
panel.newCheckbox("Display status",
|
||||
function(value) { Scene.setEngineDisplayItemStatus(value); },
|
||||
function() { return Scene.doEngineDisplayItemStatus(); },
|
||||
function(value) { return (value); }
|
||||
);
|
||||
|
||||
var tickTackPeriod = 500;
|
||||
|
||||
function updateCounters() {
|
||||
|
|
|
@ -3526,6 +3526,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems();
|
||||
renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems();
|
||||
|
||||
renderContext._drawItemStatus = sceneInterface->doEngineDisplayItemStatus();
|
||||
|
||||
renderArgs->_shouldRender = LODManager::shouldRender;
|
||||
|
||||
renderContext.args = renderArgs;
|
||||
|
|
|
@ -229,7 +229,25 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
|||
render::PendingChanges pendingChanges;
|
||||
if (_model->needsFixupInScene()) {
|
||||
_model->removeFromScene(scene, pendingChanges);
|
||||
_model->addToScene(scene, pendingChanges);
|
||||
|
||||
|
||||
render::Item::Status::Getter statusGetter = [this] () -> render::Item::Status::Value {
|
||||
quint64 now = usecTimestampNow();
|
||||
/* if (now - entity->getLastEditedFromRemote() < 0.1f * USECS_PER_SECOND) {
|
||||
return glm::vec4 redColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
renderBoundingBox(entity, args, 0.16f, redColor);
|
||||
}
|
||||
*/
|
||||
/*if (now - this->getLastBroadcast() < 0.2f * USECS_PER_SECOND) {
|
||||
return 256;
|
||||
}
|
||||
return 0;*/
|
||||
static int i = 0;
|
||||
return (i++)%256;
|
||||
|
||||
};
|
||||
|
||||
_model->addToScene(scene, pendingChanges, statusGetter);
|
||||
}
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
<@elif GLPROFILE == MAC_GL @>
|
||||
<@def GPU_FEATURE_PROFILE GPU_LEGACY@>
|
||||
<@def GPU_TRANSFORM_PROFILE GPU_LEGACY@>
|
||||
<@def VERSION_HEADER #version 120
|
||||
<@def VERSION_HEADER #version 120
|
||||
#extension GL_EXT_gpu_shader4 : enable@>
|
||||
<@else@>
|
||||
<@def GPU_FEATURE_PROFILE GPU_LEGACY@>
|
||||
<@def GPU_TRANSFORM_PROFILE GPU_LEGACY@>
|
||||
<@def VERSION_HEADER #version 120@>
|
||||
<@def VERSION_HEADER #version 120
|
||||
#extension GL_EXT_gpu_shader4 : enable@>
|
||||
<@endif@>
|
||||
|
||||
<@endif@>
|
||||
|
|
|
@ -202,7 +202,7 @@ void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) {
|
|||
uint32 startVertex = batch._params[paramOffset + 1]._uint;
|
||||
uint32 startInstance = batch._params[paramOffset + 0]._uint;
|
||||
|
||||
glDrawArraysInstanced(mode, startVertex, numVertices, numInstances);
|
||||
glDrawArraysInstancedARB(mode, startVertex, numVertices, numInstances);
|
||||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,11 @@ RenderDeferredTask::RenderDeferredTask() : Task() {
|
|||
_jobs.push_back(Job(new CullItems::JobModel("CullTransparent", _jobs.back().getOutput())));
|
||||
_jobs.push_back(Job(new DepthSortItems::JobModel("DepthSortTransparent", _jobs.back().getOutput(), DepthSortItems(false))));
|
||||
_jobs.push_back(Job(new DrawTransparentDeferred::JobModel("TransparentDeferred", _jobs.back().getOutput())));
|
||||
|
||||
_jobs.push_back(Job(new render::DrawStatus::JobModel("DrawStatus", renderedOpaques)));
|
||||
_jobs.back().setEnabled(false);
|
||||
_drawStatusJobIndex = _jobs.size() - 1;
|
||||
|
||||
_jobs.push_back(Job(new DrawOverlay3D::JobModel("DrawOverlay3D")));
|
||||
_jobs.push_back(Job(new ResetGLState::JobModel()));
|
||||
}
|
||||
|
@ -89,6 +93,9 @@ void RenderDeferredTask::run(const SceneContextPointer& sceneContext, const Rend
|
|||
return;
|
||||
}
|
||||
|
||||
// Make sure we turn the displayItemStatus on/off
|
||||
setDrawItemStatus(renderContext->_drawItemStatus);
|
||||
|
||||
renderContext->args->_context->syncCache();
|
||||
|
||||
for (auto job : _jobs) {
|
||||
|
|
|
@ -70,6 +70,11 @@ public:
|
|||
|
||||
render::Jobs _jobs;
|
||||
|
||||
int _drawStatusJobIndex = -1;
|
||||
|
||||
void setDrawItemStatus(bool draw) { if (_drawStatusJobIndex >= 0) { _jobs[_drawStatusJobIndex].setEnabled(draw); } }
|
||||
bool doDrawItemStatus() const { if (_drawStatusJobIndex >= 0) { return _jobs[_drawStatusJobIndex].isEnabled(); } else { return false; } }
|
||||
|
||||
virtual void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
||||
|
||||
};
|
||||
|
|
|
@ -116,12 +116,7 @@ void DrawStatus::run(const SceneContextPointer& sceneContext, const RenderContex
|
|||
(*itemAABox).setBox(item.bounds.getCorner(), 0.1f);
|
||||
}
|
||||
auto& itemScene = scene->getItem(item.id);
|
||||
auto& status = itemScene.getStatus();
|
||||
if (status) {
|
||||
status->getValue((*itemStatus));
|
||||
} else {
|
||||
(*itemStatus) = glm::vec4(-1.0f);
|
||||
}
|
||||
(*itemStatus) = itemScene.getStatusValues();
|
||||
|
||||
nbItems++;
|
||||
itemAABox++;
|
||||
|
|
|
@ -77,6 +77,9 @@ public:
|
|||
Job(const Job& other) : _concept(other._concept) {}
|
||||
~Job();
|
||||
|
||||
bool isEnabled() const { return _concept->isEnabled(); }
|
||||
void setEnabled(bool isEnabled) { _concept->setEnabled(isEnabled); }
|
||||
|
||||
const std::string& getName() const { return _concept->getName(); }
|
||||
const Varying getInput() const { return _concept->getInput(); }
|
||||
const Varying getOutput() const { return _concept->getOutput(); }
|
||||
|
@ -92,6 +95,7 @@ public:
|
|||
|
||||
class Concept {
|
||||
std::string _name;
|
||||
bool _isEnabled = true;
|
||||
public:
|
||||
Concept() : _name() {}
|
||||
Concept(const std::string& name) : _name(name) {}
|
||||
|
@ -99,7 +103,10 @@ public:
|
|||
|
||||
void setName(const std::string& name) { _name = name; }
|
||||
const std::string& getName() const { return _name; }
|
||||
|
||||
|
||||
bool isEnabled() const { return _isEnabled; }
|
||||
void setEnabled(bool isEnabled) { _isEnabled = isEnabled; }
|
||||
|
||||
virtual const Varying getInput() const { return Varying(); }
|
||||
virtual const Varying getOutput() const { return Varying(); }
|
||||
virtual void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) = 0;
|
||||
|
@ -119,7 +126,11 @@ public:
|
|||
Model(Data data): _data(data) {}
|
||||
Model(Data data, const std::string& name): Concept(name), _data(data) {}
|
||||
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { jobRun(_data, sceneContext, renderContext); }
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
if (isEnabled()) {
|
||||
jobRun(_data, sceneContext, renderContext);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class I> class ModelI : public Concept {
|
||||
|
@ -135,7 +146,11 @@ public:
|
|||
ModelI(const std::string& name, const Varying& input): Concept(name), _input(input) {}
|
||||
ModelI(const std::string& name, Data data): Concept(name), _data(data) {}
|
||||
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { jobRunI(_data, sceneContext, renderContext, _input.get<I>()); }
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
if (isEnabled()) {
|
||||
jobRunI(_data, sceneContext, renderContext, _input.get<I>());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class O> class ModelO : public Concept {
|
||||
|
@ -155,7 +170,9 @@ public:
|
|||
ModelO(const std::string& name, Data data): Concept(name), _data(data), _output(Output()) {}
|
||||
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
jobRunO(_data, sceneContext, renderContext, _output.edit<O>());
|
||||
if (isEnabled()) {
|
||||
jobRunO(_data, sceneContext, renderContext, _output.edit<O>());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -177,7 +194,11 @@ public:
|
|||
|
||||
void setInput(const Varying& input) { _input = input; }
|
||||
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { jobRunIO(_data, sceneContext, renderContext, _input.get<I>(), _output.edit<O>()); }
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
if (isEnabled()) {
|
||||
jobRunIO(_data, sceneContext, renderContext, _input.get<I>(), _output.edit<O>());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<Concept> _concept;
|
||||
|
|
|
@ -49,6 +49,8 @@ public:
|
|||
int _numDrawnOverlay3DItems = 0;
|
||||
int _maxDrawnOverlay3DItems = -1;
|
||||
|
||||
bool _drawItemStatus = false;
|
||||
|
||||
RenderContext() {}
|
||||
};
|
||||
typedef std::shared_ptr<RenderContext> RenderContextPointer;
|
||||
|
|
|
@ -53,6 +53,15 @@ void ItemBucketMap::allocateStandardOpaqueTranparentBuckets() {
|
|||
(*this)[ItemFilter::Builder::transparentShape().withLayered()];
|
||||
}
|
||||
|
||||
void Item::Status::getValues(glm::vec4& values) {
|
||||
for (int i = 0; i < values.length(); i++) {
|
||||
if (i < _values.size()) {
|
||||
values[i] = _values[i]() / 256.0f;
|
||||
} else {
|
||||
values[i] = -1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Item::resetPayload(const PayloadPointer& payload) {
|
||||
if (!payload) {
|
||||
|
|
|
@ -202,20 +202,12 @@ public:
|
|||
public:
|
||||
typedef unsigned char Value;
|
||||
typedef std::function<Value()> Getter;
|
||||
typedef std::vector<Getter> Getters;
|
||||
|
||||
int _firstFrame;
|
||||
std::vector<Getter> _values;
|
||||
Getters _values;
|
||||
|
||||
void addGetter(Getter& getter) { _values.push_back(getter); }
|
||||
void getValue(glm::vec4& value) {
|
||||
for (unsigned int i = 0; i < value.length(); i++) {
|
||||
if (i < _values.size()) {
|
||||
value[i] = _values[i]() / 256;
|
||||
} else {
|
||||
value[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
void getValues(glm::vec4& values);
|
||||
};
|
||||
typedef std::shared_ptr<Status> StatusPointer;
|
||||
|
||||
|
@ -278,6 +270,7 @@ public:
|
|||
|
||||
// Access the status
|
||||
const StatusPointer& getStatus() const { return _payload->getStatus(); }
|
||||
glm::vec4 getStatusValues() const { glm::vec4 values(-1.f); auto& status = getStatus(); if (status) { status->getValues(values); }; return values; }
|
||||
|
||||
protected:
|
||||
PayloadPointer _payload;
|
||||
|
|
|
@ -106,6 +106,10 @@ public:
|
|||
Q_INVOKABLE int getEngineMaxDrawnTransparentItems() { return _maxDrawnTransparentItems; }
|
||||
Q_INVOKABLE void setEngineMaxDrawnOverlay3DItems(int count) { _maxDrawnOverlay3DItems = count; }
|
||||
Q_INVOKABLE int getEngineMaxDrawnOverlay3DItems() { return _maxDrawnOverlay3DItems; }
|
||||
|
||||
Q_INVOKABLE void setEngineDisplayItemStatus(bool display) { _drawItemStatus = display; }
|
||||
Q_INVOKABLE bool doEngineDisplayItemStatus() { return _drawItemStatus; }
|
||||
|
||||
signals:
|
||||
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
|
||||
void shouldRenderEntitiesChanged(bool shouldRenderEntities);
|
||||
|
@ -136,6 +140,8 @@ protected:
|
|||
int _maxDrawnTransparentItems = -1;
|
||||
int _maxDrawnOverlay3DItems = -1;
|
||||
|
||||
bool _drawItemStatus = false;
|
||||
|
||||
};
|
||||
|
||||
#endif // hifi_SceneScriptingInterface_h
|
||||
|
|
Loading…
Reference in a new issue