[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / event / collider-mesh-processor-impl.h
1 #pragma once
2
3 /*
4  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 // EXTERNAL INCLUDES
21 #include <dali/integration-api/processor-interface.h>
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/object/base-object.h>
25 #include <dali/public-api/signals/connection-tracker.h>
26
27 // INTERNAL INCLUDES
28 #include <dali-scene3d/internal/event/collider-mesh-processor.h>
29 #include <dali-scene3d/public-api/controls/model/model.h>
30 #include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
31
32 namespace Dali::Scene3D
33 {
34 namespace Internal
35 {
36 class ColliderMeshProcessor : public BaseObject, public Dali::ConnectionTracker, public Integration::Processor
37 {
38 public:
39   ColliderMeshProcessor();
40
41   ~ColliderMeshProcessor();
42
43   void ColliderMeshChanged(Scene3D::Model model);
44
45 private:
46   void ModelOnScene(Actor actor);
47
48   void AddSceneViewParentToProcessingQueue(Scene3D::Model model);
49
50 protected: // Implementation of Processor
51   /**
52    * @copydoc Dali::Integration::Processor::Process()
53    */
54   void Process(bool /*postProcessor*/) override;
55
56   /**
57    * @copydoc Dali::Integration::Processor::GetProcessorName()
58    */
59   std::string_view GetProcessorName() const override
60   {
61     return "ColliderMeshProcessor";
62   }
63
64 private:
65   std::vector<Scene3D::SceneView> mSceneViewsToProcess;
66   std::vector<Scene3D::SceneView> mConnectedSceneViews;
67 };
68
69 } // namespace Internal
70
71 inline Internal::ColliderMeshProcessor& GetImpl(ColliderMeshProcessor& obj)
72 {
73   DALI_ASSERT_ALWAYS(obj);
74
75   Dali::BaseObject& handle = obj.GetBaseObject();
76
77   return static_cast<Internal::ColliderMeshProcessor&>(handle);
78 }
79
80 inline const Internal::ColliderMeshProcessor& GetImpl(const ColliderMeshProcessor& obj)
81 {
82   DALI_ASSERT_ALWAYS(obj);
83
84   const Dali::BaseObject& handle = obj.GetBaseObject();
85
86   return static_cast<const Internal::ColliderMeshProcessor&>(handle);
87 }
88
89 } // namespace Dali::Scene3D