Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / ui / effects / physics-engine / FUiEffects_PeRodSurfaceNURBS.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file        FUiEffects_PeRodSurfaceNURBS.cpp
19  * @brief       This file contains an implementation of RodSurface class methods
20  *
21  */
22
23 #include <FUiEffects_PeRodSurfaceNURBS.h>
24
25 using namespace Tizen::Ui::Effects::_Runtime;
26 using namespace Tizen::Ui::Effects::_Utils;
27
28 namespace Tizen { namespace Ui { namespace Effects { namespace _PhysicsEngine
29 {
30
31 RodSurfaceNurbs::RodSurfaceNurbs(
32         long                    objId,
33         float                   stiffness,
34         PointSurfaceNurbs*      pPoint1,
35         PointSurfaceNurbs*      pPoint2,
36         PointSurfaceNurbs*      pPoint3,
37         PointSurfaceNurbs*      pPointN
38 )
39         : RodSurface(objId, stiffness, pPoint1, pPoint2, pPoint3),
40         __pPointNeighb(pPointN)
41 {
42         // init when created
43         InitRodNurbs();
44 }
45
46 RodSurfaceNurbs::~RodSurfaceNurbs(void)
47 {
48         return;
49 }
50
51 ESurface
52 RodSurfaceNurbs::GetType(void) const
53 {
54         return ESURFACE_ROD_SURFACE;
55 }
56
57 void
58 RodSurfaceNurbs::Initialize(void)
59 {
60         RodSurface::Initialize();
61         InitRodNurbs();
62         return;
63 }
64
65 void
66 RodSurfaceNurbs::Calculate(float timeStep)
67 {
68         RodSurface::Calculate(timeStep);
69 }
70
71 PropertyCast
72 RodSurfaceNurbs::GetProperty(ElementProperty property) const
73 {
74         return RodSurface::GetProperty(property);
75 }
76
77 bool
78 RodSurfaceNurbs::SetProperty(ElementProperty property, bool boolValue)
79 {
80         return RodSurface::SetProperty(property, boolValue);
81 }
82
83 bool
84 RodSurfaceNurbs::SetProperty(ElementProperty property, LUA_NUMBER numericValue)
85 {
86         return RodSurface::SetProperty(property, numericValue);
87 }
88
89 bool
90 RodSurfaceNurbs::SetProperty(ElementProperty property, const Vec3f& vectorValue)
91 {
92         return RodSurface::SetProperty(property, vectorValue);
93 }
94
95 void
96 RodSurfaceNurbs::InitRodNurbs(void)
97 {
98         return;
99 }
100
101 const Vec3f
102 RodSurfaceNurbs::GetSurfaceNormal(void) const
103 {
104         Vec3f
105                 direction13 = _pPoint1->GetPosition() - _pPoint3->GetPosition(),
106                 direction24 = _pPoint2->GetPosition() - __pPointNeighb->GetPosition(),
107                 normalVec = direction13.getCrossed(direction24);
108
109         normalVec.normalize();
110         return normalVec;
111 }
112
113 } } } } // Tizen::Ui::Effects::_PhysicsEngine