Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / inc / renderer / engine-model / FUiEffects_RendererEngineModelAabb.h
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 /**
19  * @file                FUiEffects_RendererEngineModelAabb.h
20  * @brief               Class of Axis-Aligned Bounding Box for efficient geometry objects occlusion culling
21  *
22  */
23
24 #ifndef _FUI_EFFECTS_INTERNAL_RENDERER_ENGINE_MODEL_AABB_H_
25 #define _FUI_EFFECTS_INTERNAL_RENDERER_ENGINE_MODEL_AABB_H_
26
27 #include <renderer/math/FUiEffects_RendererMathMatrix.h>
28 #include <renderer/math/FUiEffects_RendererMathVector.h>
29
30 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer { namespace EngineModel
31 {
32
33 class Aabb //DUMMY
34 {
35 public:
36         void Identity(void)
37         {
38                 minimum.Set(0.0f);
39                 maximum.Set(0.0f);
40                 return;
41         }
42
43         void Extend(const Aabb& other)
44         {
45                 minimum.X() = Math::EffectsMin(minimum.X(), other.minimum.X());
46                 minimum.Y() = Math::EffectsMin(minimum.Y(), other.minimum.Y());
47                 minimum.Z() = Math::EffectsMin(minimum.Z(), other.minimum.Z());
48
49                 maximum.X() = Math::EffectsMax(maximum.X(), other.maximum.X());
50                 maximum.Y() = Math::EffectsMax(maximum.Y(), other.maximum.Y());
51                 maximum.Z() = Math::EffectsMax(maximum.Z(), other.maximum.Z());
52
53                 return;
54         }
55
56         Aabb GetTransformed(const Math::Matrix4f& tran) const
57         {
58                 Aabb result;
59
60                 result.minimum = minimum * tran;
61                 result.maximum = maximum * tran;
62                 if (result.minimum.X() > result.maximum.X())
63                 {
64                         std::swap(result.minimum.X(), result.maximum.X());
65                 }
66                 if (result.minimum.Y() > result.maximum.Y())
67                 {
68                         std::swap(result.minimum.Y(), result.maximum.Y());
69                 }
70                 if (result.minimum.Z() > result.maximum.Z())
71                 {
72                         std::swap(result.minimum.Z(), result.maximum.Z());
73                 }
74
75                 return result;
76         }
77
78         Math::Vector3f minimum;
79         Math::Vector3f maximum;
80 };
81
82 }}}}} //Tizen::Ui::Effects::_Renderer::EngineModel
83
84 #endif //_FUI_EFFECTS_INTERNAL_RENDERER_ENGINE_MODEL_AABB_H_