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 OHOS_RENDER_3D_NODE_IMPL_H 178bf80f4bSopenharmony_ci#define OHOS_RENDER_3D_NODE_IMPL_H 188bf80f4bSopenharmony_ci#include <meta/interface/intf_object.h> 198bf80f4bSopenharmony_ci 208bf80f4bSopenharmony_ci#include "QuatProxy.h" 218bf80f4bSopenharmony_ci#include "SceneResourceImpl.h" 228bf80f4bSopenharmony_ci#include "Vec3Proxy.h" 238bf80f4bSopenharmony_ciclass NodeImpl : public SceneResourceImpl { 248bf80f4bSopenharmony_cipublic: 258bf80f4bSopenharmony_ci static constexpr uint32_t ID = 2; 268bf80f4bSopenharmony_ci enum NodeType { NODE = 1, GEOMETRY = 2, CAMERA = 3, LIGHT = 4 }; 278bf80f4bSopenharmony_ci 288bf80f4bSopenharmony_ci static void RegisterEnums(NapiApi::Object exports); 298bf80f4bSopenharmony_ci 308bf80f4bSopenharmony_ciprotected: 318bf80f4bSopenharmony_ci static void GetPropertyDescs(BASE_NS::vector<napi_property_descriptor>& props); 328bf80f4bSopenharmony_ci NodeImpl(NodeType type); 338bf80f4bSopenharmony_ci virtual ~NodeImpl(); 348bf80f4bSopenharmony_ci 358bf80f4bSopenharmony_ci void* GetInstanceImpl(uint32_t id); 368bf80f4bSopenharmony_ci napi_value GetNodeType(NapiApi::FunctionContext<>& fc); 378bf80f4bSopenharmony_ci 388bf80f4bSopenharmony_ci napi_value GetPosition(NapiApi::FunctionContext<>& fc); 398bf80f4bSopenharmony_ci void SetPosition(NapiApi::FunctionContext<NapiApi::Object>& fc); 408bf80f4bSopenharmony_ci 418bf80f4bSopenharmony_ci napi_value GetScale(NapiApi::FunctionContext<>& fc); 428bf80f4bSopenharmony_ci void SetScale(NapiApi::FunctionContext<NapiApi::Object>& fc); 438bf80f4bSopenharmony_ci 448bf80f4bSopenharmony_ci napi_value GetRotation(NapiApi::FunctionContext<>& fc); 458bf80f4bSopenharmony_ci void SetRotation(NapiApi::FunctionContext<NapiApi::Object>& fc); 468bf80f4bSopenharmony_ci 478bf80f4bSopenharmony_ci napi_value GetPath(NapiApi::FunctionContext<>& ctx); 488bf80f4bSopenharmony_ci napi_value GetParent(NapiApi::FunctionContext<>& ctx); 498bf80f4bSopenharmony_ci 508bf80f4bSopenharmony_ci napi_value GetNodeByPath(NapiApi::FunctionContext<BASE_NS::string>& ctx); 518bf80f4bSopenharmony_ci 528bf80f4bSopenharmony_ci napi_value GetChildContainer(NapiApi::FunctionContext<>& fc); // returns a container object. 538bf80f4bSopenharmony_ci 548bf80f4bSopenharmony_ci napi_value GetVisible(NapiApi::FunctionContext<>& ctx); 558bf80f4bSopenharmony_ci void SetVisible(NapiApi::FunctionContext<bool>& ctx); 568bf80f4bSopenharmony_ci 578bf80f4bSopenharmony_ci napi_value GetLayerMask(NapiApi::FunctionContext<>& ctx); 588bf80f4bSopenharmony_ci 598bf80f4bSopenharmony_ci napi_value Dispose(NapiApi::FunctionContext<>& ctx); 608bf80f4bSopenharmony_ci 618bf80f4bSopenharmony_ci napi_value GetLayerMaskEnabled(NapiApi::FunctionContext<uint32_t>& ctx); 628bf80f4bSopenharmony_ci napi_value SetLayerMaskEnabled(NapiApi::FunctionContext<uint32_t, bool>& ctx); 638bf80f4bSopenharmony_ci 648bf80f4bSopenharmony_ci napi_value GetCount(NapiApi::FunctionContext<>& ctx); 658bf80f4bSopenharmony_ci napi_value GetChild(NapiApi::FunctionContext<uint32_t>& ctx); 668bf80f4bSopenharmony_ci 678bf80f4bSopenharmony_ci napi_value ClearChildren(NapiApi::FunctionContext<>& ctx); 688bf80f4bSopenharmony_ci napi_value InsertChildAfter(NapiApi::FunctionContext<NapiApi::Object, NapiApi::Object>& ctx); 698bf80f4bSopenharmony_ci napi_value AppendChild(NapiApi::FunctionContext<NapiApi::Object>& ctx); 708bf80f4bSopenharmony_ci napi_value RemoveChild(NapiApi::FunctionContext<NapiApi::Object>& ctx); 718bf80f4bSopenharmony_ci void ResetNativeObj(NapiApi::FunctionContext<>& ctx, NapiApi::Object& obj); 728bf80f4bSopenharmony_ci 738bf80f4bSopenharmony_ciprivate: 748bf80f4bSopenharmony_ci NodeType type_; 758bf80f4bSopenharmony_ci BASE_NS::unique_ptr<Vec3Proxy> posProxy_ { nullptr }; 768bf80f4bSopenharmony_ci BASE_NS::unique_ptr<Vec3Proxy> sclProxy_ { nullptr }; 778bf80f4bSopenharmony_ci BASE_NS::unique_ptr<QuatProxy> rotProxy_ { nullptr }; 788bf80f4bSopenharmony_ci}; 798bf80f4bSopenharmony_ci#endif // OHOS_RENDER_3D_NODE_IMPL_H