• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SCENE_INTERFACE_IMESH_H
17 #define SCENE_INTERFACE_IMESH_H
18 
19 #include <scene/base/namespace.h>
20 #include <scene/base/types.h>
21 #include <scene/interface/intf_material.h>
22 
23 #include <meta/base/interface_macros.h>
24 
SCENE_BEGIN_NAMESPACE()25 SCENE_BEGIN_NAMESPACE()
26 
27 class ISubMesh : public CORE_NS::IInterface {
28     META_INTERFACE(CORE_NS::IInterface, ISubMesh, "89060424-5034-43e2-af6c-a7554b90c107")
29 public:
30     META_PROPERTY(IMaterial::Ptr, Material)
31     META_PROPERTY(BASE_NS::Math::Vec3, AABBMin)
32     META_PROPERTY(BASE_NS::Math::Vec3, AABBMax)
33 };
34 
35 class IMesh : public CORE_NS::IInterface {
36     META_INTERFACE(CORE_NS::IInterface, IMesh, "aab724a6-312d-4872-9ff2-b7bed8571b44")
37 public:
38     /**
39      * @brief Allows to override all submesh materials with a single material.
40      * @return Material that is used to override all submesh materials, if set.
41      */
42     META_PROPERTY(SCENE_NS::IMaterial::Ptr, MaterialOverride)
43     /**
44      * @brief Axis aligned bounding box min. Calculated using all submeshes.
45      * @return vector defining the min point.
46      */
47     META_READONLY_PROPERTY(BASE_NS::Math::Vec3, AABBMin)
48     /**
49      * @brief Axis aligned bounding box max. Calculated using all submeshes.
50      * @return vector defining the max point.
51      */
52     META_READONLY_PROPERTY(BASE_NS::Math::Vec3, AABBMax)
53 
54     virtual Future<BASE_NS::vector<ISubMesh::Ptr>> GetSubmeshes() const = 0;
55     virtual Future<bool> SetSubmeshes(const BASE_NS::vector<ISubMesh::Ptr>&) = 0;
56 };
57 
58 class IMeshAccess : public CORE_NS::IInterface {
59     META_INTERFACE(CORE_NS::IInterface, IMeshAccess, "63703b44-c1f5-437e-9d57-4248d1b69311")
60 public:
61     virtual Future<bool> SetMesh(const IMesh::Ptr&) = 0;
62     virtual Future<IMesh::Ptr> GetMesh() const = 0;
63 };
64 META_REGISTER_CLASS(MeshNode, "e0ad59e3-ef66-4b74-8a40-59b1584f14dd", META_NS::ObjectCategoryBits::NO_CATEGORY)
65 META_REGISTER_CLASS(SubMesh, "7f48b697-9fba-43da-8b15-f61fbbf2a925", META_NS::ObjectCategoryBits::NO_CATEGORY)
66 META_REGISTER_CLASS(Mesh, "8478fc2b-13fe-4b59-963a-370c04a94d15", META_NS::ObjectCategoryBits::NO_CATEGORY)
67 
68 SCENE_END_NAMESPACE()
69 
70 META_INTERFACE_TYPE(SCENE_NS::ISubMesh)
71 META_INTERFACE_TYPE(SCENE_NS::IMesh)
72 
73 #endif
74