BsD3D9Resource.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsD3D9Prerequisites.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Provides an interface for dealing with DX9 resources. Primarily
  9. * notifying the resources of any changed states.
  10. */
  11. class BS_D3D9_EXPORT D3D9Resource
  12. {
  13. public:
  14. D3D9Resource();
  15. virtual ~D3D9Resource();
  16. /**
  17. * @brief Called immediately after the Direct3D device has been created.
  18. */
  19. virtual void notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device) {}
  20. /**
  21. * @brief Called before the Direct3D device is going to be destroyed.
  22. */
  23. virtual void notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device) {}
  24. /**
  25. * @brief Called immediately after the Direct3D device has entered a lost state.
  26. */
  27. virtual void notifyOnDeviceLost(IDirect3DDevice9* d3d9Device) {}
  28. /**
  29. * @brief Called immediately after the Direct3D device has been reset.
  30. */
  31. virtual void notifyOnDeviceReset(IDirect3DDevice9* d3d9Device) {}
  32. /**
  33. * @brief Called when device state is changing. Access to any device should be locked.
  34. * Relevant for multi thread application.
  35. */
  36. static void lockDeviceAccess();
  37. /**
  38. * @brief Called when device state change completed. Access to any device is allowed.
  39. * Relevant for multi thread application.
  40. */
  41. static void unlockDeviceAccess();
  42. protected:
  43. BS_STATIC_MUTEX(msDeviceAccessMutex)
  44. };
  45. }