/* * Copyright(c) 2017 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; namespace Tizen.NUI { /// /// Geometry is handle to an object that can be used to define a geometric elements. /// /// 3 public class Geometry : BaseHandle { /// /// Create an instance of Geometry. /// /// 3 public Geometry() : this(Interop.Geometry.Geometry_New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal Geometry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Geometry.Geometry_SWIGUpcast(cPtr), cMemoryOwn) { } /// /// Enumeration for the description of the type of geometry, /// used to determine how the coordinates will be used. /// /// Type of primitives this geometry contains. /// 3 public enum Type { /// /// Individual points. /// POINTS, /// /// Individual lines (made of 2 points each). /// LINES, /// /// A strip of lines (made of 1 point each) which also joins the first and last point. /// LINE_LOOP, /// /// A strip of lines (made of 1 point each). /// LINE_STRIP, /// /// Individual triangles (made of 3 points each). /// TRIANGLES, /// /// A fan of triangles around a centre point (after the first triangle, following triangles need only 1 point). /// TRIANGLE_FAN, /// /// A strip of triangles (after the first triangle, following triangles need only 1 point). /// TRIANGLE_STRIP } /// /// Adds a PropertyBuffer to be used as source of geometry vertices. /// /// PropertyBuffer to be used as source of geometry vertices. /// Index of the newly added buffer. /// 3 public uint AddVertexBuffer(PropertyBuffer vertexBuffer) { uint ret = Interop.Geometry.Geometry_AddVertexBuffer(swigCPtr, PropertyBuffer.getCPtr(vertexBuffer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Retrieves the number of vertex buffers that have been added to this geometry. /// /// Number of vertex buffers that have been added to this geometry. /// 3 public uint GetNumberOfVertexBuffers() { uint ret = Interop.Geometry.Geometry_GetNumberOfVertexBuffers(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Removes a vertex buffer. /// /// Index to the vertex buffer to remove. /// 3 public void RemoveVertexBuffer(uint index) { Interop.Geometry.Geometry_RemoveVertexBuffer(swigCPtr, index); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets a the index data to be used as a source of indices for the geometry /// Setting this buffer will cause the geometry to be rendered using indices. /// /// Array of indices. /// Number of indices in the array. /// 3 public void SetIndexBuffer(ushort[] indices, uint count) { Interop.Geometry.Geometry_SetIndexBuffer(swigCPtr, indices, count); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the type of primitives this geometry contains. /// /// Array of indices. /// 3 public void SetType(Geometry.Type geometryType) { Interop.Geometry.Geometry_SetType(swigCPtr, (int)geometryType); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Gets the type of primitives this geometry contains. /// /// Type of primitives this geometry contains. /// 3 public new Geometry.Type GetType() { Geometry.Type ret = (Geometry.Type)Interop.Geometry.Geometry_GetType(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Geometry obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } /// This will not be public opened. [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.Geometry.delete_Geometry(swigCPtr); } } }