Exemplo n.º 1
0
        public HardwareIndexBuffer(HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage,
                                   bool useSystemMemory, bool useShadowBuffer)
            : base(usage, useSystemMemory, useShadowBuffer)
        {
            this.type       = type;
            this.numIndices = numIndices;
            this.Manager    = manager;
            // calc the index buffer size
            sizeInBytes = numIndices;

            if (type == IndexType.Size32)
            {
                this.indexSize = Memory.SizeOf(typeof(int));
            }
            else
            {
                this.indexSize = Memory.SizeOf(typeof(short));
            }

            sizeInBytes *= this.indexSize;

            // create a shadow buffer if required
            if (useShadowBuffer)
            {
                shadowBuffer = new DefaultHardwareIndexBuffer(this.Manager, type, numIndices, BufferUsage.Dynamic);
            }
        }
Exemplo n.º 2
0
 public VertexData(HardwareBufferManagerBase mgr)
     : base()
 {
     this._mgr = mgr != null ? mgr : HardwareBufferManager.Instance;
     this.vertexBufferBinding = HardwareBufferManager.Instance.CreateVertexBufferBinding();
     this.vertexDeclaration   = HardwareBufferManager.Instance.CreateVertexDeclaration();
     DeleteDclBinding         = true;
 }
Exemplo n.º 3
0
 public VertexData(VertexDeclaration dcl, VertexBufferBinding bind)
     : base()
 {
     // this is a fallback rather than actively used
     this._mgr = HardwareBufferManager.Instance;
     this.vertexDeclaration   = dcl;
     this.vertexBufferBinding = bind;
     DeleteDclBinding         = false;
 }
Exemplo n.º 4
0
 protected internal HardwareBufferManager(HardwareBufferManagerBase baseInstance)
     : base()
 {
     if (instance == null)
     {
         instance           = this;
         this._baseInstance = baseInstance;
     }
 }
Exemplo n.º 5
0
        public HardwareVertexBuffer(HardwareBufferManagerBase manager, VertexDeclaration vertexDeclaration, int numVertices,
                                    BufferUsage usage, bool useSystemMemory, bool useShadowBuffer)
            : base(usage, useSystemMemory, useShadowBuffer)
        {
            this.vertexDeclaration = vertexDeclaration;
            this.numVertices       = numVertices;
            this.Manager           = manager;

            // calculate the size in bytes of this buffer
            sizeInBytes = vertexDeclaration.GetVertexSize() * numVertices;

            // create a shadow buffer if required
            if (useShadowBuffer)
            {
                shadowBuffer = new DefaultHardwareVertexBuffer(this.Manager, vertexDeclaration, numVertices, BufferUsage.Dynamic);
            }

            this.useCount = 0;
        }
 public DefaultHardwareVertexBuffer(HardwareBufferManagerBase manager, VertexDeclaration vertexDeclaration,
                                    int numVertices, BufferUsage usage)
     : base(manager, vertexDeclaration, numVertices, usage, true, false)               // always software, never shadowed
 {
     _mpData = new byte[base.sizeInBytes];
 }
Exemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <remarks>
 ///		This is already in system memory, so no need to use a shadow buffer.
 /// </remarks>
 /// <param name="vertexSize"></param>
 /// <param name="numVertices"></param>
 /// <param name="usage"></param>
 public SoftwareVertexBuffer(HardwareBufferManagerBase manager, VertexDeclaration vertexDeclaration, int numVertices, BufferUsage usage)
     : base(manager, vertexDeclaration, numVertices, usage, true, false)
 {
     data = new byte[sizeInBytes];
 }
Exemplo n.º 8
0
 public SoftwareBufferManager(HardwareBufferManagerBase baseInstance) : base(baseInstance)
 {
 }
Exemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 /// <remarks>
 ///		This is already in system memory, so no need to use a shadow buffer.
 /// </remarks>
 /// <param name="vertexSize"></param>
 /// <param name="numVertices"></param>
 /// <param name="usage"></param>
 public SoftwareIndexBuffer(HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage)
     : base(manager, type, numIndices, usage, true, false)
 {
     data = new byte[sizeInBytes];
 }
Exemplo n.º 10
0
 public DefaultHardwareIndexBuffer(HardwareBufferManagerBase manager, IndexType idxType, int numIndexes,
                                   BufferUsage usage)
     : base(manager, idxType, numIndexes, usage, true, false)
 {
     _mpData = new byte[sizeInBytes];
 }