BsScriptRenderable.h 2.3 KB

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