From a3682a1a0ea5725136bf8bc038731d11a5463c98 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 12 Apr 2017 13:30:08 -0700 Subject: [PATCH] cleanup includes in Avatar.cpp and remove cruft --- interface/src/Physics.cpp | 44 ------------------------ interface/src/Physics.h | 18 ---------- interface/src/avatar/Avatar.cpp | 24 ++++--------- interface/src/avatar/Avatar.h | 4 --- interface/src/avatar/AvatarManager.h | 4 ++- interface/src/avatar/AvatarMotionState.h | 2 -- interface/src/avatar/MyAvatar.cpp | 1 - 7 files changed, 9 insertions(+), 88 deletions(-) delete mode 100644 interface/src/Physics.cpp delete mode 100644 interface/src/Physics.h diff --git a/interface/src/Physics.cpp b/interface/src/Physics.cpp deleted file mode 100644 index 7efa520571..0000000000 --- a/interface/src/Physics.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// Physics.cpp -// interface/src -// -// Copyright 2013 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 -#include - -#include "Util.h" -#include "world.h" -#include "Physics.h" - -// -// Applies static friction: maxVelocity is the largest velocity for which there -// there is friction, and strength is the amount of friction force applied to reduce -// velocity. -// -void applyStaticFriction(float deltaTime, glm::vec3& velocity, float maxVelocity, float strength) { - float v = glm::length(velocity); - if (v < maxVelocity) { - velocity *= glm::clamp((1.0f - deltaTime * strength * (1.0f - v / maxVelocity)), 0.0f, 1.0f); - } -} - -// -// Applies velocity damping, with a strength value for linear and squared velocity damping -// - -void applyDamping(float deltaTime, glm::vec3& velocity, float linearStrength, float squaredStrength) { - if (squaredStrength == 0.0f) { - velocity *= glm::clamp(1.0f - deltaTime * linearStrength, 0.0f, 1.0f); - } else { - velocity *= glm::clamp(1.0f - deltaTime * (linearStrength + glm::length(velocity) * squaredStrength), 0.0f, 1.0f); - } -} - -void applyDampedSpring(float deltaTime, glm::vec3& velocity, glm::vec3& position, glm::vec3& targetPosition, float k, float damping) { - -} diff --git a/interface/src/Physics.h b/interface/src/Physics.h deleted file mode 100644 index 97e873d920..0000000000 --- a/interface/src/Physics.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Physics.h -// interface/src -// -// Created by Philip on 4/25/13. -// Copyright 2013 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_Physics_h -#define hifi_Physics_h - -void applyStaticFriction(float deltaTime, glm::vec3& velocity, float maxVelocity, float strength); -void applyDamping(float deltaTime, glm::vec3& velocity, float linearStrength, float squaredStrength); - -#endif // hifi_Physics_h diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 73ca149461..78ffd22540 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -9,20 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include +#include "Avatar.h" -#include -#include - -#include -#include -#include -#include +#include +#include #include #include -#include -#include +#include #include #include #include @@ -31,19 +25,13 @@ #include #include #include -#include #include #include -#include "Application.h" -#include "Avatar.h" #include "AvatarManager.h" #include "AvatarMotionState.h" -#include "Head.h" +#include "Camera.h" #include "Menu.h" -#include "Physics.h" -#include "Util.h" -#include "world.h" #include "InterfaceLogging.h" #include "SceneScriptingInterface.h" #include "SoftAttachmentModel.h" @@ -583,7 +571,7 @@ void Avatar::render(RenderArgs* renderArgs) { auto& batch = *renderArgs->_batch; PROFILE_RANGE_BATCH(batch, __FUNCTION__); - if (glm::distance(DependencyManager::get()->getMyAvatar()->getPosition(), getPosition()) < 10.0f) { + if (glm::distance(DependencyManager::get()->getMyAvatarPosition(), getPosition()) < 10.0f) { auto geometryCache = DependencyManager::get(); // render pointing lasers diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index 50edb4e947..e8a5366586 100644 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -14,19 +14,15 @@ #include #include -#include #include #include #include - #include -#include "Camera.h" #include "Head.h" #include "SkeletonModel.h" -#include "world.h" #include "Rig.h" #include diff --git a/interface/src/avatar/AvatarManager.h b/interface/src/avatar/AvatarManager.h index b86de68894..6eabbd081f 100644 --- a/interface/src/avatar/AvatarManager.h +++ b/interface/src/avatar/AvatarManager.h @@ -23,6 +23,7 @@ #include #include "Avatar.h" +#include "MyAvatar.h" #include "AvatarMotionState.h" #include "ScriptAvatar.h" @@ -42,6 +43,7 @@ public: void init(); std::shared_ptr getMyAvatar() { return _myAvatar; } + glm::vec3 getMyAvatarPosition() const { return _myAvatar->getPosition(); } // Null/Default-constructed QUuids will return MyAvatar Q_INVOKABLE virtual ScriptAvatarData* getAvatar(QUuid avatarID) override { return new ScriptAvatar(getAvatarBySessionID(avatarID)); } @@ -110,7 +112,7 @@ private: QVector _avatarsToFade; - SetOfAvatarMotionStates _motionStatesThatMightUpdate; + QSet _motionStatesThatMightUpdate; VectorOfMotionStates _motionStatesToRemoveFromPhysics; SetOfMotionStates _motionStatesToAddToPhysics; diff --git a/interface/src/avatar/AvatarMotionState.h b/interface/src/avatar/AvatarMotionState.h index 66824d6e37..98b2b69373 100644 --- a/interface/src/avatar/AvatarMotionState.h +++ b/interface/src/avatar/AvatarMotionState.h @@ -83,6 +83,4 @@ protected: uint32_t _dirtyFlags; }; -typedef QSet SetOfAvatarMotionStates; - #endif // hifi_AvatarMotionState_h diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 8ff93660ac..af54f08d54 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -48,7 +48,6 @@ #include "AvatarActionHold.h" #include "Menu.h" #include "MyAvatar.h" -#include "Physics.h" #include "Util.h" #include "InterfaceLogging.h" #include "DebugDraw.h"