Skip to content

Commit

Permalink
initiali commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sinnwrig committed Aug 29, 2023
0 parents commit 8703f90
Show file tree
Hide file tree
Showing 183 changed files with 62,461 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Recordings can get excessive in size
/[Rr]ecordings/

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage
*.app

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
56 changes: 56 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"files.exclude":
{
"**/.DS_Store":true,
"**/.git":true,
"**/.gitmodules":true,
"**/*.booproj":true,
"**/*.pidb":true,
"**/*.suo":true,
"**/*.user":true,
"**/*.userprefs":true,
"**/*.unityproj":true,
"**/*.dll":true,
"**/*.exe":true,
"**/*.pdf":true,
"**/*.mid":true,
"**/*.midi":true,
"**/*.wav":true,
"**/*.gif":true,
"**/*.ico":true,
"**/*.jpg":true,
"**/*.jpeg":true,
"**/*.png":true,
"**/*.psd":true,
"**/*.tga":true,
"**/*.tif":true,
"**/*.tiff":true,
"**/*.3ds":true,
"**/*.3DS":true,
"**/*.fbx":true,
"**/*.FBX":true,
"**/*.lxo":true,
"**/*.LXO":true,
"**/*.ma":true,
"**/*.MA":true,
"**/*.obj":true,
"**/*.OBJ":true,
"**/*.asset":true,
"**/*.cubemap":true,
"**/*.flare":true,
"**/*.mat":true,
"**/*.meta":true,
"**/*.prefab":true,
"**/*.unity":true,
"build/":true,
"Build/":true,
"Library/":true,
"library/":true,
"obj/":true,
"Obj/":true,
"ProjectSettings/":true,
"temp/":true,
"Temp/":true
},
"dotnet.defaultSolution": "Experimental Project.sln"
}
8 changes: 8 additions & 0 deletions Assets/Atmosphere.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions Assets/Atmosphere/Atmosphere.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "Atmosphere",
"rootNamespace": "",
"references": [
"Unity.RenderPipelines.Core.Runtime",
"Unity.RenderPipelines.Universal.Runtime",
"BlitUtility"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.render-pipelines.universal",
"expression": "0.0",
"define": "USING_URP"
},
{
"name": "com.unity.render-pipelines.high-definition",
"expression": "0.0",
"define": "USING_HDRP"
}
],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Assets/Atmosphere/Atmosphere.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Atmosphere/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Assets/Atmosphere/Editor/Atmosphere.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Atmosphere.Editor",
"rootNamespace": "",
"references": [
"GUID:539f265ea35515f45bbeb4a9cf080c04",
"GUID:15fc0a57446b3144c949da3e2b9737a9"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Assets/Atmosphere/Editor/Atmosphere.Editor.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 128 additions & 0 deletions Assets/Atmosphere/Editor/AtmosphereEffectEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
using UnityEngine;
using UnityEditor;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;


[CustomEditor(typeof(AtmosphereEffect))]
public class AtmosphereEffectEditor : Editor
{
SerializedProperty profile;
SerializedProperty sun;
SerializedProperty directional;
SerializedProperty planetRadius;
SerializedProperty oceanRadius;
SerializedProperty atmosphereScale;


void OnEnable()
{
profile = serializedObject.FindProperty("profile");
sun = serializedObject.FindProperty("sun");
directional = serializedObject.FindProperty("directional");
planetRadius = serializedObject.FindProperty("planetRadius");
oceanRadius = serializedObject.FindProperty("oceanRadius");
atmosphereScale = serializedObject.FindProperty("atmosphereScale");
}



public override void OnInspectorGUI()
{
serializedObject.Update();

ShowWarnings();

DrawPropertyLabelControl(profile, new GUIContent("Profile", "The Atmosphere Profile used for rendering the Atmosphere Effect."), GUILayout.Width(110));

GUILayout.BeginHorizontal();

EditorGUILayout.LabelField(new GUIContent("Sun", "The main light that affects the atmosphere."), GUILayout.Width(110));
EditorGUILayout.PropertyField(sun, GUIContent.none);

TightLabel("Directional", "Use the Sun's forward direction instead of the direction from the planet to the Sun's transform?");
EditorGUILayout.PropertyField(directional, GUIContent.none, GUILayout.Width(15));

GUILayout.EndHorizontal();

float prevWidth = EditorGUIUtility.labelWidth;

EditorGUIUtility.labelWidth = 110;

EditorGUILayout.PropertyField(planetRadius, new GUIContent("Planet Radius", "The main light that affects the atmosphere."));
EditorGUILayout.PropertyField(oceanRadius, new GUIContent("Ocean Radius", "The main light that affects the atmosphere."));
EditorGUILayout.PropertyField(atmosphereScale, new GUIContent("Atmosphere Scale", "The scale of the planet aatmosphere relative to the planet radius"));

EditorGUIUtility.labelWidth = prevWidth;

serializedObject.ApplyModifiedProperties();
}


void ShowWarnings()
{
AtmosphereEffect effect = (AtmosphereEffect)target;

if (!(GraphicsSettings.currentRenderPipeline is UniversalRenderPipelineAsset))
{
EditorGUILayout.HelpBox("Effect is only compatible with the Universal Render Pipeline!", MessageType.Error);
}
else if (effect.profile == null)
{
EditorGUILayout.HelpBox("Atmosphere Profile required to display effect!", MessageType.Error);
}
else if (effect.sun == null)
{
EditorGUILayout.HelpBox("Sun transform required to display effect!", MessageType.Error);
}
}


public void OnSceneGUI()
{
AtmosphereEffect[] effects = System.Array.ConvertAll(targets, item => (AtmosphereEffect)item);

for (int i = 0; i < effects.Length; i++)
{
var effect = effects[i];

EditorGUI.BeginChangeCheck();
Handles.color = Color.yellow;
float newPlanet = Handles.RadiusHandle(Quaternion.identity, effect.transform.position, effect.planetRadius);

Handles.color = Color.red;
float newOcean = Handles.RadiusHandle(Quaternion.identity, effect.transform.position, effect.oceanRadius);

Handles.color = Color.blue;
float newAtmo = Handles.RadiusHandle(Quaternion.identity, effect.transform.position, effect.AtmosphereSize);


if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(effect, "Changed Atmosphere Radii");

effect.atmosphereScale = (newAtmo / effect.planetRadius) - 1;
effect.planetRadius = newPlanet;
effect.oceanRadius = newOcean;
}
}
}


void DrawPropertyLabelControl(SerializedProperty property, GUIContent content, params GUILayoutOption[] options)
{
GUILayout.BeginHorizontal();

EditorGUILayout.LabelField(content, options);
EditorGUILayout.PropertyField(property, GUIContent.none);

GUILayout.EndHorizontal();
}


public static void TightLabel(string labelStr, string tooltip = null)
{
GUIContent label = tooltip == null ? new GUIContent(labelStr) : new GUIContent(labelStr, tooltip);
EditorGUILayout.LabelField(label, GUILayout.Width(GUI.skin.label.CalcSize(label).x));
}
}
11 changes: 11 additions & 0 deletions Assets/Atmosphere/Editor/AtmosphereEffectEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8703f90

Please sign in to comment.