/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_TransformAnimAdder.h Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. 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. The content herein is highly confidential and should be handled accordingly. $Revision: 31311 $ *---------------------------------------------------------------------------*/ #ifndef NW_GFX_TRANSFORMANIMADDER_H_ #define NW_GFX_TRANSFORMANIMADDER_H_ #include namespace nw { namespace gfx { //--------------------------------------------------------------------------- //! @details :private //! @brief トランスフォームアニメーション評価結果を加算ブレンドするクラスです。 //! //! ブレンドは各メンバの移動・回転・スケール成分ごとに行われます。 //--------------------------------------------------------------------------- class TransformAnimAdder : public AnimAdder { public: NW_UT_RUNTIME_TYPEINFO; //---------------------------------------- //! @name 作成 //@{ //! トランスフォームアニメーション加算を構築するクラスです。 class Builder { public: //! コンストラクタです。 Builder() : m_MaxAnimObjects(2) {} //! 最大アニメーションオブジェクト数を設定します。 Builder& MaxAnimObjects(int maxAnimObjects) { NW_ASSERT(maxAnimObjects > 0); m_MaxAnimObjects = maxAnimObjects; return *this; } //! @brief 生成時に必要なメモリサイズを取得します。 //! //! メモリサイズは Builder の設定によって変化します。 //! すべての設定が終わった後にこの関数を呼び出してください。 //! //! @param[in] alignment 計算に用いるアライメントです。2 のべき乗である必要があります。 size_t GetMemorySize(size_t alignment = os::IAllocator::DEFAULT_ALIGNMENT) const { os::MemorySizeCalculator size(alignment); GetMemorySizeInternal(&size); return size.GetSizeWithPadding(alignment); } //! @details :private void GetMemorySizeInternal(os::MemorySizeCalculator* pSize) const { os::MemorySizeCalculator& size = *pSize; size += sizeof(TransformAnimAdder); TransformAnimAdder::GetMemorySizeForInitialize(pSize, m_MaxAnimObjects); } //! @brief トランスフォームアニメーション加算を生成します。 //! //! @param[in] allocator アロケータです。 //! //! @return 生成されたトランスフォームアニメーション加算です。 //! TransformAnimAdder* Create(os::IAllocator* allocator) { void* buf = allocator->Alloc(sizeof(TransformAnimAdder)); if (buf == NULL) { return NULL; } TransformAnimAdder* adder = new(buf) TransformAnimAdder(allocator); Result result = adder->Initialize(m_MaxAnimObjects); NW_ASSERT(result.IsSuccess()); return adder; } private: int m_MaxAnimObjects; }; //@} //---------------------------------------- //! @name 評価 //@{ //! @brief メンバ単位でアニメーション結果を取得します。 //! //! @param[out] target アニメーション結果を書き込む対象です。 //! @param[in] memberIdx メンバインデックスです。 //! //! @return アニメーション結果を適用した場合は NULL でない値を返します。 //! virtual const anim::AnimResult* GetResult( void* target, int memberIdx) const; //@} protected: //---------------------------------------- //! @name コンストラクタ/デストラクタ //@{ //! コンストラクタです。 TransformAnimAdder( os::IAllocator* allocator) : AnimAdder(allocator) {} //! デストラクタです。 virtual ~TransformAnimAdder() {} //@} }; } // namespace gfx } // namespace nw #endif // NW_GFX_TRANSFORMANIMADDER_H_