mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 17:03:43 +02:00
Adding the Selection, and not the Tag concept fro real, and beeing able to reset it from the Transaction and simply communicating the ranked zones to the engine through a selection, ready to be used by the ZOneREnderer
This commit is contained in:
parent
158084369a
commit
6fc965072c
8 changed files with 112 additions and 6 deletions
|
@ -43,6 +43,8 @@
|
|||
#include "AddressManager.h"
|
||||
#include <Rig.h>
|
||||
|
||||
#include "ZoneRenderer.h"
|
||||
|
||||
EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState,
|
||||
AbstractScriptingServicesInterface* scriptingServices) :
|
||||
_wantScripts(wantScripts),
|
||||
|
@ -266,6 +268,9 @@ bool EntityTreeRenderer::findBestZoneAndMaybeContainingEntities(QVector<EntityIt
|
|||
}
|
||||
}
|
||||
_layeredZones.apply();
|
||||
|
||||
applyLayeredZones();
|
||||
|
||||
didUpdate = true;
|
||||
});
|
||||
|
||||
|
@ -343,6 +348,30 @@ void EntityTreeRenderer::forceRecheckEntities() {
|
|||
_avatarPosition = _viewState->getAvatarPosition() + glm::vec3((float)TREE_SCALE);
|
||||
}
|
||||
|
||||
bool EntityTreeRenderer::applyLayeredZones() {
|
||||
// from the list of zones we are going to build a selection list the Render Item corresponding to the zones
|
||||
// in the expected layered order and update the scene with it
|
||||
auto scene = _viewState->getMain3DScene();
|
||||
if (scene) {
|
||||
render::Transaction transaction;
|
||||
render::ItemIDs list;
|
||||
|
||||
for (auto& zone : _layeredZones) {
|
||||
auto id = std::dynamic_pointer_cast<RenderableZoneEntityItem>(zone.zone)->getRenderItemID();
|
||||
list.push_back(id);
|
||||
}
|
||||
render::Selection selection("RankedZones", list);
|
||||
transaction.resetSelection(selection);
|
||||
|
||||
scene->enqueueTransaction(transaction);
|
||||
} else {
|
||||
qCWarning(entitiesrenderer) << "EntityTreeRenderer::applyLayeredZones(), Unexpected null scene, possibly during application shutdown";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool EntityTreeRenderer::applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone) {
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
auto scene = DependencyManager::get<SceneScriptingInterface>();
|
||||
|
|
|
@ -150,6 +150,7 @@ private:
|
|||
bool applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
|
||||
bool layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
|
||||
bool applySkyboxAndHasAmbient();
|
||||
bool applyLayeredZones();
|
||||
|
||||
void checkAndCallPreload(const EntityItemID& entityID, const bool reload = false, const bool unloadFirst = false);
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
virtual bool addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::Transaction& transaction) override;
|
||||
virtual void removeFromScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::Transaction& transaction) override;
|
||||
|
||||
render::ItemID getRenderItemID() const { return _myMetaItem; }
|
||||
|
||||
private:
|
||||
virtual void locationChanged(bool tellPhysics = true) override { EntityItem::locationChanged(tellPhysics); notifyBoundChanged(); }
|
||||
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); notifyBoundChanged(); }
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "FramebufferCache.h"
|
||||
#include "HitEffect.h"
|
||||
#include "TextureCache.h"
|
||||
#include "ZoneRenderer.h"
|
||||
|
||||
#include "AmbientOcclusionEffect.h"
|
||||
#include "AntialiasingEffect.h"
|
||||
|
|
25
libraries/render-utils/src/ZoneRenderer.cpp
Normal file
25
libraries/render-utils/src/ZoneRenderer.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// ZoneRenderer.cpp
|
||||
// render/src/render-utils
|
||||
//
|
||||
// Created by Sam Gateau on 4/4/2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "ZoneRenderer.h"
|
||||
|
||||
const render::Selection::Name ZoneRenderer::ZONES_SELECTION { "RankedZones" };
|
||||
|
||||
|
||||
void ZoneRenderer::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs) {
|
||||
auto& scene = sceneContext->_scene;
|
||||
RenderArgs* args = renderContext->args;
|
||||
|
||||
auto zones = scene->getSelection(ZONES_SELECTION);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
48
libraries/render-utils/src/ZoneRenderer.h
Normal file
48
libraries/render-utils/src/ZoneRenderer.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// ZoneRenderer.h
|
||||
// render/src/render-utils
|
||||
//
|
||||
// Created by Sam Gateau on 4/4/2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_ZoneRenderer_h
|
||||
#define hifi_ZoneRenderer_h
|
||||
|
||||
#include "render/Engine.h"
|
||||
|
||||
class ZoneRendererConfig : public render::Job::Config {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int maxDrawn MEMBER maxDrawn NOTIFY dirty)
|
||||
public:
|
||||
|
||||
int maxDrawn { -1 };
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
class ZoneRenderer {
|
||||
public:
|
||||
|
||||
static const render::Selection::Name ZONES_SELECTION;
|
||||
|
||||
using Inputs = render::ItemBounds;
|
||||
using Config = ZoneRendererConfig;
|
||||
using JobModel = render::Job::ModelI<ZoneRenderer, Inputs, Config>;
|
||||
|
||||
ZoneRenderer() {}
|
||||
|
||||
void configure(const Config& config) { _maxDrawn = config.maxDrawn; }
|
||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs);
|
||||
|
||||
protected:
|
||||
int _maxDrawn; // initialized by Config
|
||||
};
|
||||
|
||||
#endif
|
|
@ -15,6 +15,10 @@
|
|||
using namespace render;
|
||||
|
||||
|
||||
Selection::~Selection() {
|
||||
|
||||
}
|
||||
|
||||
Selection::Selection() :
|
||||
_name(),
|
||||
_items()
|
||||
|
@ -52,7 +56,3 @@ Selection::Selection(const Name& name, const ItemIDs& items) :
|
|||
{
|
||||
}
|
||||
|
||||
Selection::~Selection() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace render {
|
|||
~Selection();
|
||||
Selection();
|
||||
Selection(const Selection& selection);
|
||||
Selection& operator= (const Selection& selection);
|
||||
Selection& operator = (const Selection& selection);
|
||||
Selection(Selection&& selection);
|
||||
Selection& operator= (Selection&& selection);
|
||||
Selection& operator = (Selection&& selection);
|
||||
|
||||
Selection(const Name& name, const ItemIDs& items);
|
||||
|
||||
|
|
Loading…
Reference in a new issue