• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SCENE_INTERFACE_ITEXTURE_H
17 #define SCENE_INTERFACE_ITEXTURE_H
18 
19 #include <scene/base/namespace.h>
20 #include <scene/interface/intf_bitmap.h>
21 
22 #include <meta/base/interface_macros.h>
23 #include <meta/interface/interface_macros.h>
24 
25 SCENE_BEGIN_NAMESPACE()
26 
27 /**
28  * @brief Predefined sampler types
29  */
30 enum class TextureSampler {
31     UNKNOWN,
32     /** Default sampler, nearest repeat */
33     NEAREST_REPEAT,
34     /** Default sampler, nearest clamp */
35     NEAREST_CLAMP,
36     /** Default sampler, linear repeat */
37     LINEAR_REPEAT,
38     /** Default sampler, linear clamp */
39     LINEAR_CLAMP,
40     /** Default sampler, linear mipmap repeat */
41     LINEAR_MIPMAP_REPEAT,
42     /** Default sampler, linear mipmap clamp */
43     LINEAR_MIPMAP_CLAMP,
44     END_OF_LIST
45 };
46 
47 class ITexture : public CORE_NS::IInterface {
48     META_INTERFACE(CORE_NS::IInterface, ITexture, "38c66860-d325-4256-becd-ffd2f94fbd8a")
49 public:
50     /**
51      * @brief Texture Image
52      */
53     META_PROPERTY(IBitmap::Ptr, Image)
54     /**
55      * @brief Sampler type to be used with texture.
56      */
57     META_PROPERTY(TextureSampler, Sampler)
58     /**
59      * @brief Factor
60      */
61     META_PROPERTY(BASE_NS::Math::Vec4, Factor)
62     /**
63      * @brief Translation of the texture.
64      */
65     META_PROPERTY(BASE_NS::Math::Vec2, Translation)
66     /**
67      * @brief Rotation of the texture.
68      */
69     META_PROPERTY(float, Rotation)
70     /**
71      * @brief Scale of the texture.
72      */
73     META_PROPERTY(BASE_NS::Math::Vec2, Scale)
74 };
75 
76 SCENE_END_NAMESPACE()
77 
78 META_TYPE(SCENE_NS::TextureSampler)
79 META_INTERFACE_TYPE(SCENE_NS::ITexture)
80 
81 #endif
82