first commit
This commit is contained in:
6
NitroxModel-Subnautica/Helper/SubnauticaConstants.cs
Normal file
6
NitroxModel-Subnautica/Helper/SubnauticaConstants.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace NitroxModel_Subnautica.Helper;
|
||||
|
||||
public static class SubnauticaConstants
|
||||
{
|
||||
public const string LIGHTMAPPED_PREFAB_NAME = "__LIGHTMAPPED_PREFAB__";
|
||||
}
|
40
NitroxModel-Subnautica/Helper/SubnauticaMap.cs
Normal file
40
NitroxModel-Subnautica/Helper/SubnauticaMap.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
using NitroxModel.Helper;
|
||||
|
||||
namespace NitroxModel_Subnautica.Helper
|
||||
{
|
||||
/// <summary>
|
||||
/// Static information about the game world loaded by Subnautica that isn't (and shouldn't) be retrievable from the game directly.
|
||||
/// </summary>
|
||||
public class SubnauticaMap : IMap
|
||||
{
|
||||
private const int BATCH_SIZE = 160;
|
||||
private const int SKYBOX_METERS_ABOVE_WATER = 160;
|
||||
|
||||
/// <summary>
|
||||
/// TechType can't be introspected at runtime in RELEASE mode because its reflection info is elided.
|
||||
/// </summary>
|
||||
public static readonly List<NitroxTechType> GLOBAL_ROOT_TECH_TYPES = new List<NitroxTechType>
|
||||
{
|
||||
new NitroxTechType(nameof(TechType.Pipe)),
|
||||
new NitroxTechType(nameof(TechType.Constructor)),
|
||||
new NitroxTechType(nameof(TechType.Flare)),
|
||||
new NitroxTechType(nameof(TechType.Gravsphere)),
|
||||
new NitroxTechType(nameof(TechType.PipeSurfaceFloater)),
|
||||
new NitroxTechType(nameof(TechType.SmallStorage)),
|
||||
new NitroxTechType(nameof(TechType.CyclopsDecoy)),
|
||||
new NitroxTechType(nameof(TechType.LEDLight)),
|
||||
new NitroxTechType(nameof(TechType.Beacon))
|
||||
};
|
||||
|
||||
public int ItemLevelOfDetail => 3;
|
||||
public int BatchSize => 160;
|
||||
public NitroxInt3 BatchDimensions => new NitroxInt3(BatchSize, BatchSize, BatchSize);
|
||||
public NitroxInt3 DimensionsInMeters => new NitroxInt3(4096, 3200, 4096);
|
||||
public NitroxInt3 DimensionsInBatches => NitroxInt3.Ceil(DimensionsInMeters / BATCH_SIZE);
|
||||
public NitroxInt3 BatchDimensionCenter => new NitroxInt3(DimensionsInMeters.X / 2, DimensionsInMeters.Y - SKYBOX_METERS_ABOVE_WATER, DimensionsInMeters.Z / 2);
|
||||
public List<NitroxTechType> GlobalRootTechTypes { get; } = GLOBAL_ROOT_TECH_TYPES;
|
||||
}
|
||||
}
|
32
NitroxModel-Subnautica/Helper/TextureScaler.cs
Normal file
32
NitroxModel-Subnautica/Helper/TextureScaler.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxModel_Subnautica.Helper
|
||||
{
|
||||
public static class TextureScaler
|
||||
{
|
||||
public static void Scale(Texture2D tex, int width, int height, FilterMode mode = FilterMode.Trilinear)
|
||||
{
|
||||
Rect texR = new Rect(0, 0, width, height);
|
||||
GpuScale(tex, width, height, mode);
|
||||
|
||||
tex.Resize(width, height);
|
||||
tex.ReadPixels(texR, 0, 0, true);
|
||||
tex.Apply(true);
|
||||
}
|
||||
|
||||
internal static void GpuScale(Texture2D src, int width, int height, FilterMode fmode)
|
||||
{
|
||||
src.filterMode = fmode;
|
||||
src.Apply(true);
|
||||
|
||||
RenderTexture rtt = new RenderTexture(width, height, 32);
|
||||
|
||||
Graphics.SetRenderTarget(rtt);
|
||||
|
||||
GL.LoadPixelMatrix(0, 1, 1, 0);
|
||||
|
||||
GL.Clear(true, true, new Color(0, 0, 0, 0));
|
||||
Graphics.DrawTexture(new Rect(0, 0, 1, 1), src);
|
||||
}
|
||||
}
|
||||
}
|
65
NitroxModel-Subnautica/Helper/VehicleHelper.cs
Normal file
65
NitroxModel-Subnautica/Helper/VehicleHelper.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel_Subnautica.Helper
|
||||
{
|
||||
public static class VehicleHelper
|
||||
{
|
||||
public static NitroxVector3[] GetDefaultColours(TechType techType)
|
||||
{
|
||||
switch (techType)
|
||||
{
|
||||
case TechType.Seamoth:
|
||||
return new[] {
|
||||
new NitroxVector3(0f, 0f, 1f),
|
||||
new NitroxVector3(0f, 0f, 0f),
|
||||
new NitroxVector3(0f, 0f, 1f),
|
||||
new NitroxVector3(0.577f, 0.447f, 0.604f),
|
||||
new NitroxVector3(0.114f, 0.729f, 0.965f)
|
||||
};
|
||||
case TechType.Exosuit:
|
||||
return new[] {
|
||||
new NitroxVector3(0f, 0f, 1f), //_Color
|
||||
new NitroxVector3(0f, 0f, 0f), //_Tint
|
||||
new NitroxVector3(0f, 0f, 1f), //_Color
|
||||
new NitroxVector3(0.577f, 0.447f, 0.604f),//_Color2
|
||||
new NitroxVector3(0.114f, 0.729f, 0.965f) //_Color3
|
||||
};
|
||||
|
||||
case TechType.Cyclops:
|
||||
return new[]
|
||||
{
|
||||
new NitroxVector3(1f, 0f, 1f),
|
||||
new NitroxVector3(0.6f, 0.4f, 0.4f),
|
||||
new NitroxVector3(0.1f, 0.8f, 1f),
|
||||
new NitroxVector3(0f, 0f, 0f)
|
||||
};
|
||||
|
||||
default:
|
||||
return GetPrimalDefaultColours();
|
||||
}
|
||||
}
|
||||
|
||||
public static NitroxVector3[] GetPrimalDefaultColours()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new NitroxVector3(0f, 0f, 1f)
|
||||
};
|
||||
}
|
||||
|
||||
public static bool IsVehicle(TechType techtype)
|
||||
{
|
||||
switch (techtype)
|
||||
{
|
||||
case TechType.Seamoth:
|
||||
case TechType.Exosuit:
|
||||
case TechType.Cyclops:
|
||||
case TechType.RocketBase:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user