2 * Copyright(c) 2019 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.
17 using System.ComponentModel;
18 using System.Runtime.InteropServices;
23 /// TextureSet is a handle to an object that specifies the set of images used as textures by a renderer.<br />
24 /// The images have to be ordered in the same order they are declared in the shader.
26 /// <since_tizen> 3 </since_tizen>
27 public class TextureSet : BaseHandle
31 /// Create an instance of TextureSet.
33 /// <since_tizen> 3 </since_tizen>
34 public TextureSet() : this(Interop.TextureSet.New(), true)
36 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39 internal TextureSet(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
44 /// Sets the texture at position "index".
46 /// <param name="index">The position in the texture set of the texture.</param>
47 /// <param name="texture">The texture.</param>
48 /// <since_tizen> 3 </since_tizen>
49 public void SetTexture(uint index, Texture texture)
51 Interop.TextureSet.SetTexture(SwigCPtr, index, Texture.getCPtr(texture));
52 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
56 /// Gets the image at position "index".
58 /// <param name="index">The position in the texture set of the image.</param>
59 /// <returns>A handle to the image at the specified position.</returns>
60 /// <since_tizen> 3 </since_tizen>
61 public Texture GetTexture(uint index)
63 global::System.IntPtr cPtr = Interop.TextureSet.GetTexture(SwigCPtr, index);
64 Texture ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Texture;
67 Interop.BaseHandle.DeleteBaseHandle(new global::System.Runtime.InteropServices.HandleRef(this, cPtr));
71 ret = new Texture(cPtr, true);
73 NDalicPINVOKE.ThrowExceptionIfExists();
78 /// Sets the sampler to be used by the image at position "index".
80 /// <param name="index">The position in the texture set of the image.</param>
81 /// <param name="sampler">The sampler to use.</param>
82 /// <since_tizen> 3 </since_tizen>
83 public void SetSampler(uint index, Sampler sampler)
85 Interop.TextureSet.SetSampler(SwigCPtr, index, Sampler.getCPtr(sampler));
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 /// Sets the sampler to be used by the image at position "index".
92 /// <param name="index">The position in the texture set of the image.</param>
93 /// <returns>A handle to the sampler at the specified position.</returns>
94 /// <since_tizen> 3 </since_tizen>
95 public Sampler GetSampler(uint index)
97 global::System.IntPtr cPtr = Interop.TextureSet.GetSampler(SwigCPtr, index);
98 Sampler ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Sampler;
101 Interop.BaseHandle.DeleteBaseHandle(new global::System.Runtime.InteropServices.HandleRef(this, cPtr));
105 ret = new Sampler(cPtr, true);
107 NDalicPINVOKE.ThrowExceptionIfExists();
112 /// Gets the number of textures present in the TextureSet.
114 /// <returns>The number of textures in the TextureSet.</returns>
115 /// <since_tizen> 3 </since_tizen>
116 public uint GetTextureCount()
118 uint ret = Interop.TextureSet.GetTextureCount(SwigCPtr);
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 /// This will not be public opened.
124 [EditorBrowsable(EditorBrowsableState.Never)]
125 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
127 Interop.TextureSet.DeleteTextureSet(swigCPtr);