Updated all header files to new format
[platform/core/uifw/dali-toolkit.git] / dali-scene-loader / public-api / environment-definition.h
1 #ifndef DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
2 #define DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
3 /*
4  * Copyright (c) 2021 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-scene-loader/public-api/api.h"
22 #include "dali-scene-loader/public-api/ktx-loader.h"
23
24 // EXTERNAL INCLUDES
25 #include "dali/public-api/math/quaternion.h"
26 #include "dali/public-api/rendering/texture.h"
27
28 namespace Dali
29 {
30 namespace SceneLoader
31 {
32 /**
33  * @brief Defines an environment map with either or both of radiance
34  *  and irradiance maps.
35  */
36 struct DALI_SCENE_LOADER_API EnvironmentDefinition
37 {
38   struct Textures
39   {
40     Texture mDiffuse;  // irradiance
41     Texture mSpecular; // radiance
42
43     bool IsLoaded() const
44     {
45       return mDiffuse || mSpecular;
46     }
47   };
48
49   struct RawData
50   {
51     CubeData mDiffuse;
52     CubeData mSpecular;
53   };
54
55   using EnvironmentData = std::pair<EnvironmentDefinition, Textures>;
56   using Vector          = std::vector<EnvironmentData>;
57
58   EnvironmentDefinition() = default;
59
60   EnvironmentDefinition(const EnvironmentDefinition&) = delete;
61   EnvironmentDefinition& operator=(const EnvironmentDefinition&) = delete;
62
63   EnvironmentDefinition(EnvironmentDefinition&&) = default;
64   EnvironmentDefinition& operator=(EnvironmentDefinition&&) = default;
65
66   /**
67    * @brief Loads raw pixel data for the given diffuse and specular maps.
68    * @note This can be done on any thread.
69    */
70   RawData LoadRaw(const std::string& environmentsPath) const;
71
72   /**
73    * @brief Creates DALi cubemap Textures from the pixel data in @a raw, then
74    *  returns them in a Textures object.
75    * @note This must only be called from the event thread.
76    */
77   Textures Load(RawData&& raw) const;
78
79 public: // DATA
80   std::string mDiffuseMapPath;
81   std::string mSpecularMapPath;
82   Quaternion  mCubeOrientation = Quaternion::IDENTITY;
83   float       mIblIntensity    = 1.0f;
84 };
85
86 } // namespace SceneLoader
87 } // namespace Dali
88
89 #endif //DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H