diff --git a/SHADE_Engine/src/Animation/SHAnimationController.cpp b/SHADE_Engine/src/Animation/SHAnimationController.cpp new file mode 100644 index 00000000..3af70309 --- /dev/null +++ b/SHADE_Engine/src/Animation/SHAnimationController.cpp @@ -0,0 +1,19 @@ +/************************************************************************************//*! +\file SHAnimationController.cpp +\author Tng Kah Wei, kahwei.tng, 390009620 +\par email: kahwei.tng\@digipen.edu +\date Feb 22, 2023 +\brief Contains the definition of SHAnimationController's functions. + + +Copyright (C) 2023 DigiPen Institute of Technology. +Reproduction or disclosure of this file or its contents without the prior written consent +of DigiPen Institute of Technology is prohibited. +*//*************************************************************************************/ +#include "SHpch.h" +#include "SHAnimationController.h" + +namespace SHADE +{ + +} diff --git a/SHADE_Engine/src/Animation/SHAnimationController.h b/SHADE_Engine/src/Animation/SHAnimationController.h new file mode 100644 index 00000000..d21c5c01 --- /dev/null +++ b/SHADE_Engine/src/Animation/SHAnimationController.h @@ -0,0 +1,115 @@ +/************************************************************************************//*! +\file SHAnimationController.h +\author Tng Kah Wei, kahwei.tng, 390009620 +\par email: kahwei.tng\@digipen.edu +\date Feb 22, 2023 +\brief Contains the definition of SHAnimationController. + +Copyright (C) 2023 DigiPen Institute of Technology. +Reproduction or disclosure of this file or its contents without the prior written consent +of DigiPen Institute of Technology is prohibited. +*//*************************************************************************************/ +#pragma once + +// STL Includes +#include +#include +// Project Includes +#include "SH_API.h" +#include "Resource/SHHandle.h" +#include "SHAnimationClip.h" + +namespace SHADE +{ + /*-----------------------------------------------------------------------------------*/ + /* Forward Declarations */ + /*-----------------------------------------------------------------------------------*/ + /// + /// Object that controls the animation that is played by an animator through the use + /// of an internal state machine. + /// + class SH_API SHAnimationController + { + public: + /*---------------------------------------------------------------------------------*/ + /* Forward Declarations */ + /*---------------------------------------------------------------------------------*/ + class Node; + + /*---------------------------------------------------------------------------------*/ + /* Type Definition */ + /*---------------------------------------------------------------------------------*/ + /// + /// Describes a parameter for the AnimationController that can be used to control + /// the flow of animations. + /// + struct AnimParam + { + /*-------------------------------------------------------------------------------*/ + /* Type Definition */ + /*-------------------------------------------------------------------------------*/ + /// + /// Type of animation parameter. + /// + enum class Type + { + Bool, + Trigger, + Float, + Int + }; + + /*-------------------------------------------------------------------------------*/ + /* Data Members */ + /*-------------------------------------------------------------------------------*/ + Type ParamType; + std::variant Value; + }; + + /// + /// Describes a transition between nodes of the animation controller. + /// + struct Transition + { + /*-------------------------------------------------------------------------------*/ + /* Type Definition */ + /*-------------------------------------------------------------------------------*/ + /// + /// Types of conditions for the transition. + /// + enum class ConditionType + { + None, + Equals, + NotEquals, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual + }; + + /*-------------------------------------------------------------------------------*/ + /* Data Members */ + /*-------------------------------------------------------------------------------*/ + ConditionType Condition; + Handle Target; + }; + + /// + /// Describes a node in the animation controller. + /// + struct Node + { + Handle Clip; + std::vector Transitions; + }; + + + private: + /*---------------------------------------------------------------------------------*/ + /* Data Members */ + /*---------------------------------------------------------------------------------*/ + Handle currentNode; + std::vector> nodes; + }; +}