[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / environment-map-data.h
1 #ifndef DALI_SCENE3D_LOADER_ENVIRONMENT_MAP_DATA_H
2 #define DALI_SCENE3D_LOADER_ENVIRONMENT_MAP_DATA_H
3 /*
4  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 // EXTERNAL INCLUDES
21 #include <dali/public-api/common/vector-wrapper.h>
22 #include <dali/public-api/images/pixel-data.h>
23 #include <dali/public-api/rendering/shader.h>
24 #include <dali/public-api/rendering/texture.h>
25
26 // INTERNAL INCLUDES
27 #include <dali-scene3d/public-api/api.h>
28 #include <dali-scene3d/public-api/common/environment-map.h>
29
30 namespace Dali::Scene3D::Loader
31 {
32 /**
33  * @brief Stores the pixel data objects for environment map texture.
34  *
35  * EnvironmentMapData supports cube map that contains textures for 6 faces, or
36  * an equirectangular image.
37  * @SINCE_2_2.11
38  */
39 class DALI_SCENE3D_API EnvironmentMapData
40 {
41 public:
42   /**
43    * @brief Retrieves environment map texture from image file
44    * @SINCE_2_2.11
45    * @return texture for loaded environment map.
46    */
47   Texture GetTexture();
48
49   /**
50    * @brief Sets environment map type
51    * @SINCE_2_2.11
52    * @param[in] environmentMapType environment map type
53    */
54   void SetEnvironmentMapType(Dali::Scene3D::EnvironmentMapType environmentMapType)
55   {
56     if(mEnvironmentMapType != environmentMapType)
57     {
58       mEnvironmentMapTexture.Reset();
59       mEnvironmentMapType = environmentMapType;
60     }
61   }
62
63   /**
64    * @brief Retrieves environment map type.
65    * @SINCE_2_2.11
66    * @return environment map type
67    */
68   Dali::Scene3D::EnvironmentMapType GetEnvironmentMapType() const
69   {
70     return mEnvironmentMapType;
71   }
72
73   /**
74    * @brief Sets the mipmap levels
75    * @SINCE_2_2.19
76    * @param[in] mipmapLevels No. of mipmap levels
77    */
78   void SetMipmapLevels(uint32_t mipmapLevels)
79   {
80     mMipmapLevels = mipmapLevels;
81   }
82
83   /**
84    * @brief Retrieves the number of mipmap levels
85    * @SINCE_2_2.19
86    * @return No. of mipmap levels
87    */
88   uint32_t GetMipmapLevels() const
89   {
90     return mMipmapLevels;
91   }
92
93 public:
94   std::vector<std::vector<PixelData> > mPixelData;
95
96 private:
97   Dali::Texture                     mEnvironmentMapTexture;
98   Dali::Shader                      mEnvironmentMapShader;
99   Dali::Scene3D::EnvironmentMapType mEnvironmentMapType{Dali::Scene3D::EnvironmentMapType::AUTO};
100   uint32_t                          mMipmapLevels{1u};
101 };
102
103 } // namespace Dali::Scene3D::Loader
104
105 #endif // DALI_SCENE3D_LOADER_ENVIRONMENT_MAP_DATA_H