public void SetStreamedVertices(IPrimitiveReader <TMaterial> srcPrim, PackedEncoding vertexEncoding) { Guard.NotNull(srcPrim, nameof(srcPrim)); var attributeNames = VertexTypes.VertexUtils .GetVertexAttributes(srcPrim.Vertices[0], srcPrim.Vertices.Count, vertexEncoding) .Select(item => item.Name) .ToList(); var vAccessors = new List <MACCESSOR>(); GuardAll.MustBeEqualTo(vAccessors.Select(item => item.Attribute.ByteOffset), 0, nameof(vAccessors)); GuardAll.MustBeEqualTo(vAccessors.Select(item => item.Attribute.ByteStride), 0, nameof(vAccessors)); foreach (var an in attributeNames) { var vAccessor = VertexTypes.VertexUtils.CreateVertexMemoryAccessor(srcPrim.Vertices, an, vertexEncoding); if (vAccessor == null) { continue; } vAccessors.Add(vAccessor); } _VertexAccessors = vAccessors.ToArray(); MACCESSOR.SanitizeVertexAttributes(_VertexAccessors); }
public void SetIndices(IPrimitiveReader <TMaterial> srcPrim, EncodingType encoding) { Guard.NotNull(srcPrim, nameof(srcPrim)); var iAccessor = VertexTypes.VertexUtils.CreateIndexMemoryAccessor(srcPrim.GetIndices(), encoding); if (_VerticesPerPrimitive == 1) { Guard.MustBeNull(iAccessor, nameof(srcPrim)); } else { Guard.NotNull(iAccessor, nameof(iAccessor)); } _IndexAccessors = iAccessor; }