Texture.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 <string.h>
  17. #include "Texture.h"
  18. namespace android {
  19. Texture::Texture() :
  20. mTextureName(0), mTextureTarget(TEXTURE_2D),
  21. mWidth(0), mHeight(0), mFiltering(false) {
  22. }
  23. Texture::Texture(Target textureTarget, uint32_t textureName) :
  24. mTextureName(textureName), mTextureTarget(textureTarget),
  25. mWidth(0), mHeight(0), mFiltering(false) {
  26. }
  27. void Texture::init(Target textureTarget, uint32_t textureName) {
  28. mTextureName = textureName;
  29. mTextureTarget = textureTarget;
  30. }
  31. Texture::~Texture() {
  32. }
  33. void Texture::setMatrix(float const* matrix) {
  34. mTextureMatrix = mat4(matrix);
  35. }
  36. void Texture::setFiltering(bool enabled) {
  37. mFiltering = enabled;
  38. }
  39. void Texture::setDimensions(size_t width, size_t height) {
  40. mWidth = width;
  41. mHeight = height;
  42. }
  43. uint32_t Texture::getTextureName() const {
  44. return mTextureName;
  45. }
  46. uint32_t Texture::getTextureTarget() const {
  47. return mTextureTarget;
  48. }
  49. const mat4& Texture::getMatrix() const {
  50. return mTextureMatrix;
  51. }
  52. bool Texture::getFiltering() const {
  53. return mFiltering;
  54. }
  55. size_t Texture::getWidth() const {
  56. return mWidth;
  57. }
  58. size_t Texture::getHeight() const {
  59. return mHeight;
  60. }
  61. } /* namespace android */