コード例 #1
0
        public static GpuIndexBuffer CreateIndexBuffer(int[] indices, GpuBufferFlags flags = 0)
        {
            if (indices.Length == 0)
            {
                Log.Fatal("GpuBufferManager: CreateIndexBuffer: indices.Length == 0.");
            }
            if (flags.HasFlag(GpuBufferFlags.ComputeWrite))
            {
                Log.Fatal("GpuBufferManager: CreateIndexBuffer: ComputeWrite buffer can't write data from CPU.");
            }

            return(new GpuIndexBuffer(indices, indices.Length, flags));
        }
コード例 #2
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        //public static GpuBuffer[] GetBuffers()
        //{
        //	lock( buffers )
        //		return buffers.ToArray();
        //}

        public static GpuVertexBuffer CreateVertexBuffer(byte[] vertices, SharpBgfx.VertexLayout vertexDeclaration, GpuBufferFlags flags = 0)
        {
            if (vertices.Length == 0)
            {
                Log.Fatal("GpuBufferManager: CreateVertexBuffer: vertices.Length == 0.");
            }
            if (flags.HasFlag(GpuBufferFlags.ComputeWrite))
            {
                Log.Fatal("GpuBufferManager: CreateVertexBuffer: ComputeWrite buffer can't write data from CPU.");
            }

            var vertexCount = vertices.Length / vertexDeclaration.Stride;

            return(new GpuVertexBuffer(vertices, vertexCount, vertexDeclaration, flags));
        }