1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #ifndef SCENEPLUGINAPI_ENVIRONMENT_H
17 #define SCENEPLUGINAPI_ENVIRONMENT_H
18
19 #include <scene_plugin/api/environment_uid.h>
20 #include <scene_plugin/interface/intf_environment.h>
21 #include <scene_plugin/interface/intf_node.h>
22
23 #include <meta/api/internal/object_api.h>
SCENE_BEGIN_NAMESPACE()24 SCENE_BEGIN_NAMESPACE()
25
26 class Environment final : public META_NS::Internal::ObjectInterfaceAPI<Environment, ClassId::Environment> {
27 META_API(Environment)
28 API_OBJECT_CONVERTIBLE(IEnvironment)
29 API_CACHE_INTERFACE(IEnvironment, Environment)
30 API_OBJECT_CONVERTIBLE(INode)
31 API_CACHE_INTERFACE(INode, Node)
32
33 public:
34 API_INTERFACE_PROPERTY_CACHED(Node, Name, BASE_NS::string)
35 API_INTERFACE_PROPERTY_CACHED(Node, Position, BASE_NS::Math::Vec3)
36 API_INTERFACE_PROPERTY_CACHED(Node, Scale, BASE_NS::Math::Vec3)
37 API_INTERFACE_PROPERTY_CACHED(Node, Rotation, BASE_NS::Math::Quat)
38 API_INTERFACE_PROPERTY_CACHED(Node, Visible, bool)
39 API_INTERFACE_PROPERTY_CACHED(Node, LayerMask, uint64_t)
40 API_INTERFACE_PROPERTY_CACHED(Node, LocalMatrix, BASE_NS::Math::Mat4X4)
41
42 API_INTERFACE_PROPERTY_CACHED(Environment, Background, IEnvironment::BackgroundType)
43 API_INTERFACE_PROPERTY_CACHED(Environment, IndirectDiffuseFactor, BASE_NS::Math::Vec4)
44 API_INTERFACE_PROPERTY_CACHED(Environment, IndirectSpecularFactor, BASE_NS::Math::Vec4)
45 API_INTERFACE_PROPERTY_CACHED(Environment, EnvMapFactor, BASE_NS::Math::Vec4)
46 API_INTERFACE_PROPERTY_CACHED(Environment, RadianceImage, IBitmap::Ptr)
47 API_INTERFACE_PROPERTY_CACHED(Environment, RadianceCubemapMipCount, uint32_t)
48 API_INTERFACE_PROPERTY_CACHED(Environment, EnvironmentImage, IBitmap::Ptr)
49 API_INTERFACE_PROPERTY_CACHED(Environment, EnvironmentMapLodLevel, float)
50 API_INTERFACE_PROPERTY_CACHED(Environment, EnvironmentRotation, BASE_NS::Math::Quat)
51 API_INTERFACE_PROPERTY_CACHED(Environment, AdditionalFactor, BASE_NS::Math::Vec4)
52 API_INTERFACE_PROPERTY_CACHED(Environment, ShaderHandle, uint64_t)
53
54 /**
55 * @brief Construct Environment instance from INode strong pointer.
56 * @param node the object pointed by interface is kept alive
57 */
58 explicit Environment(const INode::Ptr& node)
59 {
60 Initialize(interface_pointer_cast<META_NS::IObject>(node));
61 }
62
63 /**
64 * @brief Construct Environment instance from IEnvironment strong pointer.
65 * @param node the object pointed by interface is kept alive
66 */
67 explicit Environment(const IEnvironment::Ptr& node)
68 {
69 Initialize(interface_pointer_cast<META_NS::IObject>(node));
70 }
71 };
72 SCENE_END_NAMESPACE()
73
74 #endif // SCENEPLUGINAPI_ENVIRONMENT_H
75