/*---------------------------------------------------------------------------* Project: NintendoWare File: anim_AnimFrameController.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 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 */