[A] full screen wave

This commit is contained in:
2025-03-06 22:26:48 +08:00
parent 130cc22348
commit d764abfd7d
20 changed files with 1034 additions and 1020 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee00fd152ab58af4bb7fedc9f1ceb006
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace zzwater
{
public class URPHelper
{
public static ScriptableRendererFeature FindAndCacheRendererFeature(string name)
{
// 获取当前 URP 资产
var urpAsset = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline;
// 使用反射获取 rendererData (因为它通常是私有的)
System.Reflection.FieldInfo propertyInfo = urpAsset.GetType().GetField("m_RendererDataList", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
if (propertyInfo != null)
{
ScriptableRendererData[] rendererDataList = (ScriptableRendererData[])propertyInfo.GetValue(urpAsset);
if (rendererDataList.Length > 0)
{
var rendererData = rendererDataList[0]; // 获取第一个渲染器数据,你可能需要调整此逻辑
// 查找指定名称的 FullScreenPassRendererFeature
foreach (var feature in rendererData.rendererFeatures)
{
if (feature.name == name)
{
return feature;
}
}
}
}
return null;
}
public static void RendererFeatureSetActive(bool active, string name)
{
FindAndCacheRendererFeature(name)?.SetActive(active);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4ee461df0edcb524687cefd2783f2457
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
{
"name": "zzwater",
"rootNamespace": "zzwater",
"references": [
"GUID:15fc0a57446b3144c949da3e2b9737a9"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 40a8d4f50e806594fb91dad6449d0397
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: