From b2ec7f78c136dd1f47d8d1389421723673774bec Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 14 Jun 2018 14:53:44 -0700 Subject: [PATCH] Remove signaling and render code for collision models in RenderableModelEntityItem and EntityTreeRenderer --- .../src/EntityTreeRenderer.cpp | 1 - .../src/EntityTreeRenderer.h | 6 --- .../src/RenderableModelEntityItem.cpp | 45 +------------------ .../src/RenderableModelEntityItem.h | 2 - 4 files changed, 2 insertions(+), 52 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 600d1c32a8..ab282ea6f9 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -42,7 +42,6 @@ size_t std::hash::operator()(const EntityItemID& id) const { return qHash(id); } std::function EntityTreeRenderer::_entitiesShouldFadeFunction; -std::function EntityTreeRenderer::_renderDebugHullsOperator = [] { return false; }; EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState, AbstractScriptingServicesInterface* scriptingServices) : diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.h b/libraries/entities-renderer/src/EntityTreeRenderer.h index 882ec2fd5b..de3033936a 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.h +++ b/libraries/entities-renderer/src/EntityTreeRenderer.h @@ -116,14 +116,10 @@ public: EntityItemPointer getEntity(const EntityItemID& id); void onEntityChanged(const EntityItemID& id); - static void setRenderDebugHullsOperator(std::function renderDebugHullsOperator) { _renderDebugHullsOperator = renderDebugHullsOperator; } - static bool shouldRenderDebugHulls() { return _renderDebugHullsOperator(); } - signals: void enterEntity(const EntityItemID& entityItemID); void leaveEntity(const EntityItemID& entityItemID); void collisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision); - void setRenderDebugHulls(); public slots: void addingEntity(const EntityItemID& entityID); @@ -259,8 +255,6 @@ private: static int _entitiesScriptEngineCount; static CalculateEntityLoadingPriority _calculateEntityLoadingPriorityFunc; static std::function _entitiesShouldFadeFunction; - - static std::function _renderDebugHullsOperator; }; diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index f12d2dc180..be385008a3 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include #include @@ -35,8 +34,6 @@ #include "EntitiesRendererLogging.h" -static CollisionRenderMeshCache collisionMeshCache; - void ModelEntityWrapper::setModel(const ModelPointer& model) { withWriteLock([&] { if (_model != model) { @@ -1052,11 +1049,7 @@ using namespace render; using namespace render::entities; 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().data(), &EntityTreeRenderer::setRenderDebugHulls, this, [&] { - _needsCollisionGeometryUpdate = true; - emit requestRenderUpdate(); - }); + } void ModelEntityRenderer::setKey(bool didVisualGeometryRequestSucceed) { @@ -1216,10 +1209,6 @@ bool ModelEntityRenderer::needsRenderUpdate() const { if (model->getRenderItemsNeedUpdate()) { return true; } - - if (_needsCollisionGeometryUpdate) { - return true; - } } return Parent::needsRenderUpdate(); } @@ -1286,12 +1275,7 @@ bool ModelEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoin } void ModelEntityRenderer::setCollisionMeshKey(const void*key) { - if (key != _collisionMeshKey) { - if (_collisionMeshKey) { - collisionMeshCache.releaseMesh(_collisionMeshKey); - } - _collisionMeshKey = key; - } + _collisionMeshKey = key; } void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { @@ -1340,7 +1324,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce _didLastVisualGeometryRequestSucceed = didVisualGeometryRequestSucceed; }); connect(model.get(), &Model::requestRenderUpdate, this, &ModelEntityRenderer::requestRenderUpdate); - connect(entity.get(), &RenderableModelEntityItem::requestCollisionGeometryUpdate, this, &ModelEntityRenderer::flagForCollisionGeometryUpdate); model->setLoadingPriority(EntityTreeRenderer::getEntityLoadingPriority(*entity)); entity->setModel(model); withWriteLock([&] { _model = model; }); @@ -1413,25 +1396,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce model->setCanCastShadow(_canCastShadow, scene); } - if (_needsCollisionGeometryUpdate) { - setCollisionMeshKey(entity->getCollisionMeshKey()); - _needsCollisionGeometryUpdate = false; - ShapeType type = entity->getShapeType(); - if (DependencyManager::get()->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"); if (model->needsFixupInScene()) { @@ -1487,11 +1451,6 @@ void ModelEntityRenderer::setIsVisibleInSecondaryCamera(bool value) { setKey(_didLastVisualGeometryRequestSucceed); } -void ModelEntityRenderer::flagForCollisionGeometryUpdate() { - _needsCollisionGeometryUpdate = true; - emit requestRenderUpdate(); -} - // NOTE: this only renders the "meta" portion of the Model, namely it renders debugging items void ModelEntityRenderer::doRender(RenderArgs* args) { DETAILED_PROFILE_RANGE(render_detail, "MetaModelRender"); diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index f1748ca069..50d8801363 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -161,7 +161,6 @@ protected: virtual bool needsRenderUpdate() const override; virtual void doRender(RenderArgs* args) override; virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override; - void flagForCollisionGeometryUpdate(); void setCollisionMeshKey(const void* key); render::hifi::Tag getTagMask() const override; @@ -189,7 +188,6 @@ private: #endif bool _needsJointSimulation { false }; - bool _needsCollisionGeometryUpdate { false }; const void* _collisionMeshKey { nullptr }; // used on client side