using System.Collections; using System.Collections.Generic; using AwesomeTechnologies.Utility; using AwesomeTechnologies.VegetationSystem; using Unity.Collections; using Unity.Mathematics; using UnityEngine; namespace AwesomeTechnologies.Vegetation { public class VegetationInstanceData { public NativeList Position; public NativeList Rotation; public NativeList Scale; public NativeList TerrainNormal; public NativeList BiomeDistance; public NativeList TerrainTextureData; public NativeList RandomNumberIndex; public NativeList DistanceFalloff; public NativeList VegetationMaskDensity; public NativeList VegetationMaskScale; public NativeList TerrainSourceID; public NativeList TextureMaskData; public NativeList Excluded; public NativeList HeightmapSampled; public NativeList SpawnLocations; public VegetationInstanceData() { Position = new NativeList(Allocator.Persistent); Rotation = new NativeList(Allocator.Persistent); Scale = new NativeList(Allocator.Persistent); TerrainNormal = new NativeList(Allocator.Persistent); BiomeDistance = new NativeList(Allocator.Persistent); TerrainTextureData = new NativeList(Allocator.Persistent); RandomNumberIndex = new NativeList(Allocator.Persistent); DistanceFalloff = new NativeList(Allocator.Persistent); VegetationMaskDensity = new NativeList(Allocator.Persistent); VegetationMaskScale = new NativeList(Allocator.Persistent); TerrainSourceID = new NativeList(Allocator.Persistent); TextureMaskData = new NativeList(Allocator.Persistent); Excluded = new NativeList(Allocator.Persistent); HeightmapSampled = new NativeList(Allocator.Persistent); SpawnLocations = new NativeList(Allocator.Persistent); } public void ResizeUninitialized(int length) { Position.ResizeUninitialized(length); Rotation.ResizeUninitialized(length); Scale.ResizeUninitialized(length); TerrainNormal.ResizeUninitialized(length); BiomeDistance.ResizeUninitialized(length); TerrainTextureData.ResizeUninitialized(length); RandomNumberIndex.ResizeUninitialized(length); DistanceFalloff.ResizeUninitialized(length); VegetationMaskDensity.ResizeUninitialized(length); VegetationMaskScale.ResizeUninitialized(length); TerrainSourceID.ResizeUninitialized(length); TextureMaskData.ResizeUninitialized(length); Excluded.ResizeUninitialized(length); HeightmapSampled.ResizeUninitialized(length); } public void Dispose() { Position.Dispose(); Rotation.Dispose(); Scale.Dispose(); TerrainNormal.Dispose(); BiomeDistance.Dispose(); TerrainTextureData.Dispose(); RandomNumberIndex.Dispose(); DistanceFalloff.Dispose(); VegetationMaskDensity.Dispose(); VegetationMaskScale.Dispose(); TerrainSourceID.Dispose(); TextureMaskData.Dispose(); Excluded.Dispose(); HeightmapSampled.Dispose(); SpawnLocations.Dispose(); } public void Clear() { Position.Clear(); Rotation.Clear(); Scale.Clear(); TerrainNormal.Clear(); BiomeDistance.Clear(); TerrainTextureData.Clear(); RandomNumberIndex.Clear(); DistanceFalloff.Clear(); VegetationMaskDensity.Clear(); VegetationMaskScale.Clear(); TerrainSourceID.Clear(); TextureMaskData.Clear(); Excluded.Clear(); HeightmapSampled.Clear(); SpawnLocations.Clear(); } public void CompactMemory() { Position.CompactMemory(); Rotation.CompactMemory(); Scale.CompactMemory(); TerrainNormal.CompactMemory(); BiomeDistance.CompactMemory(); TerrainTextureData.CompactMemory(); RandomNumberIndex.CompactMemory(); DistanceFalloff.CompactMemory(); VegetationMaskDensity.CompactMemory(); VegetationMaskScale.CompactMemory(); TerrainSourceID.CompactMemory(); TextureMaskData.CompactMemory(); Excluded.CompactMemory(); HeightmapSampled.CompactMemory(); SpawnLocations.CompactMemory(); } public void SetCapasity(int capasity) { Position.Capacity = capasity; Rotation.Capacity = capasity; Scale.Capacity = capasity; TerrainNormal.Capacity = capasity; BiomeDistance.Capacity = capasity; TerrainTextureData.Capacity = capasity; RandomNumberIndex.Capacity = capasity; DistanceFalloff.Capacity = capasity; VegetationMaskDensity.Capacity = capasity; VegetationMaskScale.Capacity = capasity; TerrainSourceID.Capacity = capasity; TextureMaskData.Capacity = capasity; Excluded.Capacity = capasity; HeightmapSampled.Capacity = capasity; SpawnLocations.Capacity = capasity; } } }