1 #ifndef DALI_SCENE3D_LOADER_ENVIRONMENT_DEFINITION_H
2 #define DALI_SCENE3D_LOADER_ENVIRONMENT_DEFINITION_H
4 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali/public-api/math/quaternion.h>
22 #include <dali/public-api/rendering/texture.h>
26 #include <dali-scene3d/public-api/api.h>
27 #include <dali-scene3d/public-api/loader/environment-map-data.h>
29 namespace Dali::Scene3D::Loader
32 * @brief Defines an environment map with either or both of radiance
33 * and irradiance maps.
35 struct DALI_SCENE3D_API EnvironmentDefinition
39 Texture mDiffuse; // irradiance
40 Texture mSpecular; // radiance
41 Texture mBrdf; // pre-computed brdf
42 uint32_t mSpecularMipmapLevels{1u};
46 return mDiffuse || mSpecular;
52 EnvironmentMapData mDiffuse;
53 EnvironmentMapData mSpecular;
57 using EnvironmentData = std::pair<EnvironmentDefinition, Textures>;
58 using Vector = std::vector<EnvironmentData>;
60 EnvironmentDefinition() = default;
62 EnvironmentDefinition(const EnvironmentDefinition&) = delete;
63 EnvironmentDefinition& operator=(const EnvironmentDefinition&) = delete;
65 EnvironmentDefinition(EnvironmentDefinition&&) = default;
66 EnvironmentDefinition& operator=(EnvironmentDefinition&&) = default;
69 * @brief Loads raw pixel data for the given diffuse and specular maps.
70 * @note This can be done on any thread.
72 RawData LoadRaw(const std::string& environmentsPath) const;
75 * @brief Creates DALi cubemap Textures from the pixel data in @a raw, then
76 * returns them in a Textures object.
77 * @note This must only be called from the event thread.
79 Textures Load(RawData&& raw) const;
82 * @brief Get default intensity value.
83 * @return Default intensity. (1.0f)
85 static float GetDefaultIntensity();
88 std::string mDiffuseMapPath;
89 std::string mSpecularMapPath;
90 std::shared_ptr<RawData> mRawData;
91 Quaternion mCubeOrientation = Quaternion::IDENTITY;
92 Vector3 mYDirection = Vector3::ONE;
93 float mIblIntensity = 1.0f;
94 bool mUseBrdfTexture = false;
97 } // namespace Dali::Scene3D::Loader
99 #endif // DALI_SCENE3D_LOADER_ENVIRONMENT_DEFINITION_H