Added initial stubs for SHAnimationController

This commit is contained in:
Kah Wei 2023-02-20 16:55:08 +08:00
parent 17a84bb2c8
commit c85298db88
2 changed files with 134 additions and 0 deletions

View File

@ -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
{
}

View File

@ -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;
};
}