blob: 5eabbcf03e677648c4f9aa25da9e8a06b534b663 [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
Mathias Agopian49457ac2013-08-14 18:20:17 -070019namespace android {
Peiyong Lin833074a2018-08-28 11:53:54 -070020namespace renderengine {
Mathias Agopian49457ac2013-08-14 18:20:17 -070021
Chia-I Wub027f802017-11-29 14:00:52 -080022Texture::Texture()
23 : mTextureName(0), mTextureTarget(TEXTURE_2D), mWidth(0), mHeight(0), mFiltering(false) {}
Mathias Agopian49457ac2013-08-14 18:20:17 -070024
Chia-I Wub027f802017-11-29 14:00:52 -080025Texture::Texture(Target textureTarget, uint32_t textureName)
26 : mTextureName(textureName),
27 mTextureTarget(textureTarget),
28 mWidth(0),
29 mHeight(0),
30 mFiltering(false) {}
Mathias Agopian49457ac2013-08-14 18:20:17 -070031
32void Texture::init(Target textureTarget, uint32_t textureName) {
33 mTextureName = textureName;
34 mTextureTarget = textureTarget;
35}
36
Chia-I Wub027f802017-11-29 14:00:52 -080037Texture::~Texture() {}
Mathias Agopian49457ac2013-08-14 18:20:17 -070038
39void Texture::setMatrix(float const* matrix) {
Mathias Agopiana8c386f2013-08-26 20:42:07 -070040 mTextureMatrix = mat4(matrix);
Mathias Agopian49457ac2013-08-14 18:20:17 -070041}
42
43void Texture::setFiltering(bool enabled) {
44 mFiltering = enabled;
45}
46
47void Texture::setDimensions(size_t width, size_t height) {
48 mWidth = width;
49 mHeight = height;
50}
51
52uint32_t Texture::getTextureName() const {
53 return mTextureName;
54}
55
56uint32_t Texture::getTextureTarget() const {
57 return mTextureTarget;
58}
59
Mathias Agopiana8c386f2013-08-26 20:42:07 -070060const mat4& Texture::getMatrix() const {
Mathias Agopian49457ac2013-08-14 18:20:17 -070061 return mTextureMatrix;
62}
63
64bool Texture::getFiltering() const {
65 return mFiltering;
66}
67
68size_t Texture::getWidth() const {
69 return mWidth;
70}
71
72size_t Texture::getHeight() const {
73 return mHeight;
74}
75
Peiyong Lin833074a2018-08-28 11:53:54 -070076} // namespace renderengine
77} // namespace android