From 2d1b569e48c751a7bba1563deaf319affbcb18a3 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sat, 9 Jan 2021 22:14:32 -0800 Subject: Added IDeviceObject::SetUserData() and IDeviceObject::GetUserData() methods (API240081) --- Graphics/GraphicsTools/interface/DynamicTextureAtlas.h | 15 +++++++++++++++ Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp | 12 ++++++++++++ 2 files changed, 27 insertions(+) (limited to 'Graphics/GraphicsTools') diff --git a/Graphics/GraphicsTools/interface/DynamicTextureAtlas.h b/Graphics/GraphicsTools/interface/DynamicTextureAtlas.h index 20a6077c..4bb96ff4 100644 --- a/Graphics/GraphicsTools/interface/DynamicTextureAtlas.h +++ b/Graphics/GraphicsTools/interface/DynamicTextureAtlas.h @@ -67,6 +67,21 @@ struct ITextureAtlasSuballocation : public IObject /// Returns the pointer to the parent texture atlas. virtual IDynamicTextureAtlas* GetAtlas() = 0; + + /// Stores a pointer to the user-provided data object, which + /// may later be retreived through GetUserData(). + /// + /// \param [in] pUserData - Pointer to the user data object to store. + /// + /// \note The method is not thread-safe and an application + /// must externally synchronize the access. + virtual void SetUserData(IObject* pUserData) = 0; + + /// Returns the pointer to the user data object previously + /// set with SetUserData() method. + /// + /// \return Pointer to the user data object + virtual IObject* GetUserData() const = 0; }; /// Dynamic texture atlas. diff --git a/Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp b/Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp index 05ee3586..01056a59 100644 --- a/Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp +++ b/Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp @@ -97,6 +97,16 @@ public: virtual IDynamicTextureAtlas* GetAtlas() override final; + virtual void SetUserData(IObject* pUserData) override final + { + m_pUserData = pUserData; + } + + virtual IObject* GetUserData() const override final + { + return m_pUserData.RawPtr(); + } + private: RefCntAutoPtr m_pParentAtlas; @@ -104,6 +114,8 @@ private: const Uint32 m_Slice; const uint2 m_Size; + + RefCntAutoPtr m_pUserData; }; -- cgit v1.2.3