Some containers that triggered only one times could be optimized by OrderedSet feature.
Let we make Add/Remove time faster.
Change-Id: I3a4864a6e76671fa89f851b3b4382e74893ba130
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
mSkybox(),
mSkyboxOrientation(Quaternion()),
mSkyboxIntensity(1.0f),
+ mLightObservers(),
mShaderManager(new Scene3D::Loader::ShaderManager())
{
}
{
item->NotifyImageBasedLightTexture(mDiffuseTexture, mSpecularTexture, mIblScaleFactor, mSpecularMipmapLevels);
item->NotifyShadowMapTexture(mShadowTexture);
- mItems.push_back(item);
+ mLightObservers.PushBack(item);
}
}
{
if(item)
{
- for(uint32_t i = 0; i < mItems.size(); ++i)
+ auto iter = mLightObservers.Find(item);
+ if(iter != mLightObservers.End())
{
- if(mItems[i] == item)
- {
- mItems.erase(mItems.begin() + i);
- break;
- }
+ mLightObservers.Erase(iter);
}
}
}
void SceneView::SetImageBasedLightScaleFactor(float scaleFactor)
{
mIblScaleFactor = scaleFactor;
- for(auto&& item : mItems)
+ for(auto&& item : mLightObservers)
{
if(item)
{
mShadowLight.Reset();
mShadowTexture.Reset();
- for(auto&& item : mItems)
+ for(auto&& item : mLightObservers)
{
if(item)
{
void SceneView::OnSceneDisconnection()
{
- mItems.clear();
+ mLightObservers.Clear();
Window window = mWindow.GetHandle();
if(window)
void SceneView::NotifyImageBasedLightTextureChange()
{
- for(auto&& item : mItems)
+ for(auto&& item : mLightObservers)
{
if(item)
{
DevelFrameBuffer::AttachDepthTexture(mShadowFrameBuffer, mShadowTexture);
mShadowMapRenderTask.SetFrameBuffer(mShadowFrameBuffer);
- for(auto&& item : mItems)
+ for(auto&& item : mLightObservers)
{
if(item)
{
#include <dali-toolkit/internal/visuals/image/image-visual.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali/integration-api/adaptor-framework/scene-holder.h>
+#include <dali/integration-api/ordered-set.h>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/adaptor-framework/window.h>
/////////////////////////////////////////////////////////////
// FrameBuffer and Rendertask to render child objects as a 3D Scene
- Dali::WeakHandle<Dali::Window> mWindow;
- Integration::SceneHolder mSceneHolder;
- CameraActor mDefaultCamera;
- CameraActor mSelectedCamera;
- std::vector<CameraActor> mCameras;
- std::vector<Scene3D::Internal::LightObserver*> mItems;
- Dali::FrameBuffer mFrameBuffer;
- Dali::Texture mTexture;
- Dali::RenderTask mRenderTask;
- Layer mRootLayer;
- int32_t mWindowOrientation;
- Dali::Actor mSkybox;
- Quaternion mSkyboxOrientation;
- float mSkyboxIntensity{1.0f};
- uint8_t mFrameBufferMultiSamplingLevel{0u};
+ Dali::WeakHandle<Dali::Window> mWindow;
+ Integration::SceneHolder mSceneHolder;
+ CameraActor mDefaultCamera;
+ CameraActor mSelectedCamera;
+ std::vector<CameraActor> mCameras;
+ Dali::FrameBuffer mFrameBuffer;
+ Dali::Texture mTexture;
+ Dali::RenderTask mRenderTask;
+ Layer mRootLayer;
+ int32_t mWindowOrientation;
+ Dali::Actor mSkybox;
+ Quaternion mSkyboxOrientation;
+ float mSkyboxIntensity{1.0f};
+ uint8_t mFrameBufferMultiSamplingLevel{0u};
+
+ Dali::Integration::OrderedSet<Scene3D::Internal::LightObserver, false> mLightObservers; ///< The set of items to be notified when light properties change. (not owned)
bool mWindowSizeChanged{false};
uint32_t mWindowWidth{0};
VectorAnimationManager::~VectorAnimationManager()
{
- mEventCallbacks.clear();
+ mEventCallbacks.Clear();
if(mProcessorRegistered && Adaptor::IsAvailable())
{
void VectorAnimationManager::RegisterEventCallback(CallbackBase* callback)
{
- mEventCallbacks.emplace_back(std::unique_ptr<Dali::CallbackBase>(callback));
+ mEventCallbacks.PushBack(callback); ///< Take ownership of callback.
if(!mProcessorRegistered)
{
void VectorAnimationManager::UnregisterEventCallback(CallbackBase* callback)
{
- auto iter = std::find_if(mEventCallbacks.begin(),
- mEventCallbacks.end(),
- [callback](const std::unique_ptr<CallbackBase>& element) {
- return element.get() == callback;
- });
- if(iter != mEventCallbacks.end())
+ auto iter = mEventCallbacks.Find(callback);
+ if(iter != mEventCallbacks.End())
{
- mEventCallbacks.erase(iter);
+ mEventCallbacks.Erase(iter);
- if(mEventCallbacks.empty())
+ if(mEventCallbacks.Count() == 0u)
{
if(Adaptor::IsAvailable())
{
#ifdef TRACE_ENABLED
if(gTraceFilter && gTraceFilter->IsTraceEnabled())
{
- if(mEventCallbacks.size() > 0u)
+ if(mEventCallbacks.Count() > 0u)
{
std::ostringstream oss;
- oss << "[" << mEventCallbacks.size() << "]";
+ oss << "[" << mEventCallbacks.Count() << "]";
DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_VECTOR_ANIMATION_MANAGER_PROCESS", oss.str().c_str());
}
}
#ifdef TRACE_ENABLED
if(gTraceFilter && gTraceFilter->IsTraceEnabled())
{
- if(mEventCallbacks.size() > 0u)
+ if(mEventCallbacks.Count() > 0u)
{
std::ostringstream oss;
- oss << "[" << mEventCallbacks.size() << "]";
+ oss << "[" << mEventCallbacks.Count() << "]";
DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_VECTOR_ANIMATION_MANAGER_PROCESS", oss.str().c_str());
}
}
#endif
- mEventCallbacks.clear();
+ mEventCallbacks.Clear();
Adaptor::Get().UnregisterProcessor(*this, true);
mProcessorRegistered = false;
*/
// EXTERNAL INCLUDES
+#include <dali/integration-api/ordered-set.h>
#include <dali/integration-api/processor-interface.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/signals/callback.h>
VectorAnimationManager& operator=(const VectorAnimationManager& manager) = delete;
private:
- std::vector<std::unique_ptr<CallbackBase>> mEventCallbacks;
- std::unique_ptr<VectorAnimationThread> mVectorAnimationThread;
- bool mProcessorRegistered;
+ Dali::Integration::OrderedSet<CallbackBase> mEventCallbacks; ///< Event triggered callback lists (owned)
+
+ std::unique_ptr<VectorAnimationThread> mVectorAnimationThread;
+ bool mProcessorRegistered : 1;
};
} // namespace Internal