/*---------------------------------------------------------------------------* Project: NintendoWare File: anim_AnimFrameController.cpp 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: 23268 $ *---------------------------------------------------------------------------*/ #include "precompiled.h" #include #include using namespace nw::math; namespace nw { namespace anim { //---------------------------------------------------------- f32 PlayPolicy_Onetime(f32 startFrame, f32 endFrame, f32 inputFrame, void* /*pUserData*/) { // 再生方向終端時間で停止。 if (inputFrame > endFrame) { return endFrame; } // 再生方向終端時間で停止。 if (inputFrame < startFrame) { return startFrame; } return inputFrame; } //---------------------------------------------------------- f32 PlayPolicy_Loop(f32 startFrame, f32 endFrame, f32 inputFrame, void* /*pUserData*/) { NW_ASSERT(startFrame <= endFrame); f32 length = endFrame - startFrame; if (length == 0.0f) { return startFrame; } else { f32 offset = inputFrame - startFrame; if (offset < 0.0f) { offset += (FFloor(-offset / length) + 1) * length; } return FMod(offset, length) + startFrame; } } } /* namespace anim */ } /* namespace nw */