diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-05-13 18:16:14 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-05-17 16:16:19 +0300 |
commit | 63543601660861bdd6a729454f1ae02a88885c1e (patch) | |
tree | 878975e8d9612b3283f991f91f28c06881aa2256 /drape | |
parent | e4443bec67bf88e9a577fba78d839c6feb78b36d (diff) |
Added displacement modes
Diffstat (limited to 'drape')
-rw-r--r-- | drape/constants.hpp | 26 | ||||
-rw-r--r-- | drape/depth_constants.hpp | 16 | ||||
-rw-r--r-- | drape/drape_common.pri | 2 | ||||
-rw-r--r-- | drape/overlay_handle.cpp | 9 | ||||
-rw-r--r-- | drape/overlay_handle.hpp | 10 | ||||
-rw-r--r-- | drape/overlay_tree.cpp | 15 | ||||
-rw-r--r-- | drape/overlay_tree.hpp | 3 | ||||
-rw-r--r-- | drape/utils/projection.hpp | 4 |
8 files changed, 57 insertions, 28 deletions
diff --git a/drape/constants.hpp b/drape/constants.hpp new file mode 100644 index 0000000000..5cbe4d88db --- /dev/null +++ b/drape/constants.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "utils/projection.hpp" + +namespace dp +{ + +namespace depth +{ + +float constexpr POSITION_ACCURACY = minDepth + 1.0f; +float constexpr MY_POSITION_MARK = maxDepth - 1.0f; + +} // namespace depth + +namespace displacement +{ + +int constexpr kDefaultMode = 0x1; +int constexpr kHotelMode = 0x2; + +int constexpr kAllModes = kDefaultMode | kHotelMode; + +} // namespace displacement + +} // namespace dp diff --git a/drape/depth_constants.hpp b/drape/depth_constants.hpp deleted file mode 100644 index 516f5606ee..0000000000 --- a/drape/depth_constants.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include "utils/projection.hpp" - -namespace dp -{ - -namespace depth -{ - -float const POSITION_ACCURACY = minDepth + 1.0f; -float const MY_POSITION_MARK = maxDepth - 1.0f; - -} // namespace depth - -} // namespace dp diff --git a/drape/drape_common.pri b/drape/drape_common.pri index 7cb8e4da16..f8cc8fa8ff 100644 --- a/drape/drape_common.pri +++ b/drape/drape_common.pri @@ -60,11 +60,11 @@ HEADERS += \ $$DRAPE_DIR/binding_info.hpp \ $$DRAPE_DIR/buffer_base.hpp \ $$DRAPE_DIR/color.hpp \ + $$DRAPE_DIR/constants.hpp \ $$DRAPE_DIR/cpu_buffer.hpp \ $$DRAPE_DIR/data_buffer.hpp \ $$DRAPE_DIR/data_buffer_impl.hpp \ $$DRAPE_DIR/debug_rect_renderer.hpp \ - $$DRAPE_DIR/depth_constants.hpp \ $$DRAPE_DIR/drape_global.hpp \ $$DRAPE_DIR/dynamic_texture.hpp \ $$DRAPE_DIR/font_texture.hpp \ diff --git a/drape/overlay_handle.cpp b/drape/overlay_handle.cpp index 0bcd2b514c..fd1179453a 100644 --- a/drape/overlay_handle.cpp +++ b/drape/overlay_handle.cpp @@ -1,5 +1,7 @@ #include "drape/overlay_handle.hpp" +#include "drape/constants.hpp" + #include "base/macros.hpp" #include "base/internal/message.hpp" @@ -22,10 +24,8 @@ private: uint8_t m_bufferID; }; -OverlayHandle::OverlayHandle(FeatureID const & id, - dp::Anchor anchor, - uint64_t priority, - bool isBillboard) +OverlayHandle::OverlayHandle(FeatureID const & id, dp::Anchor anchor, + uint64_t priority, bool isBillboard) : m_id(id) , m_anchor(anchor) , m_priority(priority) @@ -34,6 +34,7 @@ OverlayHandle::OverlayHandle(FeatureID const & id, , m_pivotZ(0.0) , m_isBillboard(isBillboard) , m_isVisible(false) + , m_displacementMode(displacement::kAllModes) , m_enableCaching(false) , m_extendedShapeDirty(true) , m_extendedRectDirty(true) diff --git a/drape/overlay_handle.hpp b/drape/overlay_handle.hpp index ce6bb1fcbb..ab16ab166c 100644 --- a/drape/overlay_handle.hpp +++ b/drape/overlay_handle.hpp @@ -39,10 +39,8 @@ class OverlayHandle public: typedef vector<m2::RectF> Rects; - OverlayHandle(FeatureID const & id, - dp::Anchor anchor, - uint64_t priority, - bool isBillboard); + OverlayHandle(FeatureID const & id, dp::Anchor anchor, + uint64_t priority, bool isBillboard); virtual ~OverlayHandle() {} @@ -91,6 +89,9 @@ public: void SetCachingEnable(bool enable); + int GetDisplacementMode() const { return m_displacementMode; } + void SetDisplacementMode(int mode) { m_displacementMode = mode; } + #ifdef DEBUG_OVERLAYS_OUTPUT virtual string GetOverlayDebugInfo() { return ""; } #endif @@ -113,6 +114,7 @@ protected: private: bool const m_isBillboard; bool m_isVisible; + int m_displacementMode; dp::IndexStorage m_indexes; struct LessOffsetNode diff --git a/drape/overlay_tree.cpp b/drape/overlay_tree.cpp index 394ce7e0a6..c4e8b9fc05 100644 --- a/drape/overlay_tree.cpp +++ b/drape/overlay_tree.cpp @@ -1,5 +1,7 @@ #include "drape/overlay_tree.hpp" +#include "drape/constants.hpp" + #include "std/algorithm.hpp" #include "std/bind.hpp" @@ -63,6 +65,7 @@ OverlayTree::OverlayTree() : m_frameCounter(kInvalidFrame) , m_followingMode(false) , m_isDisplacementEnabled(true) + , m_displacementMode(displacement::kDefaultMode) { for (size_t i = 0; i < m_handles.size(); i++) m_handles[i].reserve(kAverageHandlesCount[i]); @@ -115,9 +118,15 @@ void OverlayTree::Add(ref_ptr<OverlayHandle> handle) handle->SetIsVisible(false); handle->SetCachingEnable(true); + // Skip overlays from another displacement mode. + if ((handle->GetDisplacementMode() & m_displacementMode) == 0) + return; + + // Skip duplicates. if (m_handlesCache.find(handle) != m_handlesCache.end()) return; + // Skip not-ready handles. if (!handle->Update(modelView)) return; @@ -397,6 +406,12 @@ void OverlayTree::SetDisplacementEnabled(bool enabled) m_frameCounter = kInvalidFrame; } +void OverlayTree::SetDisplacementMode(int displacementMode) +{ + m_displacementMode = displacementMode; + m_frameCounter = kInvalidFrame; +} + #ifdef COLLECT_DISPLACEMENT_INFO OverlayTree::TDisplacementInfo const & OverlayTree::GetDisplacementInfo() const diff --git a/drape/overlay_tree.hpp b/drape/overlay_tree.hpp index 3b11413352..bf13ae88b5 100644 --- a/drape/overlay_tree.hpp +++ b/drape/overlay_tree.hpp @@ -62,8 +62,8 @@ public: void Select(m2::PointD const & glbPoint, TOverlayContainer & result) const; void SetFollowingMode(bool mode); - void SetDisplacementEnabled(bool enabled); + void SetDisplacementMode(int displacementMode); #ifdef COLLECT_DISPLACEMENT_INFO struct DisplacementData @@ -93,6 +93,7 @@ private: bool m_followingMode; bool m_isDisplacementEnabled; + int m_displacementMode; #ifdef COLLECT_DISPLACEMENT_INFO TDisplacementInfo m_displacementInfo; diff --git a/drape/utils/projection.hpp b/drape/utils/projection.hpp index d0051f545d..896be9cf6d 100644 --- a/drape/utils/projection.hpp +++ b/drape/utils/projection.hpp @@ -4,8 +4,8 @@ namespace dp { - static float const minDepth = -20000.0f; - static float const maxDepth = 20000.0f; + float constexpr minDepth = -20000.0f; + float constexpr maxDepth = 20000.0f; void MakeProjection(array<float, 16> & result, float left, float right, float bottom, float top); } // namespace dp |