BsScriptRenderable.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. namespace BansheeEngine
  7. {
  8. class ScriptAnimation;
  9. /** @addtogroup ScriptInteropEngine
  10. * @{
  11. */
  12. /** Interop class between C++ & CLR for Renderable. */
  13. class BS_SCR_BE_EXPORT ScriptRenderable : public ScriptObject < ScriptRenderable >
  14. {
  15. public:
  16. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeRenderable")
  17. /** Returns the native wrapped renderable. */
  18. SPtr<Renderable> getInternal() const { return mRenderable; }
  19. private:
  20. ScriptRenderable(MonoObject* managedInstance, const HSceneObject& parentSO);
  21. ~ScriptRenderable();
  22. /** Updates the internal transform of the renderable handled according to the scene object it is attached to. */
  23. void updateTransform(const HSceneObject& parent);
  24. /** Destroys the internal renderable object. */
  25. void destroy();
  26. /** @copydoc ScriptObject::_onManagedInstanceDeleted */
  27. void _onManagedInstanceDeleted() override;
  28. SPtr<Renderable> mRenderable;
  29. UINT32 mLastUpdateHash;
  30. /************************************************************************/
  31. /* CLR HOOKS */
  32. /************************************************************************/
  33. static void internal_Create(MonoObject* instance, ScriptSceneObject* parentSO);
  34. static void internal_SetAnimation(ScriptRenderable* thisPtr, ScriptAnimation* animation);
  35. static void internal_UpdateTransform(ScriptRenderable* thisPtr, ScriptSceneObject* parentSO);
  36. static void internal_SetMesh(ScriptRenderable* thisPtr, ScriptMesh* mesh);
  37. static void internal_GetBounds(ScriptRenderable* thisPtr, ScriptSceneObject* parentSO, AABox* box, Sphere* sphere);
  38. static UINT64 internal_GetLayers(ScriptRenderable* thisPtr);
  39. static void internal_SetLayers(ScriptRenderable* thisPtr, UINT64 layers);
  40. static void internal_SetMaterial(ScriptRenderable* thisPtr, ScriptMaterial* material, int index);
  41. static void internal_SetMaterials(ScriptRenderable* thisPtr, MonoArray* materials);
  42. static void internal_OnDestroy(ScriptRenderable* thisPtr);
  43. };
  44. /** @} */
  45. }