License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / dali / internal / update / dynamics / scene-graph-dynamics-cylinder-shape.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.h>
20
21 // INTERNAL HEADERS
22 #include <dali/integration-api/debug.h>
23 #include <dali/integration-api/dynamics/dynamics-factory-intf.h>
24 #include <dali/integration-api/dynamics/dynamics-shape-intf.h>
25 #include <dali/internal/update/dynamics/scene-graph-dynamics-world.h>
26 #include <dali/public-api/dynamics/dynamics-shape.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 namespace SceneGraph
35 {
36
37 DynamicsCylinderShape::DynamicsCylinderShape(DynamicsWorld& world)
38 : DynamicsShape(world)
39 {
40   DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
41 }
42
43 DynamicsCylinderShape::~DynamicsCylinderShape()
44 {
45   DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
46 }
47
48 void DynamicsCylinderShape::Initialize(const float radius, const float length)
49 {
50   DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius: %.1f length: %.1f)\n", __PRETTY_FUNCTION__, radius, length);
51
52   mShape = mWorld.GetDynamicsFactory().CreateDynamicsShape();
53   const float worldScale((1.0f / mWorld.GetWorldScale()) );
54   mShape->Initialize( Dali::DynamicsShape::CYLINDER, Vector3( radius * worldScale, length * worldScale, 0.0f ) );
55
56   DynamicsShape::Initialize();
57 }
58
59
60 } // namespace SceneGraph
61
62 } // namespace Internal
63
64 } // namespace Dali