18bf80f4bSopenharmony_ci/* 28bf80f4bSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 38bf80f4bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 48bf80f4bSopenharmony_ci * you may not use this file except in compliance with the License. 58bf80f4bSopenharmony_ci * You may obtain a copy of the License at 68bf80f4bSopenharmony_ci * 78bf80f4bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 88bf80f4bSopenharmony_ci * 98bf80f4bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 108bf80f4bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 118bf80f4bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 128bf80f4bSopenharmony_ci * See the License for the specific language governing permissions and 138bf80f4bSopenharmony_ci * limitations under the License. 148bf80f4bSopenharmony_ci */ 158bf80f4bSopenharmony_ci 168bf80f4bSopenharmony_ci#ifndef SCENE_HOLDER_H 178bf80f4bSopenharmony_ci#define SCENE_HOLDER_H 188bf80f4bSopenharmony_ci 198bf80f4bSopenharmony_ci#include <ComponentTools/component_query.h> 208bf80f4bSopenharmony_ci#include <scene_plugin/interface/intf_asset_manager.h> 218bf80f4bSopenharmony_ci#include <scene_plugin/interface/intf_bitmap.h> 228bf80f4bSopenharmony_ci#include <scene_plugin/interface/intf_ecs_scene.h> 238bf80f4bSopenharmony_ci#include <scene_plugin/interface/intf_entity_collection.h> 248bf80f4bSopenharmony_ci#include <scene_plugin/interface/intf_nodes.h> 258bf80f4bSopenharmony_ci#include <scene_plugin/interface/intf_scene.h> 268bf80f4bSopenharmony_ci 278bf80f4bSopenharmony_ci#include <3d/ecs/components/animation_component.h> 288bf80f4bSopenharmony_ci#include <3d/ecs/components/camera_component.h> 298bf80f4bSopenharmony_ci#include <3d/ecs/components/environment_component.h> 308bf80f4bSopenharmony_ci#include <3d/ecs/components/layer_component.h> 318bf80f4bSopenharmony_ci#include <3d/ecs/components/light_component.h> 328bf80f4bSopenharmony_ci#include <3d/ecs/components/material_component.h> 338bf80f4bSopenharmony_ci#include <3d/ecs/components/mesh_component.h> 348bf80f4bSopenharmony_ci#include <3d/ecs/components/name_component.h> 358bf80f4bSopenharmony_ci#include <3d/ecs/components/node_component.h> 368bf80f4bSopenharmony_ci#include <3d/ecs/components/render_handle_component.h> 378bf80f4bSopenharmony_ci#include <3d/ecs/components/render_mesh_component.h> 388bf80f4bSopenharmony_ci#include <3d/ecs/components/transform_component.h> 398bf80f4bSopenharmony_ci#include <3d/ecs/components/uri_component.h> 408bf80f4bSopenharmony_ci#include <3d/ecs/systems/intf_node_system.h> 418bf80f4bSopenharmony_ci#include <3d/gltf/gltf.h> 428bf80f4bSopenharmony_ci#include <3d/intf_graphics_context.h> 438bf80f4bSopenharmony_ci#include <3d/util/intf_picking.h> 448bf80f4bSopenharmony_ci#include <base/containers/string.h> 458bf80f4bSopenharmony_ci#include <base/util/uid.h> 468bf80f4bSopenharmony_ci#include <core/ecs/intf_ecs.h> 478bf80f4bSopenharmony_ci#include <core/intf_engine.h> 488bf80f4bSopenharmony_ci#include <render/intf_render_context.h> 498bf80f4bSopenharmony_ci 508bf80f4bSopenharmony_ci#include <meta/interface/intf_task_queue.h> 518bf80f4bSopenharmony_ci 528bf80f4bSopenharmony_ci#include "ecs_listener.h" 538bf80f4bSopenharmony_ci 548bf80f4bSopenharmony_ciclass SceneHolder { 558bf80f4bSopenharmony_cipublic: 568bf80f4bSopenharmony_ci using Ptr = BASE_NS::shared_ptr<SceneHolder>; 578bf80f4bSopenharmony_ci using WeakPtr = BASE_NS::weak_ptr<SceneHolder>; 588bf80f4bSopenharmony_ci 598bf80f4bSopenharmony_ci class ISceneInitialized : public META_NS::ICallable { 608bf80f4bSopenharmony_ci public: 618bf80f4bSopenharmony_ci constexpr static BASE_NS::Uid UID { "bd0405c7-bb97-4230-b893-1cd242909dd0" }; 628bf80f4bSopenharmony_ci using Ptr = BASE_NS::shared_ptr<ISceneInitialized>; 638bf80f4bSopenharmony_ci virtual void Invoke(const BASE_NS::string& rootId, const BASE_NS::string& cameraId) = 0; 648bf80f4bSopenharmony_ci using FunctionType = void(const BASE_NS::string& rootId, const BASE_NS::string& cameraId); 658bf80f4bSopenharmony_ci 668bf80f4bSopenharmony_ci protected: 678bf80f4bSopenharmony_ci friend Ptr; 688bf80f4bSopenharmony_ci META_NO_COPY_MOVE_INTERFACE(ISceneInitialized) 698bf80f4bSopenharmony_ci }; 708bf80f4bSopenharmony_ci 718bf80f4bSopenharmony_ci class ISceneLoaded : public META_NS::ICallable { 728bf80f4bSopenharmony_ci public: 738bf80f4bSopenharmony_ci constexpr static BASE_NS::Uid UID { "004304d0-63bf-4e63-928d-7349a337ec35" }; 748bf80f4bSopenharmony_ci using Ptr = BASE_NS::shared_ptr<ISceneLoaded>; 758bf80f4bSopenharmony_ci virtual void Invoke(uint32_t loadingStatus) = 0; 768bf80f4bSopenharmony_ci using FunctionType = void(uint32_t loadingStatus); 778bf80f4bSopenharmony_ci 788bf80f4bSopenharmony_ci protected: 798bf80f4bSopenharmony_ci friend Ptr; 808bf80f4bSopenharmony_ci META_NO_COPY_MOVE_INTERFACE(ISceneLoaded) 818bf80f4bSopenharmony_ci }; 828bf80f4bSopenharmony_ci 838bf80f4bSopenharmony_ci class ISceneUpdated : public META_NS::ICallable { 848bf80f4bSopenharmony_ci public: 858bf80f4bSopenharmony_ci constexpr static BASE_NS::Uid UID { "41cb396a-e628-43c3-a0eb-2fc7144674da" }; 868bf80f4bSopenharmony_ci using Ptr = BASE_NS::shared_ptr<ISceneUpdated>; 878bf80f4bSopenharmony_ci virtual void Invoke( 888bf80f4bSopenharmony_ci RENDER_NS::RenderHandleReference image, uint64_t handle, uint32_t width, uint32_t height) = 0; 898bf80f4bSopenharmony_ci using FunctionType = void( 908bf80f4bSopenharmony_ci RENDER_NS::RenderHandleReference image, uint64_t handle, uint32_t width, uint32_t height); 918bf80f4bSopenharmony_ci 928bf80f4bSopenharmony_ci protected: 938bf80f4bSopenharmony_ci friend Ptr; 948bf80f4bSopenharmony_ci META_NO_COPY_MOVE_INTERFACE(ISceneUpdated) 958bf80f4bSopenharmony_ci }; 968bf80f4bSopenharmony_ci 978bf80f4bSopenharmony_ci class ISceneUninitialized : public META_NS::ICallable { 988bf80f4bSopenharmony_ci public: 998bf80f4bSopenharmony_ci constexpr static BASE_NS::Uid UID { "99422a62-1963-4543-a17f-8539e5f58fb1" }; 1008bf80f4bSopenharmony_ci using Ptr = BASE_NS::shared_ptr<ISceneUninitialized>; 1018bf80f4bSopenharmony_ci // return false from task to stop, otherwise it will be called again after 1028bf80f4bSopenharmony_ci // the defined delay. 1038bf80f4bSopenharmony_ci virtual void Invoke() = 0; 1048bf80f4bSopenharmony_ci using FunctionType = void(); 1058bf80f4bSopenharmony_ci 1068bf80f4bSopenharmony_ci protected: 1078bf80f4bSopenharmony_ci friend Ptr; 1088bf80f4bSopenharmony_ci META_NO_COPY_MOVE_INTERFACE(ISceneUninitialized) 1098bf80f4bSopenharmony_ci }; 1108bf80f4bSopenharmony_ci 1118bf80f4bSopenharmony_ci SceneHolder(META_NS::InstanceId uid, META_NS::IObjectRegistry& registry, 1128bf80f4bSopenharmony_ci const BASE_NS::shared_ptr<RENDER_NS::IRenderContext>& gc, META_NS::ITaskQueue::Ptr appQueue, 1138bf80f4bSopenharmony_ci META_NS::ITaskQueue::Ptr engineQueue); 1148bf80f4bSopenharmony_ci virtual ~SceneHolder(); 1158bf80f4bSopenharmony_ci 1168bf80f4bSopenharmony_ci void Initialize(WeakPtr self); 1178bf80f4bSopenharmony_ci void Uninitialize(); 1188bf80f4bSopenharmony_ci 1198bf80f4bSopenharmony_ci void Load(const BASE_NS::string& uri); 1208bf80f4bSopenharmony_ci 1218bf80f4bSopenharmony_ci void SetRenderSize(uint32_t width, uint32_t height, uint64_t cameraHandle); 1228bf80f4bSopenharmony_ci void SetSystemGraphUri(const BASE_NS::string& uri); 1238bf80f4bSopenharmony_ci 1248bf80f4bSopenharmony_ci void SetCameraTarget( 1258bf80f4bSopenharmony_ci const SCENE_NS::ICamera::Ptr& camera, BASE_NS::Math::UVec2 size, RENDER_NS::RenderHandleReference ref); 1268bf80f4bSopenharmony_ci 1278bf80f4bSopenharmony_ci void SetInitializeCallback(ISceneInitialized::Ptr callback, WeakPtr self); 1288bf80f4bSopenharmony_ci void SetSceneLoadedCallback(ISceneLoaded::Ptr callback, WeakPtr self); 1298bf80f4bSopenharmony_ci void SetUninitializeCallback(ISceneUninitialized::Ptr callback, WeakPtr self); 1308bf80f4bSopenharmony_ci 1318bf80f4bSopenharmony_ci CORE_NS::IEcs::Ptr GetEcs(); 1328bf80f4bSopenharmony_ci 1338bf80f4bSopenharmony_ci void ChangeCamera(SCENE_NS::ICamera::Ptr camera); 1348bf80f4bSopenharmony_ci 1358bf80f4bSopenharmony_ci void SaveScene(const BASE_NS::string& fileName); 1368bf80f4bSopenharmony_ci 1378bf80f4bSopenharmony_ci META_NS::ITaskQueue::Token QueueEngineTask( 1388bf80f4bSopenharmony_ci const META_NS::ITaskQueue::CallableType::Ptr& task, bool runDeferred = true) 1398bf80f4bSopenharmony_ci { 1408bf80f4bSopenharmony_ci if (!isAsync_ && !runDeferred) { 1418bf80f4bSopenharmony_ci if (task->Invoke()) { 1428bf80f4bSopenharmony_ci // task requested async retry, give it 1438bf80f4bSopenharmony_ci return engineTaskQueue_->AddTask(task); 1448bf80f4bSopenharmony_ci } 1458bf80f4bSopenharmony_ci return META_NS::ITaskQueue::Token {}; 1468bf80f4bSopenharmony_ci } else { 1478bf80f4bSopenharmony_ci return engineTaskQueue_->AddTask(task); 1488bf80f4bSopenharmony_ci } 1498bf80f4bSopenharmony_ci } 1508bf80f4bSopenharmony_ci META_NS::ITaskQueue::Token QueueApplicationTask( 1518bf80f4bSopenharmony_ci const META_NS::ITaskQueue::CallableType::Ptr& task, bool runDeferred = true) 1528bf80f4bSopenharmony_ci { 1538bf80f4bSopenharmony_ci if (!isAsync_ && !runDeferred) { 1548bf80f4bSopenharmony_ci if (task->Invoke()) { 1558bf80f4bSopenharmony_ci return appTaskQueue_->AddTask(task); 1568bf80f4bSopenharmony_ci } 1578bf80f4bSopenharmony_ci return META_NS::ITaskQueue::Token {}; 1588bf80f4bSopenharmony_ci } else { 1598bf80f4bSopenharmony_ci return appTaskQueue_->AddTask(task); 1608bf80f4bSopenharmony_ci } 1618bf80f4bSopenharmony_ci } 1628bf80f4bSopenharmony_ci 1638bf80f4bSopenharmony_ci void SetOperationMode(bool async) 1648bf80f4bSopenharmony_ci { 1658bf80f4bSopenharmony_ci isAsync_ = async; 1668bf80f4bSopenharmony_ci } 1678bf80f4bSopenharmony_ci 1688bf80f4bSopenharmony_ci bool IsAsync() const 1698bf80f4bSopenharmony_ci { 1708bf80f4bSopenharmony_ci return isAsync_; 1718bf80f4bSopenharmony_ci } 1728bf80f4bSopenharmony_ci 1738bf80f4bSopenharmony_ci void CancelEngineTask(META_NS::ITaskQueue::Token token) 1748bf80f4bSopenharmony_ci { 1758bf80f4bSopenharmony_ci engineTaskQueue_->CancelTask(token); 1768bf80f4bSopenharmony_ci } 1778bf80f4bSopenharmony_ci 1788bf80f4bSopenharmony_ci void CancelAppTask(META_NS::ITaskQueue::Token token) 1798bf80f4bSopenharmony_ci { 1808bf80f4bSopenharmony_ci appTaskQueue_->CancelTask(token); 1818bf80f4bSopenharmony_ci } 1828bf80f4bSopenharmony_ci 1838bf80f4bSopenharmony_ci SCENE_NS::IEntityCollection* GetEntityCollection() 1848bf80f4bSopenharmony_ci { 1858bf80f4bSopenharmony_ci return scene_.get(); 1868bf80f4bSopenharmony_ci } 1878bf80f4bSopenharmony_ci 1888bf80f4bSopenharmony_ci SCENE_NS::IAssetManager* GetAssetManager() 1898bf80f4bSopenharmony_ci { 1908bf80f4bSopenharmony_ci return assetManager_.get(); 1918bf80f4bSopenharmony_ci } 1928bf80f4bSopenharmony_ci 1938bf80f4bSopenharmony_ci // Set Uri to load scene 1948bf80f4bSopenharmony_ci void LoadScene(const BASE_NS::string& uri); 1958bf80f4bSopenharmony_ci 1968bf80f4bSopenharmony_ci // Actual loading code, can take place through several paths 1978bf80f4bSopenharmony_ci void LoadScene(); 1988bf80f4bSopenharmony_ci 1998bf80f4bSopenharmony_ci // Run component queries for materials and meshes 2008bf80f4bSopenharmony_ci void IntrospectNodeless(); 2018bf80f4bSopenharmony_ci 2028bf80f4bSopenharmony_ci // Find animation entity based on name 2038bf80f4bSopenharmony_ci bool FindAnimation(const BASE_NS::string_view name, const BASE_NS::string_view fullPath, CORE_NS::Entity& entity); 2048bf80f4bSopenharmony_ci 2058bf80f4bSopenharmony_ci // Find material entity based on name 2068bf80f4bSopenharmony_ci bool FindMaterial(const BASE_NS::string_view name, const BASE_NS::string_view fullPath, CORE_NS::Entity& entity); 2078bf80f4bSopenharmony_ci 2088bf80f4bSopenharmony_ci // Find mesh entity based on name 2098bf80f4bSopenharmony_ci bool FindMesh(const BASE_NS::string_view name, const BASE_NS::string_view fullPath, CORE_NS::Entity& entity); 2108bf80f4bSopenharmony_ci 2118bf80f4bSopenharmony_ci // Find resource entity based on name using the scene-entity collection 2128bf80f4bSopenharmony_ci bool FindResource(const BASE_NS::string_view name, const BASE_NS::string_view fullPath, CORE_NS::Entity& entity); 2138bf80f4bSopenharmony_ci 2148bf80f4bSopenharmony_ci BASE_NS::shared_ptr<BASE_NS::vector<BASE_NS::string_view>> ListMaterialNames(); 2158bf80f4bSopenharmony_ci BASE_NS::shared_ptr<BASE_NS::vector<BASE_NS::string_view>> ListMeshNames(); 2168bf80f4bSopenharmony_ci 2178bf80f4bSopenharmony_ci // Find resource identifier based on entity 2188bf80f4bSopenharmony_ci BASE_NS::string GetResourceId(CORE_NS::Entity entity); 2198bf80f4bSopenharmony_ci 2208bf80f4bSopenharmony_ci // Set given mesh to target entity 2218bf80f4bSopenharmony_ci void SetMesh(CORE_NS::Entity targetEntity, CORE_NS::Entity mesh); 2228bf80f4bSopenharmony_ci 2238bf80f4bSopenharmony_ci // Read the name component of the mesh in the given entity 2248bf80f4bSopenharmony_ci BASE_NS::string_view GetMeshName(CORE_NS::Entity referringEntity); 2258bf80f4bSopenharmony_ci 2268bf80f4bSopenharmony_ci // Get Mesh entity from submesh 2278bf80f4bSopenharmony_ci CORE_NS::Entity GetMaterial(CORE_NS::Entity meshEntity, int64_t submeshIndex); 2288bf80f4bSopenharmony_ci 2298bf80f4bSopenharmony_ci // Resolve material name from submesh 2308bf80f4bSopenharmony_ci BASE_NS::string_view GetMaterialName(CORE_NS::Entity meshEntity, int64_t submeshIndex); 2318bf80f4bSopenharmony_ci 2328bf80f4bSopenharmony_ci // Assign material to the given entity 2338bf80f4bSopenharmony_ci void SetMaterial(CORE_NS::Entity targetEntity, CORE_NS::Entity material, int64_t submeshIndex = -1); 2348bf80f4bSopenharmony_ci 2358bf80f4bSopenharmony_ci // Prepares a bitmap for 3D use 2368bf80f4bSopenharmony_ci CORE_NS::EntityReference BindUIBitmap(SCENE_NS::IBitmap::Ptr bitmap, bool createNew); 2378bf80f4bSopenharmony_ci 2388bf80f4bSopenharmony_ci // Set submesh render sort order 2398bf80f4bSopenharmony_ci void SetSubmeshRenderSortOrder(CORE_NS::Entity meshEntity, int64_t submeshIndex, uint8_t value); 2408bf80f4bSopenharmony_ci 2418bf80f4bSopenharmony_ci // Set submesh aabb min 2428bf80f4bSopenharmony_ci void SetSubmeshAABBMin(CORE_NS::Entity targetEntity, int64_t submeshIndex, const BASE_NS::Math::Vec3& vec); 2438bf80f4bSopenharmony_ci 2448bf80f4bSopenharmony_ci // Set submesh aabb max 2458bf80f4bSopenharmony_ci void SetSubmeshAABBMax(CORE_NS::Entity targetEntity, int64_t submeshIndex, const BASE_NS::Math::Vec3& vec); 2468bf80f4bSopenharmony_ci 2478bf80f4bSopenharmony_ci // Remove submesh(es) 2488bf80f4bSopenharmony_ci void RemoveSubmesh(CORE_NS::Entity targetEntity, int64_t submeshIndex); 2498bf80f4bSopenharmony_ci 2508bf80f4bSopenharmony_ci // Set texture to a given index on texture array 2518bf80f4bSopenharmony_ci void SetTexture(size_t index, CORE_NS::Entity targetEntity, CORE_NS::EntityReference imageEntity); 2528bf80f4bSopenharmony_ci 2538bf80f4bSopenharmony_ci enum UriHandleType { 2548bf80f4bSopenharmony_ci HANDLE_TYPE_DO_NOT_CARE = 0, 2558bf80f4bSopenharmony_ci HANDLE_TYPE_SHADER, 2568bf80f4bSopenharmony_ci }; 2578bf80f4bSopenharmony_ci 2588bf80f4bSopenharmony_ci // Get handle for a shader 2598bf80f4bSopenharmony_ci BASE_NS::string GetHandleUri( 2608bf80f4bSopenharmony_ci RENDER_NS::RenderHandleReference renderHandleReference, UriHandleType type = HANDLE_TYPE_DO_NOT_CARE); 2618bf80f4bSopenharmony_ci 2628bf80f4bSopenharmony_ci // Set and get shader and graphics state to/from the given material 2638bf80f4bSopenharmony_ci enum ShaderType : uint8_t { MATERIAL_SHADER, DEPTH_SHADER }; 2648bf80f4bSopenharmony_ci void SetShader(CORE_NS::Entity materialEntity, ShaderType type, SCENE_NS::IShader::Ptr shader); 2658bf80f4bSopenharmony_ci void SetGraphicsState(CORE_NS::Entity materialEntity, ShaderType type, SCENE_NS::IGraphicsState::Ptr state); 2668bf80f4bSopenharmony_ci SCENE_NS::IShader::Ptr GetShader(CORE_NS::Entity materialEntity, ShaderType type); 2678bf80f4bSopenharmony_ci SCENE_NS::IGraphicsState::Ptr GetGraphicsState(CORE_NS::Entity materialEntity, ShaderType type); 2688bf80f4bSopenharmony_ci 2698bf80f4bSopenharmony_ci // for state raw access 2708bf80f4bSopenharmony_ci void SetGraphicsState(CORE_NS::Entity materialEntity, ShaderType type, const RENDER_NS::GraphicsState& state); 2718bf80f4bSopenharmony_ci bool GetGraphicsState( 2728bf80f4bSopenharmony_ci CORE_NS::Entity materialEntity, ShaderType type, const SCENE_NS::IShaderGraphicsState::Ptr& ret); 2738bf80f4bSopenharmony_ci 2748bf80f4bSopenharmony_ci // Get handle for a sampler 2758bf80f4bSopenharmony_ci CORE_NS::Entity LoadSampler(BASE_NS::string_view uri); 2768bf80f4bSopenharmony_ci 2778bf80f4bSopenharmony_ci // Get handle for a image 2788bf80f4bSopenharmony_ci CORE_NS::EntityReference LoadImage(BASE_NS::string_view uri, RENDER_NS::RenderHandleReference rh = {}); 2798bf80f4bSopenharmony_ci 2808bf80f4bSopenharmony_ci // Set (and create if needed) sampler to a given index on texture array 2818bf80f4bSopenharmony_ci void SetSampler(size_t index, CORE_NS::Entity targetEntity, SCENE_NS::ITextureInfo::SamplerId samplerId); 2828bf80f4bSopenharmony_ci 2838bf80f4bSopenharmony_ci // Enable evironment component on the entity. 2848bf80f4bSopenharmony_ci void EnableEnvironmentComponent(CORE_NS::Entity entity); 2858bf80f4bSopenharmony_ci 2868bf80f4bSopenharmony_ci // Enable layer component on the entity. This is called for every node that scene creates or binds 2878bf80f4bSopenharmony_ci void EnableLayerComponent(CORE_NS::Entity entity); 2888bf80f4bSopenharmony_ci 2898bf80f4bSopenharmony_ci // Enable light component on the entity. 2908bf80f4bSopenharmony_ci void EnableLightComponent(CORE_NS::Entity entity); 2918bf80f4bSopenharmony_ci 2928bf80f4bSopenharmony_ci // Enable canvas component on the entity. 2938bf80f4bSopenharmony_ci // Create new node 2948bf80f4bSopenharmony_ci CORE3D_NS::ISceneNode* CreateNode(const BASE_NS::string& name); 2958bf80f4bSopenharmony_ci CORE3D_NS::ISceneNode* CreateNode(const BASE_NS::string& path, const BASE_NS::string& name); 2968bf80f4bSopenharmony_ci 2978bf80f4bSopenharmony_ci // Create new material entity 2988bf80f4bSopenharmony_ci CORE_NS::Entity CreateMaterial(const BASE_NS::string& name); 2998bf80f4bSopenharmony_ci 3008bf80f4bSopenharmony_ci // Create new node with a camera component, by default no flag bits are set. 3018bf80f4bSopenharmony_ci CORE_NS::Entity CreateCamera(const BASE_NS::string& name, uint32_t flagBits); 3028bf80f4bSopenharmony_ci CORE_NS::Entity CreateCamera(const BASE_NS::string& path, const BASE_NS::string& name, uint32_t flagBits); 3038bf80f4bSopenharmony_ci 3048bf80f4bSopenharmony_ci CORE_NS::Entity CreatePostProcess(); 3058bf80f4bSopenharmony_ci CORE_NS::Entity CreateRenderConfiguration(); 3068bf80f4bSopenharmony_ci 3078bf80f4bSopenharmony_ci // Rename the entity name component 3088bf80f4bSopenharmony_ci void RenameEntity(CORE_NS::Entity entity, const BASE_NS::string& name); 3098bf80f4bSopenharmony_ci 3108bf80f4bSopenharmony_ci // Clone the entity, reference will be stored 3118bf80f4bSopenharmony_ci CORE_NS::Entity CloneEntity(CORE_NS::Entity entity, const BASE_NS::string& name, bool storeWithUniqueId); 3128bf80f4bSopenharmony_ci 3138bf80f4bSopenharmony_ci // Destroy entity 3148bf80f4bSopenharmony_ci void DestroyEntity(CORE_NS::Entity entity); 3158bf80f4bSopenharmony_ci 3168bf80f4bSopenharmony_ci void SetEntityActive(CORE_NS::Entity entity, bool active); 3178bf80f4bSopenharmony_ci 3188bf80f4bSopenharmony_ci // Find and re-parent node. Does not find nodeless entities 3198bf80f4bSopenharmony_ci const CORE3D_NS::ISceneNode* ReparentEntity(const BASE_NS::string& parentPath, const BASE_NS::string& name); 3208bf80f4bSopenharmony_ci 3218bf80f4bSopenharmony_ci bool ReparentEntity(CORE_NS::Entity entity, const BASE_NS::string& parentPath, size_t index); 3228bf80f4bSopenharmony_ci 3238bf80f4bSopenharmony_ci // Create mesh from raw data 3248bf80f4bSopenharmony_ci template<typename IndicesType> 3258bf80f4bSopenharmony_ci CORE_NS::Entity CreateMeshFromArrays(const BASE_NS::string& name, 3268bf80f4bSopenharmony_ci SCENE_NS::MeshGeometryArrayPtr<IndicesType> arrays, RENDER_NS::IndexType indexType, 3278bf80f4bSopenharmony_ci CORE_NS::Entity existingEntity = {}, bool append = false); 3288bf80f4bSopenharmony_ci 3298bf80f4bSopenharmony_ci void SetMultiviewCamera(CORE_NS::Entity target, CORE_NS::Entity source); 3308bf80f4bSopenharmony_ci void RemoveMultiviewCamera(CORE_NS::Entity target, CORE_NS::Entity source); 3318bf80f4bSopenharmony_ci 3328bf80f4bSopenharmony_ci // Copy submesh from another mesh entity 3338bf80f4bSopenharmony_ci void CopySubMesh(CORE_NS::Entity target, CORE_NS::Entity source, size_t index); 3348bf80f4bSopenharmony_ci 3358bf80f4bSopenharmony_ci // Create new multi-mesh batch 3368bf80f4bSopenharmony_ci CORE_NS::Entity CreateMultiMeshInstance(CORE_NS::Entity baseComponent); 3378bf80f4bSopenharmony_ci 3388bf80f4bSopenharmony_ci // Set mesh to multi-mesh 3398bf80f4bSopenharmony_ci void SetMeshMultimeshArray(CORE_NS::Entity target, CORE_NS::Entity mesh); 3408bf80f4bSopenharmony_ci 3418bf80f4bSopenharmony_ci // Set override material to multi-mesh 3428bf80f4bSopenharmony_ci BASE_NS::vector<CORE_NS::Entity> SetOverrideMaterialMultimeshArray( 3438bf80f4bSopenharmony_ci CORE_NS::Entity target, CORE_NS::Entity material); 3448bf80f4bSopenharmony_ci void ResetOverrideMaterialMultimeshArray(CORE_NS::Entity target, BASE_NS::vector<CORE_NS::Entity>& in); 3458bf80f4bSopenharmony_ci // Set instance count to multi-mesh 3468bf80f4bSopenharmony_ci void SetInstanceCountMultimeshArray(CORE_NS::Entity target, size_t count); 3478bf80f4bSopenharmony_ci 3488bf80f4bSopenharmony_ci // Set visible count to multi-mesh 3498bf80f4bSopenharmony_ci void SetVisibleCountMultimeshArray(CORE_NS::Entity target, size_t count); 3508bf80f4bSopenharmony_ci 3518bf80f4bSopenharmony_ci // Set custom data to multi-mesh index 3528bf80f4bSopenharmony_ci void SetCustomData(CORE_NS::Entity target, size_t index, const BASE_NS::Math::Vec4& data); 3538bf80f4bSopenharmony_ci 3548bf80f4bSopenharmony_ci // Set transformation to multi-mesh index 3558bf80f4bSopenharmony_ci void SetTransformation(CORE_NS::Entity target, size_t index, const BASE_NS::Math::Mat4X4& transform); 3568bf80f4bSopenharmony_ci 3578bf80f4bSopenharmony_ci // Reposition a node within its parent 3588bf80f4bSopenharmony_ci void ReindexEntity(CORE_NS::Entity target, size_t index); 3598bf80f4bSopenharmony_ci 3608bf80f4bSopenharmony_ci bool GetImageEntity(CORE_NS::Entity material, size_t index, CORE_NS::Entity& entity); 3618bf80f4bSopenharmony_ci bool SetEntityUri(const CORE_NS::Entity& entity, const BASE_NS::string& nameString); 3628bf80f4bSopenharmony_ci bool GetEntityUri(const CORE_NS::Entity& entity, BASE_NS::string& nameString); 3638bf80f4bSopenharmony_ci bool GetEntityName(const CORE_NS::Entity& entity, BASE_NS::string& nameString); 3648bf80f4bSopenharmony_ci bool GetImageHandle( 3658bf80f4bSopenharmony_ci const CORE_NS::Entity& entity, RENDER_NS::RenderHandleReference& handle, RENDER_NS::GpuImageDesc& desc); 3668bf80f4bSopenharmony_ci bool GetRenderHandleUri(const RENDER_NS::RenderHandle& handle, BASE_NS::string& uriString); 3678bf80f4bSopenharmony_ci void SetRenderHandle(const CORE_NS::Entity& target, const CORE_NS::Entity& source); 3688bf80f4bSopenharmony_ci 3698bf80f4bSopenharmony_ci CORE_NS::Entity GetEntityByUri(BASE_NS::string_view uriString); 3708bf80f4bSopenharmony_ci 3718bf80f4bSopenharmony_ci // Get common ECS listener to avoid overhead of all properties using their own 3728bf80f4bSopenharmony_ci BASE_NS::shared_ptr<SCENE_NS::EcsListener> GetCommonEcsListener() 3738bf80f4bSopenharmony_ci { 3748bf80f4bSopenharmony_ci return ecsListener_; 3758bf80f4bSopenharmony_ci } 3768bf80f4bSopenharmony_ci 3778bf80f4bSopenharmony_ci // Set a callback that fires when the ecs has been created, but not yet initialized. 3788bf80f4bSopenharmony_ci // Needs to be handled synchronously. Return value from callback is ignored currently. 3798bf80f4bSopenharmony_ci void SetEcsInitializationCallback( 3808bf80f4bSopenharmony_ci SCENE_NS::IEcsScene::IPrepareSceneForInitialization::WeakPtr ecsInitializationCallback) 3818bf80f4bSopenharmony_ci { 3828bf80f4bSopenharmony_ci ecsInitializationCallback_ = ecsInitializationCallback; 3838bf80f4bSopenharmony_ci } 3848bf80f4bSopenharmony_ci 3858bf80f4bSopenharmony_ci void ReleaseOwnership(CORE_NS::Entity entity); 3868bf80f4bSopenharmony_ci 3878bf80f4bSopenharmony_ci struct CameraData { 3888bf80f4bSopenharmony_ci using Ptr = BASE_NS::shared_ptr<CameraData>; 3898bf80f4bSopenharmony_ci static Ptr Create(const CORE_NS::Entity& entity) 3908bf80f4bSopenharmony_ci { 3918bf80f4bSopenharmony_ci return Ptr { new CameraData(entity) }; 3928bf80f4bSopenharmony_ci } 3938bf80f4bSopenharmony_ci explicit CameraData(const CORE_NS::Entity& cameraEntity) : entity(cameraEntity) {} 3948bf80f4bSopenharmony_ci CORE_NS::Entity entity; 3958bf80f4bSopenharmony_ci bool ownsColorImage = true; 3968bf80f4bSopenharmony_ci RENDER_NS::RenderHandleReference colorImage; 3978bf80f4bSopenharmony_ci RENDER_NS::RenderHandleReference depthImage; 3988bf80f4bSopenharmony_ci uint32_t width = 128; 3998bf80f4bSopenharmony_ci uint32_t height = 128; 4008bf80f4bSopenharmony_ci bool resized = true; 4018bf80f4bSopenharmony_ci bool updateTargets = true; 4028bf80f4bSopenharmony_ci }; 4038bf80f4bSopenharmony_ci 4048bf80f4bSopenharmony_ci void UpdateAttachments(SCENE_NS::IEcsObject::Ptr& ecsObject); 4058bf80f4bSopenharmony_ci void ResolveAnimations(); 4068bf80f4bSopenharmony_ci 4078bf80f4bSopenharmony_ci // Not particulally happy with this 4088bf80f4bSopenharmony_ci META_NS::IObjectRegistry& GetObjectRegistry() 4098bf80f4bSopenharmony_ci { 4108bf80f4bSopenharmony_ci return objectRegistry_; 4118bf80f4bSopenharmony_ci } 4128bf80f4bSopenharmony_ci 4138bf80f4bSopenharmony_ci CORE_NS::IFileManager* GetFileManager() 4148bf80f4bSopenharmony_ci { 4158bf80f4bSopenharmony_ci if (graphicsContext3D_) { 4168bf80f4bSopenharmony_ci auto& engine = graphicsContext3D_->GetRenderContext().GetEngine(); 4178bf80f4bSopenharmony_ci return &engine.GetFileManager(); 4188bf80f4bSopenharmony_ci } 4198bf80f4bSopenharmony_ci return nullptr; 4208bf80f4bSopenharmony_ci } 4218bf80f4bSopenharmony_ci 4228bf80f4bSopenharmony_ci SCENE_NS::IEcsAnimation::Ptr GetAnimation(const CORE_NS::Entity& entity) 4238bf80f4bSopenharmony_ci { 4248bf80f4bSopenharmony_ci if (auto animation = animations_.find(entity.id); animation != animations_.cend()) { 4258bf80f4bSopenharmony_ci return animation->second; 4268bf80f4bSopenharmony_ci } 4278bf80f4bSopenharmony_ci return SCENE_NS::IEcsAnimation::Ptr {}; 4288bf80f4bSopenharmony_ci } 4298bf80f4bSopenharmony_ci 4308bf80f4bSopenharmony_ci SCENE_NS::IEcsAnimation::Ptr GetAnimation(const BASE_NS::string& name) 4318bf80f4bSopenharmony_ci { 4328bf80f4bSopenharmony_ci for (auto& animation : animations_) { 4338bf80f4bSopenharmony_ci if (auto named = interface_pointer_cast<META_NS::INamed>(animation.second)) { 4348bf80f4bSopenharmony_ci if (META_NS::GetValue(named->Name()) == name) { 4358bf80f4bSopenharmony_ci return animation.second; 4368bf80f4bSopenharmony_ci } 4378bf80f4bSopenharmony_ci } 4388bf80f4bSopenharmony_ci } 4398bf80f4bSopenharmony_ci return SCENE_NS::IEcsAnimation::Ptr {}; 4408bf80f4bSopenharmony_ci } 4418bf80f4bSopenharmony_ci 4428bf80f4bSopenharmony_ci BASE_NS::vector<SCENE_NS::IEcsAnimation::Ptr> GetAnimations() const 4438bf80f4bSopenharmony_ci { 4448bf80f4bSopenharmony_ci BASE_NS::vector<SCENE_NS::IEcsAnimation::Ptr> res; 4458bf80f4bSopenharmony_ci for (auto& animation : animations_) { 4468bf80f4bSopenharmony_ci res.push_back(animation.second); 4478bf80f4bSopenharmony_ci } 4488bf80f4bSopenharmony_ci return res; 4498bf80f4bSopenharmony_ci } 4508bf80f4bSopenharmony_ci 4518bf80f4bSopenharmony_ci void SetRenderMode(uint8_t renderMode) 4528bf80f4bSopenharmony_ci { 4538bf80f4bSopenharmony_ci if (renderMode != renderMode_) { 4548bf80f4bSopenharmony_ci renderMode_ = (CORE_NS::IEcs::RenderMode)renderMode; 4558bf80f4bSopenharmony_ci if (ecs_) { 4568bf80f4bSopenharmony_ci ecs_->SetRenderMode(renderMode_); 4578bf80f4bSopenharmony_ci } 4588bf80f4bSopenharmony_ci } 4598bf80f4bSopenharmony_ci } 4608bf80f4bSopenharmony_ci 4618bf80f4bSopenharmony_ci bool GetWorldMatrixComponentAABB(SCENE_NS::IPickingResult::Ptr, CORE_NS::Entity entity, bool isRecursive); 4628bf80f4bSopenharmony_ci bool GetTransformComponentAABB(SCENE_NS::IPickingResult::Ptr, CORE_NS::Entity entity, bool isRecursive); 4638bf80f4bSopenharmony_ci bool GetWorldAABB(SCENE_NS::IPickingResult::Ptr, const BASE_NS::Math::Mat4X4& world, 4648bf80f4bSopenharmony_ci const BASE_NS::Math::Vec3& aabbMin, const BASE_NS::Math::Vec3& aabbMax); 4658bf80f4bSopenharmony_ci bool RayCast(SCENE_NS::IRayCastResult::Ptr, const BASE_NS::Math::Vec3& start, const BASE_NS::Math::Vec3& direction); 4668bf80f4bSopenharmony_ci bool RayCast(SCENE_NS::IRayCastResult::Ptr, const BASE_NS::Math::Vec3& start, const BASE_NS::Math::Vec3& direction, 4678bf80f4bSopenharmony_ci uint64_t layerMask); 4688bf80f4bSopenharmony_ci bool ScreenToWorld(SCENE_NS::IPickingResult::Ptr, CORE_NS::Entity camera, BASE_NS::Math::Vec3 screenCoordinate); 4698bf80f4bSopenharmony_ci 4708bf80f4bSopenharmony_ci bool WorldToScreen(SCENE_NS::IPickingResult::Ptr, CORE_NS::Entity camera, BASE_NS::Math::Vec3 worldCoordinate); 4718bf80f4bSopenharmony_ci 4728bf80f4bSopenharmony_ci bool RayCastFromCamera(SCENE_NS::IRayCastResult::Ptr, CORE_NS::Entity camera, const BASE_NS::Math::Vec2& screenPos); 4738bf80f4bSopenharmony_ci 4748bf80f4bSopenharmony_ci bool RayCastFromCamera(SCENE_NS::IRayCastResult::Ptr, CORE_NS::Entity camera, const BASE_NS::Math::Vec2& screenPos, 4758bf80f4bSopenharmony_ci uint64_t layerMask); 4768bf80f4bSopenharmony_ci 4778bf80f4bSopenharmony_ci bool RayFromCamera(SCENE_NS::IPickingResult::Ptr ret, CORE_NS::Entity camera, BASE_NS::Math::Vec2 screenCoordinate); 4788bf80f4bSopenharmony_ci 4798bf80f4bSopenharmony_ci void ProcessEvents(); 4808bf80f4bSopenharmony_ci 4818bf80f4bSopenharmony_ci void AddCamera(const CORE_NS::Entity& entity); 4828bf80f4bSopenharmony_ci void RemoveCamera(const CORE_NS::Entity& entity); 4838bf80f4bSopenharmony_ci 4848bf80f4bSopenharmony_ci void SetMainCamera(const CORE_NS::Entity& entity); 4858bf80f4bSopenharmony_ci 4868bf80f4bSopenharmony_ci void ActivateCamera(const CORE_NS::Entity& entity) const; 4878bf80f4bSopenharmony_ci void DeactivateCamera(const CORE_NS::Entity& cameraEntity) const; 4888bf80f4bSopenharmony_ci bool IsCameraActive(const CORE_NS::Entity& cameraEntity) const; 4898bf80f4bSopenharmony_ci 4908bf80f4bSopenharmony_ci BASE_NS::vector<CORE_NS::Entity> RenderCameras(); 4918bf80f4bSopenharmony_ci 4928bf80f4bSopenharmony_ciprivate: 4938bf80f4bSopenharmony_ci void RemoveUriComponentsFromMeshes(); 4948bf80f4bSopenharmony_ci 4958bf80f4bSopenharmony_ci bool InitializeScene(); 4968bf80f4bSopenharmony_ci bool UninitializeScene(); 4978bf80f4bSopenharmony_ci 4988bf80f4bSopenharmony_ci bool CreateDefaultEcs(); 4998bf80f4bSopenharmony_ci void SetDefaultCamera(); 5008bf80f4bSopenharmony_ci 5018bf80f4bSopenharmony_ci void UpdateViewportSize(uint32_t width, uint32_t height, uint64_t cameraHandle); 5028bf80f4bSopenharmony_ci 5038bf80f4bSopenharmony_ci void RecreateOutputTexture(CameraData::Ptr camera); 5048bf80f4bSopenharmony_ci bool UpdateCameraRenderTarget(CameraData::Ptr camera); 5058bf80f4bSopenharmony_ci 5068bf80f4bSopenharmony_ci void RequestReload(); 5078bf80f4bSopenharmony_ci void ResetScene(bool initialize = false); 5088bf80f4bSopenharmony_ci 5098bf80f4bSopenharmony_ci void SetSceneSystemGraph(const BASE_NS::string& uri); 5108bf80f4bSopenharmony_ci 5118bf80f4bSopenharmony_ci BASE_NS::string GetUniqueName(); 5128bf80f4bSopenharmony_ci 5138bf80f4bSopenharmony_ci bool IsMultiMeshChild(const CORE3D_NS::ISceneNode* child); 5148bf80f4bSopenharmony_ci 5158bf80f4bSopenharmony_ci CORE_NS::Entity FindCachedRelatedEntity(const CORE_NS::Entity& entity); 5168bf80f4bSopenharmony_ci 5178bf80f4bSopenharmony_ci BASE_NS::vector<CameraData::Ptr> cameras_; 5188bf80f4bSopenharmony_ci CameraData::Ptr mainCamera_ {}; 5198bf80f4bSopenharmony_ci 5208bf80f4bSopenharmony_ci // Data for Engine thread. 5218bf80f4bSopenharmony_ci META_NS::ITaskQueue::Token updateTaskToken_ {}; 5228bf80f4bSopenharmony_ci META_NS::ITaskQueue::Token redrawTaskToken_ {}; 5238bf80f4bSopenharmony_ci 5248bf80f4bSopenharmony_ci BASE_NS::shared_ptr<RENDER_NS::IRenderContext> renderContext_; 5258bf80f4bSopenharmony_ci CORE3D_NS::IGraphicsContext::Ptr graphicsContext3D_; 5268bf80f4bSopenharmony_ci CORE_NS::IEcs::Ptr ecs_; 5278bf80f4bSopenharmony_ci 5288bf80f4bSopenharmony_ci CORE_NS::Entity defaultCameraEntity_; 5298bf80f4bSopenharmony_ci 5308bf80f4bSopenharmony_ci CORE_NS::Entity sceneEntity_; 5318bf80f4bSopenharmony_ci 5328bf80f4bSopenharmony_ci CORE3D_NS::GLTFResourceData gltfResourceData_; 5338bf80f4bSopenharmony_ci 5348bf80f4bSopenharmony_ci CORE3D_NS::ISceneNode* rootNode_ { nullptr }; 5358bf80f4bSopenharmony_ci 5368bf80f4bSopenharmony_ci BASE_NS::unordered_map<uint64_t, bool> isReadyForNewFrame_; 5378bf80f4bSopenharmony_ci 5388bf80f4bSopenharmony_ci META_NS::InstanceId instanceId_; 5398bf80f4bSopenharmony_ci 5408bf80f4bSopenharmony_ci ISceneInitialized::Ptr sceneInitializedCallback_; 5418bf80f4bSopenharmony_ci ISceneLoaded::Ptr sceneLoadedCallback_; 5428bf80f4bSopenharmony_ci ISceneUpdated::Ptr sceneUpdatedCallback_; 5438bf80f4bSopenharmony_ci ISceneUninitialized::Ptr sceneUninitializedCallback_; 5448bf80f4bSopenharmony_ci SCENE_NS::IEcsScene::IPrepareSceneForInitialization::WeakPtr ecsInitializationCallback_; 5458bf80f4bSopenharmony_ci 5468bf80f4bSopenharmony_ci META_NS::ITaskQueue::Ptr appTaskQueue_; 5478bf80f4bSopenharmony_ci META_NS::ITaskQueue::Ptr engineTaskQueue_; 5488bf80f4bSopenharmony_ci 5498bf80f4bSopenharmony_ci SCENE_NS::IAssetManager::Ptr assetManager_ {}; 5508bf80f4bSopenharmony_ci SCENE_NS::IEntityCollection::Ptr scene_ {}; 5518bf80f4bSopenharmony_ci uint64_t instanceNumber_ = 0; 5528bf80f4bSopenharmony_ci 5538bf80f4bSopenharmony_ci BASE_NS::string sceneSystemGraphUri_ { "project://assets/config/system_graph.json" }; 5548bf80f4bSopenharmony_ci BASE_NS::string sceneUri_; 5558bf80f4bSopenharmony_ci META_NS::TimeSpan refreshInterval_ { META_NS::TimeSpan::Microseconds(16667) }; 5568bf80f4bSopenharmony_ci bool scenePrepared_ { false }; 5578bf80f4bSopenharmony_ci WeakPtr me_; 5588bf80f4bSopenharmony_ci 5598bf80f4bSopenharmony_ci BASE_NS::unique_ptr<CORE_NS::ComponentQuery> meshQuery_ {}; 5608bf80f4bSopenharmony_ci BASE_NS::unique_ptr<CORE_NS::ComponentQuery> materialQuery_ {}; 5618bf80f4bSopenharmony_ci BASE_NS::unique_ptr<CORE_NS::ComponentQuery> animationQuery_ {}; 5628bf80f4bSopenharmony_ci 5638bf80f4bSopenharmony_ci CORE3D_NS::IAnimationComponentManager* animationComponentManager_ {}; 5648bf80f4bSopenharmony_ci CORE3D_NS::ICameraComponentManager* cameraComponentManager_ {}; 5658bf80f4bSopenharmony_ci 5668bf80f4bSopenharmony_ci CORE3D_NS::IEnvironmentComponentManager* envComponentManager_ {}; 5678bf80f4bSopenharmony_ci CORE3D_NS::ILayerComponentManager* layerComponentManager_ {}; 5688bf80f4bSopenharmony_ci CORE3D_NS::ILightComponentManager* lightComponentManager_ {}; 5698bf80f4bSopenharmony_ci CORE3D_NS::IMaterialComponentManager* materialComponentManager_ {}; 5708bf80f4bSopenharmony_ci CORE3D_NS::IMeshComponentManager* meshComponentManager_ {}; 5718bf80f4bSopenharmony_ci CORE3D_NS::INameComponentManager* nameComponentManager_ {}; 5728bf80f4bSopenharmony_ci CORE3D_NS::INodeComponentManager* nodeComponentManager_ {}; 5738bf80f4bSopenharmony_ci CORE3D_NS::IRenderMeshComponentManager* renderMeshComponentManager_ {}; 5748bf80f4bSopenharmony_ci CORE3D_NS::IRenderHandleComponentManager* rhComponentManager_ {}; 5758bf80f4bSopenharmony_ci CORE3D_NS::ITransformComponentManager* transformComponentManager_ {}; 5768bf80f4bSopenharmony_ci CORE3D_NS::IUriComponentManager* uriComponentManager_ {}; 5778bf80f4bSopenharmony_ci 5788bf80f4bSopenharmony_ci // Not used regularly, perhaps we don't want to maintain the ptrs 5798bf80f4bSopenharmony_ci // CORE3D_NS::IRenderConfigurationComponentManager* rcComponentManager_{}; 5808bf80f4bSopenharmony_ci 5818bf80f4bSopenharmony_ci CORE3D_NS::INodeSystem* nodeSystem_ {}; 5828bf80f4bSopenharmony_ci BASE_NS::shared_ptr<SCENE_NS::EcsListener> ecsListener_; 5838bf80f4bSopenharmony_ci 5848bf80f4bSopenharmony_ci BASE_NS::unordered_map<uint64_t, SCENE_NS::IEcsAnimation::Ptr> animations_; 5858bf80f4bSopenharmony_ci 5868bf80f4bSopenharmony_ci META_NS::IObjectRegistry& objectRegistry_; 5878bf80f4bSopenharmony_ci 5888bf80f4bSopenharmony_ci bool isAsync_ { false }; 5898bf80f4bSopenharmony_ci bool reloadPending_ { false }; // this may occur if switching between sync and async modes on fly 5908bf80f4bSopenharmony_ci bool loadSceneFailed_ { false }; // a corner case where request to reload a scene takes place before initialization 5918bf80f4bSopenharmony_ci CORE_NS::IEcs::RenderMode renderMode_ { CORE_NS::IEcs::RENDER_IF_DIRTY }; 5928bf80f4bSopenharmony_ci 5938bf80f4bSopenharmony_ci CORE3D_NS::IPicking* picking_ { nullptr }; 5948bf80f4bSopenharmony_ci 5958bf80f4bSopenharmony_ci bool isRunningFrame_ { false }; 5968bf80f4bSopenharmony_ci bool requiresEventProcessing_ { false }; 5978bf80f4bSopenharmony_ci 5988bf80f4bSopenharmony_ci uint64_t firstTime_ { ~0u }; 5998bf80f4bSopenharmony_ci uint64_t previousFrameTime_ { ~0u }; 6008bf80f4bSopenharmony_ci uint64_t deltaTime_ { 1 }; 6018bf80f4bSopenharmony_ci}; 6028bf80f4bSopenharmony_ci 6038bf80f4bSopenharmony_cistatic constexpr BASE_NS::string_view MULTI_MESH_CHILD_PREFIX("multi_mesh_child"); 6048bf80f4bSopenharmony_ci 6058bf80f4bSopenharmony_ciMETA_TYPE(SceneHolder::Ptr); 6068bf80f4bSopenharmony_ciMETA_TYPE(SceneHolder::WeakPtr); 6078bf80f4bSopenharmony_ci 6088bf80f4bSopenharmony_ci#endif 609