CSharpGL.TeapotModel.GetFaces C# (CSharp) Method

GetFaces() public method

public GetFaces ( ) : ushort[]
return ushort[]
        public ushort[] GetFaces()
        {
            var result = new ushort[faceData.Length];
            faceData.CopyTo(result, 0);
            return result;
        }

Usage Example

Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IndexBuffer GetIndexBuffer()
        {
            if (indexBuffer == null)
            {
                ushort[]       faces  = model.GetFaces();
                int            length = faces.Length;
                OneIndexBuffer buffer = GLBuffer.Create(IndexBufferElementType.UShort, length, DrawMode.Triangles, BufferUsage.StaticDraw);
                unsafe
                {
                    IntPtr pointer = buffer.MapBuffer(MapBufferAccess.WriteOnly);
                    var    array   = (ushort *)pointer;
                    for (int i = 0; i < faces.Length; i++)
                    {
                        array[i] = (ushort)(faces[i] - 1);
                    }
                    buffer.UnmapBuffer();
                }
                this.indexBuffer = buffer;
            }

            return(indexBuffer);
        }
All Usage Examples Of CSharpGL.TeapotModel::GetFaces