示例#1
0
        public void CreateInterleaved1()
        {
            var pos = MemoryAccessInfo.CreateDefaultElement("POSITION");
            var nrm = MemoryAccessInfo.CreateDefaultElement("NORMAL");

            var attributes = new[] { pos, nrm };

            const int baseOffset = 8;

            var byteStride = MemoryAccessInfo.SetInterleavedInfo(attributes, baseOffset, 5);

            pos = attributes[0];
            nrm = attributes[1];

            Assert.AreEqual(24, byteStride);

            Assert.AreEqual(baseOffset + 0, pos.ByteOffset);
            Assert.AreEqual(24, pos.ByteStride);
            Assert.AreEqual(5, pos.ItemsCount);

            Assert.AreEqual(baseOffset + 12, nrm.ByteOffset);
            Assert.AreEqual(24, nrm.ByteStride);
            Assert.AreEqual(5, nrm.ItemsCount);

            Assert.IsTrue(pos.IsValidVertexAttribute);
            Assert.IsTrue(nrm.IsValidVertexAttribute);
        }
示例#2
0
        public static     MemoryAccessInfo[] Slice(MemoryAccessInfo[] attributes, int start, int count)
        {
            var dst = new MemoryAccessInfo[attributes.Length];

            for (int i = 0; i < dst.Length; ++i)
            {
                dst[i] = attributes[i].Slice(start, count);
            }

            return(dst);
        }
示例#3
0
 public void Update(BYTES data, MemoryAccessInfo encoding)
 {
     this._Slicer = encoding;
     this._Data   = data;
 }
示例#4
0
 public MemoryAccessor(MemoryAccessInfo info)
 {
     this._Slicer = info;
     this._Data   = default;
 }
示例#5
0
 public MemoryAccessor(BYTES data, MemoryAccessInfo info)
 {
     this._Slicer = info;
     this._Data   = data;
 }
示例#6
0
 public void Update(ArraySegment <Byte> data, MemoryAccessInfo info)
 {
     this._Attribute = info;
     this._Data      = data;
 }
示例#7
0
 public MemoryAccessor(MemoryAccessInfo info)
 {
     this._Attribute = info;
     this._Data      = default;
 }