// Copyright 2020 Phyronnaz #pragma once #include "CoreMinimal.h" #include "VoxelValue.h" template struct TVoxelDiff { FVoxelCellIndex Index; T Value; TVoxelDiff() = default; TVoxelDiff(FVoxelCellIndex Index, const T& Value) : Index(Index), Value(Value) {} }; template FORCEINLINE FArchive& operator<<(FArchive &Ar, TVoxelDiff& ValueDiff) { Ar << ValueDiff.Index; Ar << ValueDiff.Value; return Ar; } template<> FORCEINLINE FArchive& operator<<(FArchive &Ar, TVoxelDiff& ValueDiff) { Ar << ValueDiff.Index; Ar << ValueDiff.Value.GetStorage(); return Ar; } template struct TVoxelChunkDiff { FIntVector Position; TArray> Diffs; TVoxelChunkDiff() = default; TVoxelChunkDiff(const FIntVector& Position) : Position(Position) {} }; template FORCEINLINE FArchive& operator<<(FArchive &Ar, TVoxelChunkDiff& ChunkDiff) { Ar << ChunkDiff.Position; Ar << ChunkDiff.Diffs; return Ar; }