Exemple #1
0
        public void CreateInterleaved1()
        {
            var pos = MemoryEncoding.CreateDefaultElement("POSITION");
            var nrm = MemoryEncoding.CreateDefaultElement("NORMAL");

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

            const int baseOffset = 8;

            var byteStride = MemoryEncoding.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);
        }
Exemple #2
0
        public static     MemoryEncoding[] Slice(MemoryEncoding[] attributes, int start, int count)
        {
            Guard.NotNull(attributes, nameof(attributes));

            var dst = new MemoryEncoding[attributes.Length];

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

            return(dst);
        }
Exemple #3
0
 public void Update(ArraySegment <Byte> data, MemoryEncoding info)
 {
     this._Encoding = info;
     this._Data     = data;
 }
Exemple #4
0
 public MemoryAccessor(MemoryEncoding info)
 {
     this._Encoding = info;
     this._Data     = default;
 }
Exemple #5
0
 public MemoryAccessor(ArraySegment <Byte> data, MemoryEncoding info)
 {
     this._Encoding = info;
     this._Data     = data;
 }