TextureViewImpl.h 877 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Gr/TextureView.h>
  7. #include <AnKi/Gr/gl/GlObject.h>
  8. #include <AnKi/Gr/gl/TextureImpl.h>
  9. namespace anki {
  10. /// @addtogroup opengl
  11. /// @{
  12. /// Texture view implementation.
  13. class TextureViewImpl final : public TextureView, public GlObject
  14. {
  15. public:
  16. MicroTextureView m_view = {};
  17. TexturePtr m_tex; ///< Hold a reference.
  18. TextureViewImpl(GrManager* manager, CString name)
  19. : TextureView(manager, name)
  20. {
  21. }
  22. ~TextureViewImpl()
  23. {
  24. m_glName = 0;
  25. }
  26. void preInit(const TextureViewInitInfo& inf);
  27. void init()
  28. {
  29. m_view = static_cast<const TextureImpl&>(*m_tex).getOrCreateView(getSubresource());
  30. m_glName = m_view.m_glName;
  31. }
  32. };
  33. /// @}
  34. } // end namespace anki