From bf1cb951a3b304cd69272540d58d3b549fca066d Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 11 Mar 2015 18:34:27 -0700 Subject: [PATCH] move PhysicsEntity so that ModelEntityItem can initiate a model download --- libraries/entities/CMakeLists.txt | 2 +- libraries/entities/src/ModelEntityItem.cpp | 13 +++++++------ libraries/render-utils/src/Model.cpp | 3 ++- libraries/render-utils/src/Model.h | 2 +- .../{physics => render-utils}/src/PhysicsEntity.cpp | 0 .../{physics => render-utils}/src/PhysicsEntity.h | 0 6 files changed, 11 insertions(+), 9 deletions(-) rename libraries/{physics => render-utils}/src/PhysicsEntity.cpp (100%) rename libraries/{physics => render-utils}/src/PhysicsEntity.h (100%) diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index e57bcf67fa..d8c316aba6 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -13,4 +13,4 @@ find_package(Bullet REQUIRED) target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) -link_hifi_libraries(avatars shared octree gpu model fbx networking animation) +link_hifi_libraries(avatars shared octree gpu model fbx networking animation render-utils) diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index bd6842b18a..1d9dc0dc87 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -17,7 +17,7 @@ #include "EntityTree.h" #include "EntityTreeElement.h" #include "ModelEntityItem.h" -// #include "GeometryCache.h" +#include "GeometryCache.h" const QString ModelEntityItem::DEFAULT_MODEL_URL = QString(""); const QString ModelEntityItem::DEFAULT_COLLISION_MODEL_URL = QString(""); @@ -416,13 +416,14 @@ QString ModelEntityItem::getAnimationSettings() const { void ModelEntityItem::computeShapeInfo(ShapeInfo& info) const { if (_collisionModelURL != "") { - // QSharedPointer networkGeometry = - // DependencyManager::get()->getGeometry (_collisionModelURL, QUrl(), false); + QSharedPointer networkGeometry = + DependencyManager::get()->getGeometry (_collisionModelURL, QUrl(), false); + + // XXX does this do an unneeded copy? + FBXGeometry _collisionModel = networkGeometry->getFBXGeometry(); - // FBXGeometry& _collisionModel; - // _collisionModel = &networkGeometry->getFBXGeometry(); // connect(networkGeometry, loaded, this, collisionGeometryLoaded); - // info.setParams(getShapeType(), 0.5f * getDimensions(), NULL, _collisionModelURL); + info.setParams(getShapeType(), 0.5f * getDimensions(), NULL, _collisionModelURL); } } diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 532d730ba1..a4eb952703 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -34,6 +33,8 @@ #include "DeferredLightingEffect.h" #include "GlowEffect.h" #include "Model.h" +#include "PhysicsEntity.h" + #include "model_vert.h" #include "model_shadow_vert.h" diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 99a8c3f69c..2da7ce6043 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "AnimationHandle.h" @@ -32,6 +31,7 @@ #include "JointState.h" #include "ProgramObject.h" #include "TextureCache.h" +#include "PhysicsEntity.h" class AbstractViewStateInterface; class QScriptEngine; diff --git a/libraries/physics/src/PhysicsEntity.cpp b/libraries/render-utils/src/PhysicsEntity.cpp similarity index 100% rename from libraries/physics/src/PhysicsEntity.cpp rename to libraries/render-utils/src/PhysicsEntity.cpp diff --git a/libraries/physics/src/PhysicsEntity.h b/libraries/render-utils/src/PhysicsEntity.h similarity index 100% rename from libraries/physics/src/PhysicsEntity.h rename to libraries/render-utils/src/PhysicsEntity.h