-
Notifications
You must be signed in to change notification settings - Fork 241
/
TextureSet.cs
executable file
·130 lines (121 loc) · 5.1 KB
/
TextureSet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* Copyright(c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace Tizen.NUI
{
/// <summary>
/// TextureSet is a handle to an object that specifies the set of images used as textures by a renderer.<br />
/// The images have to be ordered in the same order they are declared in the shader.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class TextureSet : BaseHandle
{
/// <summary>
/// Create an instance of TextureSet.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public TextureSet() : this(Interop.TextureSet.New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal TextureSet(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
}
/// <summary>
/// Sets the texture at position "index".
/// </summary>
/// <param name="index">The position in the texture set of the texture.</param>
/// <param name="texture">The texture.</param>
/// <since_tizen> 3 </since_tizen>
public void SetTexture(uint index, Texture texture)
{
Interop.TextureSet.SetTexture(SwigCPtr, index, Texture.getCPtr(texture));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Gets the image at position "index".
/// </summary>
/// <param name="index">The position in the texture set of the image.</param>
/// <returns>A handle to the image at the specified position.</returns>
/// <since_tizen> 3 </since_tizen>
public Texture GetTexture(uint index)
{
global::System.IntPtr cPtr = Interop.TextureSet.GetTexture(SwigCPtr, index);
Texture ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Texture;
if (ret != null)
{
Interop.BaseHandle.DeleteBaseHandle(new global::System.Runtime.InteropServices.HandleRef(this, cPtr));
}
else
{
ret = new Texture(cPtr, true);
}
NDalicPINVOKE.ThrowExceptionIfExists();
return ret;
}
/// <summary>
/// Sets the sampler to be used by the image at position "index".
/// </summary>
/// <param name="index">The position in the texture set of the image.</param>
/// <param name="sampler">The sampler to use.</param>
/// <since_tizen> 3 </since_tizen>
public void SetSampler(uint index, Sampler sampler)
{
Interop.TextureSet.SetSampler(SwigCPtr, index, Sampler.getCPtr(sampler));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Sets the sampler to be used by the image at position "index".
/// </summary>
/// <param name="index">The position in the texture set of the image.</param>
/// <returns>A handle to the sampler at the specified position.</returns>
/// <since_tizen> 3 </since_tizen>
public Sampler GetSampler(uint index)
{
global::System.IntPtr cPtr = Interop.TextureSet.GetSampler(SwigCPtr, index);
Sampler ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Sampler;
if (ret != null)
{
Interop.BaseHandle.DeleteBaseHandle(new global::System.Runtime.InteropServices.HandleRef(this, cPtr));
}
else
{
ret = new Sampler(cPtr, true);
}
NDalicPINVOKE.ThrowExceptionIfExists();
return ret;
}
/// <summary>
/// Gets the number of textures present in the TextureSet.
/// </summary>
/// <returns>The number of textures in the TextureSet.</returns>
/// <since_tizen> 3 </since_tizen>
public uint GetTextureCount()
{
uint ret = Interop.TextureSet.GetTextureCount(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.TextureSet.DeleteTextureSet(swigCPtr);
}
}
}