-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f385ef0
commit 578bfbe
Showing
91 changed files
with
6,592 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": "1.0", | ||
"components": [ | ||
"Microsoft.VisualStudio.Workload.ManagedGame" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
#if UNITY_EDITOR | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
[CustomEditor(typeof(RaymarchRenderer))] | ||
public class PropertiesEditor : Editor | ||
{ | ||
public override void OnInspectorGUI() | ||
{ | ||
base.OnInspectorGUI(); | ||
|
||
RaymarchRenderer renderer = (RaymarchRenderer)target; | ||
|
||
/*if (renderer.dimensions == null) | ||
return;*/ | ||
if (GUILayout.Button("Create New Dimensions")) | ||
renderer.dimensions = CreateShapeDimensionsAsset(); | ||
|
||
if (renderer.dimensions == null) | ||
return; | ||
|
||
EditorGUILayout.Space(); | ||
EditorGUILayout.LabelField("Shape Dimensions", EditorStyles.boldLabel); | ||
|
||
switch (renderer.shape) | ||
{ | ||
case RaymarchRenderer.Shape.Shpere: | ||
renderer.dimensions.sphereRadius = EditorGUILayout.FloatField("Radius", renderer.dimensions.sphereRadius); | ||
break; | ||
case RaymarchRenderer.Shape.Torus: | ||
renderer.dimensions.torusThickness = EditorGUILayout.Vector2Field("Thickness", renderer.dimensions.torusThickness); | ||
break; | ||
case RaymarchRenderer.Shape.CappedTorus: | ||
renderer.dimensions.cappedTorusRo = EditorGUILayout.FloatField("Ro", renderer.dimensions.cappedTorusRo); | ||
renderer.dimensions.cappedTorusRi = EditorGUILayout.FloatField("Ri", renderer.dimensions.cappedTorusRi); | ||
renderer.dimensions.cappedTorusThickness = EditorGUILayout.Vector2Field("Thickness", renderer.dimensions.cappedTorusThickness); | ||
break; | ||
case RaymarchRenderer.Shape.Link: | ||
renderer.dimensions.linkSeparation = EditorGUILayout.FloatField("Separation", renderer.dimensions.linkSeparation); | ||
renderer.dimensions.linkRadius = EditorGUILayout.FloatField("Radius", renderer.dimensions.linkRadius); | ||
renderer.dimensions.linkThickness = EditorGUILayout.FloatField("Thickness", renderer.dimensions.linkThickness); | ||
break; | ||
case RaymarchRenderer.Shape.Cone: | ||
renderer.dimensions.coneTan = EditorGUILayout.Vector2Field("Tan", renderer.dimensions.coneTan); | ||
renderer.dimensions.coneHeight = EditorGUILayout.FloatField("Height", renderer.dimensions.coneHeight); | ||
break; | ||
case RaymarchRenderer.Shape.InfCone: | ||
renderer.dimensions.infConeTan = EditorGUILayout.Vector2Field("Tan", renderer.dimensions.infConeTan); | ||
break; | ||
case RaymarchRenderer.Shape.Plane: | ||
renderer.dimensions.planeNormal = EditorGUILayout.Vector3Field("Normal", renderer.dimensions.planeNormal); | ||
renderer.dimensions.planeDistance = EditorGUILayout.FloatField("Distance", renderer.dimensions.planeDistance); | ||
break; | ||
case RaymarchRenderer.Shape.HexPrism: | ||
renderer.dimensions.hexPrismH = EditorGUILayout.Vector2Field("H", renderer.dimensions.hexPrismH); | ||
break; | ||
case RaymarchRenderer.Shape.TriPrism: | ||
renderer.dimensions.triPrismH = EditorGUILayout.Vector2Field("H", renderer.dimensions.triPrismH); | ||
break; | ||
case RaymarchRenderer.Shape.Capsule: | ||
renderer.dimensions.capsuleA = EditorGUILayout.Vector3Field("A", renderer.dimensions.capsuleA); | ||
renderer.dimensions.capsuleB = EditorGUILayout.Vector3Field("B", renderer.dimensions.capsuleB); | ||
renderer.dimensions.capsuleR = EditorGUILayout.FloatField("R", renderer.dimensions.capsuleR); | ||
break; | ||
case RaymarchRenderer.Shape.InfiniteCylinder: | ||
renderer.dimensions.infCylC = EditorGUILayout.Vector3Field("C", renderer.dimensions.infCylC); | ||
break; | ||
case RaymarchRenderer.Shape.Box: | ||
renderer.dimensions.boxSize = EditorGUILayout.FloatField("Size", renderer.dimensions.boxSize); | ||
break; | ||
case RaymarchRenderer.Shape.RoundBox: | ||
renderer.dimensions.roundBoxSize = EditorGUILayout.FloatField("Size", renderer.dimensions.roundBoxSize); | ||
renderer.dimensions.roundBoxRoundFactor = EditorGUILayout.FloatField("Round Factor", renderer.dimensions.roundBoxRoundFactor); | ||
break; | ||
case RaymarchRenderer.Shape.RoundedCylinder: | ||
renderer.dimensions.roundCylRa = EditorGUILayout.FloatField("Ra", renderer.dimensions.roundCylRa); | ||
renderer.dimensions.roundCylRb = EditorGUILayout.FloatField("Ra", renderer.dimensions.roundCylRb); | ||
renderer.dimensions.roundCylH = EditorGUILayout.FloatField("Ra", renderer.dimensions.roundCylH); | ||
break; | ||
case RaymarchRenderer.Shape.CappedCone: | ||
renderer.dimensions.capConeH = EditorGUILayout.FloatField("H", renderer.dimensions.capConeH); | ||
renderer.dimensions.capConeR1 = EditorGUILayout.FloatField("R1", renderer.dimensions.capConeR1); | ||
renderer.dimensions.capConeR1 = EditorGUILayout.FloatField("R2", renderer.dimensions.capConeR2); | ||
break; | ||
case RaymarchRenderer.Shape.BoxFrame: | ||
renderer.dimensions.boxFrameSize = EditorGUILayout.Vector3Field("Size", renderer.dimensions.boxFrameSize); | ||
renderer.dimensions.boxFrameCavity = EditorGUILayout.FloatField("Cavity", renderer.dimensions.boxFrameCavity); | ||
break; | ||
case RaymarchRenderer.Shape.SolidAngle: | ||
renderer.dimensions.solidAngleC = EditorGUILayout.Vector2Field("C", renderer.dimensions.solidAngleC); | ||
renderer.dimensions.solidAngleRa = EditorGUILayout.FloatField("Ra", renderer.dimensions.solidAngleRa); | ||
break; | ||
case RaymarchRenderer.Shape.CutSphere: | ||
renderer.dimensions.cutSphereR = EditorGUILayout.FloatField("R", renderer.dimensions.cutSphereR); | ||
renderer.dimensions.cutSphereH = EditorGUILayout.FloatField("H", renderer.dimensions.cutSphereH); | ||
break; | ||
case RaymarchRenderer.Shape.CutHollowSphere: | ||
renderer.dimensions.cutSphereR = EditorGUILayout.FloatField("R", renderer.dimensions.cutSphereR); | ||
renderer.dimensions.cutSphereH = EditorGUILayout.FloatField("H", renderer.dimensions.cutSphereH); | ||
break; | ||
case RaymarchRenderer.Shape.DeathStar: | ||
renderer.dimensions.deathStarRa = EditorGUILayout.FloatField("Ra", renderer.dimensions.deathStarRa); | ||
renderer.dimensions.deathStarRb = EditorGUILayout.FloatField("Rb", renderer.dimensions.deathStarRb); | ||
renderer.dimensions.deathStarD = EditorGUILayout.FloatField("D", renderer.dimensions.deathStarD); | ||
break; | ||
case RaymarchRenderer.Shape.RoundCone: | ||
renderer.dimensions.roundConeR1 = EditorGUILayout.FloatField("R1", renderer.dimensions.roundConeR1); | ||
renderer.dimensions.roundConeR2 = EditorGUILayout.FloatField("R2", renderer.dimensions.roundConeR2); | ||
renderer.dimensions.roundConeH = EditorGUILayout.FloatField("H", renderer.dimensions.roundConeH); | ||
break; | ||
case RaymarchRenderer.Shape.Ellipsoid: | ||
renderer.dimensions.ellipsoidRadius = EditorGUILayout.Vector3Field("Radius", renderer.dimensions.ellipsoidRadius); | ||
break; | ||
case RaymarchRenderer.Shape.Rhombus: | ||
renderer.dimensions.rhombusLa = EditorGUILayout.FloatField("La", renderer.dimensions.rhombusLa); | ||
renderer.dimensions.rhombusLb = EditorGUILayout.FloatField("Lb", renderer.dimensions.rhombusLb); | ||
renderer.dimensions.rhombusH = EditorGUILayout.FloatField("H", renderer.dimensions.rhombusH); | ||
renderer.dimensions.rhombusRa = EditorGUILayout.FloatField("Ra", renderer.dimensions.rhombusRa); | ||
break; | ||
case RaymarchRenderer.Shape.Octahedron: | ||
renderer.dimensions.octahedronSize = EditorGUILayout.FloatField("Size", renderer.dimensions.octahedronSize); | ||
break; | ||
case RaymarchRenderer.Shape.Pyramid: | ||
renderer.dimensions.pyramidSize = EditorGUILayout.FloatField("Size", renderer.dimensions.pyramidSize); | ||
break; | ||
case RaymarchRenderer.Shape.Triangle: | ||
renderer.dimensions.triangleSideA = EditorGUILayout.Vector3Field("Side A", renderer.dimensions.triangleSideA); | ||
renderer.dimensions.triangleSideB = EditorGUILayout.Vector3Field("Side B", renderer.dimensions.triangleSideB); | ||
renderer.dimensions.triangleSideC = EditorGUILayout.Vector3Field("Side C", renderer.dimensions.triangleSideC); | ||
break; | ||
case RaymarchRenderer.Shape.Quad: | ||
renderer.dimensions.quadSideA = EditorGUILayout.Vector3Field("Side A", renderer.dimensions.quadSideA); | ||
renderer.dimensions.quadSideB = EditorGUILayout.Vector3Field("Side B", renderer.dimensions.quadSideB); | ||
renderer.dimensions.quadSideC = EditorGUILayout.Vector3Field("Side C", renderer.dimensions.quadSideC); | ||
renderer.dimensions.quadSideD = EditorGUILayout.Vector3Field("Side D", renderer.dimensions.quadSideD); | ||
break; | ||
case RaymarchRenderer.Shape.Fractal: | ||
renderer.dimensions.fractalI = EditorGUILayout.FloatField("I", renderer.dimensions.fractalI); | ||
renderer.dimensions.fractalS = EditorGUILayout.FloatField("S", renderer.dimensions.fractalS); | ||
renderer.dimensions.fractalO = EditorGUILayout.FloatField("O", renderer.dimensions.fractalO); | ||
break; | ||
case RaymarchRenderer.Shape.Tesseract: | ||
renderer.dimensions.tesseractSize = EditorGUILayout.Vector4Field("Size", renderer.dimensions.tesseractSize); | ||
break; | ||
case RaymarchRenderer.Shape.HyperSphere: | ||
renderer.dimensions.hyperSphereRadius = EditorGUILayout.FloatField("Radius", renderer.dimensions.hyperSphereRadius); | ||
break; | ||
case RaymarchRenderer.Shape.DuoCylinder: | ||
renderer.dimensions.duoCylR1R2 = EditorGUILayout.Vector2Field("R1 R2", renderer.dimensions.duoCylR1R2); | ||
break; | ||
case RaymarchRenderer.Shape.VerticalCapsule: | ||
renderer.dimensions.vertCapsuleH = EditorGUILayout.FloatField("H", renderer.dimensions.vertCapsuleH); | ||
renderer.dimensions.vertCapsuleR = EditorGUILayout.FloatField("R", renderer.dimensions.vertCapsuleR); | ||
break; | ||
case RaymarchRenderer.Shape.FiveCell: | ||
renderer.dimensions.fiveCellA = EditorGUILayout.Vector4Field("A", renderer.dimensions.fiveCellA); | ||
break; | ||
case RaymarchRenderer.Shape.SixteenCell: | ||
renderer.dimensions.sixteenCellS = EditorGUILayout.FloatField("S", renderer.dimensions.sixteenCellS); | ||
break; | ||
default: | ||
EditorGUILayout.HelpBox("Select a shape to see properties", MessageType.Info); | ||
break; | ||
} | ||
|
||
if (!PrefabUtility.IsPartOfPrefabAsset(renderer)) | ||
{ | ||
EditorUtility.SetDirty(renderer); | ||
EditorUtility.SetDirty(renderer.dimensions); | ||
} | ||
} | ||
|
||
void OnEnable() | ||
{ | ||
EditorApplication.playModeStateChanged += OnPlayModeStateChanged; | ||
EditorApplication.quitting += OnQuitting; | ||
} | ||
|
||
void OnDisable() | ||
{ | ||
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; | ||
EditorApplication.quitting -= OnQuitting; | ||
} | ||
|
||
private void OnPlayModeStateChanged(PlayModeStateChange state) | ||
{ | ||
if (state == PlayModeStateChange.ExitingEditMode || state == PlayModeStateChange.ExitingPlayMode) | ||
((RaymarchRenderer)target).editorStateChange = true; | ||
} | ||
|
||
private void OnQuitting() | ||
{ | ||
((RaymarchRenderer)target).editorStateChange = true; | ||
} | ||
|
||
ShapeDimensions CreateShapeDimensionsAsset() | ||
{ | ||
ShapeDimensions asset = ScriptableObject.CreateInstance<ShapeDimensions>(); | ||
|
||
string folderPath = "Assets/ScriptableObjects"; | ||
|
||
if (!System.IO.Directory.Exists(folderPath)) | ||
{ | ||
AssetDatabase.CreateFolder("Assets", "ScriptableObjects"); | ||
} | ||
Debug.Log(folderPath); | ||
string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(folderPath + "/New " + typeof(ShapeDimensions).ToString() + ".asset"); | ||
|
||
AssetDatabase.CreateAsset(asset, assetPathAndName); | ||
AssetDatabase.SaveAssets(); | ||
AssetDatabase.Refresh(); | ||
EditorUtility.FocusProjectWindow(); | ||
Selection.activeObject = asset; | ||
|
||
return asset; | ||
} | ||
} | ||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.