private int ExportData(Schema.AccessorType type, Schema.AccessorComponentType componentType, int componentSize, int count, IEnumerable <object> min, IEnumerable <object> max, int byteLength, Action <BinaryWriter> writeData, string accessorName = null) { // The offset of the data must be aligned to a multiple of the component size. var position = checked ((int)this.dataWriter.BaseStream.Position); var alignedPosition = Align(position, componentSize); for (var i = position; i < alignedPosition; i++) { this.dataWriter.Write(byte.MinValue); } var bufferViewIndex = this.ExportBufferView(0, alignedPosition, byteLength); var accessorIndex = this.ExportAccessor(bufferViewIndex, componentType, count, type, min, max, accessorName); writeData(this.dataWriter); return(accessorIndex); }
private int ExportAccessor(int bufferViewIndex, Schema.AccessorComponentType componentType, int count, Schema.AccessorType type, IEnumerable <object> min, IEnumerable <object> max, string name = null) { int index = this.accessors.Count; this.accessors.Add(new Schema.Accessor { BufferView = bufferViewIndex, ComponentType = componentType, Count = count, Type = type, Min = min, Max = max, Name = name }); return(index); }