/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_ResMesh.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: 13145 $ *---------------------------------------------------------------------------*/ #ifndef NW_GFX_RESMESH_H_ #define NW_GFX_RESMESH_H_ #include #include #include #include #include namespace nw { namespace gfx { namespace res { //! @details :private struct ResMeshData : public ResSceneObjectData { enum { IR_SCALE_COMMAND_SIZE = 2 + 1 + 2 * 4 + 1 }; nw::ut::ResS32 m_ShapeIndex; nw::ut::ResS32 m_MaterialIndex; nw::ut::Offset toOwnerModel; nw::ut::ResBool m_IsVisible; nw::ut::ResU8 m_RenderPriority; nw::ut::ResS16 m_MeshNodeVisibilityIndex; nw::ut::ResS32 m_CurrentPrimitiveIndex; nw::ut::ResU32 m_Flags; nw::ut::ResU32 m_IrScaleCommand[ IR_SCALE_COMMAND_SIZE ]; void* m_ActivateCommandCache; s32 m_ActivateCommandCacheSize; void* m_DeactivateCommandCache; s32 m_DeactivateCommandCacheSize; nw::ut::BinString toMeshNodeName; u64 m_RenderKeyCache; nw::os::IAllocator* m_CommandAllocator; }; //-------------------------------------------------------------------------- //! @brief メッシュを表すバイナリリソースクラスです。 //--------------------------------------------------------------------------- class ResMesh : public ResSceneObject { public: enum Flag { FLAG_HAS_VERTEX_ALPHA = 0x1, FLAG_HAS_BONE_WEIGHT_W = 0x1 << 1, FLAG_VALID_RENDER_KEY_CACHE = 0x1 << 2, FLAG_HAS_BEEN_SETUP = 0x1 << 3 }; NW_RES_CTOR_INHERIT( ResMesh, ResSceneObject ) //--------------------------------------------------------------------------- //! @fn void SetVisible(bool value) //! @brief 表示されるかどうかのフラグを設定します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void SetShapeIndex(s32 value) //! @brief 使用するシェイプのインデックスを設定します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void SetRenderPriority(u8 value) //! @brief 描画優先度を設定します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void SetMaterialIndex(s32 value) //! @brief 使用するマテリアルのインデックスを設定します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void SetFlags(u32 value) //! @brief フラグの値を設定します。 //! 設定されなかったフラグは無効になります。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void EnaleFlags(u32 value) //! @brief 指定された Flag の値を有効にします。 //! 設定されなかったフラグは変更されません。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void DisableFlags(u32 value) //! @brief 指定された Flag の値を無効にします。 //! 設定されなかったフラグは変更されません。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void SetCurrentPrimitiveIndex(s32 value) //! @brief 現在有効なプリミティブのインデックス番号を設定します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn bool IsVisible() const //! @brief 表示されるかどうかのフラグを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn s32 GetShapeIndex() const //! @brief 使用するシェイプのインデックスを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn u8 GetRenderPriority() const //! @brief 描画優先度を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn ResTransformNode GetOwnerModel() //! @brief 親モデルへを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn s32 GetMaterialIndex() const //! @brief 使用するマテリアルのインデックスを取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn u32 GetFlags() const //! @brief フラグの値を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn s32 GetCurrentPrimitiveIndex() const //! @brief 現在有効なプリミティブのインデックス番号を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn const char * GetMeshNodeName() const //! @brief DCC 上でのノード名を取得します。 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //! @fn void GetMeshNodeVisibilityIndex(s32 value) //! @brief 親モデルが持つビジビリティテーブルのインデックス番号を取得します。 //--------------------------------------------------------------------------- NW_RES_FIELD_PRIMITIVE_DECL( s32, ShapeIndex ) // GetShapeIndex(), SetShapeIndex() NW_RES_FIELD_PRIMITIVE_DECL( s32, MaterialIndex ) // GetMaterialIndex(), SetMaterialIndex() NW_RES_FIELD_CLASS_DECL( ResTransformNode, OwnerModel ) // GetOwnerModel() NW_RES_FIELD_BOOL_PRIMITIVE_DECL( Visible ) // IsVisible(), SetVisible() NW_RES_FIELD_PRIMITIVE_DECL( u8, RenderPriority ) // GetRenderPriority(), SetRenderPriority() NW_RES_FIELD_PRIMITIVE_DECL( s32, CurrentPrimitiveIndex ) // GetCurrentPrimitiveIndex(), SetCurrentPrimitiveIndex() NW_RES_FIELD_FLAGS_DECL( u32, Flags ) // GetFlags(), SetFlags(), EnableFlags(), DisableFlags() // TODO: Name が取れないのを修正する。 // NW_RES_FIELD_STRING_DECL( MeshNodeName ) // GetMeshNodeName() NW_RES_FIELD_PRIMITIVE_DECL( s32, MeshNodeVisibilityIndex ) // GetMeshNodeVisibilityIndex(), SetMeshNodeVisibilityIndex() //--------------------------------------------------------------------------- //! @brief キャッシュされたレンダーキーの値を取得します。 //! //! @return レンダーキーの値です。 //--------------------------------------------------------------------------- u64 GetRenderKeyCache() const { return ref().m_RenderKeyCache; } //--------------------------------------------------------------------------- //! @brief レンダーキーの値をキャッシュに保存します。 //! //! @param[in] renderKey レンダーキーの値です。 //--------------------------------------------------------------------------- void SetRenderKeyCache(u64 renderKey) { ref().m_RenderKeyCache = renderKey; } //--------------------------------------------------------------------------- //! @brief リソースのセットアップをおこないます。 //! //! @param[in] owner 所有者となるモデルリソースです。 //! @param[in] allocator アロケータです。 //! @param[in] graphicsFile グラフィックスリソースです。 //--------------------------------------------------------------------------- Result Setup(ResModel owner, os::IAllocator* allocator, ResGraphicsFile graphicsFile); //--------------------------------------------------------------------------- //! @brief リソースの後始末をおこないます。 //--------------------------------------------------------------------------- void Cleanup(); }; typedef nw::ut::ResArrayClass::type ResMeshArray; } // namespace res } // namespace gfx } // namespace nw #endif // NW_GFX_RESMESH_H_