TextureMTL.h 866 B

1234567891011121314151617181920212223242526272829303132
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Renderer/Texture.h>
  6. #include <MetalKit/MetalKit.h>
  7. class RendererMTL;
  8. /// Metal texture
  9. class TextureMTL : public Texture
  10. {
  11. public:
  12. /// Constructor, called by Renderer::CreateTextureMTL
  13. TextureMTL(RendererMTL *inRenderer, const Surface *inSurface); // Create a normal Texture
  14. TextureMTL(RendererMTL *inRenderer, int inWidth, int inHeight); // Create a render target (depth only)
  15. virtual ~TextureMTL() override;
  16. /// Bind texture to the pixel shader
  17. virtual void Bind() const override;
  18. /// Access to the metal texture
  19. id<MTLTexture> GetTexture() const { return mTexture; }
  20. private:
  21. RendererMTL * mRenderer;
  22. id<MTLTexture> mTexture;
  23. };