BsScriptSkeleton.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEnginePrerequisites.h"
  5. #include "BsScriptObject.h"
  6. #include "BsSkeleton.h"
  7. namespace bs
  8. {
  9. class ScriptAnimationClip;
  10. /** @addtogroup ScriptInteropEngine
  11. * @{
  12. */
  13. /** Interop class between C++ & CLR for Skeleton. */
  14. class BS_SCR_BE_EXPORT ScriptSkeleton : public ScriptObject <ScriptSkeleton>
  15. {
  16. public:
  17. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Skeleton")
  18. /** Returns the native wrapped animation. */
  19. SPtr<Skeleton> getInternal() const { return mSkeleton; }
  20. /** Creates a new managed Skeleton instance wrapping the provided native skeleton. */
  21. static MonoObject* create(const SPtr<Skeleton>& skeleton);
  22. private:
  23. ScriptSkeleton(MonoObject* managedInstance, const SPtr<Skeleton>& skeleton);
  24. SPtr<Skeleton> mSkeleton;
  25. /************************************************************************/
  26. /* CLR HOOKS */
  27. /************************************************************************/
  28. static int internal_GetNumBones(ScriptSkeleton* thisPtr);
  29. static MonoObject* internal_GetBoneInfo(ScriptSkeleton* thisPtr, UINT32 boneIdx);
  30. };
  31. /** Helper class for dealing with SkeletonBoneInfo structure. */
  32. class BS_SCR_BE_EXPORT ScriptBoneInfo : public ScriptObject<ScriptBoneInfo>
  33. {
  34. public:
  35. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "BoneInfo")
  36. /** Converts native bone info to its native counterpart. */
  37. static MonoObject* toManaged(const SkeletonBoneInfo& boneInfo, const Matrix4& invBindPose);
  38. private:
  39. ScriptBoneInfo(MonoObject* instance);
  40. /************************************************************************/
  41. /* CLR HOOKS */
  42. /************************************************************************/
  43. static MonoField* sNameField;
  44. static MonoField* sParentField;
  45. static MonoField* sInvBindPoseField;
  46. };
  47. /** @} */
  48. }