1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsCorePrerequisites.h"
6
7namespace bs
8{
9 /** @addtogroup Animation
10 * @{
11 */
12
13 /**
14 * Contains a bitfield that determines which skeleton bones are enabled or disabled during skeletal animation. Use
15 * SkeletonMaskBuilder to create a mask for a specific skeleton.
16 */
17 class BS_CORE_EXPORT SkeletonMask
18 {
19 public:
20 SkeletonMask() = default;
21 SkeletonMask(UINT32 numBones);
22
23 /**
24 * Checks is the bone at the specified index enabled. Caller is expected to know which skeleton is the skeleton
25 * mask tied with, in order to determine the bone index.
26 */
27 bool isEnabled(UINT32 boneIdx) const;
28
29 private:
30 friend class SkeletonMaskBuilder;
31
32 Vector<bool> mIsDisabled;
33 };
34
35 /** Builds a SkeletonMask for a specific skeleton. */
36 class BS_CORE_EXPORT SkeletonMaskBuilder
37 {
38 public:
39 SkeletonMaskBuilder(const SPtr<Skeleton>& skeleton);
40
41 /** Enables or disables a bone with the specified name. */
42 void setBoneState(const String& name, bool enabled);
43
44 /** Teturns the built skeleton mask. */
45 SkeletonMask getMask() const { return mMask; }
46
47 private:
48 SPtr<Skeleton> mSkeleton;
49 SkeletonMask mMask;
50 };
51
52 /** @} */
53}