/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_ResModel.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 19143 $ *---------------------------------------------------------------------------*/ #ifndef NW_GFX_RESMODEL_H_ #define NW_GFX_RESMODEL_H_ #include #include #include #include #include #include #include #include #include namespace nw { namespace gfx { namespace res { class ResGraphicsFile; //! @details :private struct ResMeshNodeVisibilityData { nw::ut::BinString toName; nw::ut::ResBool m_IsVisible; }; //! @details :private struct ResModelData : public ResTransformNodeData { nw::ut::ResS32 m_MeshesTableCount; nw::ut::Offset toMeshesTable; nw::ut::ResS32 m_MaterialsDicCount; nw::ut::Offset toMaterialsDic; nw::ut::ResS32 m_ShapesTableCount; nw::ut::Offset toShapesTable; nw::ut::ResS32 m_MeshNodeVisibilitiesDicCount; nw::ut::Offset toMeshNodeVisibilitiesDic; nw::ut::ResBool m_IsVisible; nw::ut::ResBool m_IsNonuniformScalable; u8 _padding_0[6]; nw::ut::ResU32 m_LayerId; }; //! @details :private struct ResSkeletalModelData : public ResModelData { nw::ut::Offset toSkeleton; }; //-------------------------------------------------------------------------- //! @brief DCC 上でのノードのビジビリティを表すバイナリリソースクラスです。 //--------------------------------------------------------------------------- class ResMeshNodeVisibility : public nw::ut::ResCommon< ResMeshNodeVisibilityData > { public: NW_RES_CTOR( ResMeshNodeVisibility ) //--------------------------------------------------------------------------- //! @fn const char * GetName() const //! @brief ノード名を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn bool IsVisible() const //! @brief 表示されるかどうかのフラグを取得します。 //--------------------------------------------------------------------------- NW_RES_FIELD_STRING_DECL( Name ) // GetName() NW_RES_FIELD_BOOL_PRIMITIVE_DECL( Visible ) // IsVisible(), SetVisible() }; //-------------------------------------------------------------------------- //! @brief モデルを表すバイナリリソースクラスです。 //--------------------------------------------------------------------------- class ResModel : public ResTransformNode { public: enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResModel) }; enum { SIGNATURE = NW_RES_SIGNATURE32('CMDL') }; enum { BINARY_REVISION = REVISION_RES_MODEL }; NW_RES_CTOR_INHERIT( ResModel, ResTransformNode ) //--------------------------------------------------------------------------- //! @fn void SetVisible(bool value) //! @brief 表示するかどうかのフラグを設定します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void SetNonuniformScalable(bool value) //! @brief 不均一なスケールをかけることができるかのフラグを設定します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void SetLayerId(u32 value) //! @brief 描画順を制御するためのIDを設定します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn bool IsVisible() const //! @brief 表示するかどうかのフラグを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn bool IsNonuniformScalable() const //! @brief 不均一なスケールをかけることができるかのフラグを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn s32 GetShapesCount() const //! @brief シェイプの要素数を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn ResShape GetShapes(int idx) //! @brief シェイプを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn s32 GetMeshesCount() const //! @brief メッシュの要素数を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn ResMesh GetMeshes(int idx) //! @brief メッシュを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn s32 GetMaterialsIndex(const char * key) const //! @brief マテリアルの辞書データ中でのインデックス番号を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn s32 GetMaterialsCount() const //! @brief マテリアルの要素数を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn ResMaterial GetMaterials(int idx) //! @brief マテリアルを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn u32 GetLayerId() const //! @brief 描画順を制御するためのIDを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn s32 GetMeshNodeVisibilitiesCount() const //! @brief ビジビリティを持つ DCC 上でのノードの数を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn ResMeshNodeVisibility GetMeshNodeVisibilities(int idx) //! @brief DCC 上でのノードのビジビリティを取得します。 //--------------------------------------------------------------------------- NW_RES_FIELD_CLASS_LIST_DECL( ResMesh, Meshes ) // GetMeshes(int idx), GetMeshesCount() NW_RES_FIELD_CLASS_DIC_DECL( ResMaterial, Materials, nw::ut::ResDicPatricia ) // GetMaterials(int idx), GetMaterials(const char*), GetMaterialsIndex(const char*), GetMaterialsCount() NW_RES_FIELD_CLASS_LIST_DECL( ResShape, Shapes ) // GetShapes(int idx), GetShapesCount() NW_RES_FIELD_CLASS_DIC_DECL( ResMeshNodeVisibility, MeshNodeVisibilities, nw::ut::ResDicPatricia ) // GetMeshNodeVisibilities(int idx), GetMeshNodeVisibilities(const char*), GetMeshNodeVisibilitiesIndex(const char*), GetMeshNodeVisibilitiesCount() NW_RES_FIELD_BOOL_PRIMITIVE_DECL( Visible ) // IsVisible(), SetVisible() NW_RES_FIELD_BOOL_PRIMITIVE_DECL( NonuniformScalable ) // IsNonuniformScalable(), SetNonuniformScalable() NW_RES_FIELD_PRIMITIVE_DECL( u32, LayerId ) // GetLayerId(), SetLayerId() //--------------------------------------------------------------------------- //! @brief リビジョンを取得します。 //! //! @return リソースのリビジョン情報です。 //--------------------------------------------------------------------------- u32 GetRevision() const { return this->GetHeader().revision; } //--------------------------------------------------------------------------- //! @brief リソースの初期化処理をおこないます。 //! //! @param[in] allocator アロケータです。 //! @param[in] graphicsFile グラフィックスリソースです。 //--------------------------------------------------------------------------- Result Setup(os::IAllocator* allocator, ResGraphicsFile graphicsFile); //--------------------------------------------------------------------------- //! @brief リソースの解放処理をおこないます。 //--------------------------------------------------------------------------- void Cleanup(); }; typedef nw::ut::ResArrayPatricia::type ResModelArray; //-------------------------------------------------------------------------- //! @brief スケルタルモデルを表すバイナリリソースクラスです。 //--------------------------------------------------------------------------- class ResSkeletalModel : public ResModel { public: enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResSkeletalModel) }; enum { SIGNATURE = NW_RES_SIGNATURE32('CSMD') }; NW_RES_CTOR_INHERIT( ResSkeletalModel, ResModel ) //--------------------------------------------------------------------------- //! @fn ResSkeleton GetSkeleton() //! @brief スケルトンを取得します。 //--------------------------------------------------------------------------- NW_RES_FIELD_CLASS_DECL( ResSkeleton, Skeleton ) // GetSkeleton() }; } // namespace res } // namespace gfx } // namespace nw #endif // NW_GFX_RESMODEL_H_