License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / dali / internal / update / dynamics / scene-graph-dynamics-cone-shape.h
1 #ifndef __SCENE_GRAPH_DYNAMICS_CONE_SHAPE_H__
2 #define __SCENE_GRAPH_DYNAMICS_CONE_SHAPE_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // BASE CLASS HEADERS
22 #include <dali/internal/update/dynamics/scene-graph-dynamics-shape.h>
23
24 // INTERNAL HEADERS
25 #include <dali/internal/event/dynamics/dynamics-declarations.h>
26 #include <dali/internal/common/message.h>
27 #include <dali/internal/common/event-to-update.h>
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 namespace SceneGraph
36 {
37
38 class DynamicsWorld;
39
40 class DynamicsConeShape : public DynamicsShape
41 {
42 public:
43   /**
44    * Constructor.
45    * @param[in] world The dynamics world object
46    */
47   DynamicsConeShape(DynamicsWorld& world);
48
49   /**
50    * Destructor.
51    */
52   virtual ~DynamicsConeShape();
53
54   /**
55    * Constructor.
56    * @param[in] radius  The radius of the cone.
57    * @param[in] length  The length of the cone.
58    */
59   void Initialize( float radius, float length );
60
61 private:
62   // unimplemented copy constructor and assignment operator
63   DynamicsConeShape(const DynamicsConeShape&);
64   DynamicsConeShape& operator=(const DynamicsConeShape&);
65
66 }; // class DynamicsConeShape
67
68 // Messages for DynamicsConeShape
69
70 inline void InitializeDynamicsConeShapeMessage( EventToUpdate& eventToUpdate, const DynamicsConeShape& shape, const float radius, const float length )
71 {
72   typedef MessageValue2< DynamicsConeShape, float, float > LocalType;
73
74   // Reserve some memory inside the message queue
75   unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
76
77   // Construct message in the message queue memory; note that delete should not be called on the return value
78   new (slot) LocalType( &shape, &DynamicsConeShape::Initialize, radius, length );
79 }
80
81 } // namespace SceneGraph
82
83 } // namespace Internal
84
85 } // namespace Dali
86
87 #endif // __SCENE_GRAPH_DYNAMICS_CONE_SHAPE_H__