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