NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/GameWrapper/PostProcessInstructor.cs

95 lines
3.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.Serialization;
public enum PostProcessTextureUnitSize
{
_256 = 256,
_512 = 512,
}
public class PostProcessInstructor : MonoBehaviour
{
[FormerlySerializedAs("combinedRoots")]
[LabelText("需要网格合并节点")]
[ListDrawerSettings(AlwaysAddDefaultValue = false)]
public List<Transform> rootsToCombine = new();
[FormerlySerializedAs("art")]
[LabelText("网格合并后父节点")]
public Transform combinedObjectsRoot;
[LabelText("地面")]
public GameObject ground;
[LabelText("雾")]
public GameObject fog;
[LabelText("后处理预制体")]
public bool processPrefab;
[LabelText("单位贴图尺寸")]
public PostProcessTextureUnitSize postProcessTextureUnitSize = PostProcessTextureUnitSize._256;
[LabelText("后处理指定材质")]
public List<Material> sampleMaterials = new();
[LabelText("启用分组合批")]
[Tooltip("启用分组合批可以减少单次渲染的对象数量但会增加DrawCall")]
public bool enableBatchGrouping = false;
[LabelText("分组合批距离")]
[Tooltip("物体之间的距离超过此值将被分到不同组,距离越大分组越少;距离越小分组越多")]
[Range(2.0f, 50.0f)]
public float batchGroupDistance = 8.0f;
[Header("灯光烘焙设置")]
[LabelText("启用灯光烘焙")]
[Tooltip("启用后将在合批完成后进行灯光烘焙")]
public bool enableLightmapBaking = false;
[Header("模型切割设置")]
[LabelText("启用模型切割")]
[Tooltip("启用后会在模型合并前进行切割处理,裁切地面以下的模型部分")]
public bool enableModelSlicing = false;
[LabelText("需要切割的模型节点")]
[ListDrawerSettings(AlwaysAddDefaultValue = false), ShowIf("enableModelSlicing")]
[Tooltip("选择需要进行切割的模型父节点,不在此列表中的模型不会被切割")]
public List<Transform> rootsToSlice = new();
[LabelText("切割面材质")]
[Tooltip("切割面使用的材质,需要一个简单的不透明材质,暂时不使用新材质"), ShowIf("enableModelSlicing"), HideInInspector]
public Material sliceMaterial;
[LabelText("切割平面方向")]
[Tooltip("切割平面的法线方向,默认使用地面的上方向,暂时固定不用改变"), HideInInspector]
public Vector3 slicePlaneDirection = Vector3.up;
[LabelText("忽略边界检测")]
[Tooltip("启用后将忽略边界检测直接进行切割,解决一些边界检测不准确的问题"), ShowIf("enableModelSlicing"), HideInInspector]
public bool ignoreObjectBoundsCheck = false;
[LabelText("异步切割")]
[Tooltip("启用异步处理可以提高性能,但可能在某些情况下导致问题,暂时禁用"), HideInInspector]
public bool sliceAsynchronously = false;
[LabelText("保留原始模型")]
[Tooltip("启用后将在切割完成后保留原始未切割的模型,便于对比或调试"), ShowIf("enableModelSlicing")]
public bool preserveOriginalModels = false;
// 保存网格资源,暂时禁用
[LabelText("保存切割后的网格")]
[Tooltip("启用后将切割后的网格保存到Assets目录便于后续使用暂时禁用"), ShowIf("enableModelSlicing"), HideInInspector]
public bool saveMeshesToAssets = false;
[LabelText("网格保存路径")]
[Tooltip("切割后网格保存的路径相对于Assets目录暂时禁用"), ShowIf("@this.enableModelSlicing && this.saveMeshesToAssets"), HideInInspector]
public string meshSavePath = "SlicedMeshes";
[LabelText("添加时间戳")]
[Tooltip("为保存的网格添加时间戳,避免名称冲突,暂时禁用"), ShowIf("@this.enableModelSlicing && this.saveMeshesToAssets"), HideInInspector]
public bool addTimestampToMeshName = true;
}