BsD3D9Resource.h 1.3 KB

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