• 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_image.h>
21 
22 #include <meta/base/interface_macros.h>
23 #include <meta/interface/interface_macros.h>
24 
25 SCENE_BEGIN_NAMESPACE()
26 
27 /** Filter */
28 enum class SamplerFilter : uint32_t {
29     /** Nearest */
30     NEAREST = 0,
31     /** Linear */
32     LINEAR = 1,
33 };
34 
35 /** Sampler address mode */
36 enum class SamplerAddressMode : uint32_t {
37     /** Repeat */
38     REPEAT = 0,
39     /** Mirrored repeat */
40     MIRRORED_REPEAT = 1,
41     /** Clamp to edge */
42     CLAMP_TO_EDGE = 2,
43     /** Clamp to border */
44     CLAMP_TO_BORDER = 3,
45     /** Mirror clamp to edge */
46     MIRROR_CLAMP_TO_EDGE = 4,
47 };
48 
49 /**
50  * @brief The ISampler interface defines properties for a sampler.
51  */
52 class ISampler : public CORE_NS::IInterface {
53     META_INTERFACE(CORE_NS::IInterface, ISampler, "e4ecf173-e07f-4534-a02d-a5eee9b43a97")
54 public:
55     /**
56      * @brief Magnification filter
57      */
58     META_PROPERTY(SamplerFilter, MagFilter)
59     /**
60      * @brief Minification filter
61      */
62     META_PROPERTY(SamplerFilter, MinFilter)
63     /**
64      * @brief Mip map filter filter
65      */
66     META_PROPERTY(SamplerFilter, MipMapMode)
67     /**
68      * @brief Address mode U
69      */
70     META_PROPERTY(SamplerAddressMode, AddressModeU)
71     /**
72      * @brief Address mode V
73      */
74     META_PROPERTY(SamplerAddressMode, AddressModeV)
75     /**
76      * @brief Address mode W
77      */
78     META_PROPERTY(SamplerAddressMode, AddressModeW)
79 };
80 
81 /**
82  * @brief The ITexture interface defines material property properties.
83  */
84 class ITexture : public CORE_NS::IInterface {
85     META_INTERFACE(CORE_NS::IInterface, ITexture, "38c66860-d325-4256-becd-ffd2f94fbd8a")
86 public:
87     /**
88      * @brief Texture Image
89      */
90     META_PROPERTY(IImage::Ptr, Image)
91     /**
92      * @brief Sampler to be used with the texture.
93      */
94     META_READONLY_PROPERTY(ISampler::Ptr, Sampler)
95     /**
96      * @brief Factor
97      */
98     META_PROPERTY(BASE_NS::Math::Vec4, Factor)
99     /**
100      * @brief Translation of the texture.
101      */
102     META_PROPERTY(BASE_NS::Math::Vec2, Translation)
103     /**
104      * @brief Rotation of the texture.
105      */
106     META_PROPERTY(float, Rotation)
107     /**
108      * @brief Scale of the texture.
109      */
110     META_PROPERTY(BASE_NS::Math::Vec2, Scale)
111 };
112 
113 SCENE_END_NAMESPACE()
114 
115 META_TYPE(SCENE_NS::SamplerFilter)
116 META_TYPE(SCENE_NS::SamplerAddressMode)
117 META_INTERFACE_TYPE(SCENE_NS::ITexture)
118 META_INTERFACE_TYPE(SCENE_NS::ISampler)
119 
120 #endif
121