/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_MaterialActivator.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: 28677 $ *---------------------------------------------------------------------------*/ #ifndef NW_GFX_MATERIALACTIVATOR_H_ #define NW_GFX_MATERIALACTIVATOR_H_ #include #include namespace nw { namespace os { class IAllocator; } // namesapce os namespace gfx { class RenderContext; class Material; //--------------------------------------------------------------------------- //! @brief マテリアルを更新するためのクラスです。 //! //! バッファを用いる場合に MaterialActivator が選択されます。 //! バッファを用いない場合は SimpleMaterialActivator が選択されます。 //--------------------------------------------------------------------------- class MaterialActivator : public IMaterialActivator { private: NW_DISALLOW_COPY_AND_ASSIGN(MaterialActivator); public: NW_UT_RUNTIME_TYPEINFO; //--------------------------------------------------------------------------- //! @brief マテリアルアクティベータを生成します。 //! //! @param[in] allocator アロケータです。 //! //! @return 生成したマテリアルアクティベータを返します。 //--------------------------------------------------------------------------- static MaterialActivator* Create(os::IAllocator* allocator); //--------------------------------------------------------------------------- //! @brief 生成時に必要なメモリサイズを取得します。 //! //! @param[in] alignment 計算に用いるアライメントです。2 のべき乗である必要があります。 //--------------------------------------------------------------------------- static size_t GetMemorySize(size_t alignment = os::IAllocator::DEFAULT_ALIGNMENT) { os::MemorySizeCalculator size(alignment); GetMemorySizeInternal(&size); return size.GetSizeWithPadding(alignment); } //! @details :private static void GetMemorySizeInternal( os::MemorySizeCalculator* pSize) { os::MemorySizeCalculator& size = *pSize; size += sizeof(MaterialActivator); } //--------------------------------------------------------------------------- //! @brief マテリアルを有効化します。 //! //! @param[in] renderContext レンダーコンテキストです。 //! @param[in] material 有効化するマテリアルです。 //--------------------------------------------------------------------------- virtual void Activate(RenderContext* renderContext, const Material* material); private: //! コンストラクタです。 MaterialActivator(os::IAllocator* allocator); //! デストラクタです。 virtual ~MaterialActivator(); }; } // namespace gfx } // namespace nw #endif // NW_GFX_MATERIALACTIVATOR_H_