[Add] Base Logic
This commit is contained in:
@@ -37,6 +37,9 @@ namespace InfiniteWorld.VoxelWorld
|
||||
public float biomeNoiseScale = 0.02f;
|
||||
[Min(1f)] public float biomeSize = 48f;
|
||||
|
||||
[Header("Placements")]
|
||||
public List<WorldPrefabCollection> placementCollections = new List<WorldPrefabCollection>();
|
||||
|
||||
[Header("Runtime")]
|
||||
[Min(1)] public int maxAsyncChunkJobs = 2;
|
||||
[Min(1)] public int maxChunkBuildsPerFrame = 1;
|
||||
@@ -50,6 +53,7 @@ namespace InfiniteWorld.VoxelWorld
|
||||
internal readonly struct VoxelWorldResolvedSettings
|
||||
{
|
||||
private static readonly IReadOnlyList<VoxelBiomeProfile> EmptyBiomes = System.Array.Empty<VoxelBiomeProfile>();
|
||||
private static readonly IReadOnlyList<WorldPrefabCollection> EmptyPlacementCollections = System.Array.Empty<WorldPrefabCollection>();
|
||||
|
||||
public static readonly VoxelWorldResolvedSettings Default = Resolve(null);
|
||||
|
||||
@@ -75,6 +79,7 @@ namespace InfiniteWorld.VoxelWorld
|
||||
IReadOnlyList<VoxelBiomeProfile> biomeProfiles,
|
||||
float biomeNoiseScale,
|
||||
float biomeSize,
|
||||
IReadOnlyList<WorldPrefabCollection> placementCollections,
|
||||
int maxAsyncChunkJobs,
|
||||
int maxChunkBuildsPerFrame,
|
||||
int maxChunkMeshBuildsPerFrame,
|
||||
@@ -104,6 +109,7 @@ namespace InfiniteWorld.VoxelWorld
|
||||
BiomeProfiles = biomeProfiles;
|
||||
BiomeNoiseScale = biomeNoiseScale;
|
||||
BiomeSize = biomeSize;
|
||||
PlacementCollections = placementCollections;
|
||||
MaxAsyncChunkJobs = maxAsyncChunkJobs;
|
||||
MaxChunkBuildsPerFrame = maxChunkBuildsPerFrame;
|
||||
MaxChunkMeshBuildsPerFrame = maxChunkMeshBuildsPerFrame;
|
||||
@@ -134,6 +140,7 @@ namespace InfiniteWorld.VoxelWorld
|
||||
public IReadOnlyList<VoxelBiomeProfile> BiomeProfiles { get; }
|
||||
public float BiomeNoiseScale { get; }
|
||||
public float BiomeSize { get; }
|
||||
public IReadOnlyList<WorldPrefabCollection> PlacementCollections { get; }
|
||||
public int MaxAsyncChunkJobs { get; }
|
||||
public int MaxChunkBuildsPerFrame { get; }
|
||||
public int MaxChunkMeshBuildsPerFrame { get; }
|
||||
@@ -147,6 +154,9 @@ namespace InfiniteWorld.VoxelWorld
|
||||
IReadOnlyList<VoxelBiomeProfile> biomes = config != null && config.biomeProfiles != null
|
||||
? config.biomeProfiles
|
||||
: EmptyBiomes;
|
||||
IReadOnlyList<WorldPrefabCollection> placements = config != null && config.placementCollections != null
|
||||
? config.placementCollections
|
||||
: EmptyPlacementCollections;
|
||||
|
||||
return new VoxelWorldResolvedSettings(
|
||||
Mathf.Max(8, config != null ? config.chunkSize : 16),
|
||||
@@ -170,6 +180,7 @@ namespace InfiniteWorld.VoxelWorld
|
||||
biomes,
|
||||
config != null ? config.biomeNoiseScale : 0.02f,
|
||||
Mathf.Max(1f, config != null ? config.biomeSize : 48f),
|
||||
placements,
|
||||
Mathf.Max(1, config != null ? config.maxAsyncChunkJobs : 2),
|
||||
Mathf.Max(1, config != null ? config.maxChunkBuildsPerFrame : 1),
|
||||
Mathf.Max(1, config != null ? config.maxChunkMeshBuildsPerFrame : 1),
|
||||
|
||||
Reference in New Issue
Block a user