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 <renderengine/Texture.h>
18
19 namespace android {
20 namespace renderengine {
21
Texture()22 Texture::Texture()
23 : mTextureName(0), mTextureTarget(TEXTURE_2D), mWidth(0), mHeight(0), mFiltering(false) {}
24
Texture(Target textureTarget,uint32_t textureName)25 Texture::Texture(Target textureTarget, uint32_t textureName)
26 : mTextureName(textureName),
27 mTextureTarget(textureTarget),
28 mWidth(0),
29 mHeight(0),
30 mFiltering(false) {}
31
init(Target textureTarget,uint32_t textureName)32 void Texture::init(Target textureTarget, uint32_t textureName) {
33 mTextureName = textureName;
34 mTextureTarget = textureTarget;
35 }
36
~Texture()37 Texture::~Texture() {}
38
setMatrix(float const * matrix)39 void Texture::setMatrix(float const* matrix) {
40 mTextureMatrix = mat4(matrix);
41 }
42
setFiltering(bool enabled)43 void Texture::setFiltering(bool enabled) {
44 mFiltering = enabled;
45 }
46
setDimensions(size_t width,size_t height)47 void Texture::setDimensions(size_t width, size_t height) {
48 mWidth = width;
49 mHeight = height;
50 }
51
getTextureName() const52 uint32_t Texture::getTextureName() const {
53 return mTextureName;
54 }
55
getTextureTarget() const56 uint32_t Texture::getTextureTarget() const {
57 return mTextureTarget;
58 }
59
getMatrix() const60 const mat4& Texture::getMatrix() const {
61 return mTextureMatrix;
62 }
63
getFiltering() const64 bool Texture::getFiltering() const {
65 return mFiltering;
66 }
67
getWidth() const68 size_t Texture::getWidth() const {
69 return mWidth;
70 }
71
getHeight() const72 size_t Texture::getHeight() const {
73 return mHeight;
74 }
75
76 } // namespace renderengine
77 } // namespace android
78