public static void Ensure(ref ProbeVolumePayload payload, int length) { if (payload.dataSHL01 == null || payload.dataSHL01.Length != (length * GetDataSHL01Stride())) { ProbeVolumePayload.Dispose(ref payload); ProbeVolumePayload.Allocate(ref payload, length); } }
void ApplyMigrationAddProbeVolumesAtlasEncodingModes() { Debug.Assert(probeVolumeAsset != null && probeVolumeAsset.Version == (int)ProbeVolumeAsset.AssetVersion.First); probeVolumeAsset.m_Version = (int)ProbeVolumeAsset.AssetVersion.AddProbeVolumesAtlasEncodingModes; int probeLength = probeVolumeAsset.dataSH.Length; ProbeVolumePayload.Allocate(ref probeVolumeAsset.payload, probeLength); for (int i = 0; i < probeLength; ++i) { ProbeVolumePayload.SetSphericalHarmonicsL1FromIndex(ref probeVolumeAsset.payload, probeVolumeAsset.dataSH[i], i); } probeVolumeAsset.dataSH = null; probeVolumeAsset.dataValidity = null; probeVolumeAsset.dataOctahedralDepth = null; }