Remove handle::operator=(NULL) as it is duplicating handle.Reset() functionality...
[platform/core/uifw/dali-core.git] / dali / public-api / dynamics / dynamics-shape.h
1 #ifndef __DALI_DYNAMICS_SHAPE_H__
2 #define __DALI_DYNAMICS_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 // EXTERNAL INCLUDES
22 #include <string>
23
24 // BASE CLASS INCLUDES
25 #include <dali/public-api/object/base-handle.h>
26 #include <dali/public-api/geometry/cloth.h>
27
28 namespace Dali
29 {
30
31 namespace Internal DALI_INTERNAL
32 {
33 class DynamicsShape;
34 } // namespace Internal
35
36 class DynamicsWorld;
37
38 /**
39  * @brief Defines the shape of an object in the simulation.
40  */
41 class DALI_IMPORT_API DynamicsShape : public BaseHandle
42 {
43 public:
44   /**
45    * @brief The types of shape available.
46    */
47   enum ShapeType
48   {
49     CAPSULE = 0,        ///< A capsule (a cylinder capped with half spheres) defined by the radius of the caps and its height (the height is to the center of the caps)
50     CONE,               ///< A cone defined by the radius of its base and its height
51     CUBE,               ///< A cube defined by width,height and depth
52     CYLINDER,           ///< A cylinder defined by the radius of its ends and its height
53     MESH,               ///< A shape defined by a triangular mesh
54     SPHERE,             ///< A sphere defined by its radius
55   }; // enum ShapeType
56
57 public:
58   /**
59    * @brief Creates a capsule. (A cylinder capped with half spheres)
60    *
61    * @param[in] radius The radius of the capsule.
62    * @param[in] length The length of the capsule.
63    * @return a handle to the new shape.
64    */
65   static DynamicsShape NewCapsule(const float radius, const float length);
66
67   /**
68    * @brief Creates a cone.
69    *
70    * @param[in] radius The radius of the cone.
71    * @param[in] length The length of the cone.
72    * @return a handle to the new shape.
73    */
74   static DynamicsShape NewCone(const float radius, const float length);
75
76   /**
77    * @brief Creates a cube shape.
78    *
79    * All angles are right angles, and opposite faces are equal.
80    * @param[in] dimensions The dimensions of the cuboid ( width, height and depth ).
81    * @return A handle to the new shape
82    */
83   static DynamicsShape NewCube(const Vector3& dimensions);
84
85   /**
86    * @brief Creates a cylinder.
87    *
88    * @param[in] radius The radius of the cylinder.
89    * @param[in] length The length of the cylinder.
90    * @return A handle to the new shape
91    */
92   static DynamicsShape NewCylinder(const float radius, const float length);
93
94   /**
95    * @brief Creates a mesh.
96    *
97    * @param[in] mesh  A mesh.
98    * @return A handle to the new shape
99    */
100   static DynamicsShape NewMesh(Cloth mesh);
101
102   /**
103    * @brief Creates a sphere.
104    *
105    * @param[in] radius The radius of the sphere.
106    * @return A handle to the new shape
107    */
108   static DynamicsShape NewSphere(const float radius);
109
110 public:
111   /**
112    * @brief Constructor which creates an uninitialized DynamicsShape handle.
113    *
114    * Use one of the DynamicsShape::New methods to initialise the handle.
115    */
116   DynamicsShape();
117
118   /**
119    * @brief Destructor
120    *
121    * This is non-virtual since derived Handle types must not contain data or virtual methods.
122    */
123   ~DynamicsShape();
124
125   /**
126    * @brief This copy constructor is required for (smart) pointer semantics.
127    *
128    * @param [in] handle A reference to the copied handle
129    */
130   DynamicsShape(const DynamicsShape& handle);
131
132   /**
133    * @brief This assignment operator is required for (smart) pointer semantics.
134    *
135    * @param [in] rhs  A reference to the copied handle
136    * @return A reference to this
137    */
138   DynamicsShape& operator=(const DynamicsShape& rhs);
139
140 public:
141   /**
142    * @brief Get the type of shape.
143    *
144    * @return One of the ShapeType enumeration.
145    */
146   ShapeType GetType() const;
147
148   // Not intended for application developers
149 public:
150   /**
151    * @brief This constructor is used by Dali New() methods.
152    *
153    * @param [in] internal A pointer to a newly allocated Dali resource
154    */
155   explicit DALI_INTERNAL DynamicsShape(Internal::DynamicsShape* internal);
156 }; // class DynamicsShape
157
158 } // namespace Dali
159
160 #endif /* __DALI_DYNAMICS_SHAPE_H__ */