Procedural Planets
Integrated Sebastian Lague's Planet Generator Created Tour function in SectorRenderer which makes the camera follow each terrestrial planet in turn
This commit is contained in:
parent
f8165878e0
commit
53a91351b7
332 changed files with 11904 additions and 78 deletions
21
Assets/Plugins/Celestial Body/Scripts/Normalizer.cs
Normal file
21
Assets/Plugins/Celestial Body/Scripts/Normalizer.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class Normalizer {
|
||||
|
||||
public static void Normalize (System.Func<int, float> getValue, System.Action<int, float> setValue, int length) {
|
||||
float min = float.PositiveInfinity;
|
||||
float max = float.NegativeInfinity;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
float value = getValue (i);
|
||||
min = System.Math.Min (min, value);
|
||||
max = System.Math.Max (max, value);
|
||||
}
|
||||
for (int i = 0; i < length; i++) {
|
||||
setValue (i, Mathf.InverseLerp (min, max, getValue (i)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue