fix:代码提初始化

This commit is contained in:
zhangjiajia
2026-05-08 15:34:53 +08:00
parent af67dcce8c
commit 2540141343
4131 changed files with 1239331 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4eacb969ef7bfec4ba69d66b0a873f2f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 236601
packageName: Enviro 3 - Sky and Weather
packageVersion: 3.1.2
assetPath: Assets/Enviro 3 - Sky and Weather/Scripts/Runtime/Modules/Fog/EnviroFogModule.cs
uploadId: 660896

View File

@@ -0,0 +1,116 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
namespace Enviro
{
[ExecuteInEditMode]
[AddComponentMenu("Enviro 3/Volumetric Light")]
public class EnviroVolumetricFogLight : MonoBehaviour
{
[Range(0f,2f)]
public float intensity = 1.0f;
[Range(0f,2f)]
public float range = 1.0f;
private Light myLight;
private bool initialized = false;
private CommandBuffer cascadeShadowCB;
//private CommandBuffer shadowMatrixBuffer;
public bool isOn
{
get
{
if (!isActiveAndEnabled)
return false;
Init();
return myLight.enabled;
}
private set{}
}
new public Light light {get{Init(); return myLight;} private set{}}
void OnEnable()
{
Init();
if(EnviroManager.instance != null && EnviroManager.instance.Fog != null)
AddToLightManager();
}
void OnDisable()
{
#if !ENVIRO_URP && !ENVIRO_HDRP
if(cascadeShadowCB != null && myLight != null && myLight.type == LightType.Directional)
myLight.RemoveCommandBuffer(LightEvent.AfterShadowMap, cascadeShadowCB);
#endif
// if(shadowMatrixBuffer != null && myLight != null && myLight.type == LightType.Directional)
// myLight.RemoveCommandBuffer(LightEvent.BeforeScreenspaceMask, shadowMatrixBuffer);
if(EnviroManager.instance != null && EnviroManager.instance.Fog != null)
RemoveFromLightManager();
}
void AddToLightManager()
{
bool addedToMgr = false;
for(int i = 0; i < EnviroManager.instance.Fog.fogLights.Count; i++)
{
if(EnviroManager.instance.Fog.fogLights[i] == this)
{
addedToMgr = true;
break;
}
}
if(!addedToMgr)
EnviroManager.instance.Fog.AddLight(this);
}
void RemoveFromLightManager()
{
for(int i = 0; i < EnviroManager.instance.Fog.fogLights.Count; i++)
{
if(EnviroManager.instance.Fog.fogLights[i] == this)
{
EnviroManager.instance.Fog.RemoveLight(this);
initialized = false;
}
}
}
private void Init()
{
if (initialized)
return;
myLight = GetComponent<Light>();
#if !ENVIRO_URP && !ENVIRO_HDRP
if(myLight.type == LightType.Directional)
{
cascadeShadowCB = new CommandBuffer();
cascadeShadowCB.name = "Dir Light Command Buffer";
cascadeShadowCB.SetGlobalTexture("_CascadeShadowMapTexture", new UnityEngine.Rendering.RenderTargetIdentifier(UnityEngine.Rendering.BuiltinRenderTextureType.CurrentActive));
myLight.AddCommandBuffer(LightEvent.AfterShadowMap, cascadeShadowCB);
//shadowMatrixBuffer = new CommandBuffer();
//shadowMatrixBuffer.name = "Extract Shadow Matrix Buffer";
//myLight.AddCommandBuffer(LightEvent.BeforeShadowMap, shadowMatrixBuffer);
}
#endif
initialized = true;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 84329a1a5ad77384a9c3bb7ed65d8506
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 236601
packageName: Enviro 3 - Sky and Weather
packageVersion: 3.1.2
assetPath: Assets/Enviro 3 - Sky and Weather/Scripts/Runtime/Modules/Fog/EnviroVolumetricFogLight.cs
uploadId: 660896

View File

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

View File

@@ -0,0 +1,162 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4eacb969ef7bfec4ba69d66b0a873f2f, type: 3}
m_Name: Default Fog Preset
m_EditorClassIdentifier:
showModuleInspector: 1
showSaveLoad: 0
active: 1
Settings:
volumetrics: 1
steps: 32
quality: 1
scattering: 0.425
scatteringMultiplier:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 8
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.29862836
value: 7.1266994
inSlope: -7.9367094
outSlope: -7.9367094
tangentMode: 0
weightedMode: 0
inWeight: 0.1494251
outWeight: 0.33333334
- serializedVersion: 3
time: 0.41374835
value: 1.9498584
inSlope: -5.9926996
outSlope: -5.9926996
tangentMode: 0
weightedMode: 0
inWeight: 0.515421
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
extinction: 0.029
anistropy: 0.5
maxRange: 1000
maxRangePointSpot: 100
noiseIntensity: 0
noiseScale: 0
windDirection: {x: 3.9, y: 0, z: 0}
noise: {fileID: 0}
ditheringTex: {fileID: 2800000, guid: 711e788cbc742bb439b3c7cad60651e3, type: 3}
fog: 1
fogQualityMode: 0
floatingPointOriginMod: {x: 0, y: 0, z: 0}
globalFogHeight: 0
fogDensity: 0.097
fogHeightFalloff: 0.0045
fogHeight: 0
fogDensity2: 0.073
fogHeightFalloff2: 0.05
fogHeight2: -25
fogMaxOpacity: 1
startDistance: 0.01
fogColorBlend: 0.7
fogColorMod: {r: 1, g: 1, b: 1, a: 1}
blockScattering: 1
ambientColorGradient:
serializedVersion: 2
key0: {r: 0.23549305, g: 0.2427107, b: 0.7924528, a: 1}
key1: {r: 0.16073336, g: 0.22812635, b: 0.7924528, a: 1}
key2: {r: 0.35590956, g: 0.44551674, b: 0.5849056, a: 0}
key3: {r: 2.5796902, g: 2.651018, b: 2.8293376, a: 0}
key4: {r: 2.5796902, g: 2.651018, b: 2.8293376, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 29491
ctime2: 33539
ctime3: 65535
ctime4: 65535
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 4
m_NumAlphaKeys: 2
unityFog: 0
unityFogMode: 2
unityFogDensity: 0.05
unityFogStartDistance: 0
unityFogEndDistance: 1000
unityFogColor:
serializedVersion: 2
key0: {r: 0, g: 0, b: 0, a: 1}
key1: {r: 0.0146404365, g: 0.019780159, b: 0.066037714, a: 1}
key2: {r: 0.12589, g: 0.15198022, b: 0.38679248, a: 0}
key3: {r: 0.6415094, g: 0.39747813, b: 0.26326096, a: 0}
key4: {r: 0.53266287, g: 0.63567483, b: 0.8490566, a: 0}
key5: {r: 0.82702917, g: 0.8807278, b: 0.990566, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 9830
ctime2: 23130
ctime3: 32768
ctime4: 36430
ctime5: 65535
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 6
m_NumAlphaKeys: 2
preset: {fileID: 0}
showFogControls: 0
showVolumetricsControls: 0
showUnityFogControls: 0
fogLights: []
customFogDensityModifer: 1
fogMat: {fileID: 0}
volumetricsMat: {fileID: 0}
blurMat: {fileID: 0}
blurMat2: {fileID: 0}
volumetricsRenderTexture: {fileID: 0}

View File

@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 6625884995235d049bd7f2f1de182577
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 236601
packageName: Enviro 3 - Sky and Weather
packageVersion: 3.1.2
assetPath: Assets/Enviro 3 - Sky and Weather/Scripts/Runtime/Modules/Fog/Preset/Default
Fog Preset.asset
uploadId: 660896