ITexture2D.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <stdint.h>
  3. namespace unity
  4. {
  5. namespace webrtc
  6. {
  7. class ITexture2D
  8. {
  9. public:
  10. //[TODO-Sin: 2019-19-11] ITexture2D should not be created directly, but should be called using
  11. // GraphicsDevice->CreateDefaultTexture
  12. ITexture2D(uint32_t w, uint32_t h)
  13. : m_width(w)
  14. , m_height(h)
  15. {
  16. }
  17. bool IsSize(uint32_t w, uint32_t h) const { return m_width == w && m_height == h; }
  18. virtual ~ITexture2D() = default;
  19. /// <summary>
  20. /// Get the pointer taken from Unity
  21. /// </summary>
  22. virtual void* GetNativeTexturePtrV() = 0;
  23. /// <summary>
  24. /// Get the pointer taken from Unity
  25. /// </summary>
  26. virtual const void* GetNativeTexturePtrV() const = 0;
  27. virtual void* GetEncodeTexturePtrV() = 0;
  28. virtual const void* GetEncodeTexturePtrV() const = 0;
  29. uint32_t GetWidth() const { return m_width; }
  30. uint32_t GetHeight() const { return m_height; }
  31. protected:
  32. uint32_t m_width;
  33. uint32_t m_height;
  34. };
  35. } // end namespace webrtc
  36. } // end namespace unity