Exemplo n.º 1
0
 public HardwareBufferEntry(
     XNABufferPair <TVertex> buffer,
     int vertexOffset, int indexOffset,
     int sourceVertexCount, int sourceIndexCount
     )
 {
     Buffer            = buffer;
     VertexOffset      = vertexOffset;
     IndexOffset       = indexOffset;
     SourceVertexCount = sourceVertexCount;
     SourceIndexCount  = sourceIndexCount;
     VerticesUsed      = IndicesUsed = 0;
 }
Exemplo n.º 2
0
 public void Initialize(
     XNABufferPair <TVertex> buffer,
     int vertexOffset, int indexOffset,
     int sourceVertexCount, int sourceIndexCount
     )
 {
     Buffer              = buffer;
     VertexOffset        = vertexOffset;
     IndexOffset         = indexOffset;
     SourceVertexCount   = sourceVertexCount;
     SourceIndexCount    = sourceIndexCount;
     SoftwareBufferCount = 0;
     VerticesUsed        = IndicesUsed = 0;
 }
Exemplo n.º 3
0
        protected void FillHardwareBuffer(
            XNABufferPair <TVertex> hardwareBuffer,
            ArraySegment <TVertex> vertices,
            ArraySegment <ushort> indices
            )
        {
            if (!hardwareBuffer.IsAllocated)
            {
                lock (CreateResourceLock)
                    hardwareBuffer.Allocate();
            }

            lock (hardwareBuffer.InUseLock) {
                hardwareBuffer.Vertices.SetData(vertices.Array, vertices.Offset, vertices.Count, SetDataOptions.Discard);
                hardwareBuffer.Indices.SetData(indices.Array, indices.Offset, indices.Count, SetDataOptions.Discard);
            }
        }
Exemplo n.º 4
0
            public void Initialize(
                ArraySegment <TVertex> vertices, ArraySegment <TIndex> indices,
                XNABufferPair <TVertex> hardwareBuffer, int hardwareVertexOffset, int hardwareIndexOffset
                )
            {
                if (IsInitialized)
                {
                    throw new ThreadStateException("Software buffer already initialized.");
                }

                Vertices             = vertices;
                Indices              = indices;
                HardwareBuffer       = hardwareBuffer;
                HardwareVertexOffset = hardwareVertexOffset;
                HardwareIndexOffset  = hardwareIndexOffset;
                IsInitialized        = true;
            }