mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 17:17:58 +02:00
Remove signaling and render code for collision models in RenderableModelEntityItem and EntityTreeRenderer
This commit is contained in:
parent
3c4050884e
commit
b2ec7f78c1
4 changed files with 2 additions and 52 deletions
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
size_t std::hash<EntityItemID>::operator()(const EntityItemID& id) const { return qHash(id); }
|
size_t std::hash<EntityItemID>::operator()(const EntityItemID& id) const { return qHash(id); }
|
||||||
std::function<bool()> EntityTreeRenderer::_entitiesShouldFadeFunction;
|
std::function<bool()> EntityTreeRenderer::_entitiesShouldFadeFunction;
|
||||||
std::function<bool()> EntityTreeRenderer::_renderDebugHullsOperator = [] { return false; };
|
|
||||||
|
|
||||||
EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState,
|
EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState,
|
||||||
AbstractScriptingServicesInterface* scriptingServices) :
|
AbstractScriptingServicesInterface* scriptingServices) :
|
||||||
|
|
|
@ -116,14 +116,10 @@ public:
|
||||||
EntityItemPointer getEntity(const EntityItemID& id);
|
EntityItemPointer getEntity(const EntityItemID& id);
|
||||||
void onEntityChanged(const EntityItemID& id);
|
void onEntityChanged(const EntityItemID& id);
|
||||||
|
|
||||||
static void setRenderDebugHullsOperator(std::function<bool()> renderDebugHullsOperator) { _renderDebugHullsOperator = renderDebugHullsOperator; }
|
|
||||||
static bool shouldRenderDebugHulls() { return _renderDebugHullsOperator(); }
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enterEntity(const EntityItemID& entityItemID);
|
void enterEntity(const EntityItemID& entityItemID);
|
||||||
void leaveEntity(const EntityItemID& entityItemID);
|
void leaveEntity(const EntityItemID& entityItemID);
|
||||||
void collisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision);
|
void collisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision);
|
||||||
void setRenderDebugHulls();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addingEntity(const EntityItemID& entityID);
|
void addingEntity(const EntityItemID& entityID);
|
||||||
|
@ -259,8 +255,6 @@ private:
|
||||||
static int _entitiesScriptEngineCount;
|
static int _entitiesScriptEngineCount;
|
||||||
static CalculateEntityLoadingPriority _calculateEntityLoadingPriorityFunc;
|
static CalculateEntityLoadingPriority _calculateEntityLoadingPriorityFunc;
|
||||||
static std::function<bool()> _entitiesShouldFadeFunction;
|
static std::function<bool()> _entitiesShouldFadeFunction;
|
||||||
|
|
||||||
static std::function<bool()> _renderDebugHullsOperator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <QtCore/QUrlQuery>
|
#include <QtCore/QUrlQuery>
|
||||||
|
|
||||||
#include <AbstractViewStateInterface.h>
|
#include <AbstractViewStateInterface.h>
|
||||||
#include <CollisionRenderMeshCache.h>
|
|
||||||
#include <Model.h>
|
#include <Model.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <render/Scene.h>
|
#include <render/Scene.h>
|
||||||
|
@ -35,8 +34,6 @@
|
||||||
#include "EntitiesRendererLogging.h"
|
#include "EntitiesRendererLogging.h"
|
||||||
|
|
||||||
|
|
||||||
static CollisionRenderMeshCache collisionMeshCache;
|
|
||||||
|
|
||||||
void ModelEntityWrapper::setModel(const ModelPointer& model) {
|
void ModelEntityWrapper::setModel(const ModelPointer& model) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_model != model) {
|
if (_model != model) {
|
||||||
|
@ -1052,11 +1049,7 @@ using namespace render;
|
||||||
using namespace render::entities;
|
using namespace render::entities;
|
||||||
|
|
||||||
ModelEntityRenderer::ModelEntityRenderer(const EntityItemPointer& entity) : Parent(entity) {
|
ModelEntityRenderer::ModelEntityRenderer(const EntityItemPointer& entity) : Parent(entity) {
|
||||||
// TODO: Re-add menu item in Menu.ccp/Menu.h when collision model updates in doRenderUpdateSynchronousTyped(...) are re-implemented
|
|
||||||
connect(DependencyManager::get<EntityTreeRenderer>().data(), &EntityTreeRenderer::setRenderDebugHulls, this, [&] {
|
|
||||||
_needsCollisionGeometryUpdate = true;
|
|
||||||
emit requestRenderUpdate();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityRenderer::setKey(bool didVisualGeometryRequestSucceed) {
|
void ModelEntityRenderer::setKey(bool didVisualGeometryRequestSucceed) {
|
||||||
|
@ -1216,10 +1209,6 @@ bool ModelEntityRenderer::needsRenderUpdate() const {
|
||||||
if (model->getRenderItemsNeedUpdate()) {
|
if (model->getRenderItemsNeedUpdate()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_needsCollisionGeometryUpdate) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Parent::needsRenderUpdate();
|
return Parent::needsRenderUpdate();
|
||||||
}
|
}
|
||||||
|
@ -1286,12 +1275,7 @@ bool ModelEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoin
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityRenderer::setCollisionMeshKey(const void*key) {
|
void ModelEntityRenderer::setCollisionMeshKey(const void*key) {
|
||||||
if (key != _collisionMeshKey) {
|
_collisionMeshKey = key;
|
||||||
if (_collisionMeshKey) {
|
|
||||||
collisionMeshCache.releaseMesh(_collisionMeshKey);
|
|
||||||
}
|
|
||||||
_collisionMeshKey = key;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
|
void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
|
||||||
|
@ -1340,7 +1324,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
||||||
_didLastVisualGeometryRequestSucceed = didVisualGeometryRequestSucceed;
|
_didLastVisualGeometryRequestSucceed = didVisualGeometryRequestSucceed;
|
||||||
});
|
});
|
||||||
connect(model.get(), &Model::requestRenderUpdate, this, &ModelEntityRenderer::requestRenderUpdate);
|
connect(model.get(), &Model::requestRenderUpdate, this, &ModelEntityRenderer::requestRenderUpdate);
|
||||||
connect(entity.get(), &RenderableModelEntityItem::requestCollisionGeometryUpdate, this, &ModelEntityRenderer::flagForCollisionGeometryUpdate);
|
|
||||||
model->setLoadingPriority(EntityTreeRenderer::getEntityLoadingPriority(*entity));
|
model->setLoadingPriority(EntityTreeRenderer::getEntityLoadingPriority(*entity));
|
||||||
entity->setModel(model);
|
entity->setModel(model);
|
||||||
withWriteLock([&] { _model = model; });
|
withWriteLock([&] { _model = model; });
|
||||||
|
@ -1413,25 +1396,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
||||||
model->setCanCastShadow(_canCastShadow, scene);
|
model->setCanCastShadow(_canCastShadow, scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_needsCollisionGeometryUpdate) {
|
|
||||||
setCollisionMeshKey(entity->getCollisionMeshKey());
|
|
||||||
_needsCollisionGeometryUpdate = false;
|
|
||||||
ShapeType type = entity->getShapeType();
|
|
||||||
if (DependencyManager::get<EntityTreeRenderer>()->shouldRenderDebugHulls() && type != SHAPE_TYPE_NONE) {
|
|
||||||
// NOTE: it is OK if _collisionMeshKey is nullptr
|
|
||||||
graphics::MeshPointer mesh = collisionMeshCache.getMesh(_collisionMeshKey);
|
|
||||||
// TODO: Start displaying collision model
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (_collisionMeshKey) {
|
|
||||||
// release mesh
|
|
||||||
collisionMeshCache.releaseMesh(_collisionMeshKey);
|
|
||||||
}
|
|
||||||
// TODO: Stop displaying collision model
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
DETAILED_PROFILE_RANGE(simulation_physics, "Fixup");
|
DETAILED_PROFILE_RANGE(simulation_physics, "Fixup");
|
||||||
if (model->needsFixupInScene()) {
|
if (model->needsFixupInScene()) {
|
||||||
|
@ -1487,11 +1451,6 @@ void ModelEntityRenderer::setIsVisibleInSecondaryCamera(bool value) {
|
||||||
setKey(_didLastVisualGeometryRequestSucceed);
|
setKey(_didLastVisualGeometryRequestSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityRenderer::flagForCollisionGeometryUpdate() {
|
|
||||||
_needsCollisionGeometryUpdate = true;
|
|
||||||
emit requestRenderUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: this only renders the "meta" portion of the Model, namely it renders debugging items
|
// NOTE: this only renders the "meta" portion of the Model, namely it renders debugging items
|
||||||
void ModelEntityRenderer::doRender(RenderArgs* args) {
|
void ModelEntityRenderer::doRender(RenderArgs* args) {
|
||||||
DETAILED_PROFILE_RANGE(render_detail, "MetaModelRender");
|
DETAILED_PROFILE_RANGE(render_detail, "MetaModelRender");
|
||||||
|
|
|
@ -161,7 +161,6 @@ protected:
|
||||||
virtual bool needsRenderUpdate() const override;
|
virtual bool needsRenderUpdate() const override;
|
||||||
virtual void doRender(RenderArgs* args) override;
|
virtual void doRender(RenderArgs* args) override;
|
||||||
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
|
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
|
||||||
void flagForCollisionGeometryUpdate();
|
|
||||||
void setCollisionMeshKey(const void* key);
|
void setCollisionMeshKey(const void* key);
|
||||||
|
|
||||||
render::hifi::Tag getTagMask() const override;
|
render::hifi::Tag getTagMask() const override;
|
||||||
|
@ -189,7 +188,6 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool _needsJointSimulation { false };
|
bool _needsJointSimulation { false };
|
||||||
bool _needsCollisionGeometryUpdate { false };
|
|
||||||
const void* _collisionMeshKey { nullptr };
|
const void* _collisionMeshKey { nullptr };
|
||||||
|
|
||||||
// used on client side
|
// used on client side
|
||||||
|
|
Loading…
Reference in a new issue