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
|
|
@ -0,0 +1,22 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class TextureHelper {
|
||||
|
||||
public static void TextureFromGradient (Gradient gradient, int width, ref Texture2D texture) {
|
||||
if (texture == null || texture.width != width || texture.height != 1) {
|
||||
texture = new Texture2D (width, 1);
|
||||
texture.filterMode = FilterMode.Bilinear;
|
||||
texture.wrapMode = TextureWrapMode.Clamp;
|
||||
}
|
||||
|
||||
Color[] colours = new Color[width];
|
||||
for (int i = 0; i < width; i++) {
|
||||
float t = i / (width - 1f);
|
||||
colours[i] = gradient.Evaluate (t);
|
||||
}
|
||||
texture.SetPixels (colours);
|
||||
texture.Apply ();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue