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 #ifndef SF_RENDER_ENGINE_TEXTURE_H
18 #define SF_RENDER_ENGINE_TEXTURE_H
19 
20 #include <stdint.h>
21 
22 #include <math/mat4.h>
23 
24 namespace android {
25 namespace renderengine {
26 
27 class Texture {
28 public:
29     enum Target { TEXTURE_2D = 0x0DE1, TEXTURE_EXTERNAL = 0x8D65 };
30 
31     Texture();
32     Texture(Target textureTarget, uint32_t textureName);
33     ~Texture();
34 
35     void init(Target textureTarget, uint32_t textureName);
36 
37     void setMatrix(float const* matrix);
38     void setFiltering(bool enabled);
39     void setDimensions(size_t width, size_t height);
40 
41     uint32_t getTextureName() const;
42     uint32_t getTextureTarget() const;
43 
44     const mat4& getMatrix() const;
45     bool getFiltering() const;
46     size_t getWidth() const;
47     size_t getHeight() const;
48 
49 private:
50     uint32_t mTextureName;
51     uint32_t mTextureTarget;
52     size_t mWidth;
53     size_t mHeight;
54     bool mFiltering;
55     mat4 mTextureMatrix;
56 };
57 
58 } // namespace renderengine
59 } // namespace android
60 #endif /* SF_RENDER_ENGINE_TEXTURE_H */
61