Пример #1
0
 public void Dispose()
 {
     if (elements != null)
     {
         Marshal.FreeHGlobal((IntPtr)elements);
         elements = null;
     }
 }
Пример #2
0
        public VertexBufferLayout_NativeInterop(ref VertexBufferLayout layout)
        {
            // init defaults
            elementCount = 0;
            elements     = null;

            // init elements
            if (layout.elements != null)
            {
                elementCount = layout.elements.Length;
                elements     = (VertexBufferLayoutElement_NativeInterop *)Marshal.AllocHGlobal(Marshal.SizeOf <VertexBufferLayoutElement_NativeInterop>() * elementCount);
                for (int i = 0; i != elementCount; ++i)
                {
                    elements[i].type        = layout.elements[i].type;
                    elements[i].usage       = layout.elements[i].usage;
                    elements[i].streamIndex = layout.elements[i].streamIndex;
                    elements[i].usageIndex  = layout.elements[i].usageIndex;
                    elements[i].byteOffset  = layout.elements[i].byteOffset;
                }
            }
        }