2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FUiEffects_RendererEngineModelNode.cpp
20 * @brief This file contains implementation of Node class
24 #include <renderer/engine-model/FUiEffects_RendererEngineModelNode.h>
25 #include <renderer/engine-model/FUiEffects_RendererEngineModelGroup.h>
27 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer { namespace EngineModel
33 _relatedTransform.value.Identity();
34 _relatedTransform.invalid = false;
36 _worldTransform.value.Identity();
37 _worldTransform.invalid = false;
39 _boundBox.value.Identity();
40 _boundBox.invalid = false;
41 _boundBox.value.maximum.Set(1.0f, 1.0f, 1.0f);
42 _boundBox.value.minimum.Set(-1.0f, -1.0f, -1.0f);
44 _transformType = TransformationType::RELATED;
45 _transformMatrix.Identity();
54 Node::Visit(Visitor& visitor)
56 visitor.OnNode(*this);
61 Node::ValidateLocal(void)
63 if ((_transformType == TransformationType::RELATED) || !_pParent)
65 _relatedTransform.value = _transformMatrix;
69 _relatedTransform.value = _pParent->GetWorld().GetInversed() * _transformMatrix;
72 _relatedTransform.invalid = false;
77 Node::ValidateWorld(void)
79 if ((_transformType == TransformationType::WORLD) || !_pParent)
81 _worldTransform.value = _transformMatrix;
85 _worldTransform.value = _pParent->GetWorld() * _transformMatrix;
88 _worldTransform.invalid = false;
93 Node::SetLocal(const Math::Matrix4f& arg)
95 _transformType = TransformationType::RELATED;
96 _transformMatrix = arg;
97 _relatedTransform.invalid = true;
98 _worldTransform.invalid = true;
99 TouchParentBoundBox();
104 Node::SetWorld(const Math::Matrix4f& arg)
106 _transformType = TransformationType::WORLD;
107 _transformMatrix = arg;
108 _relatedTransform.invalid = true;
109 _worldTransform.invalid = true;
110 TouchParentBoundBox();
115 Node::TouchParentBoundBox(void)
119 _pParent->InvalidateBoundBox();
124 const Math::Matrix4f&
127 if (_transformType == TransformationType::RELATED)
129 return _transformMatrix;
132 if (_relatedTransform.invalid)
136 return _relatedTransform.value;
139 const Math::Matrix4f&
142 if (_transformType == TransformationType::WORLD)
144 return _transformMatrix;
147 if (_worldTransform.invalid)
151 return _worldTransform.value;
155 Node::GetBoundBox(void)
157 return _boundBox.value;
161 Node::GetBoundBoxInParentSpace(void)
163 return GetBoundBox().GetTransformed(GetLocal());
167 Node::AttachedToParent(Group* pParent)
169 if (null != _pParent)
175 if (_transformType != TransformationType::WORLD)
177 _worldTransform.invalid = true;
184 Node::RemoveFromParent(Group* pParent)
186 if (pParent != _pParent)
191 if (_transformType == TransformationType::WORLD)
193 _relatedTransform.invalid = true;
197 _worldTransform.invalid = true;
205 Node::ParentMoved(Group* pParent)
207 if (pParent != _pParent)
212 if (_transformType == TransformationType::WORLD)
217 _worldTransform.invalid = true;
221 }}}}} //Tizen::Ui::Effects::_Renderer::EngineModel