Ejemplo n.º 1
0
        public void Freeze(Device device)
        {
            TextMesh.PrimitiveCount = VertexBuffer.Count * 2 / 4;

            if (IndexBuffer.Count < TextMesh.PrimitiveCount * 6)
            {
                IndexBuffer.Capacity = TextMesh.PrimitiveCount * 6;

                while (IndexBuffer.Count < TextMesh.PrimitiveCount * 6)
                {
                    int baseIndex = (IndexBuffer.Count * 4) / 6;
                    foreach (int i in DynamicMesh.BoxTriIndices)
                    {
                        IndexBuffer.Add(baseIndex + i);
                    }
                }

                IndexBuffer.Update(device);
            }

            VertexBuffer.Update(device);

            TextMesh.VertexBuffer        = VertexBuffer.Buffer;
            TextMesh.IndexBuffer         = IndexBuffer.Buffer;
            TextMesh.VertexBufferBinding = new VertexBufferBinding(TextMesh.VertexBuffer, Utilites.SizeOf <Vertex>(), 0);
        }
Ejemplo n.º 2
0
 void Init(Device device, int count)
 {
     SharpDX.Utilities.Dispose(ref Buffer);
     Buffer         = new SharpDX.Direct3D11.Buffer(device, Utilites.SizeOf <T>() * count, ResourceUsage.Dynamic, Type, CpuAccessFlags.Write, ResourceOptionFlags.None, 0);
     BufferCapacity = count;
 }