Implemented Animation Clip asset and animation controller #410
|
@ -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
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -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 <variant>
|
||||||
|
#include <vector>
|
||||||
|
// Project Includes
|
||||||
|
#include "SH_API.h"
|
||||||
|
#include "Resource/SHHandle.h"
|
||||||
|
#include "SHAnimationClip.h"
|
||||||
|
|
||||||
|
namespace SHADE
|
||||||
|
{
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Forward Declarations */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Object that controls the animation that is played by an animator through the use
|
||||||
|
/// of an internal state machine.
|
||||||
|
/// </summary>
|
||||||
|
class SH_API SHAnimationController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Forward Declarations */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
class Node;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Type Definition */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a parameter for the AnimationController that can be used to control
|
||||||
|
/// the flow of animations.
|
||||||
|
/// </summary>
|
||||||
|
struct AnimParam
|
||||||
|
{
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
/* Type Definition */
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Type of animation parameter.
|
||||||
|
/// </summary>
|
||||||
|
enum class Type
|
||||||
|
{
|
||||||
|
Bool,
|
||||||
|
Trigger,
|
||||||
|
Float,
|
||||||
|
Int
|
||||||
|
};
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
/* Data Members */
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
Type ParamType;
|
||||||
|
std::variant<bool, float, int> Value;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a transition between nodes of the animation controller.
|
||||||
|
/// </summary>
|
||||||
|
struct Transition
|
||||||
|
{
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
/* Type Definition */
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Types of conditions for the transition.
|
||||||
|
/// </summary>
|
||||||
|
enum class ConditionType
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Equals,
|
||||||
|
NotEquals,
|
||||||
|
LessThan,
|
||||||
|
LessThanOrEqual,
|
||||||
|
GreaterThan,
|
||||||
|
GreaterThanOrEqual
|
||||||
|
};
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
/* Data Members */
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
ConditionType Condition;
|
||||||
|
Handle<Node> Target;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a node in the animation controller.
|
||||||
|
/// </summary>
|
||||||
|
struct Node
|
||||||
|
{
|
||||||
|
Handle<SHAnimationClip> Clip;
|
||||||
|
std::vector<Transition> Transitions;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Data Members */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
Handle<Node> currentNode;
|
||||||
|
std::vector<Handle<Node>> nodes;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue