2 * Copyright (c) 2020 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.
19 #include <dali/public-api/rendering/texture-set.h> // Dali::TextureSet
22 #include <dali/internal/event/rendering/sampler-impl.h> // Dali::Internal::Sampler
23 #include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
24 #include <dali/internal/event/rendering/texture-set-impl.h> // Dali::Internal::TextureSet
28 TextureSet TextureSet::New()
30 Internal::TextureSetPtr textureSet = Internal::TextureSet::New();
31 return TextureSet(textureSet.Get());
34 TextureSet::TextureSet()
38 TextureSet::~TextureSet()
42 TextureSet::TextureSet(const TextureSet& handle) = default;
44 TextureSet TextureSet::DownCast(BaseHandle handle)
46 return TextureSet(dynamic_cast<Dali::Internal::TextureSet*>(handle.GetObjectPtr()));
49 TextureSet& TextureSet::operator=(const TextureSet& handle) = default;
51 TextureSet::TextureSet(TextureSet&& rhs) = default;
53 TextureSet& TextureSet::operator=(TextureSet&& rhs) = default;
55 void TextureSet::SetTexture(size_t index, Texture texture)
59 Internal::TexturePtr texturePtr(&GetImplementation(texture));
60 GetImplementation(*this).SetTexture(static_cast<uint32_t>(index), texturePtr); // only support 4,294,967,295 textures
64 GetImplementation(*this).SetTexture(static_cast<uint32_t>(index), nullptr); // only support 4,294,967,295 textures
68 Texture TextureSet::GetTexture(size_t index) const
70 Internal::Texture* texturePtr = GetImplementation(*this).GetTexture(static_cast<uint32_t>(index)); // only support 4,294,967,295 textures
71 return Dali::Texture(texturePtr);
74 void TextureSet::SetSampler(size_t index, Sampler sampler)
78 Internal::SamplerPtr samplerPtr(&GetImplementation(sampler));
79 GetImplementation(*this).SetSampler(static_cast<uint32_t>(index), samplerPtr); // only support 4,294,967,295 samplers
83 GetImplementation(*this).SetSampler(static_cast<uint32_t>(index), nullptr); // only support 4,294,967,295 samplers
87 Sampler TextureSet::GetSampler(size_t index) const
89 Internal::Sampler* samplerPtr = GetImplementation(*this).GetSampler(static_cast<uint32_t>(index)); // only support 4,294,967,295 samplers
90 return Dali::Sampler(samplerPtr);
93 size_t TextureSet::GetTextureCount() const
95 return GetImplementation(*this).GetTextureCount();
98 TextureSet::TextureSet(Internal::TextureSet* pointer)