TextureViewImpl.h 877 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. {
  11. /// @addtogroup opengl
  12. /// @{
  13. /// Texture view implementation.
  14. class TextureViewImpl final : public TextureView, public GlObject
  15. {
  16. public:
  17. MicroTextureView m_view = {};
  18. TexturePtr m_tex; ///< Hold a reference.
  19. TextureViewImpl(GrManager* manager, CString name)
  20. : TextureView(manager, name)
  21. {
  22. }
  23. ~TextureViewImpl()
  24. {
  25. m_glName = 0;
  26. }
  27. void preInit(const TextureViewInitInfo& inf);
  28. void init()
  29. {
  30. m_view = static_cast<const TextureImpl&>(*m_tex).getOrCreateView(getSubresource());
  31. m_glName = m_view.m_glName;
  32. }
  33. };
  34. /// @}
  35. } // end namespace anki