1 /* 2 * Copyright (c) 2022 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_MODEL_MODEL_VIEW_NG_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_MODEL_MODEL_VIEW_NG_H 18 19 #include "core/components_ng/pattern/model/model_light.h" 20 #include "core/components_ng/pattern/model/model_paint_property.h" 21 #include "core/components_ng/pattern/model/model_position.h" 22 #include "core/components_ng/pattern/model/model_view.h" 23 24 namespace OHOS::Ace::NG { 25 26 class ACE_EXPORT ModelViewNG : public ModelView { 27 public: 28 void Create(const ModelViewContext& context) override; 29 void SetBackground(const std::string& value) override; 30 void SetModelSource(const std::string& value) override; 31 void SetHandleCameraMove(bool value) override; 32 void AddCustomRender(const std::shared_ptr<Render3D::CustomRenderDescriptor>& customRender) override; 33 void SetRenderWidth(Dimension& width) override; 34 void SetRenderHeight(Dimension& height) override; 35 void SetRenderFrameRate(float rate) override; 36 void SetShader(const std::string& path) override; 37 void AddShaderImageTexture(const std::string& path) override; 38 void AddShaderInputBuffer(const std::shared_ptr<Render3D::ShaderInputBuffer>& buffer) override; 39 std::optional<std::shared_ptr<Render3D::ShaderInputBuffer>> GetShaderInputBuffer() override; 40 41 static void AddShaderInputBuffer(FrameNode* frameNode, const std::shared_ptr<Render3D::ShaderInputBuffer>& buffer); 42 private: 43 // Camera and lights animations are done from the frontend with Animatable types. 44 WeakPtr<FrameNode> frameNode_; 45 ModelPosition cameraPosition_; 46 std::vector<RefPtr<ModelLight>> lights_; 47 }; 48 49 } // namespace OHOS::Ace::NG 50 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_MODEL_MODEL_VIEW_NG_H 51