Texture.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright 2013 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <stdint.h>
  17. #include <ui/mat4.h>
  18. #ifndef SF_RENDER_ENGINE_TEXTURE_H
  19. #define SF_RENDER_ENGINE_TEXTURE_H
  20. namespace android {
  21. class Texture {
  22. uint32_t mTextureName;
  23. uint32_t mTextureTarget;
  24. size_t mWidth;
  25. size_t mHeight;
  26. bool mFiltering;
  27. mat4 mTextureMatrix;
  28. public:
  29. enum Target { TEXTURE_2D = 0x0DE1, TEXTURE_EXTERNAL = 0x8D65 };
  30. Texture();
  31. Texture(Target textureTarget, uint32_t textureName);
  32. ~Texture();
  33. void init(Target textureTarget, uint32_t textureName);
  34. void setMatrix(float const* matrix);
  35. void setFiltering(bool enabled);
  36. void setDimensions(size_t width, size_t height);
  37. uint32_t getTextureName() const;
  38. uint32_t getTextureTarget() const;
  39. const mat4& getMatrix() const;
  40. bool getFiltering() const;
  41. size_t getWidth() const;
  42. size_t getHeight() const;
  43. };
  44. } /* namespace android */
  45. #endif /* SF_RENDER_ENGINE_TEXTURE_H */