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