浏览代码
Removed WaterSystem submodule and embedded as local Package.
Removed WaterSystem submodule and embedded as local Package.
No build tests so may not work in build in this commit/main
Andre McGrail
6 年前
当前提交
316d47cb
共有 137 个文件被更改,包括 10175 次插入 和 248 次删除
-
4.gitignore
-
3.gitmodules
-
2Assets/Objects/boats/Interceptor.mat
-
2Assets/Objects/environment/Trees/Materials/Softvegetation.mat
-
2Assets/Objects/environment/Trees/Materials/Trees.mat
-
2Assets/Objects/environment/Trees/Materials/Trees_billboards.mat
-
3Assets/Objects/props/houses/Materials/Matr_BuildingsJettys.mat
-
3Assets/Objects/props/props/Matr_Props.mat
-
2Assets/Objects/props/props/Matr_Props_Hue.mat
-
4Assets/Scripts/Boat/Engine.cs
-
279Assets/scenes/Island.unity
-
10Packages/manifest.json
-
2ProjectSettings/ProjectVersion.txt
-
135Packages/com.verasl.water-system/Scripts/Rendering/WaterFXPass.cs
-
8Packages/com.verasl.water-system/Data.meta
-
17Packages/com.verasl.water-system/Data/WaterResources.cs
-
11Packages/com.verasl.water-system/Data/WaterResources.cs.meta
-
26Packages/com.verasl.water-system/Data/WaterSettingsData.asset
-
8Packages/com.verasl.water-system/Data/WaterSettingsData.asset.meta
-
45Packages/com.verasl.water-system/Data/WaterSettingsData.cs
-
11Packages/com.verasl.water-system/Data/WaterSettingsData.cs.meta
-
228Packages/com.verasl.water-system/Data/WaterSurfaceData.asset
-
8Packages/com.verasl.water-system/Data/WaterSurfaceData.asset.meta
-
85Packages/com.verasl.water-system/Data/WaterSurfaceData.cs
-
11Packages/com.verasl.water-system/Data/WaterSurfaceData.cs.meta
-
8Packages/com.verasl.water-system/Editor.meta
-
46Packages/com.verasl.water-system/Editor/PlanarSettingsDrawer.cs
-
11Packages/com.verasl.water-system/Editor/PlanarSettingsDrawer.cs.meta
-
79Packages/com.verasl.water-system/Editor/WaterEditor.cs
-
11Packages/com.verasl.water-system/Editor/WaterEditor.cs.meta
-
47Packages/com.verasl.water-system/Editor/WaterSettingsDataEditor.cs
-
11Packages/com.verasl.water-system/Editor/WaterSettingsDataEditor.cs.meta
-
361Packages/com.verasl.water-system/Editor/WaterSurfaceDataEditor.cs
-
11Packages/com.verasl.water-system/Editor/WaterSurfaceDataEditor.cs.meta
-
8Packages/com.verasl.water-system/Meshes.meta
-
68Packages/com.verasl.water-system/Meshes/InfiniteSea.fbx
-
99Packages/com.verasl.water-system/Meshes/InfiniteSea.fbx.meta
-
1001Packages/com.verasl.water-system/Meshes/SeaVertDisp.fbx
-
228Packages/com.verasl.water-system/Meshes/SeaVertDisp.fbx.meta
-
253Packages/com.verasl.water-system/Meshes/Water.fbx
-
138Packages/com.verasl.water-system/Meshes/Water.fbx.meta
-
8Packages/com.verasl.water-system/Resources.meta
-
16Packages/com.verasl.water-system/Resources/WaterResources.asset
-
8Packages/com.verasl.water-system/Resources/WaterResources.asset.meta
-
8Packages/com.verasl.water-system/Scripts.meta
-
335Packages/com.verasl.water-system/Scripts/BuoyantObject.cs
-
11Packages/com.verasl.water-system/Scripts/BuoyantObject.cs.meta
-
268Packages/com.verasl.water-system/Scripts/GerstnerWavesJobs.cs
-
11Packages/com.verasl.water-system/Scripts/GerstnerWavesJobs.cs.meta
-
38Packages/com.verasl.water-system/Scripts/MainCameraAlign.cs
-
11Packages/com.verasl.water-system/Scripts/MainCameraAlign.cs.meta
-
8Packages/com.verasl.water-system/Scripts/Rendering.meta
-
350Packages/com.verasl.water-system/Scripts/Water.cs
-
11Packages/com.verasl.water-system/Scripts/Water.cs.meta
-
24Packages/com.verasl.water-system/Sea.mat
-
8Packages/com.verasl.water-system/Sea.mat.meta
-
1001Packages/com.verasl.water-system/SeaVisual.prefab
-
8Packages/com.verasl.water-system/SeaVisual.prefab.meta
-
8Packages/com.verasl.water-system/Shaders.meta
-
28Packages/com.verasl.water-system/Shaders/CommonUtilities.hlsl
-
9Packages/com.verasl.water-system/Shaders/CommonUtilities.hlsl.meta
-
101Packages/com.verasl.water-system/Shaders/GerstnerWaves.hlsl
-
9Packages/com.verasl.water-system/Shaders/GerstnerWaves.hlsl.meta
-
83Packages/com.verasl.water-system/Shaders/InfiniteWater.mat
-
8Packages/com.verasl.water-system/Shaders/InfiniteWater.mat.meta
-
158Packages/com.verasl.water-system/Shaders/InfiniteWater.shader
-
9Packages/com.verasl.water-system/Shaders/InfiniteWater.shader.meta
-
38Packages/com.verasl.water-system/Shaders/Water.shader
-
9Packages/com.verasl.water-system/Shaders/Water.shader.meta
-
240Packages/com.verasl.water-system/Shaders/WaterCommon.hlsl
-
9Packages/com.verasl.water-system/Shaders/WaterCommon.hlsl.meta
-
43Packages/com.verasl.water-system/Shaders/WaterInput.hlsl
-
9Packages/com.verasl.water-system/Shaders/WaterInput.hlsl.meta
-
73Packages/com.verasl.water-system/Shaders/WaterLighting.hlsl
-
9Packages/com.verasl.water-system/Shaders/WaterLighting.hlsl.meta
-
41Packages/com.verasl.water-system/Shaders/WaterTessellated.shader
-
9Packages/com.verasl.water-system/Shaders/WaterTessellated.shader.meta
-
128Packages/com.verasl.water-system/Shaders/WaterTessellation.hlsl
-
9Packages/com.verasl.water-system/Shaders/WaterTessellation.hlsl.meta
-
8Packages/com.verasl.water-system/Textures.meta
-
195Packages/com.verasl.water-system/Textures/DefaultFoamRamp.tif
-
108Packages/com.verasl.water-system/Textures/DefaultFoamRamp.tif.meta
-
167Packages/com.verasl.water-system/Textures/PeakMap.tif
-
99Packages/com.verasl.water-system/Textures/PeakMap.tif.meta
-
8Packages/com.verasl.water-system/Textures/SurfaceSequence.meta
-
1001Packages/com.verasl.water-system/Textures/SurfaceSequence/water_Final Color Output0001.png
-
130Packages/com.verasl.water-system/Textures/SurfaceSequence/water_Final Color Output0001.png.meta
-
1001Packages/com.verasl.water-system/Textures/SurfaceSequence/water_Final Color Output0002.png
-
130Packages/com.verasl.water-system/Textures/SurfaceSequence/water_Final Color Output0002.png.meta
-
1001Packages/com.verasl.water-system/Textures/SurfaceSequence/water_Final Color Output0003.png
-
130Packages/com.verasl.water-system/Textures/SurfaceSequence/water_Final Color Output0003.png.meta
|
|||
[submodule "Assets/WaterSystem"] |
|||
path = Assets/WaterSystem |
|||
url = https://github.com/Verasl/WaterSystem |
|
|||
m_EditorVersion: 2018.3.0a8 |
|||
m_EditorVersion: 2018.3.0a9 |
|
|||
fileFormatVersion: 2 |
|||
guid: a28afa3e85133492baf302b1d3849fe9 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace WaterSystem |
|||
{ |
|||
/// <summary>
|
|||
/// This scriptable object holds default resources for the water rendering
|
|||
/// </summary>
|
|||
[System.Serializable][CreateAssetMenu(fileName = "WaterResources", menuName = "WaterSystem/Resource", order = 0)] |
|||
public class WaterResources : ScriptableObject |
|||
{ |
|||
public Texture2D defaultFoamRamp; // a default foam ramp for the basic foam setting
|
|||
public Texture2D defaultFoamMap; // a default foam texture map
|
|||
public Texture2DArray defaultSurfaceMap; // a default normal/caustic map
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e73e41b71c5f541679f1bb37dee026c1 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 7ad544ee67a064d3eb407c8c47c67b8d, type: 3} |
|||
m_Name: WaterSettingsData |
|||
m_EditorClassIdentifier: |
|||
waterGeomType: 0 |
|||
refType: 2 |
|||
planarSettings: |
|||
m_ResolutionMultiplier: 2 |
|||
m_ClipPlaneOffset: 0.24 |
|||
m_ReflectLayers: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
enableShadows: 0 |
|||
maxLODLevel: 2 |
|||
cubemapRefType: {fileID: 8900000, guid: a90d3c9b1c3ed4d36bffc02f6b335464, type: 3} |
|||
isInfinite: 0 |
|||
originOffset: {x: 0, y: 0, z: 500, w: 500} |
|
|||
fileFormatVersion: 2 |
|||
guid: a4cacf74654e54b35b9eaea74fd20b4e |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering.LightweightPipeline; |
|||
|
|||
namespace WaterSystem.Data |
|||
{ |
|||
/// <summary>
|
|||
/// This scriptable object stores teh graphical/rendering settings for a water system
|
|||
/// </summary>
|
|||
[System.Serializable][CreateAssetMenu(fileName = "WaterSettingsData", menuName = "WaterSystem/Settings", order = 0)] |
|||
public class WaterSettingsData : ScriptableObject |
|||
{ |
|||
public GeometryType waterGeomType; // The type of geometry, either vertex offset or tessellation
|
|||
public ReflectionType refType = ReflectionType.PlanarReflection; // How the reflecitons are generated
|
|||
// planar
|
|||
public PlanerReflections.PlanarReflectionSettings planarSettings; // Planar reflection settings
|
|||
// cubemap
|
|||
public Cubemap cubemapRefType; // custom cubemap reference
|
|||
|
|||
public bool isInfinite; // Is the water infinite (shader incomplete)
|
|||
public Vector4 originOffset = new Vector4(0f, 0f, 500f, 500f); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The type of reflection source, custom cubemap, closest refelction probe, planar reflection
|
|||
/// </summary>
|
|||
[System.Serializable] |
|||
public enum ReflectionType |
|||
{ |
|||
Cubemap, |
|||
ReflectionProbe, |
|||
PlanarReflection |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The type of geometry, either vertex offset or tessellation
|
|||
/// </summary>
|
|||
[System.Serializable] |
|||
public enum GeometryType |
|||
{ |
|||
VertexOffset, |
|||
Tesselation |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7ad544ee67a064d3eb407c8c47c67b8d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%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: b17284ebf5e80436eb6089f8c7459dab, type: 3} |
|||
m_Name: WaterSurfaceData |
|||
m_EditorClassIdentifier: |
|||
_waterMaxVisibility: 40 |
|||
_absorptionRamp: |
|||
serializedVersion: 2 |
|||
key0: {r: 0.8117647, g: 1, b: 1, a: 1} |
|||
key1: {r: 0.13510147, g: 0.8679245, b: 0.8679245, a: 1} |
|||
key2: {r: 0.021626905, g: 0.49048996, b: 0.509434, a: 0} |
|||
key3: {r: 0, g: 0.275, b: 0.44, a: 0} |
|||
key4: {r: 0, g: 0, b: 0, 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: 3470 |
|||
ctime2: 20817 |
|||
ctime3: 43581 |
|||
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: 5 |
|||
m_NumAlphaKeys: 2 |
|||
_scatterRamp: |
|||
serializedVersion: 2 |
|||
key0: {r: 0, g: 0, b: 0, a: 1} |
|||
key1: {r: 0.08, g: 0.41, b: 0.34, a: 1} |
|||
key2: {r: 0.115566045, g: 0.46226418, b: 0.38125992, a: 0} |
|||
key3: {r: 0.01176471, g: 0.90588236, b: 0.84650886, a: 0} |
|||
key4: {r: 0, g: 0, b: 0, 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: 9830 |
|||
ctime2: 27525 |
|||
ctime3: 65535 |
|||
ctime4: 0 |
|||
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 |
|||
_waves: |
|||
- amplitude: 4.9 |
|||
direction: -6.03 |
|||
wavelength: 5.09 |
|||
origin: {x: -53.403767, y: 105.14393} |
|||
onmiDir: 1 |
|||
- amplitude: 1.82 |
|||
direction: 178 |
|||
wavelength: 3.3500388 |
|||
origin: {x: 0, y: 0} |
|||
onmiDir: 0 |
|||
- amplitude: 0.5 |
|||
direction: 6.532788 |
|||
wavelength: 7.455916 |
|||
origin: {x: 0, y: 0} |
|||
onmiDir: 1 |
|||
- amplitude: 0.7 |
|||
direction: 4.051435 |
|||
wavelength: 4.6626315 |
|||
origin: {x: 0, y: 0} |
|||
onmiDir: 1 |
|||
- amplitude: 0.5 |
|||
direction: 2.0216856 |
|||
wavelength: 2.6733496 |
|||
origin: {x: 0, y: 0} |
|||
onmiDir: 1 |
|||
- amplitude: 0.5 |
|||
direction: -39 |
|||
wavelength: 2.9848163 |
|||
origin: {x: 0, y: 0} |
|||
onmiDir: 1 |
|||
_customWaves: 0 |
|||
randomSeed: 891 |
|||
_basicWaveSettings: |
|||
numWaves: 6 |
|||
amplitude: 0.8 |
|||
direction: -177 |
|||
wavelength: 8 |
|||
_foamSettings: |
|||
foamType: 1 |
|||
basicFoam: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0.25280517 |
|||
value: 0 |
|||
inSlope: 3.040578 |
|||
outSlope: 3.040578 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0.07297084 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 0.925 |
|||
inSlope: 2.2884614 |
|||
outSlope: 2.2884614 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0.06255044 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
liteFoam: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0.2 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 0.4 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 0.7 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
mediumFoam: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0.4 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 0.7 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
denseFoam: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0.7 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- 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 |
|||
_init: 1 |
|
|||
fileFormatVersion: 2 |
|||
guid: 846f3dc3b5341447a86687211f741bc7 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace WaterSystem.Data |
|||
{ |
|||
/// <summary>
|
|||
/// This scriptable object contains setting for how the water looks visually
|
|||
/// </summary>
|
|||
[System.Serializable][CreateAssetMenu(fileName = "WaterSurfaceData", menuName = "WaterSystem/Surface Data", order = 0)] |
|||
public class WaterSurfaceData : ScriptableObject |
|||
{ |
|||
public float _waterMaxVisibility = 40.0f; |
|||
public Gradient _absorptionRamp; |
|||
public Gradient _scatterRamp; |
|||
public List<Wave> _waves = new List<Wave>(); |
|||
public bool _customWaves = false; |
|||
public int randomSeed = 3234; |
|||
public BasicWaves _basicWaveSettings = new BasicWaves(1.5f, 45.0f, 5.0f); |
|||
public FoamSettings _foamSettings = new FoamSettings(); |
|||
[SerializeField] |
|||
public bool _init = false; |
|||
} |
|||
|
|||
[System.Serializable] |
|||
public struct Wave |
|||
{ |
|||
public float amplitude; // height of the wave in units(m)
|
|||
public float direction; // direction the wave travels in degrees from Z+
|
|||
public float wavelength; // distance between crest>crest
|
|||
public Vector2 origin; // Omi directional point of origin
|
|||
public float onmiDir; // Is omni?
|
|||
|
|||
public Wave(float amp, float dir, float length, Vector2 org, bool omni) |
|||
{ |
|||
amplitude = amp; |
|||
direction = dir; |
|||
wavelength = length; |
|||
origin = org; |
|||
onmiDir = omni ? 1 : 0; |
|||
} |
|||
} |
|||
|
|||
[System.Serializable] |
|||
public class BasicWaves |
|||
{ |
|||
public int numWaves = 6; |
|||
public float amplitude; |
|||
public float direction; |
|||
public float wavelength; |
|||
|
|||
public BasicWaves(float amp, float dir, float len) |
|||
{ |
|||
numWaves = 6; |
|||
amplitude = amp; |
|||
direction = dir; |
|||
wavelength = len; |
|||
} |
|||
} |
|||
|
|||
[System.Serializable] |
|||
public class FoamSettings |
|||
{ |
|||
public int foamType; // 0=default, 1=simple, 3=custom
|
|||
public AnimationCurve basicFoam; |
|||
public AnimationCurve liteFoam; |
|||
public AnimationCurve mediumFoam; |
|||
public AnimationCurve denseFoam; |
|||
|
|||
// Foam curves
|
|||
public FoamSettings() |
|||
{ |
|||
foamType = 0; |
|||
basicFoam = new AnimationCurve(new Keyframe[2]{new Keyframe(0.25f, 0f), |
|||
new Keyframe(1f, 1f)}); |
|||
liteFoam = new AnimationCurve(new Keyframe[3]{new Keyframe(0.2f, 0f), |
|||
new Keyframe(0.4f, 1f), |
|||
new Keyframe(0.7f, 0f)}); |
|||
mediumFoam = new AnimationCurve(new Keyframe[3]{new Keyframe(0.4f, 0f), |
|||
new Keyframe(0.7f, 1f), |
|||
new Keyframe(1f, 0f)}); |
|||
denseFoam = new AnimationCurve(new Keyframe[2]{new Keyframe(0.7f, 0f), |
|||
new Keyframe(1f, 1f)}); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b17284ebf5e80436eb6089f8c7459dab |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ff6ef3b3109514061b996e1f998625ba |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEngine.Experimental.Rendering.LightweightPipeline; |
|||
|
|||
namespace WaterSystem |
|||
{ |
|||
[CustomPropertyDrawer(typeof(PlanerReflections.PlanarReflectionSettings))] |
|||
public class PlanarSettingsDrawer : PropertyDrawer |
|||
{ |
|||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) |
|||
{ |
|||
EditorGUI.BeginProperty(position, label, property); |
|||
|
|||
// Don't make child fields be indented
|
|||
var indent = EditorGUI.indentLevel; |
|||
EditorGUI.indentLevel = 0; |
|||
|
|||
// Rects
|
|||
Rect resMultiRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); |
|||
Rect offsetRect = new Rect(position.x, resMultiRect.yMax + EditorGUIUtility.standardVerticalSpacing, position.width, EditorGUIUtility.singleLineHeight); |
|||
Rect layerMaskRect = new Rect(position.x, offsetRect.yMax + EditorGUIUtility.standardVerticalSpacing, position.width, EditorGUIUtility.singleLineHeight); |
|||
Rect shadowRect = new Rect(position.x, layerMaskRect.yMax + EditorGUIUtility.standardVerticalSpacing, position.width * 0.5f, EditorGUIUtility.singleLineHeight); |
|||
Rect maxLODRect = new Rect(position.x + position.width * 0.5f, layerMaskRect.yMax + EditorGUIUtility.standardVerticalSpacing, position.width * 0.5f, EditorGUIUtility.singleLineHeight); |
|||
|
|||
var resMulti = property.FindPropertyRelative("m_ResolutionMultiplier"); |
|||
EditorGUI.PropertyField(resMultiRect, resMulti); |
|||
position.y += EditorGUIUtility.singleLineHeight; |
|||
var offset = property.FindPropertyRelative("m_ClipPlaneOffset"); |
|||
EditorGUI.Slider(offsetRect, offset, -0.500f, 0.500f); |
|||
var layerMask = property.FindPropertyRelative("m_ReflectLayers"); |
|||
EditorGUI.PropertyField(layerMaskRect, layerMask); |
|||
|
|||
// Set indent back to what it was
|
|||
EditorGUI.indentLevel = indent; |
|||
|
|||
EditorGUI.EndProperty(); |
|||
} |
|||
|
|||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 4f; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e0bc0b238a7fa4c69938228f2c8d657e |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditorInternal; |
|||
using WaterSystem.Data; |
|||
|
|||
namespace WaterSystem |
|||
{ |
|||
[CustomEditor(typeof(Water))] |
|||
public class WaterEditor : Editor |
|||
{ |
|||
public override void OnInspectorGUI() |
|||
{ |
|||
serializedObject.Update(); |
|||
Water w = (Water)target; |
|||
|
|||
var waterSettingsData = serializedObject.FindProperty("settingsData"); |
|||
EditorGUILayout.PropertyField(waterSettingsData, true); |
|||
if(waterSettingsData.objectReferenceValue != null) |
|||
{ |
|||
CreateEditor((WaterSettingsData)waterSettingsData.objectReferenceValue).OnInspectorGUI(); |
|||
} |
|||
|
|||
var waterSurfaceData = serializedObject.FindProperty("surfaceData"); |
|||
EditorGUILayout.PropertyField(waterSurfaceData, true); |
|||
if(waterSurfaceData.objectReferenceValue != null) |
|||
{ |
|||
CreateEditor((WaterSurfaceData)waterSurfaceData.objectReferenceValue).OnInspectorGUI(); |
|||
} |
|||
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
|
|||
if(GUI.changed) |
|||
{ |
|||
w.Init(); |
|||
} |
|||
} |
|||
|
|||
void OnSceneGUI() |
|||
{ |
|||
Water w = target as Water; |
|||
Camera cam = SceneView.currentDrawingSceneView.camera; |
|||
var waveDebug = serializedObject.FindProperty("_debugMode"); |
|||
if (cam && waveDebug.intValue != 0) |
|||
{ |
|||
Vector3 pos = Vector3.zero; |
|||
float dist = 10f; |
|||
if (waveDebug.intValue == 2) |
|||
{ |
|||
Plane p = new Plane(Vector3.zero, Vector3.forward, Vector3.right); |
|||
|
|||
Ray r = Camera.current.ViewportPointToRay(new Vector2(0.25f, 0.25f)); |
|||
if (p.Raycast(r, out dist)) |
|||
{ |
|||
pos = Camera.current.ViewportToWorldPoint(new Vector3(0.25f, 0.25f, dist)); |
|||
} |
|||
} |
|||
|
|||
for (int i = w._waves.Length - 1; i >= 0; i--) |
|||
{ |
|||
Wave wave = w._waves[i]; |
|||
Random.InitState(i); |
|||
Color c = Color.HSVToRGB(Random.Range(0f, 1f), 1f, 1f); |
|||
c.a = Mathf.Clamp01(0.01f * dist - 0.1f) * 0.5f; |
|||
Handles.color = c; |
|||
pos.y = wave.amplitude; |
|||
DrawWaveGizmo(pos, wave.direction, wave.amplitude, wave.wavelength); |
|||
} |
|||
} |
|||
} |
|||
|
|||
void DrawWaveGizmo(Vector3 pos, float angle, float size, float length) |
|||
{ |
|||
Handles.DrawSolidDisc(pos, Vector3.up, length / 2f); |
|||
Handles.ArrowHandleCap(0, pos, Quaternion.AngleAxis(angle, Vector3.up), -length / 1.75f, EventType.Repaint); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7760ef1f46dfd455cae527e7f91824d3 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditorInternal; |
|||
|
|||
namespace WaterSystem.Data |
|||
{ |
|||
[CustomEditor(typeof(WaterSettingsData))] |
|||
public class WaterSettingsDataEditor : Editor |
|||
{ |
|||
public override void OnInspectorGUI() |
|||
{ |
|||
var geomType = serializedObject.FindProperty("waterGeomType"); |
|||
EditorGUILayout.PropertyField(geomType); |
|||
|
|||
var refType = serializedObject.FindProperty("refType"); |
|||
refType.enumValueIndex = GUILayout.Toolbar(refType.enumValueIndex, refType.enumDisplayNames); |
|||
|
|||
switch(refType.enumValueIndex) |
|||
{ |
|||
case 0: |
|||
{ |
|||
// cubemap
|
|||
var cube = serializedObject.FindProperty("cubemapRefType"); |
|||
EditorGUILayout.PropertyField(cube, new GUIContent("Cubemap Texture")); |
|||
} |
|||
break; |
|||
case 1: |
|||
{ |
|||
// probe
|
|||
EditorGUILayout.HelpBox("Reflection Probe setting has no options, it automatically uses the nearest reflection probe to the main camera", MessageType.Info); |
|||
} |
|||
break; |
|||
case 2: |
|||
{ |
|||
// planar
|
|||
var planarSettings = serializedObject.FindProperty("planarSettings"); |
|||
EditorGUILayout.PropertyField(planarSettings, true); |
|||
} |
|||
break; |
|||
} |
|||
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0935a4ad227524d3cae739e174b846b2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditorInternal; |
|||
|
|||
namespace WaterSystem.Data |
|||
{ |
|||
[CustomEditor(typeof(WaterSurfaceData))] |
|||
public class WaterSurfaceDataEditor : Editor |
|||
{ |
|||
[SerializeField] |
|||
ReorderableList waveList; |
|||
|
|||
private void OnEnable() |
|||
{ |
|||
var init = serializedObject.FindProperty("_init"); |
|||
if(init.boolValue == false) |
|||
Setup(); |
|||
|
|||
var standardHeight = EditorGUIUtility.singleLineHeight; |
|||
var standardLine = standardHeight + EditorGUIUtility.standardVerticalSpacing; |
|||
//Reorderable list stuff////////////////////////////////////////////////
|
|||
waveList = new ReorderableList(serializedObject, serializedObject.FindProperty("_waves"), true, true, true, true); |
|||
|
|||
//Single entry GUI
|
|||
waveList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => |
|||
{ |
|||
var element = waveList.serializedProperty.GetArrayElementAtIndex(index); |
|||
rect.y += 2; |
|||
|
|||
// Swell height
|
|||
var preWidth = EditorGUIUtility.labelWidth; |
|||
EditorGUIUtility.labelWidth = rect.width * 0.2f; |
|||
Rect ampRect = new Rect(rect.x, rect.y + standardLine, rect.width * 0.5f, standardHeight); |
|||
var waveAmp = element.FindPropertyRelative("amplitude"); |
|||
waveAmp.floatValue = EditorGUI.Slider(ampRect, "Swell Height", waveAmp.floatValue, 0.1f, 30f); |
|||
// Wavelength
|
|||
Rect lengthRect = new Rect(rect.x + ampRect.width, rect.y + standardLine, rect.width * 0.5f, standardHeight); |
|||
var waveLen = element.FindPropertyRelative("wavelength"); |
|||
waveLen.floatValue = EditorGUI.Slider(lengthRect, "Wavelength", waveLen.floatValue, 1.0f, 200f); |
|||
EditorGUIUtility.labelWidth = preWidth; |
|||
// Directional controls
|
|||
Rect dirToggleRect = new Rect(rect.x, rect.y + 2 + standardLine * 2, rect.width * 0.5f, standardHeight); |
|||
Rect omniToggleRect = new Rect(rect.x + rect.width * 0.5f, dirToggleRect.y, rect.width * 0.5f, standardHeight); |
|||
Rect containerRect = new Rect(rect.x, dirToggleRect.y + 1, rect.width, standardLine * 3.2f); |
|||
// Direction/origin
|
|||
var waveType = element.FindPropertyRelative("onmiDir"); |
|||
var wTypeBool = (int)waveType.floatValue == 1 ? true : false; |
|||
GUI.Box(containerRect, "", EditorStyles.helpBox ); |
|||
wTypeBool = !GUI.Toggle(dirToggleRect, !wTypeBool, "Directional", EditorStyles.miniButtonLeft); |
|||
wTypeBool = GUI.Toggle(omniToggleRect, wTypeBool, "Omni-directional", EditorStyles.miniButtonRight); |
|||
waveType.floatValue = wTypeBool ? 1 : 0; |
|||
|
|||
Rect dirRect = new Rect(rect.x + 4, dirToggleRect.y + standardLine, rect.width - 8, standardHeight); |
|||
Rect buttonRect = new Rect(rect.x + 4, dirRect.y + standardLine + 2, rect.width - 8, standardHeight); |
|||
// Directional
|
|||
if(!wTypeBool) |
|||
{ |
|||
var waveDir = element.FindPropertyRelative("direction"); |
|||
waveDir.floatValue = EditorGUI.Slider(dirRect, "Facing Direction", waveDir.floatValue, -180.0f, 180.0f); |
|||
if(GUI.Button(buttonRect, "Align with Scene Camera")) |
|||
waveDir.floatValue = CameraRelativeDirection(); |
|||
} |
|||
else |
|||
{// Omni-Directional
|
|||
EditorGUIUtility.wideMode = true; |
|||
//var perWidth = EditorGUIUtility.labelWidth;
|
|||
//EditorGUIUtility.labelWidth = 20f;
|
|||
var waveOrig = element.FindPropertyRelative("origin"); |
|||
waveOrig.vector2Value = EditorGUI.Vector2Field(dirRect, "Point of Origin", waveOrig.vector2Value); |
|||
if(GUI.Button(buttonRect, "Project Origin from Scene Camera")) |
|||
waveOrig.vector2Value = CameraRelativeOrigin(waveOrig.vector2Value); |
|||
//EditorGUIUtility.labelWidth = perWidth;
|
|||
} |
|||
}; |
|||
|
|||
// Check can remove to make sure at least one wave remains
|
|||
waveList.onCanRemoveCallback = (ReorderableList l) => |
|||
{ |
|||
return l.count > 1; |
|||
}; |
|||
|
|||
// Check on remove to give a warning incase removing by accident
|
|||
waveList.onRemoveCallback = (ReorderableList l) => |
|||
{ |
|||
if (EditorUtility.DisplayDialog("Warning!", "Are you sure you want to delete the wave?", "Yes", "No")) |
|||
{ |
|||
ReorderableList.defaultBehaviours.DoRemoveButton(l); |
|||
} |
|||
}; |
|||
// When adding, check if under 10, if so add a new random wave
|
|||
waveList.onAddCallback = (ReorderableList l) => |
|||
{ |
|||
var index = l.serializedProperty.arraySize; |
|||
if (index < 10) |
|||
{ |
|||
l.serializedProperty.arraySize++; |
|||
l.index = index; |
|||
var element = l.serializedProperty.GetArrayElementAtIndex(index); |
|||
element.FindPropertyRelative("amplitude").floatValue = Random.Range(0.25f, 1.5f); |
|||
element.FindPropertyRelative("direction").floatValue = Random.Range(-180f, 180f); |
|||
element.FindPropertyRelative("wavelength").floatValue = Random.Range(2f, 8f); |
|||
} |
|||
else |
|||
{ |
|||
EditorUtility.DisplayDialog("Warning!", "You have reached the limit of 10 waves for this Water.", "Close"); |
|||
} |
|||
}; |
|||
//Draw header
|
|||
waveList.drawHeaderCallback = (Rect rect) => |
|||
{ |
|||
EditorGUI.LabelField(rect, "Wave List"); |
|||
}; |
|||
//Do height of list entry
|
|||
waveList.elementHeightCallback = (index) => |
|||
{ |
|||
var elementHeight = standardLine * 6f; |
|||
return elementHeight; |
|||
}; |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
serializedObject.Update(); |
|||
|
|||
EditorGUILayout.LabelField("Visual Settings", EditorStyles.boldLabel); |
|||
EditorGUI.indentLevel += 1; |
|||
// Max visibility - slider 3-300
|
|||
var maxDepth = serializedObject.FindProperty("_waterMaxVisibility"); |
|||
EditorGUILayout.Slider(maxDepth, 3, 300, new GUIContent("Maximum Visibility", maxDepthTT)); |
|||
// Colouring settings
|
|||
DoSmallHeader("Coloring Controls"); |
|||
// Absorbstion Ramp
|
|||
var absorpRamp = serializedObject.FindProperty("_absorptionRamp"); |
|||
EditorGUILayout.PropertyField(absorpRamp, new GUIContent("Absorption Color", absorpRampTT), true, null); |
|||
// Scatter Ramp
|
|||
var scatterRamp = serializedObject.FindProperty("_scatterRamp"); |
|||
EditorGUILayout.PropertyField(scatterRamp, new GUIContent("Scattering Color", scatterRampTT), true, null); |
|||
// Foam Ramps
|
|||
DoSmallHeader("Surface Foam"); |
|||
var foamSettings = serializedObject.FindProperty("_foamSettings"); |
|||
var foamType = foamSettings.FindPropertyRelative("foamType"); |
|||
foamType.intValue = GUILayout.Toolbar(foamType.intValue, foamTypeOptions); |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
switch (foamType.intValue) |
|||
{ |
|||
case 0: //// Auto ////
|
|||
{ |
|||
EditorGUILayout.HelpBox("Automatic will distribute the foam suitable for an average swell", MessageType.Info); |
|||
} |
|||
break; |
|||
case 1: //// Simple ////
|
|||
{ |
|||
EditorGUILayout.BeginHorizontal(); |
|||
DoInlineLabel("Foam Profile", foamCurveTT, 50f); |
|||
var basicFoam = foamSettings.FindPropertyRelative("basicFoam"); |
|||
basicFoam.animationCurveValue = EditorGUILayout.CurveField(basicFoam.animationCurveValue, Color.white, new Rect(Vector2.zero, Vector2.one)); |
|||
EditorGUILayout.EndHorizontal(); |
|||
} |
|||
break; |
|||
case 2: //// Simple ////
|
|||
{ |
|||
EditorGUILayout.BeginHorizontal(); |
|||
DoInlineLabel("Foam Profiles", foam3curvesTT, 50f); |
|||
var liteFoam = foamSettings.FindPropertyRelative("liteFoam"); |
|||
liteFoam.animationCurveValue = EditorGUILayout.CurveField(liteFoam.animationCurveValue, new Color(0.5f, 0.75f, 1f, 1f), new Rect(Vector2.zero, Vector2.one)); |
|||
var mediumFoam = foamSettings.FindPropertyRelative("mediumFoam"); |
|||
mediumFoam.animationCurveValue = EditorGUILayout.CurveField(mediumFoam.animationCurveValue, new Color(0f, 0.5f, 1f, 1f), new Rect(Vector2.zero, Vector2.one)); |
|||
var denseFoam = foamSettings.FindPropertyRelative("denseFoam"); |
|||
denseFoam.animationCurveValue = EditorGUILayout.CurveField(denseFoam.animationCurveValue, Color.blue, new Rect(Vector2.zero, Vector2.one)); |
|||
EditorGUILayout.EndHorizontal(); |
|||
} |
|||
break; |
|||
} |
|||
|
|||
EditorGUI.indentLevel -= 1; |
|||
EditorGUILayout.LabelField("Wave Settings", EditorStyles.boldLabel); |
|||
EditorGUI.indentLevel += 1; |
|||
// Wave type - Automatic / Customized
|
|||
//wavesType = EditorGUILayout.Popup("System Type", wavesType, wavesTypeOptions);
|
|||
// Toolbar labels here
|
|||
|
|||
var customWaves = serializedObject.FindProperty("_customWaves"); |
|||
var intVal = customWaves.boolValue ? 1 : 0; |
|||
intVal = GUILayout.Toolbar(intVal, wavesTypeOptions); |
|||
customWaves.boolValue = intVal == 1 ? true : false; |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
switch(customWaves.boolValue ? 1 : 0) |
|||
{ |
|||
case 0: //// Automatic ////
|
|||
{ |
|||
var basicSettings = serializedObject.FindProperty("_basicWaveSettings"); |
|||
// Wave count (display warning of on mobile platform and over 6) dropdown 1 > 10
|
|||
var autoCount = basicSettings.FindPropertyRelative("numWaves"); |
|||
EditorGUILayout.IntSlider(autoCount, 1, 10, new GUIContent("Wave Count", waveCountTT), null); |
|||
// Average Wave height - slider 0.05 - 30
|
|||
var avgHeight = basicSettings.FindPropertyRelative("amplitude"); |
|||
EditorGUILayout.Slider(avgHeight, 0.1f, 30.0f, new GUIContent("Avg Swell Height", avgHeightTT), null); |
|||
// Average Wavelength - slider 1 - 200
|
|||
var avgWavelength = basicSettings.FindPropertyRelative("wavelength"); |
|||
EditorGUILayout.Slider(avgWavelength, 1.0f, 200.0f, new GUIContent("Avg Wavelength", avgWavelengthTT), null); |
|||
// Wind direction - slider -180-180
|
|||
EditorGUILayout.BeginHorizontal(); |
|||
var windDir = basicSettings.FindPropertyRelative("direction"); |
|||
EditorGUILayout.Slider(windDir, -180.0f, 180.0f, new GUIContent("Wind Direction", windDirTT), null); |
|||
if(GUILayout.Button(new GUIContent("Align to scene camera", alignButtonTT))) |
|||
windDir.floatValue = CameraRelativeDirection(); |
|||
EditorGUILayout.EndHorizontal(); |
|||
// [override] - random otherwise(on creation/override check)
|
|||
// Random seed - int input
|
|||
EditorGUILayout.BeginHorizontal(); |
|||
var randSeed = serializedObject.FindProperty("randomSeed"); |
|||
randSeed.intValue = EditorGUILayout.IntField(new GUIContent("Random Seed", randSeedTT), randSeed.intValue); |
|||
if (GUILayout.Button("Randomize Waves")) |
|||
{ |
|||
randSeed.intValue = System.DateTime.Now.Millisecond * 100 - System.DateTime.Now.Millisecond; |
|||
} |
|||
EditorGUILayout.EndHorizontal(); |
|||
} |
|||
break; |
|||
case 1: //// Customized ////
|
|||
{ |
|||
EditorGUI.indentLevel -= 1; |
|||
// Re-orderable list with wave details
|
|||
waveList.DoLayoutList(); |
|||
/// Type - Directional / Omi-directional
|
|||
//// Amplitude - slider 0.05 - 30
|
|||
//// Wavelength - slider 1 - 200
|
|||
////// Direction(facing) - slider -180-180 && face scene camera direction(if scene view)
|
|||
// OR
|
|||
////// Origin(point of origin) - Vector input && origin at camera aim
|
|||
} |
|||
break; |
|||
} |
|||
|
|||
EditorUtility.SetDirty(this); |
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
|
|||
void DoSmallHeader(string header) |
|||
{ |
|||
EditorGUI.indentLevel -= 1; |
|||
EditorGUILayout.LabelField(header, EditorStyles.miniBoldLabel); |
|||
EditorGUI.indentLevel += 1; |
|||
} |
|||
|
|||
void DoInlineLabel(string label, string tooltip, float width) |
|||
{ |
|||
var preWidth = EditorGUIUtility.labelWidth; |
|||
EditorGUIUtility.labelWidth = width; |
|||
EditorGUILayout.LabelField(new GUIContent(label, tooltip)); |
|||
EditorGUIUtility.labelWidth = preWidth; |
|||
} |
|||
|
|||
void Setup() |
|||
{ |
|||
WaterSurfaceData wsd = (WaterSurfaceData)target; |
|||
wsd._init = true; |
|||
wsd._absorptionRamp = DefaultAbsorptionGrad(); |
|||
wsd._scatterRamp = DefaultScatterGrad(); |
|||
EditorUtility.SetDirty(wsd); |
|||
} |
|||
|
|||
Gradient DefaultAbsorptionGrad() // Preset for absorption
|
|||
{ |
|||
Gradient g = new Gradient(); |
|||
GradientColorKey[] gck = new GradientColorKey[5]; |
|||
GradientAlphaKey[] gak = new GradientAlphaKey[1]; |
|||
gak[0].alpha = 1; |
|||
gak[0].time = 0; |
|||
gck[0].color = Color.white; |
|||
gck[0].time = 0f; |
|||
gck[1].color = new Color(0.22f, 0.87f, 0.87f); |
|||
gck[1].time = 0.082f; |
|||
gck[2].color = new Color(0f, 0.47f, 0.49f); |
|||
gck[2].time = 0.318f; |
|||
gck[3].color = new Color(0f, 0.275f, 0.44f); |
|||
gck[3].time = 0.665f; |
|||
gck[4].color = Color.black; |
|||
gck[4].time = 1f; |
|||
g.SetKeys(gck, gak); |
|||
return g; |
|||
} |
|||
|
|||
Gradient DefaultScatterGrad() // Preset for scattering
|
|||
{ |
|||
Gradient g = new Gradient(); |
|||
GradientColorKey[] gck = new GradientColorKey[4]; |
|||
GradientAlphaKey[] gak = new GradientAlphaKey[1]; |
|||
gak[0].alpha = 1; |
|||
gak[0].time = 0; |
|||
gck[0].color = Color.black; |
|||
gck[0].time = 0f; |
|||
gck[1].color = new Color(0.08f, 0.41f, 0.34f); |
|||
gck[1].time = 0.15f; |
|||
gck[2].color = new Color(0.13f, 0.55f, 0.45f); |
|||
gck[2].time = 0.42f; |
|||
gck[3].color = new Color(0.21f, 0.62f, 0.6f); |
|||
gck[3].time = 1f; |
|||
g.SetKeys(gck, gak); |
|||
return g; |
|||
} |
|||
|
|||
float CameraRelativeDirection() |
|||
{ |
|||
float degrees = 0; |
|||
|
|||
Vector3 camFwd = UnityEditor.SceneView.lastActiveSceneView.camera.transform.forward; |
|||
camFwd.y = 0f; |
|||
camFwd.Normalize(); |
|||
float dot = Vector3.Dot(-Vector3.forward, camFwd); |
|||
degrees = Mathf.LerpUnclamped(90.0f, 180.0f, dot); |
|||
if(camFwd.x < 0) |
|||
degrees *= -1f; |
|||
|
|||
return Mathf.RoundToInt(degrees * 1000) / 1000; |
|||
} |
|||
|
|||
Vector2 CameraRelativeOrigin(Vector2 original) |
|||
{ |
|||
Camera sceneCam = UnityEditor.SceneView.lastActiveSceneView.camera; |
|||
|
|||
float angle = 90f - Vector3.Angle(sceneCam.transform.forward, Vector3.down); |
|||
if (angle > 0.1f) |
|||
{ |
|||
Vector3 intersect = Vector2.zero; |
|||
float hypot = (sceneCam.transform.position.y) * (1 / Mathf.Sin(Mathf.Deg2Rad * angle)); |
|||
Vector3 fwd = sceneCam.transform.forward * hypot; |
|||
intersect = fwd + sceneCam.transform.position; |
|||
return new Vector2(intersect.x, intersect.z); |
|||
} |
|||
else |
|||
{ |
|||
return original; |
|||
} |
|||
} |
|||
|
|||
static string[] wavesTypeOptions = new string[] { "Automatic", "Customized" }; |
|||
|
|||
static string[] foamTypeOptions = new string[3] { "Automatic", "Simple Curve", "Density Curves" }; |
|||
|
|||
|
|||
////TOOLTIPS////
|
|||
private string maxDepthTT = "This controls the max depth of the waters transparency/visiblility, the absorption and scattering gradients map to this depth. Units:Meters"; |
|||
private string absorpRampTT = "This gradient controls the color of the water as it gets deeper, darkening the surfaces under the water as they get deeper."; |
|||
private string scatterRampTT = "This gradient controls the 'scattering' of the water from shallow to deep, lighting the water as there becomes more of it."; |
|||
private string waveCountTT = "Number of waves the automatic setup creates, if aiming for mobile set to 6 or less"; |
|||
private string avgHeightTT = "The average height of the waves. Units:Meters"; |
|||
private string avgWavelengthTT = "The average wavelength of the waves. Units:Meters"; |
|||
private string windDirTT = "The general wind direction, this is in degrees from Z+"; |
|||
private string alignButtonTT = "This aligns the wave direction to the current scene view camera facing direction"; |
|||
private string foamCurveTT = "This curve control the foam propagation. X is wave height and Y is foam opacity"; |
|||
private string foam3curvesTT = "These three curves control the Lite, Medium and Dense foam propagation. X is wave height and Y is foam opacity"; |
|||
private string randSeedTT = "This seed controls the automatic wave generation"; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1016bd3ba0af54af184326cd470c1bb3 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: bc33e2c6cda7143a3b9bd922abb88865 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Kaydara FBX Binary � � FBXHeaderExtension\ FBXHeaderVersionI� x |
|||
FBXVersionI� � EncryptionTypeI � CreationTimeStamp� VersionI� � YearI� � MonthI DayI ' HourI ? MinuteI W SecondI t MillisecondI � ' |