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 #include "render_data_store_morph.h" 17 18 #include <cstdint> 19 20 #include <3d/render/intf_render_data_store_morph.h> 21 #include <base/containers/array_view.h> 22 #include <render/resource_handle.h> 23 24 CORE3D_BEGIN_NAMESPACE() 25 using namespace BASE_NS; 26 using namespace RENDER_NS; 27 RenderDataStoreMorph(const string_view name)28RenderDataStoreMorph::RenderDataStoreMorph(const string_view name) : name_(name) {} 29 Init(const IRenderDataStoreMorph::ReserveSize & reserveSize)30void RenderDataStoreMorph::Init(const IRenderDataStoreMorph::ReserveSize& reserveSize) 31 { 32 submeshes_.reserve(reserveSize.submeshCount); 33 } 34 PostRender()35void RenderDataStoreMorph::PostRender() 36 { 37 Clear(); 38 } 39 Clear()40void RenderDataStoreMorph::Clear() 41 { 42 submeshes_.clear(); 43 } 44 AddSubmesh(const RenderDataMorph::Submesh & submesh)45void RenderDataStoreMorph::AddSubmesh(const RenderDataMorph::Submesh& submesh) 46 { 47 submeshes_.push_back(submesh); 48 } 49 GetSubmeshes() const50array_view<const RenderDataMorph::Submesh> RenderDataStoreMorph::GetSubmeshes() const 51 { 52 return submeshes_; 53 } 54 55 // for plugin / factory interface Create(RENDER_NS::IRenderContext &,char const * name)56RENDER_NS::IRenderDataStore* RenderDataStoreMorph::Create(RENDER_NS::IRenderContext&, char const* name) 57 { 58 return new RenderDataStoreMorph(name); 59 } 60 Destroy(IRenderDataStore * instance)61void RenderDataStoreMorph::Destroy(IRenderDataStore* instance) 62 { 63 delete static_cast<RenderDataStoreMorph*>(instance); 64 } 65 CORE3D_END_NAMESPACE() 66