Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / event / dynamics / dynamics-universal-joint-impl.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // CLASS HEADER
18 #include <dali/internal/event/dynamics/dynamics-universal-joint-impl.h>
19
20 // EXTERNAL HEADERS
21
22 // INTERNAL HEADERS
23 #include <dali/integration-api/debug.h>
24 #include <dali/internal/event/common/stage-impl.h>
25 #include <dali/internal/event/dynamics/dynamics-body-impl.h>
26 #include <dali/internal/event/dynamics/dynamics-world-impl.h>
27 #include <dali/internal/update/dynamics/scene-graph-dynamics-universal-joint.h>
28 #include <dali/public-api/math/vector3.h>
29
30 namespace Dali
31 {
32
33 namespace Internal
34 {
35
36 DynamicsUniversalJoint::DynamicsUniversalJoint(DynamicsWorldPtr world,
37                                                DynamicsBodyPtr bodyA, DynamicsBodyPtr bodyB,
38                                                const Vector3& pointA, const Quaternion& orientationA,
39                                                const Vector3& pointB, const Quaternion& orientationB )
40 : DynamicsJoint(Dali::DynamicsJoint::UNIVERSAL),
41   mTranslationLowerLimit(Vector3::ZERO),
42   mTranslationUpperLimit(Vector3::ZERO),
43   mRotationLowerLimit(Vector3::ONE),
44   mRotationUpperLimit(-Vector3::ONE)
45 {
46   DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
47
48   SceneGraph::DynamicsUniversalJoint* univeralJoint( new SceneGraph::DynamicsUniversalJoint(*(world->GetSceneObject())) );
49   mDynamicsJoint = univeralJoint;
50
51   Stage::GetCurrent().QueueMessage( InitializeDynamicsUniversalJointMessage(*univeralJoint,
52                                                                             *(bodyA->GetSceneObject()), *(bodyB->GetSceneObject()),
53                                                                             pointA, orientationA, pointB, orientationB) );
54 }
55
56 DynamicsUniversalJoint::~DynamicsUniversalJoint()
57 {
58   DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__);
59 }
60
61 Vector3 DynamicsUniversalJoint::GetTranslationLowerLimit() const
62 {
63   return mTranslationLowerLimit;
64 }
65
66 void DynamicsUniversalJoint::SetTranslationLowerLimit( const Vector3& limit )
67 {
68   if( mTranslationLowerLimit != limit )
69   {
70     mTranslationLowerLimit = limit;
71
72     Stage::GetCurrent().QueueMessage( SetTranslationLowerLimitMessage( *(GetSceneObject()), limit ) );
73   }
74 }
75
76 Vector3 DynamicsUniversalJoint::GetTranslationUpperLimit() const
77 {
78   return mTranslationUpperLimit;
79 }
80
81 void DynamicsUniversalJoint::SetTranslationUpperLimit( const Vector3& limit )
82 {
83   if( mTranslationUpperLimit != limit )
84   {
85     mTranslationUpperLimit = limit;
86
87     Stage::GetCurrent().QueueMessage( SetTranslationUpperLimitMessage( *(GetSceneObject()), limit ) );
88   }
89 }
90
91 Vector3 DynamicsUniversalJoint::GetRotationLowerLimit() const
92 {
93   return mRotationLowerLimit;
94 }
95
96 void DynamicsUniversalJoint::SetRotationLowerLimit( const Vector3& limit )
97 {
98   if( mRotationLowerLimit != limit )
99   {
100     mRotationLowerLimit = limit;
101
102     Stage::GetCurrent().QueueMessage( SetRotationLowerLimitMessage( *(GetSceneObject()), limit ) );
103   }
104 }
105
106 Vector3 DynamicsUniversalJoint::GetRotationUpperLimit() const
107 {
108   return mRotationUpperLimit;
109 }
110
111 void DynamicsUniversalJoint::SetRotationUpperLimit( const Vector3& limit )
112 {
113   if( mRotationUpperLimit != limit )
114   {
115     mRotationUpperLimit = limit;
116
117     Stage::GetCurrent().QueueMessage( SetRotationUpperLimitMessage( *(GetSceneObject()), limit ) );
118   }
119 }
120
121 void DynamicsJoint::EnableSpring(const int index, const bool flag)
122 {
123 }
124
125 void DynamicsJoint::SetStiffness(const int index, const float stiffness)
126 {
127 }
128
129 void DynamicsJoint::SetCenterPoint(const int index, const float ratio)
130 {
131 }
132
133 void EnableMotor(const int index, const bool flag)
134 {
135 }
136
137 void SetMotorVelocity(const int index, const float velocity)
138 {
139 }
140
141 void SetMotorForce(const int index, const float force)
142 {
143 }
144
145
146 SceneGraph::DynamicsUniversalJoint* DynamicsUniversalJoint::GetSceneObject() const
147 {
148   return static_cast<SceneGraph::DynamicsUniversalJoint*>(DynamicsJoint::GetSceneObject());
149 }
150
151
152
153 } // namespace Internal
154
155 } // namespace Dali