[dali_2.2.19] 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  * EnvironmentMapData supports cube map that contains textures for 6 faces, or
35  * an equirectangular image.
36  */
37 class DALI_SCENE3D_API EnvironmentMapData
38 {
39 public:
40   /**
41    * @brief Retrieves environment map texture from image file
42    * @return texture for loaded environment map.
43    */
44   Texture GetTexture();
45
46   /**
47    * @brief Sets environment map type
48    * @param[in] environmentMapType environment map type
49    */
50   void SetEnvironmentMapType(Dali::Scene3D::EnvironmentMapType environmentMapType)
51   {
52     if(mEnvironmentMapType != environmentMapType)
53     {
54       mEnvironmentMapTexture.Reset();
55       mEnvironmentMapType = environmentMapType;
56     }
57   }
58
59   /**
60    * @brief Retrieves environment map type.
61    * @return environment map type
62    */
63   Dali::Scene3D::EnvironmentMapType GetEnvironmentMapType() const
64   {
65     return mEnvironmentMapType;
66   }
67
68   void SetMipmapLevels(uint32_t mipmapLevels)
69   {
70     mMipmapLevels = mipmapLevels;
71   }
72
73   uint32_t GetMipmapLevels()
74   {
75     return mMipmapLevels;
76   }
77
78 public:
79   std::vector<std::vector<PixelData> > mPixelData;
80
81 private:
82   Dali::Texture                     mEnvironmentMapTexture;
83   Dali::Shader                      mEnvironmentMapShader;
84   Dali::Scene3D::EnvironmentMapType mEnvironmentMapType{Dali::Scene3D::EnvironmentMapType::AUTO};
85   uint32_t                          mMipmapLevels{1u};
86 };
87
88 } // namespace Dali::Scene3D::Loader
89
90 #endif // DALI_SCENE3D_LOADER_ENVIRONMENT_MAP_DATA_H