Files
2026-03-04 10:03:45 +08:00

160 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
namespace CTS
{
public static class CTSConstants
{
public enum ShaderType
{
Unity = 0,
Basic = 1,
Advanced = 2,
Tesselation = 3,
Lite = 4
}
public enum ShaderFeatureSet
{
None = 0,
Cutout = 1
}
public enum EnvironmentRenderer
{
BuiltIn = 0,
LightWeight2018x = 1,
HighDefinition2018x = 2
}
public enum ShaderMode
{
DesignTime = 0,
RunTime = 1
}
public enum AOType
{
None = 0,
NormalMapBased = 1,
TextureBased = 2
}
public enum TextureSize
{
Texture_64 = 0,
Texture_128 = 1,
Texture_256 = 2,
Texture_512 = 3,
Texture_1024 = 4,
Texture_2048 = 5,
Texture_4096 = 6,
Texture_8192 = 7
}
public enum TextureType
{
Albedo = 0,
Normal = 1,
AmbientOcclusion = 2,
Height = 3,
Splat = 4,
Emission = 5
}
public enum TextureChannel
{
R = 0,
G = 1,
B = 2,
A = 3
}
[Flags]
public enum TerrainChangedFlags
{
NoChange = 0,
Heightmap = 1,
TreeInstances = 2,
DelayedHeightmapUpdate = 4,
FlushEverythingImmediately = 8,
RemoveDirtyDetailsImmediately = 0x10,
WillBeDestroyed = 0x100
}
public static readonly int MajorVersion = 1;
public static readonly int MinorVersion = 9;
public static readonly int PatchVersion = 1;
public static readonly string CTSPresentSymbol = "CTS_PRESENT";
public static readonly Dictionary<CTSShaderCriteria, string> shaderNames = new Dictionary<CTSShaderCriteria, string>
{
{
new CTSShaderCriteria(EnvironmentRenderer.BuiltIn, ShaderType.Basic, ShaderFeatureSet.None),
"CTS/CTS Terrain Shader Basic"
},
{
new CTSShaderCriteria(EnvironmentRenderer.BuiltIn, ShaderType.Basic, ShaderFeatureSet.Cutout),
"CTS/CTS Terrain Shader Basic CutOut"
},
{
new CTSShaderCriteria(EnvironmentRenderer.BuiltIn, ShaderType.Advanced, ShaderFeatureSet.None),
"CTS/CTS Terrain Shader Advanced"
},
{
new CTSShaderCriteria(EnvironmentRenderer.BuiltIn, ShaderType.Advanced, ShaderFeatureSet.Cutout),
"CTS/CTS Terrain Shader Advanced CutOut"
},
{
new CTSShaderCriteria(EnvironmentRenderer.BuiltIn, ShaderType.Tesselation, ShaderFeatureSet.None),
"CTS/CTS Terrain Shader Advanced Tess"
},
{
new CTSShaderCriteria(EnvironmentRenderer.BuiltIn, ShaderType.Tesselation, ShaderFeatureSet.Cutout),
"CTS/CTS Terrain Shader Advanced Tess CutOut"
},
{
new CTSShaderCriteria(EnvironmentRenderer.BuiltIn, ShaderType.Lite, ShaderFeatureSet.None),
"CTS/CTS Terrain Shader Lite"
}
};
public const string CTSShaderName = "CTS/CTS Terrain";
public const string CTSShaderMeshBlenderName = "CTS/CTS_Model_Blend";
public const string CTSShaderMeshBlenderAdvancedName = "CTS/CTS_Model_Blend_Advanced";
public static readonly List<TextureFormat> desktopAndConsoleFormats = new List<TextureFormat>
{
TextureFormat.RGB24,
TextureFormat.RGBA32,
TextureFormat.RGBAHalf,
TextureFormat.DXT1,
TextureFormat.DXT5,
TextureFormat.BC6H,
TextureFormat.BC7
};
public static int GetTextureSize(TextureSize size)
{
return size switch
{
TextureSize.Texture_64 => 64,
TextureSize.Texture_128 => 128,
TextureSize.Texture_256 => 256,
TextureSize.Texture_512 => 512,
TextureSize.Texture_1024 => 1024,
TextureSize.Texture_2048 => 2048,
TextureSize.Texture_4096 => 4096,
TextureSize.Texture_8192 => 8192,
_ => 0,
};
}
}
}