• 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_SRC_MESH_SUBMESH_H
17 #define SCENE_SRC_MESH_SUBMESH_H
18 
19 #include <scene/interface/intf_mesh.h>
20 #include <scene/interface/intf_shader.h>
21 
22 #include <meta/ext/implementation_macros.h>
23 #include <meta/ext/object.h>
24 
25 #include "../component/mesh_component.h"
26 
SCENE_BEGIN_NAMESPACE()27 SCENE_BEGIN_NAMESPACE()
28 
29 
30 class SubMesh : public META_NS::IntroduceInterfaces<META_NS::MetaObject, ISubMesh, IInternalSubMesh, META_NS::INamed> {
31     META_OBJECT(SubMesh, ClassId::SubMesh, IntroduceInterfaces)
32 
33 public:
34     META_BEGIN_STATIC_DATA()
35     META_STATIC_PROPERTY_DATA(META_NS::INamed, BASE_NS::string, Name)
36     META_STATIC_PROPERTY_DATA(ISubMesh, IMaterial::Ptr, Material)
37     META_STATIC_PROPERTY_DATA(ISubMesh, BASE_NS::Math::Vec3, AABBMin)
38     META_STATIC_PROPERTY_DATA(ISubMesh, BASE_NS::Math::Vec3, AABBMax)
39     META_END_STATIC_DATA()
40 
41     META_IMPLEMENT_PROPERTY(BASE_NS::string, Name)
42     META_IMPLEMENT_PROPERTY(IMaterial::Ptr, Material)
43     META_IMPLEMENT_PROPERTY(BASE_NS::Math::Vec3, AABBMin)
44     META_IMPLEMENT_PROPERTY(BASE_NS::Math::Vec3, AABBMax)
45 
46     BASE_NS::string GetName() const override;
47 
48     CORE3D_NS::MeshComponent::Submesh GetSubMesh() const override;
49     bool SetSubMesh(IEcsContext&, const CORE3D_NS::MeshComponent::Submesh&) override;
50 
51 private:
52     mutable CORE3D_NS::MeshComponent::Submesh submesh_;
53 };
54 
55 SCENE_END_NAMESPACE()
56 
57 #endif