DALi Version 2.2.11
[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 // INTERNAL INCLUDES
21 #include <dali-scene3d/public-api/api.h>
22 #include <dali-scene3d/public-api/common/environment-map.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/common/vector-wrapper.h>
26 #include <dali/public-api/images/pixel-data.h>
27 #include <dali/public-api/rendering/texture.h>
28 #include <dali/public-api/rendering/shader.h>
29
30 namespace Dali
31 {
32 namespace Scene3D
33 {
34 namespace Loader
35 {
36 /**
37  * @brief Stores the pixel data objects for environment map texture.
38  * EnvironmentMapData supports cube map that contains textures for 6 faces, or
39  * an equirectangular image.
40  */
41 class DALI_SCENE3D_API EnvironmentMapData
42 {
43 public:
44   /**
45    * @brief Retrieves environment map texture from image file
46    * @return texture for loaded environment map.
47    */
48   Texture GetTexture();
49
50   /**
51    * @brief Sets environment map type
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    * @return environment map type
66    */
67   Dali::Scene3D::EnvironmentMapType GetEnvironmentMapType() const
68   {
69     return mEnvironmentMapType;
70   }
71
72 public:
73   std::vector<std::vector<PixelData> > mPixelData;
74
75 private:
76   Dali::Texture                     mEnvironmentMapTexture;
77   Dali::Shader                      mEnvironmentMapShader;
78   Dali::Scene3D::EnvironmentMapType mEnvironmentMapType{Dali::Scene3D::EnvironmentMapType::AUTO};
79 };
80
81 } // namespace Loader
82 } // namespace Scene3D
83 } // namespace Dali
84
85 #endif // DALI_SCENE3D_LOADER_ENVIRONMENT_MAP_DATA_H