private static MgStorageBlockAllocationInfo GetIndexAllocation(MgtfAccessor accessor) { return(new MgStorageBlockAllocationInfo { MemoryPropertyFlags = MgMemoryPropertyFlagBits.HOST_COHERENT_BIT, Usage = MgBufferUsageFlagBits.INDEX_BUFFER_BIT, Size = accessor.TotalByteSize, ElementByteSize = accessor.ElementByteSize, }); }
private static GltfInterleavedOperation GenerateCopyOperation(MgtfAccessor accessor, MgtfBufferView[] bufferViews) { if (!accessor.BufferView.HasValue) { throw new InvalidOperationException("unable to locate bufferview"); } var view = bufferViews[accessor.BufferView.Value]; var op = new GltfInterleavedOperation { BufferIndex = view.BufferIndex, Count = accessor.ElementCount, SrcOffset = (ulong)(view.BufferOffset + accessor.ViewOffset), TotalSize = (uint)(accessor.ElementCount * accessor.NoOfComponents * accessor.ElementByteSize), ByteStride = (view.ByteStride.HasValue) ? (uint)view.ByteStride.Value : accessor.NoOfComponents * accessor.ElementByteSize, }; return(op); }