mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Cap the number of points we generate when doing scatter to not run out of memory
This commit is contained in:
parent
2f4a4a7099
commit
e67ddc7fe6
@ -20,7 +20,12 @@ namespace NewHorizons.Builder.Props
|
|||||||
var heightMap = config.HeightMap;
|
var heightMap = config.HeightMap;
|
||||||
|
|
||||||
var area = 4f * Mathf.PI * radius * radius;
|
var area = 4f * Mathf.PI * radius * radius;
|
||||||
var points = RandomUtility.FibonacciSphere((int)(area * 10));
|
|
||||||
|
// To not use more than 0.5GB of RAM while doing this
|
||||||
|
// Works up to planets with 575 radius before capping
|
||||||
|
var numPoints = Math.Min((int)(area * 10), 41666666);
|
||||||
|
|
||||||
|
var points = RandomUtility.FibonacciSphere(numPoints);
|
||||||
|
|
||||||
Texture2D heightMapTexture = null;
|
Texture2D heightMapTexture = null;
|
||||||
if (heightMap != null)
|
if (heightMap != null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user