BsSkeletonMask.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. namespace bs
  6. {
  7. /** @addtogroup Animation
  8. * @{
  9. */
  10. /**
  11. * Contains a bitfield that determines which skeleton bones are enabled or disabled during skeletal animation. Use
  12. * SkeletonMaskBuilder to create a mask for a specific skeleton.
  13. */
  14. class BS_CORE_EXPORT SkeletonMask
  15. {
  16. public:
  17. SkeletonMask() {}
  18. SkeletonMask(UINT32 numBones);
  19. /**
  20. * Checks is the bone at the specified index enabled. Caller is expected to know which skeleton is the skeleton
  21. * mask tied with, in order to determine the bone index.
  22. */
  23. bool isEnabled(UINT32 boneIdx) const;
  24. private:
  25. friend class SkeletonMaskBuilder;
  26. Vector<bool> mIsDisabled;
  27. };
  28. /** Builds a SkeletonMask for a specific skeleton. */
  29. class BS_CORE_EXPORT SkeletonMaskBuilder
  30. {
  31. public:
  32. SkeletonMaskBuilder(const SPtr<Skeleton>& skeleton);
  33. /** Enables or disables a bone with the specified name. */
  34. void setBoneState(const String& name, bool enabled);
  35. /** Teturns the built skeleton mask. */
  36. SkeletonMask getMask() const { return mMask; }
  37. private:
  38. SPtr<Skeleton> mSkeleton;
  39. SkeletonMask mMask;
  40. };
  41. /** @} */
  42. }