1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     ut_ResPrimitive.h
4 
5   Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain proprietary
8   information of Nintendo and/or its licensed developers and are protected by
9   national and international copyright laws. They may not be disclosed to third
10   parties or copied or duplicated in any form, in whole or in part, without the
11   prior written consent of Nintendo.
12 
13   The content herein is highly confidential and should be handled accordingly.
14 
15   $Revision: 31311 $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NW_UT_RESPRIMITIVE_H_
19 #define NW_UT_RESPRIMITIVE_H_
20 
21 #include <nw/types.h>
22 #include <nw/ut/ut_Inlines.h>
23 #include <nw/ut/ut_ResTypes.h>
24 #include <nw/ut/ut_ResUtil.h>
25 #include <nw/ut/ut_ResDeclMacros.h>
26 
27 namespace nw {
28 namespace ut {
29 
30 //! @details :private
31 struct ResBoundingVolumeData
32 {
33     nw::ut::ResTypeInfo typeInfo;
34 };
35 
36 //! @details :private
37 struct ResOrientedBoundingBoxData : public ResBoundingVolumeData
38 {
39     ResVec3   m_CenterPosition;
40     ResMtx33  m_OrientationMatrix;
41     ResVec3   m_Size;
42 };
43 
44 //! @details :private
45 struct ResAxisAlignedBoundingBoxData : public ResBoundingVolumeData
46 {
47     ResVec3   m_CenterPosition;
48     ResVec3   m_Size;
49 };
50 
51 
52 //--------------------------------------------------------------------------
53 //! @brief        バウンディング情報です。
54 //---------------------------------------------------------------------------
55 class ResBoundingVolume : public nw::ut::ResCommon<ResBoundingVolumeData>
56 {
57 public:
58     enum { TYPE_INFO = NW_UT_RES_TYPE_INFO(ResBoundingVolume) };
59 
NW_RES_CTOR(ResBoundingVolume)60     NW_RES_CTOR( ResBoundingVolume )
61 
62     //---------------------------------------------------------------------------
63     //! @brief        インスタンスの型情報を取得します。
64     //!
65     //! @return       型情報です。
66     //---------------------------------------------------------------------------
67     nw::ut::ResTypeInfo     GetTypeInfo() const { return ref().typeInfo; }
68 };
69 
70 //--------------------------------------------------------------------------
71 //! @brief        OBB の情報です。
72 //---------------------------------------------------------------------------
73 class ResOrientedBoundingBox : public ResBoundingVolume
74 {
75 public:
76     enum { TYPE_INFO = NW_UT_RES_TYPE_INFO(ResOrientedBoundingBox) };
77 
78     NW_RES_CTOR_INHERIT( ResOrientedBoundingBox, ResBoundingVolume )
79 
80     //---------------------------------------------------------------------------
81     //! @fn           const nw::math::VEC3 & GetCenterPosition() const
82     //! @brief        OBB の中心座標を取得します。
83     //---------------------------------------------------------------------------
84     //---------------------------------------------------------------------------
85     //! @fn           void SetCenterPosition(f32 x, f32 y, f32 z)
86     //! @brief        OBB の中心座標を設定します。
87     //---------------------------------------------------------------------------
88     NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, CenterPosition ) // GetCenterPosition()
89 
90     //---------------------------------------------------------------------------
91     //! @fn           void SetOrientationMatrix(const nw::math::MTX33 & value)
92     //! @brief        姿勢行列を設定します。
93     //---------------------------------------------------------------------------
94     //---------------------------------------------------------------------------
95     //! @fn           nw::math::MTX33 & GetOrientationMatrix()
96     //! @brief        姿勢行列を取得します。
97     //---------------------------------------------------------------------------
98     NW_RES_FIELD_STRUCT_DECL( nw::math::MTX33, OrientationMatrix ) // GetOrientationMatrix()
99 
100     //---------------------------------------------------------------------------
101     //! @fn           const nw::math::VEC3 & GetSize() const
102     //! @brief        姿勢行列座標空間におけるサイズを取得します。
103     //---------------------------------------------------------------------------
104     //---------------------------------------------------------------------------
105     //! @fn           void SetSize(f32 x, f32 y, f32 z)
106     //! @brief         姿勢行列座標空間におけるサイズを設定します。
107     //---------------------------------------------------------------------------
108     NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, Size ) // GetSize()
109 };
110 
111 //--------------------------------------------------------------------------
112 //! @brief        AABB の情報です。
113 //---------------------------------------------------------------------------
114 class ResAxisAlignedBoundingBox : public ResBoundingVolume
115 {
116 public:
117     enum { TYPE_INFO = NW_UT_RES_TYPE_INFO(ResAxisAlignedBoundingBox) };
118 
119     NW_RES_CTOR_INHERIT( ResAxisAlignedBoundingBox, ResBoundingVolume )
120 
121     //---------------------------------------------------------------------------
122     //! @fn           const nw::math::VEC3 & GetCenterPosition() const
123     //! @brief        AABB の中心座標を取得します。
124     //---------------------------------------------------------------------------
125     //---------------------------------------------------------------------------
126     //! @fn           void SetCenterPosition(f32 x, f32 y, f32 z)
127     //! @brief        AABB の中心座標を設定します。
128     //---------------------------------------------------------------------------
129     NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, CenterPosition ) // GetCenterPosition()
130 
131     //---------------------------------------------------------------------------
132     //! @fn           const nw::math::VEC3 & GetSize() const
133     //! @brief        軸平行座標空間におけるサイズを取得します。
134     //---------------------------------------------------------------------------
135     //---------------------------------------------------------------------------
136     //! @fn           void SetSize(f32 x, f32 y, f32 z)
137     //! @brief        軸平行座標空間におけるサイズを設定します。
138     //---------------------------------------------------------------------------
139     NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, Size ) // GetSize()
140 };
141 
142 } /* namespace ut */
143 } /* namespace nw */
144 
145 #endif /* NW_UT_RESPRIMITIVE_H_ */
146