2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <dali/internal/update/common/uniform-map.h>
28 void UniformMap::MappingChanged()
33 void UniformMap::Add(UniformPropertyMapping newMap)
35 auto iter = std::find_if(mUniformMaps.Begin(),
37 [&](auto& element) { return element.uniformName == newMap.uniformName; });
39 if(iter != mUniformMaps.End())
41 // Mapping already exists - update it.
42 (*iter).propertyPtr = newMap.propertyPtr;
47 mUniformMaps.PushBack(newMap);
53 void UniformMap::Remove(ConstString uniformName)
55 auto iter = std::find_if(mUniformMaps.Begin(),
57 [&](auto& element) { return element.uniformName == uniformName; });
59 if(iter != mUniformMaps.End())
61 mUniformMaps.Erase(iter);
66 const PropertyInputImpl* UniformMap::Find(ConstString uniformName)
68 auto iter = std::find_if(mUniformMaps.Begin(),
70 [&](auto& element) { return element.uniformName == uniformName; });
72 return (iter != mUniformMaps.End()) ? (*iter).propertyPtr : nullptr;
75 UniformMap::SizeType UniformMap::Count() const
77 return static_cast<UniformMap::SizeType>(mUniformMaps.Count());
80 const UniformPropertyMapping& UniformMap::operator[](UniformMap::SizeType index) const
82 return mUniformMaps[index];
85 } // namespace SceneGraph
86 } // namespace Internal