/* * 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. * */ namespace Tizen.NUI { /// /// Geometry is handle to an object that can be used to define a geometric elements. /// /// 3 public class Geometry : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; internal Geometry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Geometry_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } 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; } /// /// Dispose. /// /// 3 protected override void Dispose(DisposeTypes type) { if (disposed) { return; } if (type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. //You should release all of your own disposable objects here. } //Release your own unmanaged resources here. //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; NDalicPINVOKE.delete_Geometry(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } base.Dispose(type); } /// /// Create an instance of Geometry. /// /// 3 public Geometry() : this(NDalicPINVOKE.Geometry_New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// 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 = NDalicPINVOKE.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 = NDalicPINVOKE.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) { NDalicPINVOKE.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) { NDalicPINVOKE.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) { NDalicPINVOKE.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)NDalicPINVOKE.Geometry_GetType(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// 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 } } }