2 * Copyright(c) 2017 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;
22 /// Geometry is handle to an object that can be used to define a geometric elements.
24 /// <since_tizen> 3 </since_tizen>
25 public class Geometry : BaseHandle
29 /// Create an instance of Geometry.
31 /// <since_tizen> 3 </since_tizen>
32 public Geometry() : this(Interop.Geometry.New(), true)
34 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
38 internal Geometry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Geometry.Upcast(cPtr), cMemoryOwn)
43 /// Enumeration for the description of the type of geometry,
44 /// used to determine how the coordinates will be used.
46 /// <returns>Type of primitives this geometry contains.</returns>
47 /// <since_tizen> 3 </since_tizen>
51 /// Individual points.
56 /// Individual lines (made of 2 points each).
61 /// A strip of lines (made of 1 point each) which also joins the first and last point.
66 /// A strip of lines (made of 1 point each).
71 /// Individual triangles (made of 3 points each).
76 /// A fan of triangles around a centre point (after the first triangle, following triangles need only 1 point).
81 /// A strip of triangles (after the first triangle, following triangles need only 1 point).
87 /// Adds a PropertyBuffer to be used as source of geometry vertices.
89 /// <param name="vertexBuffer">PropertyBuffer to be used as source of geometry vertices.</param>
90 /// <returns>Index of the newly added buffer.</returns>
91 /// <since_tizen> 3 </since_tizen>
92 public uint AddVertexBuffer(PropertyBuffer vertexBuffer)
94 uint ret = Interop.Geometry.AddVertexBuffer(SwigCPtr, PropertyBuffer.getCPtr(vertexBuffer));
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 /// Adds a VertexBuffer to be used as source of geometry vertices.
102 /// <param name="vertexBuffer">VertexBuffer to be used as source of geometry vertices.</param>
103 /// <returns>Index of the newly added buffer.</returns>
104 /// <since_tizen> 8 </since_tizen>
105 public uint AddVertexBuffer(VertexBuffer vertexBuffer)
107 uint ret = Interop.Geometry.AddVertexBuffer(SwigCPtr, VertexBuffer.getCPtr(vertexBuffer));
108 if (NDalicPINVOKE.SWIGPendingException.Pending)
109 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114 /// Retrieves the number of vertex buffers that have been added to this geometry.
116 /// <returns>Number of vertex buffers that have been added to this geometry.</returns>
117 /// <since_tizen> 3 </since_tizen>
118 public uint GetNumberOfVertexBuffers()
120 uint ret = Interop.Geometry.GetNumberOfVertexBuffers(SwigCPtr);
121 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 /// Removes a vertex buffer.
128 /// <param name="index">Index to the vertex buffer to remove.</param>
129 /// <since_tizen> 3 </since_tizen>
130 public void RemoveVertexBuffer(uint index)
132 Interop.Geometry.RemoveVertexBuffer(SwigCPtr, index);
133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137 /// Sets a the index data to be used as a source of indices for the geometry
138 /// Setting this buffer will cause the geometry to be rendered using indices.
140 /// <param name="indices">Array of indices.</param>
141 /// <param name="count">Number of indices in the array.</param>
142 /// <since_tizen> 3 </since_tizen>
143 public void SetIndexBuffer(ushort[] indices, uint count)
145 Interop.Geometry.SetIndexBuffer(SwigCPtr, indices, count);
146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150 /// Sets the type of primitives this geometry contains.
152 /// <param name="geometryType">Array of indices.</param>
153 /// <since_tizen> 3 </since_tizen>
154 public void SetType(Geometry.Type geometryType)
156 Interop.Geometry.SetType(SwigCPtr, (int)geometryType);
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 /// Gets the type of primitives this geometry contains.
163 /// <returns>Type of primitives this geometry contains.</returns>
164 /// <since_tizen> 3 </since_tizen>
165 public new Geometry.Type GetType()
167 Geometry.Type ret = (Geometry.Type)Interop.Geometry.GetType(SwigCPtr);
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Geometry obj)
174 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
177 /// This will not be public opened.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
181 Interop.Geometry.DeleteGeometry(swigCPtr);