1 #ifndef __DALI_DYNAMICS_SHAPE_H__
2 #define __DALI_DYNAMICS_SHAPE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 // BASE CLASS INCLUDES
25 #include <dali/public-api/object/base-handle.h>
26 #include <dali/public-api/geometry/cloth.h>
31 namespace Internal DALI_INTERNAL
34 } // namespace Internal
39 * @brief Defines the shape of an object in the simulation.
41 class DALI_IMPORT_API DynamicsShape : public BaseHandle
45 * @brief The types of shape available.
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
59 * @brief Creates a capsule. (A cylinder capped with half spheres)
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.
65 static DynamicsShape NewCapsule(const float radius, const float length);
68 * @brief Creates a cone.
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.
74 static DynamicsShape NewCone(const float radius, const float length);
77 * @brief Creates a cube shape.
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
83 static DynamicsShape NewCube(const Vector3& dimensions);
86 * @brief Creates a cylinder.
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
92 static DynamicsShape NewCylinder(const float radius, const float length);
95 * @brief Creates a mesh.
97 * @param[in] mesh A mesh.
98 * @return A handle to the new shape
100 static DynamicsShape NewMesh(Cloth mesh);
103 * @brief Creates a sphere.
105 * @param[in] radius The radius of the sphere.
106 * @return A handle to the new shape
108 static DynamicsShape NewSphere(const float radius);
112 * @brief Constructor which creates an uninitialized DynamicsShape handle.
114 * Use one of the DynamicsShape::New methods to initialise the handle.
121 * This is non-virtual since derived Handle types must not contain data or virtual methods.
126 * @brief This copy constructor is required for (smart) pointer semantics.
128 * @param [in] handle A reference to the copied handle
130 DynamicsShape(const DynamicsShape& handle);
133 * @brief This assignment operator is required for (smart) pointer semantics.
135 * @param [in] rhs A reference to the copied handle
136 * @return A reference to this
138 DynamicsShape& operator=(const DynamicsShape& rhs);
142 * @brief Get the type of shape.
144 * @return One of the ShapeType enumeration.
146 ShapeType GetType() const;
148 // Not intended for application developers
151 * @brief This constructor is used by Dali New() methods.
153 * @param [in] internal A pointer to a newly allocated Dali resource
155 explicit DALI_INTERNAL DynamicsShape(Internal::DynamicsShape* internal);
156 }; // class DynamicsShape
160 #endif /* __DALI_DYNAMICS_SHAPE_H__ */