/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_AnimOverrider.cpp 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 $ *---------------------------------------------------------------------------*/ #include "precompiled.h" #include #include #include namespace nw { namespace gfx { NW_UT_RUNTIME_TYPEINFO_DEFINITION(AnimOverrider , AnimBlender); //---------------------------------------------------------- const anim::AnimResult* AnimOverrider::GetResult( void* target, int memberIdx ) const { //---------------------------------------------------------- // ブレンドオペレーションがない場合および // ブレンドオペレーションにブレンド処理がない場合は上書き処理 const anim::AnimBlendOp* blendOp = m_AnimGroup->GetBlendOperation(memberIdx); if (blendOp == NULL || !blendOp->HasBlend()) { for (int animIdx = m_AnimObjects.Size() - 1; animIdx >= 0; --animIdx) { if (m_AnimObjects[animIdx] == NULL) { continue; } const anim::AnimResult* childResult = m_AnimObjects[animIdx]->GetResult(target, memberIdx); if (childResult != NULL) { return childResult; } } return NULL; } //---------------------------------------------------------- // すべての子アニメーションについてループ anim::AnimResult* result = reinterpret_cast(target); anim::AnimResult workResult; bool written = false; for (int animIdx = m_AnimObjects.Size() - 1; animIdx >= 0; --animIdx) { if (m_AnimObjects[animIdx] == NULL) { continue; } const anim::AnimResult* childResult = m_AnimObjects[animIdx]->GetResult(&workResult, memberIdx); if (childResult != NULL) { written = true; if (blendOp->Override(result, childResult)) // 全成分を上書きしたら true が返る { return result; } } } if (!written) // 有効な子アニメーションなし { return NULL; } return result; } } // namespace gfx } // namespace nw