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>
27 namespace Dali DALI_IMPORT_API
30 namespace Internal DALI_INTERNAL
33 } // namespace Internal
39 * @brief Defines the shape of an object in the simulation.
41 class 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(Mesh 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.
119 * @brief Virtual destructor.
121 virtual ~DynamicsShape();
124 * @copydoc Dali::BaseHandle::operator=
126 using BaseHandle::operator=;
130 * @brief Get the type of shape.
132 * @return One of the ShapeType enumeration.
134 ShapeType GetType() const;
136 // Not intended for application developers
139 * @brief This constructor is used by Dali New() methods.
141 * @param [in] internal A pointer to a newly allocated Dali resource
143 explicit DALI_INTERNAL DynamicsShape(Internal::DynamicsShape* internal);
144 }; // class DynamicsShape
148 #endif /* __DALI_DYNAMICS_SHAPE_H__ */