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