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 #if !defined(INITIAL_TRANSFORM_COMPONENT) || defined(IMPLEMENT_MANAGER) 17 #define INITIAL_TRANSFORM_COMPONENT 18 19 #if !defined(IMPLEMENT_MANAGER) 20 #include <3d/namespace.h> 21 #include <base/containers/vector.h> 22 #include <base/math/quaternion.h> 23 #include <base/math/vector.h> 24 #include <core/ecs/component_struct_macros.h> 25 #include <core/ecs/intf_component_manager.h> 26 #include <core/property/property.h> 27 28 CORE3D_BEGIN_NAMESPACE() 29 #endif 30 BEGIN_COMPONENT(IInitialTransformComponentManager, InitialTransformComponent) 31 #if !defined(IMPLEMENT_MANAGER) 32 union Data { 33 float floatValue; 34 35 BASE_NS::Math::Vec2 vec2Value; 36 BASE_NS::Math::Vec3 vec3Value; 37 BASE_NS::Math::Vec4 vec4Value; 38 39 BASE_NS::Math::Quat quatValue; 40 41 BASE_NS::vector<float> floatVectorValue; 42 #if _MSC_VER 43 #pragma warning(push) 44 #pragma warning(disable : 4583) // 'floatVectorValue': destructor is not implicitly called 45 #endif ~Data()46 ~Data() {}; 47 #if _MSC_VER 48 #pragma warning(pop) 49 #endif 50 }; 51 52 ~InitialTransformComponent(); 53 54 InitialTransformComponent(); 55 56 explicit InitialTransformComponent(float value); 57 explicit InitialTransformComponent(BASE_NS::Math::Vec2 value); 58 explicit InitialTransformComponent(BASE_NS::Math::Vec3 value); 59 explicit InitialTransformComponent(BASE_NS::Math::Vec4 value); 60 explicit InitialTransformComponent(BASE_NS::Math::Quat value); 61 explicit InitialTransformComponent(BASE_NS::array_view<const float> value); 62 63 InitialTransformComponent(const InitialTransformComponent& other) noexcept; 64 InitialTransformComponent(InitialTransformComponent && other) noexcept; 65 66 InitialTransformComponent& operator=(const InitialTransformComponent& other) noexcept; 67 InitialTransformComponent& operator=(InitialTransformComponent&& other) noexcept; 68 69 InitialTransformComponent& operator=(float value) noexcept; 70 InitialTransformComponent& operator=(BASE_NS::Math::Vec2 value) noexcept; 71 InitialTransformComponent& operator=(BASE_NS::Math::Vec3 value) noexcept; 72 InitialTransformComponent& operator=(BASE_NS::Math::Vec4 value) noexcept; 73 InitialTransformComponent& operator=(BASE_NS::Math::Quat value) noexcept; 74 InitialTransformComponent& operator=(BASE_NS::array_view<const float> value) noexcept; 75 #endif 76 DEFINE_PROPERTY(uint64_t, type, "Type Of Data", 77 CORE_NS::PropertyFlags::IS_HIDDEN | CORE_NS::PropertyFlags::NO_SERIALIZE | CORE_NS::PropertyFlags::IS_READONLY, 78 VALUE(0)) 79 DEFINE_PROPERTY(Data, initialData, "Initial Data", 80 CORE_NS::PropertyFlags::IS_HIDDEN | CORE_NS::PropertyFlags::NO_SERIALIZE | 81 CORE_NS::PropertyFlags::IS_READONLY, ) 82 END_COMPONENT(IInitialTransformComponentManager, InitialTransformComponent, "3949c596-435b-4210-8a90-c8976c7168a4") 83 #if !defined(IMPLEMENT_MANAGER) 84 CORE3D_END_NAMESPACE() 85 #endif 86 87 #endif