Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 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 | |
Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 17 | #include <renderengine/Texture.h> |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 18 | |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 19 | namespace android { |
Peiyong Lin | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 20 | namespace renderengine { |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 21 | |
Chia-I Wu | b027f80 | 2017-11-29 14:00:52 -0800 | [diff] [blame] | 22 | Texture::Texture() |
| 23 | : mTextureName(0), mTextureTarget(TEXTURE_2D), mWidth(0), mHeight(0), mFiltering(false) {} |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 24 | |
Chia-I Wu | b027f80 | 2017-11-29 14:00:52 -0800 | [diff] [blame] | 25 | Texture::Texture(Target textureTarget, uint32_t textureName) |
| 26 | : mTextureName(textureName), |
| 27 | mTextureTarget(textureTarget), |
| 28 | mWidth(0), |
| 29 | mHeight(0), |
| 30 | mFiltering(false) {} |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 31 | |
| 32 | void Texture::init(Target textureTarget, uint32_t textureName) { |
| 33 | mTextureName = textureName; |
| 34 | mTextureTarget = textureTarget; |
| 35 | } |
| 36 | |
Chia-I Wu | b027f80 | 2017-11-29 14:00:52 -0800 | [diff] [blame] | 37 | Texture::~Texture() {} |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 38 | |
| 39 | void Texture::setMatrix(float const* matrix) { |
Mathias Agopian | a8c386f | 2013-08-26 20:42:07 -0700 | [diff] [blame] | 40 | mTextureMatrix = mat4(matrix); |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | void Texture::setFiltering(bool enabled) { |
| 44 | mFiltering = enabled; |
| 45 | } |
| 46 | |
| 47 | void Texture::setDimensions(size_t width, size_t height) { |
| 48 | mWidth = width; |
| 49 | mHeight = height; |
| 50 | } |
| 51 | |
| 52 | uint32_t Texture::getTextureName() const { |
| 53 | return mTextureName; |
| 54 | } |
| 55 | |
| 56 | uint32_t Texture::getTextureTarget() const { |
| 57 | return mTextureTarget; |
| 58 | } |
| 59 | |
Mathias Agopian | a8c386f | 2013-08-26 20:42:07 -0700 | [diff] [blame] | 60 | const mat4& Texture::getMatrix() const { |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 61 | return mTextureMatrix; |
| 62 | } |
| 63 | |
| 64 | bool Texture::getFiltering() const { |
| 65 | return mFiltering; |
| 66 | } |
| 67 | |
| 68 | size_t Texture::getWidth() const { |
| 69 | return mWidth; |
| 70 | } |
| 71 | |
| 72 | size_t Texture::getHeight() const { |
| 73 | return mHeight; |
| 74 | } |
| 75 | |
Peiyong Lin | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 76 | } // namespace renderengine |
| 77 | } // namespace android |