Icospheres and API
New mesh generation for heightmap planets. Made the API work. Added air to planets. Ambient light works. Atmospheres work.
@ -6,7 +6,7 @@ namespace NewHorizons.Atmosphere
|
||||
{
|
||||
static class AirBuilder
|
||||
{
|
||||
public static void Make(GameObject body, float airScale, bool isRaining)
|
||||
public static void Make(GameObject body, float airScale, bool isRaining, bool hasOxygen)
|
||||
{
|
||||
GameObject airGO = new GameObject("Air");
|
||||
airGO.SetActive(false);
|
||||
@ -25,6 +25,11 @@ namespace NewHorizons.Atmosphere
|
||||
SFV.SetValue("_allowShipAutoroll", true);
|
||||
SFV.SetValue("_disableOnStart", false);
|
||||
|
||||
if(hasOxygen)
|
||||
{
|
||||
airGO.AddComponent<OxygenVolume>();
|
||||
}
|
||||
|
||||
if (isRaining)
|
||||
{
|
||||
VisorRainEffectVolume VREF = airGO.AddComponent<VisorRainEffectVolume>();
|
||||
|
||||
@ -6,71 +6,76 @@ namespace NewHorizons.Atmosphere
|
||||
{
|
||||
static class AtmosphereBuilder
|
||||
{
|
||||
public static void Make(GameObject body, IPlanetConfig config)
|
||||
public static void Make(GameObject body, AtmosphereModule atmosphereModule)
|
||||
{
|
||||
GameObject atmoGO = new GameObject("Atmosphere");
|
||||
atmoGO.SetActive(false);
|
||||
atmoGO.transform.parent = body.transform;
|
||||
|
||||
//Logger.Log("Re-add LOD atmosphere!", Logger.LogType.Todo);
|
||||
if(atmosphereModule.hasAtmosphere)
|
||||
{
|
||||
var mat = GameObject.Find("TimberHearth_Body/Atmosphere_TH/AtmoSphere/Atmosphere_LOD0").GetComponent<MeshRenderer>().material;
|
||||
|
||||
/*
|
||||
GameObject atmo = GameObject.Instantiate(GameObject.Find("Atmosphere_TH/AtmoSphere"));
|
||||
atmo.transform.parent = atmoGO.transform;
|
||||
atmo.transform.localPosition = Vector3.zero;
|
||||
atmo.transform.localScale = new Vector3(config.TopCloudSize, config.TopCloudSize, config.TopCloudSize);
|
||||
*/
|
||||
GameObject atmo = GameObject.Instantiate(GameObject.Find("Atmosphere_TH/AtmoSphere"));
|
||||
atmo.transform.parent = atmoGO.transform;
|
||||
atmo.transform.localPosition = Vector3.zero;
|
||||
atmo.transform.localScale = Vector3.one * atmosphereModule.Size;
|
||||
atmo.SetActive(true);
|
||||
|
||||
/*
|
||||
GameObject lod1 = new GameObject();
|
||||
lod1.transform.parent = atmo.transform;
|
||||
lod1.transform.localPosition = Vector3.zero;
|
||||
MeshFilter f1 = lod1.AddComponent<MeshFilter>();
|
||||
f1.mesh = GameObject.Find("Atmosphere_LOD1").GetComponent<MeshFilter>().mesh;
|
||||
MeshRenderer r1 = lod1.AddComponent<MeshRenderer>();
|
||||
r1.material = mat;
|
||||
/*
|
||||
GameObject lod0 = new GameObject();
|
||||
lod0.transform.parent = atmo.transform;
|
||||
lod0.transform.localPosition = Vector3.zero;
|
||||
MeshFilter f0 = lod0.AddComponent<MeshFilter>();
|
||||
f0.mesh = GameObject.Find("Atmosphere_LOD0").GetComponent<MeshFilter>().mesh;
|
||||
MeshRenderer r0 = lod0.AddComponent<MeshRenderer>();
|
||||
r0.material = mat;
|
||||
|
||||
GameObject lod2 = new GameObject();
|
||||
lod2.transform.parent = atmo.transform;
|
||||
lod2.transform.localPosition = Vector3.zero;
|
||||
MeshFilter f2 = lod2.AddComponent<MeshFilter>();
|
||||
f2.mesh = GameObject.Find("Atmosphere_LOD2").GetComponent<MeshFilter>().mesh;
|
||||
MeshRenderer r2 = lod2.AddComponent<MeshRenderer>();
|
||||
r2.material = mat;
|
||||
GameObject lod1 = new GameObject();
|
||||
lod1.transform.parent = atmo.transform;
|
||||
lod1.transform.localPosition = Vector3.zero;
|
||||
MeshFilter f1 = lod1.AddComponent<MeshFilter>();
|
||||
f1.mesh = GameObject.Find("Atmosphere_LOD1").GetComponent<MeshFilter>().mesh;
|
||||
MeshRenderer r1 = lod1.AddComponent<MeshRenderer>();
|
||||
r1.material = mat;
|
||||
|
||||
GameObject lod3 = new GameObject();
|
||||
lod3.transform.parent = atmo.transform;
|
||||
lod3.transform.localPosition = Vector3.zero;
|
||||
MeshFilter f3 = lod3.AddComponent<MeshFilter>();
|
||||
f3.mesh = GameObject.Find("Atmosphere_LOD3").GetComponent<MeshFilter>().mesh;
|
||||
MeshRenderer r3 = lod3.AddComponent<MeshRenderer>();
|
||||
r3.material = mat;
|
||||
*/
|
||||
GameObject lod2 = new GameObject();
|
||||
lod2.transform.parent = atmo.transform;
|
||||
lod2.transform.localPosition = Vector3.zero;
|
||||
MeshFilter f2 = lod2.AddComponent<MeshFilter>();
|
||||
f2.mesh = GameObject.Find("Atmosphere_LOD2").GetComponent<MeshFilter>().mesh;
|
||||
MeshRenderer r2 = lod2.AddComponent<MeshRenderer>();
|
||||
r2.material = mat;
|
||||
|
||||
// THIS FUCKING THING. do NOT ask why i have done this. IT WORKS.
|
||||
// This creates an LOD group in the worst way possible. i am so sorry.
|
||||
/*
|
||||
LODGroup lodg = atmo.AddComponent<LODGroup>();
|
||||
|
||||
LOD[] lodlist = new LOD[4];
|
||||
Renderer[] t0 = { r0 };
|
||||
Renderer[] t1 = { r1 };
|
||||
Renderer[] t2 = { r2 };
|
||||
Renderer[] t3 = { r3 };
|
||||
LOD one = new LOD(1, t0);
|
||||
LOD two = new LOD(0.7f, t1);
|
||||
LOD three = new LOD(0.27f, t2);
|
||||
LOD four = new LOD(0.08f, t3);
|
||||
lodlist[0] = one;
|
||||
lodlist[1] = two;
|
||||
lodlist[2] = three;
|
||||
lodlist[3] = four;
|
||||
GameObject lod3 = new GameObject();
|
||||
lod3.transform.parent = atmo.transform;
|
||||
lod3.transform.localPosition = Vector3.zero;
|
||||
MeshFilter f3 = lod3.AddComponent<MeshFilter>();
|
||||
f3.mesh = GameObject.Find("Atmosphere_LOD3").GetComponent<MeshFilter>().mesh;
|
||||
MeshRenderer r3 = lod3.AddComponent<MeshRenderer>();
|
||||
r3.material = mat;
|
||||
|
||||
lodg.SetLODs(lodlist);
|
||||
lodg.fadeMode = LODFadeMode.None;
|
||||
*/
|
||||
LODGroup lodg = atmo.AddComponent<LODGroup>();
|
||||
|
||||
LOD[] lodlist = new LOD[4];
|
||||
Renderer[] t0 = { r0 };
|
||||
Renderer[] t1 = { r1 };
|
||||
Renderer[] t2 = { r2 };
|
||||
Renderer[] t3 = { r3 };
|
||||
LOD one = new LOD(1, t0);
|
||||
LOD two = new LOD(0.7f, t1);
|
||||
LOD three = new LOD(0.27f, t2);
|
||||
LOD four = new LOD(0.08f, t3);
|
||||
lodlist[0] = one;
|
||||
lodlist[1] = two;
|
||||
lodlist[2] = three;
|
||||
lodlist[3] = four;
|
||||
|
||||
lodg.SetLODs(lodlist);
|
||||
lodg.fadeMode = LODFadeMode.None;
|
||||
*/
|
||||
}
|
||||
|
||||
//atmo.SetActive(true);
|
||||
atmoGO.SetActive(true);
|
||||
Logger.Log("Finished building atmosphere.", Logger.LogType.Log);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Utils;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
@ -10,15 +11,19 @@ namespace NewHorizons.Atmosphere
|
||||
{
|
||||
public static void Make(GameObject body, Sector sector, AtmosphereModule atmo)
|
||||
{
|
||||
var texturePath = atmo.Cloud ?? "assets\\default_clouds.png";
|
||||
var capPath = atmo.CloudCap ?? "assets\\default_cap.png";
|
||||
var rampPath = atmo.CloudRamp ?? "assets\\default_ramp.png";
|
||||
Texture2D image, cap, ramp;
|
||||
|
||||
var image = Main.Instance.ModHelper.Assets.GetTexture(texturePath);
|
||||
var cap = Main.Instance.ModHelper.Assets.GetTexture(capPath);
|
||||
var ramp = Main.Instance.ModHelper.Assets.GetTexture(rampPath);
|
||||
|
||||
Logger.Log($"Using cloud textures: {texturePath}, {capPath}, {rampPath}");
|
||||
try
|
||||
{
|
||||
image = Main.Instance.CurrentAssets.GetTexture(atmo.Cloud);
|
||||
cap = Main.Instance.CurrentAssets.GetTexture(atmo.CloudCap);
|
||||
ramp = Main.Instance.CurrentAssets.GetTexture(atmo.CloudRamp);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load Cloud textures, {e.Message}, {e.StackTrace}");
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject cloudsMainGO = new GameObject();
|
||||
cloudsMainGO.SetActive(false);
|
||||
|
||||
212
NewHorizons/Body/Geometry/CubeSphere.cs
Normal file
@ -0,0 +1,212 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Body
|
||||
{
|
||||
static class CubeSphere
|
||||
{
|
||||
public static Mesh Build(int resolution, Texture2D heightMap, float minHeight, float maxHeight)
|
||||
{
|
||||
// It breaks if resolution is greater than 100 I don't know why
|
||||
if(resolution > 100)
|
||||
{
|
||||
Logger.LogWarning($"Can't make CubeSphere's with resolution higher than 100 for some reason");
|
||||
resolution = 100;
|
||||
}
|
||||
|
||||
Mesh mesh = new Mesh();
|
||||
mesh.name = "CubeSphere";
|
||||
|
||||
CreateVertices(mesh, resolution, heightMap, minHeight, maxHeight);
|
||||
CreateTriangles(mesh, resolution);
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
// Thank you Catlikecoding
|
||||
private static void CreateVertices(Mesh mesh, int resolution, Texture2D heightMap, float minHeight, float maxHeight)
|
||||
{
|
||||
int cornerVertices = 8;
|
||||
int edgeVertices = (3 * resolution - 3) * 4;
|
||||
int faceVertices = (6 * (resolution - 1) * (resolution - 1));
|
||||
|
||||
Vector3[] vertices = new Vector3[cornerVertices + edgeVertices + faceVertices];
|
||||
Vector3[] normals = new Vector3[vertices.Length];
|
||||
Vector2[] uvs = new Vector2[vertices.Length];
|
||||
|
||||
int v = 0;
|
||||
for (int y = 0; y <= resolution; y++)
|
||||
{
|
||||
for (int x = 0; x <= resolution; x++)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, x, y, 0, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
for (int z = 1; z <= resolution; z++)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, resolution, y, z, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
for (int x = resolution - 1; x >= 0; x--)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, x, y, resolution, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
for (int z = resolution - 1; z > 0; z--)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, 0, y, z, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
for (int z = 1; z < resolution; z++)
|
||||
{
|
||||
for (int x = 1; x < resolution; x++)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, x, resolution, z, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
}
|
||||
for (int z = 1; z < resolution; z++)
|
||||
{
|
||||
for (int x = 1; x < resolution; x++)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, x, 0, z, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
mesh.vertices = vertices;
|
||||
mesh.normals = normals;
|
||||
mesh.uv = uvs;
|
||||
}
|
||||
|
||||
private static void SetVertex(Vector3[] vertices, Vector3[] normals, Vector2[] uvs, int i, int x, int y, int z, int resolution, Texture2D heightMap, float minHeight, float maxHeight)
|
||||
{
|
||||
var v2 = (new Vector3(x, y, z) - (Vector3.one * (resolution / 2f))).normalized;
|
||||
|
||||
float x2 = v2.x * v2.x;
|
||||
float y2 = v2.y * v2.y;
|
||||
float z2 = v2.z * v2.z;
|
||||
Vector3 v;
|
||||
v.x = v2.x * Mathf.Sqrt(1f - y2 / 2f - z2 / 2f + y2 * z2 / 3f);
|
||||
v.y = v2.y * Mathf.Sqrt(1f - x2 / 2f - z2 / 2f + x2 * z2 / 3f);
|
||||
v.z = v2.z * Mathf.Sqrt(1f - x2 / 2f - y2 / 2f + x2 * y2 / 3f);
|
||||
|
||||
float latitude = (Mathf.Rad2Deg * Mathf.Acos(v.z / Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z))) % 180f;
|
||||
float longitude = (Mathf.Rad2Deg * (v.x > 0 ? Mathf.Atan(v.y / v.x) : Mathf.Atan(v.y / v.x) + Mathf.PI) + 90f) % 360f;
|
||||
|
||||
float sampleX = heightMap.width * longitude / 360f;
|
||||
float sampleY = heightMap.height * latitude / 180f;
|
||||
|
||||
float relativeHeight = heightMap.GetPixel((int)sampleX, (int)sampleY).r;
|
||||
|
||||
normals[i] = v.normalized;
|
||||
vertices[i] = normals[i] * (relativeHeight * (maxHeight - minHeight) + minHeight);
|
||||
uvs[i] = new Vector2(sampleX / (float)heightMap.width, sampleY / (float)heightMap.height);
|
||||
}
|
||||
|
||||
private static void CreateTriangles(Mesh mesh, int resolution)
|
||||
{
|
||||
int quads = resolution * resolution * 6;
|
||||
int[] triangles = new int[quads * 6];
|
||||
int ring = resolution * 4;
|
||||
int t = 0, v = 0;
|
||||
|
||||
for (int y = 0; y < resolution; y++, v++)
|
||||
{
|
||||
for (int q = 0; q < ring - 1; q++, v++)
|
||||
{
|
||||
t = SetQuad(triangles, t, v, v + 1, v + ring, v + ring + 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, v, v - ring + 1, v + ring, v + 1);
|
||||
}
|
||||
|
||||
t = CreateTopFace(resolution, triangles, t, ring);
|
||||
t = CreateBottomFace(resolution, triangles, t, ring, mesh.vertices.Length);
|
||||
|
||||
mesh.triangles = triangles;
|
||||
}
|
||||
|
||||
private static int CreateTopFace(int resolution, int[] triangles, int t, int ring)
|
||||
{
|
||||
int v = ring * resolution;
|
||||
for (int x = 0; x < resolution - 1; x++, v++)
|
||||
{
|
||||
t = SetQuad(triangles, t, v, v + 1, v + ring - 1, v + ring);
|
||||
}
|
||||
t = SetQuad(triangles, t, v, v + 1, v + ring - 1, v + 2);
|
||||
|
||||
int vMin = ring * (resolution + 1) - 1;
|
||||
int vMid = vMin + 1;
|
||||
int vMax = v + 2;
|
||||
|
||||
for (int z = 1; z < resolution - 1; z++, vMin--, vMid++, vMax++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vMin, vMid, vMin - 1, vMid + resolution - 1);
|
||||
for (int x = 1; x < resolution - 1; x++, vMid++)
|
||||
{
|
||||
t = SetQuad(
|
||||
triangles, t,
|
||||
vMid, vMid + 1, vMid + resolution - 1, vMid + resolution);
|
||||
}
|
||||
t = SetQuad(triangles, t, vMid, vMax, vMid + resolution - 1, vMax + 1);
|
||||
}
|
||||
int vTop = vMin - 2;
|
||||
t = SetQuad(triangles, t, vMin, vMid, vTop + 1, vTop);
|
||||
for (int x = 1; x < resolution - 1; x++, vTop--, vMid++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vMid, vMid + 1, vTop, vTop - 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, vMid, vTop - 2, vTop, vTop - 1);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
private static int CreateBottomFace(int resolution, int[] triangles, int t, int ring, int numVertices)
|
||||
{
|
||||
int v = 1;
|
||||
int vMid = numVertices - (resolution - 1) * (resolution - 1);
|
||||
t = SetQuad(triangles, t, ring - 1, vMid, 0, 1);
|
||||
for (int x = 1; x < resolution - 1; x++, v++, vMid++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vMid, vMid + 1, v, v + 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, vMid, v + 2, v, v + 1);
|
||||
|
||||
int vMin = ring - 2;
|
||||
vMid -= resolution - 2;
|
||||
int vMax = v + 2;
|
||||
|
||||
for (int z = 1; z < resolution - 1; z++, vMin--, vMid++, vMax++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vMin, vMid + resolution - 1, vMin + 1, vMid);
|
||||
for (int x = 1; x < resolution - 1; x++, vMid++)
|
||||
{
|
||||
t = SetQuad(
|
||||
triangles, t,
|
||||
vMid + resolution - 1, vMid + resolution, vMid, vMid + 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, vMid + resolution - 1, vMax + 1, vMid, vMax);
|
||||
}
|
||||
|
||||
int vTop = vMin - 1;
|
||||
t = SetQuad(triangles, t, vTop + 1, vTop, vTop + 2, vMid);
|
||||
for (int x = 1; x < resolution - 1; x++, vTop--, vMid++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vTop, vTop - 1, vMid, vMid + 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, vTop, vTop - 1, vMid, vTop - 2);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
private static int SetQuad(int[] triangles, int i, int v00, int v10, int v01, int v11)
|
||||
{
|
||||
triangles[i] = v00;
|
||||
triangles[i + 1] = triangles[i + 4] = v01;
|
||||
triangles[i + 2] = triangles[i + 3] = v10;
|
||||
triangles[i + 5] = v11;
|
||||
return i + 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
172
NewHorizons/Body/Geometry/Icosphere.cs
Normal file
@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Body.Geometry
|
||||
{
|
||||
static class Icosphere
|
||||
{
|
||||
private static readonly float t = (1f + Mathf.Sqrt(5f)) / 2f;
|
||||
// By subdivisions, will add to this to memoize computation of icospheres
|
||||
private static List<Vector3[]> vertices = new List<Vector3[]>()
|
||||
{
|
||||
new Vector3[]
|
||||
{
|
||||
new Vector3(-1, t, 0).normalized,
|
||||
new Vector3( 1, t, 0).normalized,
|
||||
new Vector3(-1, -t, 0).normalized,
|
||||
new Vector3( 1, -t, 0).normalized,
|
||||
new Vector3( 0, -1, t).normalized,
|
||||
new Vector3( 0, 1, t).normalized,
|
||||
new Vector3( 0, -1, -t).normalized,
|
||||
new Vector3( 0, 1, -t).normalized,
|
||||
new Vector3( t, 0, -1).normalized,
|
||||
new Vector3( t, 0, 1).normalized,
|
||||
new Vector3(-t, 0, -1).normalized,
|
||||
new Vector3(-t, 0, 1).normalized,
|
||||
}
|
||||
};
|
||||
private static List<int[]> triangles = new List<int[]>()
|
||||
{
|
||||
new int[]
|
||||
{
|
||||
0, 11, 5,
|
||||
0, 5, 1,
|
||||
0, 1, 7,
|
||||
0, 7, 10,
|
||||
0, 10, 11,
|
||||
|
||||
1, 5, 9,
|
||||
5, 11, 4,
|
||||
11, 10, 2,
|
||||
10, 7, 6,
|
||||
7, 1, 8,
|
||||
|
||||
3, 9, 4,
|
||||
3, 4, 2,
|
||||
3, 2, 6,
|
||||
3, 6, 8,
|
||||
3, 8, 9,
|
||||
|
||||
4, 9, 5,
|
||||
2, 4, 11,
|
||||
6, 2, 10,
|
||||
8, 6, 7,
|
||||
9, 8, 1
|
||||
}
|
||||
};
|
||||
|
||||
public static Mesh Build(int subdivisions, Texture2D heightMap, float minHeight, float maxHeight)
|
||||
{
|
||||
Mesh mesh = new Mesh();
|
||||
|
||||
if (vertices.Count <= subdivisions)
|
||||
RefineFaces(subdivisions);
|
||||
|
||||
var verticesToCopy = vertices[subdivisions];
|
||||
|
||||
Vector3[] newVertices = new Vector3[verticesToCopy.Length];
|
||||
Vector3[] normals = new Vector3[verticesToCopy.Length];
|
||||
Vector2[] uvs = new Vector2[verticesToCopy.Length];
|
||||
|
||||
for(int i = 0; i < verticesToCopy.Length; i++)
|
||||
{
|
||||
var v = verticesToCopy[i];
|
||||
|
||||
float latitude = (Mathf.Rad2Deg * Mathf.Acos(v.z / Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z))) % 180f;
|
||||
float longitude = (Mathf.Rad2Deg * (v.x > 0 ? Mathf.Atan(v.y / v.x) : Mathf.Atan(v.y / v.x) + Mathf.PI) + 90f) % 360f;
|
||||
|
||||
float sampleX = heightMap.width * longitude / 360f;
|
||||
float sampleY = heightMap.height * latitude / 180f;
|
||||
|
||||
float height = heightMap.GetPixel((int)sampleX, (int)sampleY).r * (maxHeight - minHeight) + minHeight;
|
||||
|
||||
newVertices[i] = verticesToCopy[i] * height;
|
||||
normals[i] = v.normalized;
|
||||
uvs[i] = new Vector2(sampleX / (float)heightMap.width, sampleY / (float)heightMap.height);
|
||||
}
|
||||
|
||||
mesh.vertices = newVertices;
|
||||
mesh.triangles = triangles[subdivisions];
|
||||
mesh.normals = normals;
|
||||
mesh.uv = uvs;
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
private static void RefineFaces(int level)
|
||||
{
|
||||
if (level < vertices.Count) return;
|
||||
|
||||
for(int i = vertices.Count - 1; i < level; i++)
|
||||
{
|
||||
// Each triangle will be subdivided into 4 new ones
|
||||
int[] oldTriangles = triangles[i];
|
||||
int[] newTriangles = new int[oldTriangles.Length * 4];
|
||||
|
||||
// Making too many vertices but its fine I guess. Three per old triangle.
|
||||
Vector3[] oldVertices = vertices[i];
|
||||
Vector3[] newVertices = new Vector3[oldVertices.Length + oldTriangles.Length];
|
||||
Array.Copy(oldVertices, newVertices, oldVertices.Length);
|
||||
|
||||
int v = oldVertices.Length;
|
||||
int newTrianglesIndex = 0;
|
||||
for(int j = 0; j < oldTriangles.Length; j+=3, v+=3)
|
||||
{
|
||||
// Old vertex indices
|
||||
var v0Ind = oldTriangles[j];
|
||||
var v1Ind = oldTriangles[j + 1];
|
||||
var v2Ind = oldTriangles[j + 2];
|
||||
|
||||
// Old vertices
|
||||
var v0 = oldVertices[v0Ind];
|
||||
var v1 = oldVertices[v1Ind];
|
||||
var v2 = oldVertices[v2Ind];
|
||||
|
||||
// New vertex indices
|
||||
var aInd = v;
|
||||
var bInd = v + 1;
|
||||
var cInd = v + 2;
|
||||
|
||||
// New vertices
|
||||
var a = GetMidPoint(v0, v1);
|
||||
var b = GetMidPoint(v1, v2);
|
||||
var c = GetMidPoint(v2, v0);
|
||||
|
||||
// Add the three new vertices to the vertex list
|
||||
newVertices[aInd] = a;
|
||||
newVertices[bInd] = b;
|
||||
newVertices[cInd] = c;
|
||||
|
||||
// Add the four triangles
|
||||
newTriangles[newTrianglesIndex++] = v0Ind;
|
||||
newTriangles[newTrianglesIndex++] = aInd;
|
||||
newTriangles[newTrianglesIndex++] = cInd;
|
||||
|
||||
newTriangles[newTrianglesIndex++] = v1Ind;
|
||||
newTriangles[newTrianglesIndex++] = bInd;
|
||||
newTriangles[newTrianglesIndex++] = aInd;
|
||||
|
||||
newTriangles[newTrianglesIndex++] = v2Ind;
|
||||
newTriangles[newTrianglesIndex++] = cInd;
|
||||
newTriangles[newTrianglesIndex++] = bInd;
|
||||
|
||||
newTriangles[newTrianglesIndex++] = aInd;
|
||||
newTriangles[newTrianglesIndex++] = bInd;
|
||||
newTriangles[newTrianglesIndex++] = cInd;
|
||||
}
|
||||
|
||||
vertices.Add(newVertices);
|
||||
triangles.Add(newTriangles);
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector3 GetMidPoint(Vector3 a, Vector3 b)
|
||||
{
|
||||
return ((a + b) / 2f).normalized;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,12 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.Body.Geometry;
|
||||
using NewHorizons.External;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Body
|
||||
{
|
||||
@ -12,206 +14,51 @@ namespace NewHorizons.Body
|
||||
{
|
||||
public static void Make(GameObject go, HeightMapModule module)
|
||||
{
|
||||
Texture2D heightMap = Main.Instance.ModHelper.Assets.GetTexture(module.HeightMap);
|
||||
Texture2D heightMap, textureMap;
|
||||
try
|
||||
{
|
||||
heightMap = Main.Instance.CurrentAssets.GetTexture(module.HeightMap);
|
||||
textureMap = Main.Instance.CurrentAssets.GetTexture(module.TextureMap);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load HeightMap textures, {e.Message}, {e.StackTrace}");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
GameObject cubeSphere = new GameObject("CubeSphere");
|
||||
cubeSphere.transform.parent = go.transform;
|
||||
cubeSphere.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||
|
||||
cubeSphere.AddComponent<MeshFilter>();
|
||||
var mesh = cubeSphere.GetComponent<MeshFilter>().mesh;
|
||||
mesh.name = "CubeSphere";
|
||||
Mesh mesh = CubeSphere.Build(100, heightMap, module.MinHeight, module.MaxHeight);
|
||||
|
||||
CreateVertices(mesh, 100, heightMap, module.MinHeight, module.MaxHeight);
|
||||
CreateTriangles(mesh, 100);
|
||||
cubeSphere.AddComponent<MeshFilter>();
|
||||
cubeSphere.GetComponent<MeshFilter>().mesh = mesh;
|
||||
|
||||
var cubeSphereMR = cubeSphere.AddComponent<MeshRenderer>();
|
||||
cubeSphereMR.material = new Material(Shader.Find("Standard"));
|
||||
cubeSphereMR.material.mainTexture = Main.Instance.ModHelper.Assets.GetTexture(module.TextureMap);
|
||||
cubeSphereMR.material.mainTexture = textureMap;
|
||||
|
||||
var cubeSphereMC = cubeSphere.AddComponent<MeshCollider>();
|
||||
cubeSphereMC.sharedMesh = mesh;
|
||||
}
|
||||
*/
|
||||
|
||||
// Thank you Catlikecoding
|
||||
private static void CreateVertices(Mesh mesh, int resolution, Texture2D heightMap, float minHeight, float maxHeight)
|
||||
{
|
||||
int cornerVertices = 8;
|
||||
int edgeVertices = (3 * resolution - 3) * 4;
|
||||
int faceVertices = (6 * (resolution - 1) * (resolution - 1));
|
||||
GameObject icosphere = new GameObject("Icosphere");
|
||||
icosphere.transform.parent = go.transform;
|
||||
icosphere.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||
|
||||
Vector3[] vertices = new Vector3[cornerVertices + edgeVertices + faceVertices];
|
||||
Vector3[] normals = new Vector3[vertices.Length];
|
||||
Vector2[] uvs = new Vector2[vertices.Length];
|
||||
Mesh mesh = Icosphere.Build(5, heightMap, module.MinHeight, module.MaxHeight);
|
||||
|
||||
int v = 0;
|
||||
for (int y = 0; y <= resolution; y++)
|
||||
{
|
||||
for (int x = 0; x <= resolution; x++)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, x, y, 0, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
for (int z = 1; z <= resolution; z++)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, resolution, y, z, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
for (int x = resolution - 1; x >= 0; x--)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, x, y, resolution, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
for (int z = resolution - 1; z > 0; z--)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, 0, y, z, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
}
|
||||
icosphere.AddComponent<MeshFilter>();
|
||||
icosphere.GetComponent<MeshFilter>().mesh = mesh;
|
||||
|
||||
for (int z = 1; z < resolution; z++)
|
||||
{
|
||||
for (int x = 1; x < resolution; x++)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, x, resolution, z, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
}
|
||||
for (int z = 1; z < resolution; z++)
|
||||
{
|
||||
for (int x = 1; x < resolution; x++)
|
||||
{
|
||||
SetVertex(vertices, normals, uvs, v++, x, 0, z, resolution, heightMap, minHeight, maxHeight);
|
||||
}
|
||||
}
|
||||
var cubeSphereMR = icosphere.AddComponent<MeshRenderer>();
|
||||
cubeSphereMR.material = new Material(Shader.Find("Standard"));
|
||||
cubeSphereMR.material.mainTexture = textureMap;
|
||||
|
||||
mesh.vertices = vertices;
|
||||
mesh.normals = normals;
|
||||
mesh.uv = uvs;
|
||||
}
|
||||
|
||||
private static void SetVertex(Vector3[] vertices, Vector3[] normals, Vector2[] uvs, int i, int x, int y, int z, int resolution, Texture2D heightMap, float minHeight, float maxHeight)
|
||||
{
|
||||
var v = ((new Vector3(x, y, z) / (float)resolution) - (Vector3.one * 0.5f)).normalized;
|
||||
|
||||
float x2 = v.x * v.x;
|
||||
float y2 = v.y * v.y;
|
||||
float z2 = v.z * v.z;
|
||||
Vector3 s;
|
||||
s.x = v.x * Mathf.Sqrt(1f - y2 / 2f - z2 / 2f + y2 * z2 / 3f);
|
||||
s.y = v.y * Mathf.Sqrt(1f - x2 / 2f - z2 / 2f + x2 * z2 / 3f);
|
||||
s.z = v.z * Mathf.Sqrt(1f - x2 / 2f - y2 / 2f + x2 * y2 / 3f);
|
||||
|
||||
var latitude = (Mathf.Rad2Deg * Mathf.Acos(v.z / Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z))) % 180f;
|
||||
var longitude = (Mathf.Rad2Deg * (v.x > 0 ? Mathf.Atan(v.y / v.x) : Mathf.Atan(v.y / v.x) + Mathf.PI) + 90) % 360f;
|
||||
|
||||
var sampleX = heightMap.width * longitude / 360f;
|
||||
var sampleY = heightMap.height * latitude / 180f;
|
||||
|
||||
var relativeHeight = heightMap.GetPixel((int)sampleX, (int)sampleY).r;
|
||||
|
||||
normals[i] = s.normalized;
|
||||
vertices[i] = normals[i] * (relativeHeight * (maxHeight - minHeight) + minHeight);
|
||||
uvs[i] = new Vector2(sampleX / (float)heightMap.width, sampleY / (float)heightMap.height);
|
||||
}
|
||||
|
||||
private static void CreateTriangles(Mesh mesh, int resolution)
|
||||
{
|
||||
int quads = resolution * resolution * 6;
|
||||
int[] triangles = new int[quads * 6];
|
||||
int ring = resolution * 4;
|
||||
int t = 0, v = 0;
|
||||
|
||||
for (int y = 0; y < resolution; y++, v++)
|
||||
{
|
||||
for (int q = 0; q < ring - 1; q++, v++)
|
||||
{
|
||||
t = SetQuad(triangles, t, v, v + 1, v + ring, v + ring + 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, v, v - ring + 1, v + ring, v + 1);
|
||||
}
|
||||
|
||||
t = CreateTopFace(resolution, triangles, t, ring);
|
||||
t = CreateBottomFace(resolution, triangles, t, ring, mesh.vertices.Length);
|
||||
|
||||
mesh.triangles = triangles;
|
||||
}
|
||||
|
||||
private static int CreateTopFace(int resolution, int[] triangles, int t, int ring)
|
||||
{
|
||||
int v = ring * resolution;
|
||||
for (int x = 0; x < resolution - 1; x++, v++)
|
||||
{
|
||||
t = SetQuad(triangles, t, v, v + 1, v + ring - 1, v + ring);
|
||||
}
|
||||
t = SetQuad(triangles, t, v, v + 1, v + ring - 1, v + 2);
|
||||
|
||||
int vMin = ring * (resolution + 1) - 1;
|
||||
int vMid = vMin + 1;
|
||||
int vMax = v + 2;
|
||||
|
||||
for (int z = 1; z < resolution - 1; z++, vMin--, vMid++, vMax++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vMin, vMid, vMin - 1, vMid + resolution - 1);
|
||||
for (int x = 1; x < resolution - 1; x++, vMid++)
|
||||
{
|
||||
t = SetQuad(
|
||||
triangles, t,
|
||||
vMid, vMid + 1, vMid + resolution - 1, vMid + resolution);
|
||||
}
|
||||
t = SetQuad(triangles, t, vMid, vMax, vMid + resolution - 1, vMax + 1);
|
||||
}
|
||||
int vTop = vMin - 2;
|
||||
t = SetQuad(triangles, t, vMin, vMid, vTop + 1, vTop);
|
||||
for (int x = 1; x < resolution - 1; x++, vTop--, vMid++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vMid, vMid + 1, vTop, vTop - 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, vMid, vTop - 2, vTop, vTop - 1);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
private static int CreateBottomFace(int resolution, int[] triangles, int t, int ring, int numVertices)
|
||||
{
|
||||
int v = 1;
|
||||
int vMid = numVertices - (resolution - 1) * (resolution - 1);
|
||||
t = SetQuad(triangles, t, ring - 1, vMid, 0, 1);
|
||||
for (int x = 1; x < resolution - 1; x++, v++, vMid++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vMid, vMid + 1, v, v + 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, vMid, v + 2, v, v + 1);
|
||||
|
||||
int vMin = ring - 2;
|
||||
vMid -= resolution - 2;
|
||||
int vMax = v + 2;
|
||||
|
||||
for (int z = 1; z < resolution - 1; z++, vMin--, vMid++, vMax++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vMin, vMid + resolution - 1, vMin + 1, vMid);
|
||||
for (int x = 1; x < resolution - 1; x++, vMid++)
|
||||
{
|
||||
t = SetQuad(
|
||||
triangles, t,
|
||||
vMid + resolution - 1, vMid + resolution, vMid, vMid + 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, vMid + resolution - 1, vMax + 1, vMid, vMax);
|
||||
}
|
||||
|
||||
int vTop = vMin - 1;
|
||||
t = SetQuad(triangles, t, vTop + 1, vTop, vTop + 2, vMid);
|
||||
for (int x = 1; x < resolution - 1; x++, vTop--, vMid++)
|
||||
{
|
||||
t = SetQuad(triangles, t, vTop, vTop - 1, vMid, vMid + 1);
|
||||
}
|
||||
t = SetQuad(triangles, t, vTop, vTop - 1, vMid, vTop - 2);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
private static int SetQuad(int[] triangles, int i, int v00, int v10, int v01, int v11)
|
||||
{
|
||||
triangles[i] = v00;
|
||||
triangles[i + 1] = triangles[i + 4] = v01;
|
||||
triangles[i + 2] = triangles[i + 3] = v10;
|
||||
triangles[i + 5] = v11;
|
||||
return i + 6;
|
||||
var cubeSphereMC = icosphere.AddComponent<MeshCollider>();
|
||||
cubeSphereMC.sharedMesh = mesh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,12 +11,20 @@ namespace NewHorizons.General
|
||||
{
|
||||
static class RingBuilder
|
||||
{
|
||||
public static Material RingMaterial;
|
||||
public static Shader RingShader;
|
||||
|
||||
public static void Make(GameObject body, RingModule ring)
|
||||
{
|
||||
var ringGO = new GameObject("Ring");
|
||||
Texture2D ringTexture;
|
||||
try
|
||||
{
|
||||
ringTexture = Main.Instance.CurrentAssets.GetTexture(ring.Texture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load Ring texture, {e.Message}, {e.StackTrace}");
|
||||
return;
|
||||
}
|
||||
|
||||
var ringGO = new GameObject("Ring");
|
||||
ringGO.transform.parent = body.transform;
|
||||
ringGO.transform.localPosition = Vector3.zero;
|
||||
ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.up), ring.LongitudeOfAscendingNode);
|
||||
@ -25,20 +33,13 @@ namespace NewHorizons.General
|
||||
var ringMF = ringGO.AddComponent<MeshFilter>();
|
||||
var ringMesh = ringMF.mesh;
|
||||
var ringMR = ringGO.AddComponent<MeshRenderer>();
|
||||
var texture = Main.Instance.ModHelper.Assets.GetTexture(ring.Texture ?? "assets/default_rings.png");
|
||||
var texture = ringTexture;
|
||||
|
||||
//if (RingMaterial == null) RingMaterial = Main.bundle.LoadAsset<Material>("Assets/Ring.mat");
|
||||
//if (RingShader == null) RingShader = Main.bundle.LoadAsset<Shader>("Assets/Ring.shader");
|
||||
|
||||
var mat = new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply"));
|
||||
mat.mainTexture = texture;
|
||||
mat.renderQueue = 3000;
|
||||
ringMR.material = mat;
|
||||
|
||||
//ringMR.material = new Material(RingMaterial);
|
||||
//ringMR.material.shader = RingShader;
|
||||
//ringMR.material.mainTexture = texture;
|
||||
|
||||
// Make mesh
|
||||
var segments = (int)Math.Max(20, ring.OuterRadius);
|
||||
BuildRingMesh(ringMesh, segments, ring.InnerRadius, ring.OuterRadius);
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Components
|
||||
{
|
||||
public class RotateToCustomAstroObject : RotateToPoint
|
||||
{
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (this._quaternionTargetMode)
|
||||
{
|
||||
this._hasTargetLock = base.CheckLockedOn();
|
||||
this.IncrementalRotate(Time.fixedDeltaTime);
|
||||
return;
|
||||
}
|
||||
if (this._astroObjectLock == AstroObject.Name.None)
|
||||
{
|
||||
this._hasTargetLock = false;
|
||||
return;
|
||||
}
|
||||
AstroObject astroObject = Locator.GetAstroObject(this._astroObjectLock);
|
||||
if (astroObject == null)
|
||||
{
|
||||
this._hasTargetLock = false;
|
||||
return;
|
||||
}
|
||||
this._target = astroObject.transform.position;
|
||||
this._hasTargetLock = base.CheckLockedOn();
|
||||
this.IncrementalRotate(Time.fixedDeltaTime);
|
||||
}
|
||||
|
||||
public void SetNewAstroTarget(AstroObject.Name name, string customName, bool resetRampUp)
|
||||
{
|
||||
if (resetRampUp)
|
||||
{
|
||||
base.ResetRotationSpeed(resetRampUp);
|
||||
}
|
||||
_astroObjectLock = name;
|
||||
_astroObjectCustomName = customName;
|
||||
}
|
||||
|
||||
private AstroObject.Name _astroObjectLock;
|
||||
private string _astroObjectCustomName;
|
||||
}
|
||||
}
|
||||
2
NewHorizons/External/AtmosphereModule.cs
vendored
@ -19,5 +19,7 @@ namespace NewHorizons.External
|
||||
public float FogSize { get; set; }
|
||||
public bool HasRain { get; set; }
|
||||
public bool HasSnow { get; set; }
|
||||
public bool HasOxygen { get; set; }
|
||||
public bool hasAtmosphere { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
2
NewHorizons/External/BaseModule.cs
vendored
@ -10,7 +10,7 @@ namespace NewHorizons.External
|
||||
public class BaseModule : Module
|
||||
{
|
||||
public bool HasMapMarker { get; set; }
|
||||
public MColor32 LightTint { get; set; }
|
||||
public bool HasAmbientLight { get; set; }
|
||||
public float SurfaceGravity { get; set; }
|
||||
public float SurfaceSize { get; set; }
|
||||
public float WaterSize { get; set; }
|
||||
|
||||
1
NewHorizons/External/SpawnModule.cs
vendored
@ -11,5 +11,6 @@ namespace NewHorizons.External
|
||||
{
|
||||
public MVector3 PlayerSpawnPoint { get; set; }
|
||||
public MVector3 ShipSpawnPoint { get; set; }
|
||||
public bool StartWithSuit { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Utils;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
@ -7,26 +8,18 @@ namespace NewHorizons.General
|
||||
{
|
||||
static class AmbientLightBuilder
|
||||
{
|
||||
public static void Make(GameObject body, Sector sector, MColor32 lightTint, float scale)
|
||||
public static void Make(GameObject body, float scale)
|
||||
{
|
||||
GameObject lightGO = new GameObject("Lights");
|
||||
lightGO.SetActive(false);
|
||||
lightGO.transform.parent = body.transform;
|
||||
GameObject lightGO = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/AmbientLight_BH_Surface"), body.transform);
|
||||
lightGO.transform.localPosition = Vector3.zero;
|
||||
lightGO.name = "Light";
|
||||
|
||||
var light = lightGO.GetComponent<Light>();
|
||||
light.name = "AmbientLight";
|
||||
light.color = new Color(0.5f, 1f, 1f, 0.0225f);
|
||||
light.range = scale;
|
||||
light.intensity = 0.5f;
|
||||
|
||||
Light L = lightGO.AddComponent<Light>();
|
||||
L.type = LightType.Point;
|
||||
L.range = scale + 10;
|
||||
L.color = (lightTint != null) ? lightTint.ToColor32() : (Color32)Color.black;
|
||||
L.intensity = 0.8f;
|
||||
L.shadows = LightShadows.None;
|
||||
|
||||
L.cookie = GameObject.Find("/GiantsDeep_Body/AmbientLight_GD").GetComponent<Light>().cookie;
|
||||
|
||||
SectorLightsCullGroup SLCG = lightGO.AddComponent<SectorLightsCullGroup>();
|
||||
SLCG.SetSector(sector);
|
||||
|
||||
lightGO.SetActive(true);
|
||||
|
||||
Logger.Log("Finished building ambient light", Logger.LogType.Log);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ namespace NewHorizons.General
|
||||
{
|
||||
static class SpawnPointBuilder
|
||||
{
|
||||
private static bool suitUpQueued = false;
|
||||
public static SpawnPoint Make(GameObject body, SpawnModule module, OWRigidbody rb)
|
||||
{
|
||||
SpawnPoint playerSpawn = null;
|
||||
@ -36,11 +37,51 @@ namespace NewHorizons.General
|
||||
var ship = GameObject.Find("Ship_Body");
|
||||
ship.transform.position = spawnPoint.transform.position;
|
||||
ship.transform.rotation = Quaternion.FromToRotation(Vector3.up, (spawnPoint.transform.position - body.transform.position).normalized);
|
||||
// Move it up a bit more
|
||||
ship.transform.position = ship.transform.position + ship.transform.TransformDirection(Vector3.up) * 5f;
|
||||
|
||||
ship.GetRequiredComponent<MatchInitialMotion>().SetBodyToMatch(rb);
|
||||
}
|
||||
if(module.StartWithSuit && !suitUpQueued)
|
||||
{
|
||||
suitUpQueued = true;
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => SuitUp(), 4);
|
||||
}
|
||||
|
||||
Logger.Log("Made spawnpoint on [" + body.name + "]");
|
||||
return playerSpawn;
|
||||
}
|
||||
|
||||
private static void SuitUp()
|
||||
{
|
||||
suitUpQueued = false;
|
||||
try
|
||||
{
|
||||
var spv = GameObject.Find("Ship_Body/Module_Supplies/Systems_Supplies/ExpeditionGear").GetComponent<SuitPickupVolume>();
|
||||
spv.SetValue("_containsSuit", false);
|
||||
|
||||
if (spv.GetValue<bool>("_allowSuitReturn"))
|
||||
spv.GetValue<MultipleInteractionVolume>("_interactVolume").ChangePrompt(UITextType.ReturnSuitPrompt, spv.GetValue<int>("_pickupSuitCommandIndex"));
|
||||
else
|
||||
spv.GetValue<MultipleInteractionVolume>("_interactVolume").EnableSingleInteraction(false, spv.GetValue<int>("_pickupSuitCommandIndex"));
|
||||
|
||||
Locator.GetPlayerTransform().GetComponent<PlayerSpacesuit>().SuitUp(false, true, true);
|
||||
|
||||
spv.SetValue("_timer", 0f);
|
||||
spv.SetValue("_index", 0);
|
||||
|
||||
GameObject suitGeometry = spv.GetValue<GameObject>("_suitGeometry");
|
||||
if (suitGeometry != null) suitGeometry.SetActive(false);
|
||||
|
||||
OWCollider suitOWCollider = spv.GetValue<OWCollider>("_suitOWCollider");
|
||||
if (suitOWCollider != null) suitOWCollider.SetActivation(false);
|
||||
|
||||
spv.enabled = true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.LogWarning($"Was unable to suit up player. {e.Message}, {e.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,10 +19,11 @@ namespace NewHorizons
|
||||
public class Main : ModBehaviour
|
||||
{
|
||||
public static Main Instance { get; private set; }
|
||||
//public static AssetBundle bundle;
|
||||
|
||||
public static List<NewHorizonsBody> BodyList = new List<NewHorizonsBody>();
|
||||
|
||||
public IModAssets CurrentAssets { get; private set; }
|
||||
|
||||
public override object GetApi()
|
||||
{
|
||||
return new NewHorizonsApi();
|
||||
@ -35,32 +36,17 @@ namespace NewHorizons
|
||||
|
||||
Utility.Patches.Apply();
|
||||
|
||||
//bundle = ModHelper.Assets.LoadBundle("assets/new-horizons");
|
||||
|
||||
Logger.Log("Begin load of config files...", Logger.LogType.Log);
|
||||
|
||||
foreach (var file in Directory.GetFiles(ModHelper.Manifest.ModFolderPath + @"planets\"))
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = ModHelper.Storage.Load<PlanetConfig>(file.Replace(ModHelper.Manifest.ModFolderPath, ""));
|
||||
Logger.Log($"Loaded {config.Name}");
|
||||
BodyList.Add(new NewHorizonsBody(config));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load {file}: {e.Message}, {e.StackTrace}");
|
||||
}
|
||||
LoadConfigs(this);
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
Logger.LogWarning("Couldn't find planets folder");
|
||||
}
|
||||
|
||||
if (BodyList.Count != 0)
|
||||
{
|
||||
Logger.Log("Loaded [" + BodyList.Count + "] config files.", Logger.LogType.Log);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Log("No config files found!", Logger.LogType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
@ -78,8 +64,6 @@ namespace NewHorizons
|
||||
AstroObjectLocator.AddAstroObject(ao);
|
||||
}
|
||||
|
||||
//BodyList = BodyList.OrderBy(x => x.Config.Destroy).ToList();
|
||||
|
||||
foreach (var body in BodyList)
|
||||
{
|
||||
var stringID = body.Config.Name.ToUpper().Replace(" ", "_").Replace("'", "");
|
||||
@ -109,7 +93,7 @@ namespace NewHorizons
|
||||
{
|
||||
if (body.Config.Destroy)
|
||||
{
|
||||
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => RemoveBody(existingPlanet));
|
||||
Instance.ModHelper.Events.Unity.FireInNUpdates(() => RemoveBody(existingPlanet), 2);
|
||||
}
|
||||
else UpdateBody(body, existingPlanet);
|
||||
}
|
||||
@ -134,6 +118,25 @@ namespace NewHorizons
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadConfigs(IModBehaviour mod)
|
||||
{
|
||||
CurrentAssets = mod.ModHelper.Assets;
|
||||
var folder = mod.ModHelper.Manifest.ModFolderPath;
|
||||
foreach (var file in Directory.GetFiles(folder + @"planets\"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = mod.ModHelper.Storage.Load<PlanetConfig>(file.Replace(folder, ""));
|
||||
Logger.Log($"Loaded {config.Name}");
|
||||
BodyList.Add(new NewHorizonsBody(config));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load {file}: {e.Message}, {e.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static GameObject UpdateBody(NewHorizonsBody body, AstroObject ao)
|
||||
{
|
||||
Logger.Log($"Updating existing AstroObject {ao}");
|
||||
@ -157,7 +160,7 @@ namespace NewHorizons
|
||||
}
|
||||
if(body.Config.Atmosphere != null)
|
||||
{
|
||||
AirBuilder.Make(go, body.Config.Atmosphere.Size, body.Config.Atmosphere.HasRain);
|
||||
AirBuilder.Make(go, body.Config.Atmosphere.Size, body.Config.Atmosphere.HasRain, body.Config.Atmosphere.HasOxygen);
|
||||
|
||||
if (body.Config.Atmosphere.Cloud != null)
|
||||
{
|
||||
@ -171,7 +174,7 @@ namespace NewHorizons
|
||||
if (body.Config.Atmosphere.FogSize != 0)
|
||||
FogBuilder.Make(go, sector, body.Config.Atmosphere);
|
||||
|
||||
AtmosphereBuilder.Make(go, body.Config);
|
||||
AtmosphereBuilder.Make(go, body.Config.Atmosphere);
|
||||
}
|
||||
|
||||
return go;
|
||||
@ -250,6 +253,10 @@ namespace NewHorizons
|
||||
GameObject.Find("WhiteholeStation_Body").SetActive(false);
|
||||
GameObject.Find("WhiteholeStationSuperstructure_Body").SetActive(false);
|
||||
}
|
||||
if(ao.GetAstroObjectName() == AstroObject.Name.TimberHearth)
|
||||
{
|
||||
GameObject.Find("MiningRig_Body").SetActive(false);
|
||||
}
|
||||
|
||||
// Deal with proxies
|
||||
foreach(var p in GameObject.FindObjectsOfType<ProxyOrbiter>())
|
||||
@ -329,7 +336,7 @@ namespace NewHorizons
|
||||
// These can be shared between creating new planets and updating planets
|
||||
if (body.Config.Atmosphere != null)
|
||||
{
|
||||
AirBuilder.Make(go, body.Config.Atmosphere.Size, body.Config.Atmosphere.HasRain);
|
||||
AirBuilder.Make(go, body.Config.Atmosphere.Size, body.Config.Atmosphere.HasRain, body.Config.Atmosphere.HasOxygen);
|
||||
|
||||
if (body.Config.Atmosphere.Cloud != null)
|
||||
{
|
||||
@ -343,11 +350,9 @@ namespace NewHorizons
|
||||
if (body.Config.Atmosphere.FogSize != 0)
|
||||
FogBuilder.Make(go, sector, body.Config.Atmosphere);
|
||||
|
||||
AtmosphereBuilder.Make(go, body.Config);
|
||||
AtmosphereBuilder.Make(go, body.Config.Atmosphere);
|
||||
}
|
||||
|
||||
AmbientLightBuilder.Make(go, sector, body.Config.Base.LightTint, sphereOfInfluence);
|
||||
|
||||
if (body.Config.Ring != null)
|
||||
RingBuilder.Make(go, body.Config.Ring);
|
||||
|
||||
@ -360,10 +365,14 @@ namespace NewHorizons
|
||||
if (body.Config.Base.WaterSize != 0)
|
||||
WaterBuilder.Make(go, sector, rb, body.Config.Base.WaterSize);
|
||||
|
||||
if (body.Config.Base.HasAmbientLight)
|
||||
AmbientLightBuilder.Make(go, sphereOfInfluence);
|
||||
|
||||
Logger.Log("Generation of [" + body.Config.Name + "] completed.", Logger.LogType.Log);
|
||||
|
||||
body.Object = go;
|
||||
|
||||
// Some things have to be done the second tick
|
||||
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => OrbitlineBuilder.Make(body.Object, ao, body.Config.Orbit.IsMoon));
|
||||
|
||||
go.transform.parent = Locator.GetRootTransform();
|
||||
@ -390,8 +399,11 @@ namespace NewHorizons
|
||||
var body = new NewHorizonsBody(planetConfig);
|
||||
|
||||
Main.BodyList.Add(body);
|
||||
}
|
||||
|
||||
//Main.helper.Events.Unity.RunWhen(() => Locator.GetCenterOfTheUniverse() != null, () => Main.CreateBody(body));
|
||||
public void LoadConfigs(IModBehaviour mod)
|
||||
{
|
||||
Main.Instance.LoadConfigs(mod);
|
||||
}
|
||||
|
||||
public GameObject GetPlanet(string name)
|
||||
|
||||
@ -230,8 +230,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Atmosphere\FogBuilder.cs" />
|
||||
<Compile Include="Body\Geometry\CubeSphere.cs" />
|
||||
<Compile Include="Body\Geometry\Icosphere.cs" />
|
||||
<Compile Include="Body\HeightMapBuilder.cs" />
|
||||
<Compile Include="Components\RotateToCustomAstroObject.cs" />
|
||||
<Compile Include="External\AtmosphereModule.cs" />
|
||||
<Compile Include="External\BaseModule.cs" />
|
||||
<Compile Include="External\HeightMapModule.cs" />
|
||||
|
||||
@ -29,7 +29,7 @@ namespace NewHorizons.Utility
|
||||
var direction = Locator.GetActiveCamera().transform.TransformDirection(Vector3.forward);
|
||||
if (Physics.Raycast(origin, direction, out RaycastHit hitInfo, 100f, layerMask))
|
||||
{
|
||||
Logger.Log($"Raycast hit [{hitInfo.transform.localPosition}] on [{hitInfo.transform.gameObject.name}]");
|
||||
Logger.Log($"Raycast hit [{hitInfo.transform.InverseTransformPoint(hitInfo.point)}] on [{hitInfo.transform.gameObject.name}]");
|
||||
}
|
||||
_rb.EnableCollisionDetection();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 6.6 KiB |
@ -1,8 +1,8 @@
|
||||
{
|
||||
"filename": "NewHorizons.dll",
|
||||
"author": "xen",
|
||||
"name": "NewHorizons",
|
||||
"name": "New Horizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "0.1.0",
|
||||
"owmlVersion": "2.0.0"
|
||||
"owmlVersion": "2.1.0"
|
||||
}
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Ash Twin",
|
||||
"destroy" : true,
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 314 B |
|
Before Width: | Height: | Size: 7.9 MiB |
|
Before Width: | Height: | Size: 401 KiB |
|
Before Width: | Height: | Size: 9.0 MiB |
|
Before Width: | Height: | Size: 759 B |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 1014 B |
|
Before Width: | Height: | Size: 279 KiB |
|
Before Width: | Height: | Size: 2.8 MiB |
|
Before Width: | Height: | Size: 408 KiB |
|
Before Width: | Height: | Size: 12 MiB |
|
Before Width: | Height: | Size: 787 KiB |
|
Before Width: | Height: | Size: 329 B |
|
Before Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 3.2 MiB |
|
Before Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 267 B |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 581 KiB |
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Attlerock",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Brittle Hollow",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Dark Bramble",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
{
|
||||
"name" : "Earth",
|
||||
"Spawn" :
|
||||
{
|
||||
"playerSpawnPoint" :
|
||||
{
|
||||
"x" : -121.3,
|
||||
"y" : -246.4,
|
||||
"z" : 109.6,
|
||||
},
|
||||
"shipSpawnPoint" :
|
||||
{
|
||||
"x" : -141.5,
|
||||
"y" : -245.3,
|
||||
"z" : 89.0,
|
||||
},
|
||||
},
|
||||
"Base" :
|
||||
{
|
||||
"surfaceGravity" : 12,
|
||||
"surfaceSize" : 300,
|
||||
"hasMapMarker" : true,
|
||||
"lightTint" :
|
||||
{
|
||||
"r" : 200,
|
||||
"g" : 240,
|
||||
"b" : 255,
|
||||
"a" : 255
|
||||
},
|
||||
"waterSize" : 296
|
||||
},
|
||||
"Orbit" :
|
||||
{
|
||||
"semiMajorAxis" : 6000,
|
||||
"inclination" : 3,
|
||||
"primaryBody" : "SUN",
|
||||
"isMoon" : false,
|
||||
"longitudeOfAscendingNode" : 0,
|
||||
"eccentricity" : 0,
|
||||
"argumentOfPeriapsis": 0,
|
||||
"axialTilt" : 0,
|
||||
},
|
||||
"Atmosphere" :
|
||||
{
|
||||
"size" : 375,
|
||||
"fogTint" :
|
||||
{
|
||||
"r" : 90,
|
||||
"g" : 128,
|
||||
"b" : 128,
|
||||
"a" : 255
|
||||
},
|
||||
"fogDensity": 0.1,
|
||||
"fogSize": 375,
|
||||
},
|
||||
"HeightMap" :
|
||||
{
|
||||
"heightMap" : "planets/assets/earth_heightmap.png",
|
||||
"textureMap" : "planets/assets/earth_texturemap.png",
|
||||
"minHeight" : 292,
|
||||
"maxHeight" : 307,
|
||||
}
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Ember Twin",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Giant's Deep",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Hollow's Lantern",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Interloper",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
{
|
||||
"name" : "Jupiter",
|
||||
"Base" :
|
||||
{
|
||||
"surfaceGravity" : 20,
|
||||
"surfaceSize" : 300,
|
||||
"hasMapMarker" : true,
|
||||
"lightTint" :
|
||||
{
|
||||
"r" : 200,
|
||||
"g" : 240,
|
||||
"b" : 255,
|
||||
"a" : 255
|
||||
},
|
||||
},
|
||||
"Orbit" :
|
||||
{
|
||||
"semiMajorAxis" : 10000,
|
||||
"inclination" : 3,
|
||||
"primaryBody" : "SUN",
|
||||
"isMoon" : false,
|
||||
"longitudeOfAscendingNode" : 0,
|
||||
"eccentricity" : 0,
|
||||
"argumentOfPeriapsis": 0,
|
||||
"axialTilt" : 0,
|
||||
},
|
||||
"Atmosphere" :
|
||||
{
|
||||
"size" : 500,
|
||||
"cloudTint" :
|
||||
{
|
||||
"r" : 181,
|
||||
"g" : 181,
|
||||
"b" : 230,
|
||||
"a" : 255
|
||||
},
|
||||
"cloud" : "planets/assets/jupiter.png",
|
||||
"cloudCap" : "planets/assets/blank_cap.png",
|
||||
"cloudRamp" : "planets/assets/jupiter_ramp.png",
|
||||
"fogTint" :
|
||||
{
|
||||
"r" : 255,
|
||||
"g" : 128,
|
||||
"b" : 128,
|
||||
"a" : 255
|
||||
},
|
||||
"fogDensity": 0.9,
|
||||
"fogSize": 450,
|
||||
},
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Map Satellite",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
{
|
||||
"name" : "Mars",
|
||||
"Base" :
|
||||
{
|
||||
"surfaceGravity" : 8,
|
||||
"surfaceSize" : 200,
|
||||
"hasMapMarker" : true,
|
||||
"lightTint" :
|
||||
{
|
||||
"r" : 255,
|
||||
"g" : 200,
|
||||
"b" : 200,
|
||||
"a" : 255
|
||||
},
|
||||
},
|
||||
"Orbit" :
|
||||
{
|
||||
"semiMajorAxis" : 8000,
|
||||
"inclination" : 3,
|
||||
"primaryBody" : "SUN",
|
||||
"isMoon" : false,
|
||||
"longitudeOfAscendingNode" : 0,
|
||||
"eccentricity" : 0,
|
||||
"argumentOfPeriapsis": 0,
|
||||
"axialTilt" : 0,
|
||||
},
|
||||
"Atmosphere" :
|
||||
{
|
||||
"size" : 230,
|
||||
"fogTint" :
|
||||
{
|
||||
"r" : 90,
|
||||
"g" : 128,
|
||||
"b" : 128,
|
||||
"a" : 255
|
||||
},
|
||||
"fogDensity": 0.1,
|
||||
"fogSize": 200,
|
||||
},
|
||||
"HeightMap" :
|
||||
{
|
||||
"heightMap" : "planets/assets/mars_heightmap.png",
|
||||
"textureMap" : "planets/assets/mars_texturemap.png",
|
||||
"minHeight" : 200,
|
||||
"maxHeight" : 220,
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
{
|
||||
"name" : "Mercury",
|
||||
"Base" :
|
||||
{
|
||||
"surfaceGravity" : 12,
|
||||
"surfaceSize" : 200,
|
||||
"hasMapMarker" : true,
|
||||
"lightTint" :
|
||||
{
|
||||
"r" : 255,
|
||||
"g" : 200,
|
||||
"b" : 200,
|
||||
"a" : 255
|
||||
},
|
||||
},
|
||||
"Orbit" :
|
||||
{
|
||||
"semiMajorAxis" : 3000,
|
||||
"inclination" : 3,
|
||||
"primaryBody" : "SUN",
|
||||
"isMoon" : false,
|
||||
"longitudeOfAscendingNode" : 0,
|
||||
"eccentricity" : 0,
|
||||
"argumentOfPeriapsis": 0,
|
||||
"axialTilt" : 0,
|
||||
},
|
||||
"HeightMap" :
|
||||
{
|
||||
"heightMap" : "planets/assets/mercury_heightmap.png",
|
||||
"textureMap" : "planets/assets/mercury_texturemap.png",
|
||||
"minHeight" : 195,
|
||||
"maxHeight" : 205,
|
||||
}
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
{
|
||||
"name" : "Neptune",
|
||||
"Base" :
|
||||
{
|
||||
"surfaceGravity" : 20,
|
||||
"surfaceSize" : 300,
|
||||
"hasMapMarker" : true,
|
||||
"lightTint" :
|
||||
{
|
||||
"r" : 200,
|
||||
"g" : 240,
|
||||
"b" : 255,
|
||||
"a" : 255
|
||||
},
|
||||
},
|
||||
"Orbit" :
|
||||
{
|
||||
"semiMajorAxis" : 16000,
|
||||
"inclination" : 3,
|
||||
"primaryBody" : "SUN",
|
||||
"isMoon" : false,
|
||||
"longitudeOfAscendingNode" : 0,
|
||||
"eccentricity" : 0,
|
||||
"argumentOfPeriapsis": 0,
|
||||
"axialTilt" : 0,
|
||||
},
|
||||
"Atmosphere" :
|
||||
{
|
||||
"size" : 300,
|
||||
"cloudTint" :
|
||||
{
|
||||
"r" : 181,
|
||||
"g" : 181,
|
||||
"b" : 230,
|
||||
"a" : 255
|
||||
},
|
||||
"cloud" : "planets/assets/neptune.png",
|
||||
"cloudCap" : "planets/assets/blank_cap.png",
|
||||
"cloudRamp" : "planets/assets/neptune_ramp.png",
|
||||
"fogTint" :
|
||||
{
|
||||
"r" : 128,
|
||||
"g" : 128,
|
||||
"b" : 255,
|
||||
"a" : 255
|
||||
},
|
||||
"fogDensity": 0.9,
|
||||
"fogSize": 300,
|
||||
},
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Orbital Probe Cannon",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Quantum Moon",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
{
|
||||
"name" : "Saturn",
|
||||
"Base" :
|
||||
{
|
||||
"surfaceGravity" : 20,
|
||||
"surfaceSize" : 300,
|
||||
"hasMapMarker" : true,
|
||||
"lightTint" :
|
||||
{
|
||||
"r" : 200,
|
||||
"g" : 240,
|
||||
"b" : 255,
|
||||
"a" : 255
|
||||
},
|
||||
},
|
||||
"Orbit" :
|
||||
{
|
||||
"semiMajorAxis" : 12000,
|
||||
"inclination" : 3,
|
||||
"primaryBody" : "SUN",
|
||||
"isMoon" : false,
|
||||
"longitudeOfAscendingNode" : 0,
|
||||
"eccentricity" : 0,
|
||||
"argumentOfPeriapsis": 0,
|
||||
"axialTilt" : 0,
|
||||
},
|
||||
"Atmosphere" :
|
||||
{
|
||||
"size" : 400,
|
||||
"cloudTint" :
|
||||
{
|
||||
"r" : 181,
|
||||
"g" : 181,
|
||||
"b" : 230,
|
||||
"a" : 255
|
||||
},
|
||||
"cloud" : "planets/assets/saturn.png",
|
||||
"cloudCap" : "planets/assets/blank_cap.png",
|
||||
"cloudRamp" : "planets/assets/saturn_ramp.png",
|
||||
"fogTint" :
|
||||
{
|
||||
"r" : 255,
|
||||
"g" : 128,
|
||||
"b" : 128,
|
||||
"a" : 255
|
||||
},
|
||||
"fogDensity": 0.9,
|
||||
"fogSize": 400,
|
||||
},
|
||||
"Ring" :
|
||||
{
|
||||
"innerRadius" : 500,
|
||||
"outerRadius" : 950,
|
||||
"texture" : "planets/assets/saturn_rings.png",
|
||||
},
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Sun Station",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "Timber Hearth",
|
||||
"destroy" : true,
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
{
|
||||
"name" : "Uranus",
|
||||
"Base" :
|
||||
{
|
||||
"surfaceGravity" : 20,
|
||||
"surfaceSize" : 300,
|
||||
"hasMapMarker" : true,
|
||||
"lightTint" :
|
||||
{
|
||||
"r" : 200,
|
||||
"g" : 240,
|
||||
"b" : 255,
|
||||
"a" : 255
|
||||
},
|
||||
},
|
||||
"Orbit" :
|
||||
{
|
||||
"semiMajorAxis" : 14000,
|
||||
"inclination" : 3,
|
||||
"primaryBody" : "SUN",
|
||||
"isMoon" : false,
|
||||
"longitudeOfAscendingNode" : 0,
|
||||
"eccentricity" : 0,
|
||||
"argumentOfPeriapsis": 0,
|
||||
"axialTilt" : 0,
|
||||
},
|
||||
"Atmosphere" :
|
||||
{
|
||||
"size" : 300,
|
||||
"cloudTint" :
|
||||
{
|
||||
"r" : 181,
|
||||
"g" : 181,
|
||||
"b" : 230,
|
||||
"a" : 255
|
||||
},
|
||||
"cloud" : "planets/assets/uranus.png",
|
||||
"cloudCap" : "planets/assets/blank_cap.png",
|
||||
"cloudRamp" : "planets/assets/uranus_ramp.png",
|
||||
"fogTint" :
|
||||
{
|
||||
"r" : 128,
|
||||
"g" : 128,
|
||||
"b" : 255,
|
||||
"a" : 255
|
||||
},
|
||||
"fogDensity": 0.9,
|
||||
"fogSize": 300,
|
||||
},
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
{
|
||||
"name" : "Venus",
|
||||
"Base" :
|
||||
{
|
||||
"surfaceGravity" : 12,
|
||||
"surfaceSize" : 300,
|
||||
"hasMapMarker" : true,
|
||||
"lightTint" :
|
||||
{
|
||||
"r" : 255,
|
||||
"g" : 200,
|
||||
"b" : 200,
|
||||
"a" : 255
|
||||
},
|
||||
},
|
||||
"Orbit" :
|
||||
{
|
||||
"semiMajorAxis" : 4000,
|
||||
"inclination" : 3,
|
||||
"primaryBody" : "SUN",
|
||||
"isMoon" : false,
|
||||
"longitudeOfAscendingNode" : 0,
|
||||
"eccentricity" : 0,
|
||||
"argumentOfPeriapsis": 0,
|
||||
"axialTilt" : 0,
|
||||
},
|
||||
"Atmosphere" :
|
||||
{
|
||||
"size" : 350,
|
||||
"fogTint" :
|
||||
{
|
||||
"r" : 200,
|
||||
"g" : 128,
|
||||
"b" : 128,
|
||||
"a" : 255
|
||||
},
|
||||
"fogDensity": 0.9,
|
||||
"fogSize": 350,
|
||||
},
|
||||
"HeightMap" :
|
||||
{
|
||||
"heightMap" : "planets/assets/venus_heightmap.png",
|
||||
"textureMap" : "planets/assets/venus_texturemap.png",
|
||||
"minHeight" : 290,
|
||||
"maxHeight" : 310,
|
||||
}
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name" : "White Hole",
|
||||
"destroy" : true,
|
||||
}
|
||||