blob: c07ba085ee0c702b96775cd92a009ef3bcb1eda2 [file] [log] [blame]
Mathias Agopian49457ac2013-08-14 18:20:17 -07001/*
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 Lincbc184f2018-08-22 13:24:10 -070017#include <renderengine/Texture.h>
Mathias Agopian49457ac2013-08-14 18:20:17 -070018
Peiyong Lincbc184f2018-08-22 13:24:10 -070019#include <string.h>
Mathias Agopian49457ac2013-08-14 18:20:17 -070020
21namespace android {
22
Chia-I Wub027f802017-11-29 14:00:52 -080023Texture::Texture()
24 : mTextureName(0), mTextureTarget(TEXTURE_2D), mWidth(0), mHeight(0), mFiltering(false) {}
Mathias Agopian49457ac2013-08-14 18:20:17 -070025
Chia-I Wub027f802017-11-29 14:00:52 -080026Texture::Texture(Target textureTarget, uint32_t textureName)
27 : mTextureName(textureName),
28 mTextureTarget(textureTarget),
29 mWidth(0),
30 mHeight(0),
31 mFiltering(false) {}
Mathias Agopian49457ac2013-08-14 18:20:17 -070032
33void Texture::init(Target textureTarget, uint32_t textureName) {
34 mTextureName = textureName;
35 mTextureTarget = textureTarget;
36}
37
Chia-I Wub027f802017-11-29 14:00:52 -080038Texture::~Texture() {}
Mathias Agopian49457ac2013-08-14 18:20:17 -070039
40void Texture::setMatrix(float const* matrix) {
Mathias Agopiana8c386f2013-08-26 20:42:07 -070041 mTextureMatrix = mat4(matrix);
Mathias Agopian49457ac2013-08-14 18:20:17 -070042}
43
44void Texture::setFiltering(bool enabled) {
45 mFiltering = enabled;
46}
47
48void Texture::setDimensions(size_t width, size_t height) {
49 mWidth = width;
50 mHeight = height;
51}
52
53uint32_t Texture::getTextureName() const {
54 return mTextureName;
55}
56
57uint32_t Texture::getTextureTarget() const {
58 return mTextureTarget;
59}
60
Mathias Agopiana8c386f2013-08-26 20:42:07 -070061const mat4& Texture::getMatrix() const {
Mathias Agopian49457ac2013-08-14 18:20:17 -070062 return mTextureMatrix;
63}
64
65bool Texture::getFiltering() const {
66 return mFiltering;
67}
68
69size_t Texture::getWidth() const {
70 return mWidth;
71}
72
73size_t Texture::getHeight() const {
74 return mHeight;
75}
76
77} /* namespace android */