From 2b0ce4fee84876b59a5156e080ee749cf2438f3b Mon Sep 17 00:00:00 2001 From: Liam Arbuckle Date: Mon, 1 Nov 2021 01:09:38 +0800 Subject: [PATCH] #3 Finished settings editor --- Assets/PCG/.DS_Store | Bin 0 -> 10244 bytes .../Planet Procedural Generation/.DS_Store | Bin 0 -> 8196 bytes .../{Scripts => }/Editor.meta | 2 +- .../Editor/PlanetEditor.cs | 61 + .../{Scripts => }/Editor/PlanetEditor.cs.meta | 2 +- .../Planet Procedural Generation/Scenes.meta | 8 + .../Scenes/SampleScene.unity | 2123 +++++++++++++++++ .../Scenes/SampleScene.unity.meta | 7 + .../Scripts/ColorSettings.cs | 9 - .../Scripts/ColourSettings.cs | 9 + ...ettings.cs.meta => ColourSettings.cs.meta} | 2 +- .../Scripts/Editor/PlanetEditor.cs | 26 - .../Scripts/Planet.cs | 54 +- .../Scripts/Planet.cs.meta | 2 +- .../Scripts/ShapeGenerator.cs | 15 +- .../Scripts/ShapeGenerator.cs.meta | 2 +- .../Scripts/ShapeSettings.cs | 3 +- .../Scripts/ShapeSettings.cs.meta | 2 +- .../Scripts/TerrainFace.cs | 6 +- .../Scripts/TerrainFace.cs.meta | 2 +- .../{Scripts => }/Settings.meta | 2 +- .../Color.asset => Settings/Colour.asset} | 9 +- .../Colour.asset.meta} | 2 +- .../{Scripts => }/Settings/Shape.asset | 5 +- .../{Scripts => }/Settings/Shape.asset.meta | 2 +- 25 files changed, 2270 insertions(+), 85 deletions(-) create mode 100644 Assets/PCG/.DS_Store create mode 100644 Assets/PCG/Planet Procedural Generation/.DS_Store rename Assets/PCG/Planet Procedural Generation/{Scripts => }/Editor.meta (77%) create mode 100644 Assets/PCG/Planet Procedural Generation/Editor/PlanetEditor.cs rename Assets/PCG/Planet Procedural Generation/{Scripts => }/Editor/PlanetEditor.cs.meta (83%) create mode 100644 Assets/PCG/Planet Procedural Generation/Scenes.meta create mode 100644 Assets/PCG/Planet Procedural Generation/Scenes/SampleScene.unity create mode 100644 Assets/PCG/Planet Procedural Generation/Scenes/SampleScene.unity.meta delete mode 100644 Assets/PCG/Planet Procedural Generation/Scripts/ColorSettings.cs create mode 100644 Assets/PCG/Planet Procedural Generation/Scripts/ColourSettings.cs rename Assets/PCG/Planet Procedural Generation/Scripts/{ColorSettings.cs.meta => ColourSettings.cs.meta} (83%) delete mode 100644 Assets/PCG/Planet Procedural Generation/Scripts/Editor/PlanetEditor.cs rename Assets/PCG/Planet Procedural Generation/{Scripts => }/Settings.meta (77%) rename Assets/PCG/Planet Procedural Generation/{Scripts/Settings/Color.asset => Settings/Colour.asset} (53%) rename Assets/PCG/Planet Procedural Generation/{Scripts/Settings/Color.asset.meta => Settings/Colour.asset.meta} (79%) rename Assets/PCG/Planet Procedural Generation/{Scripts => }/Settings/Shape.asset (65%) rename Assets/PCG/Planet Procedural Generation/{Scripts => }/Settings/Shape.asset.meta (79%) diff --git a/Assets/PCG/.DS_Store b/Assets/PCG/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..be4751b09fc81045deae1ac75736bbc34828444e GIT binary patch literal 10244 zcmeHMTWl3Y82F!eK_QDnp6%HOMw*uu_u5xS(r9o`v6e!oS=j^s@*t1)9_p}r! zsWHAN0dI+kcuCY~5Fb$Ei}Ar1BZ`SJl8734G0_KKNPN);ga6FzDW|8@2T(C_C)xdH zXZ~;gnQy+GGqVQ(uqkIO2Z#fJL>IGa8QpG^SUtPOq>`|tf-DjqzySl6LKbug#&|~s z5d#qe5d#qe5d#qe{{;r12`rg+GJ>lh2>CcQ=A?!gkpHaKmn)vICCeP4DGP60uCtPfMH||PbkQv6E4o( z0h7W;_lSXrfw2s*v%3PV;DHOd!t;BZ?Pk)po2Gj9N^PKP!A+hh2T*=H3_tsuboSSa z&=jgeh)J`q6W7D?^7CoT8bZ{0} ze+=r2M>RH;wub#<&jIz%1*fQgzy4kArU(4Kkn=0)KHKtxhK6sjWWvNrlS?H@k(8;* z!PF6VAQk9A&TrDa{p_hj500e6e5dQ$BY8c&+cF2b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(!p zA#`Idtek(2rw8^qo}U=0EIcFf`ef)gEG&l;j>E}{ulfJ@p8@n)Cp!N}=l}on`TtLU C9=mq{ literal 0 HcmV?d00001 diff --git a/Assets/PCG/Planet Procedural Generation/.DS_Store b/Assets/PCG/Planet Procedural Generation/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..56f919138cc501473a9cc36d85010bdcd689f206 GIT binary patch literal 8196 zcmeHM&2AGh5FWRsY#LfpL4V+Y_5c!x7A1w!144?@7Svm%RB!;)ZkniFDcy}W8=?|| za^Wf9!~uzC;Q@FM9ss_v-N>6}6CqWo2s^UJ>z!}x{l@n0I7B2$t!ja2nTQ-@mbom7 zA&KvEK9?qR%L1eTo~T6;m8nKCel}SKECZGS%YbFTGH@9gz&o3hlk(nIcWr4Iunhc{ z4DkNoBC{-N*;7((9Vlc706B$bnNUX@ATh3%MJ;@CUaNKuU9kQrp zPe}zQq2MHR&q7BiLiP@vE7eI9m9(X0z%p>20gm10X_G>#Bb)KNPXQfKlOE6^HFxUa zVWl2cpp6A4enQ^=C6hF{INk#6oXC>_FKLUOz`|F<)--KXm3*8agcJ?vejBA*X*U~s zjNdDby5EfR`5$6pa_Y+TRmYieW@cyJl#j!9IridKv*bmu_-faSk1M*q7l!qI-K)It zYwi8q&CM`~JwK>L66{xNPk-;wkRRg8r2_1=P-ADD4!DBdW=?@Se{L~t zw8U;UZD$g;hfTTI9)O-v~e4ec0t}$7&rfymf{5%QNHHnJA zYXi*k5*xZS1V5F@gVR4;(~C3d6ZUeVpV>kEQ9UJ)^FSVBE;PVHa&BNz!phJsAz@*0 zyoI#UNS41CEawbcXUB^pwkOHAiC-9pPaBD3)U-55dvcZVI^hvKgXFm~j1hQGnAjVm zu&E=!R-3SbDPfak;3629R7RFL{@+eN|G$W?tPRV6W#E!BAf~p;TO|zc>>G4&oE&Sr z$Op)rSg)s~grJb&IHU~6A^U$AqV7VKF-0wVN}>hn?;ixHzb6yl52().sharedMaterial.color = colorSettings.planetColor; + m.GetComponent().sharedMaterial.color = colourSettings.planetColour; } } -} \ No newline at end of file +} diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/Planet.cs.meta b/Assets/PCG/Planet Procedural Generation/Scripts/Planet.cs.meta index ddf5f0026..a550e67f1 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/Planet.cs.meta +++ b/Assets/PCG/Planet Procedural Generation/Scripts/Planet.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 20944ccf891d146a788f0cbfa44b7df3 +guid: 032cda3cb5aa847b0a635bd4b95e2e16 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/ShapeGenerator.cs b/Assets/PCG/Planet Procedural Generation/Scripts/ShapeGenerator.cs index 106d1993c..d757f1af8 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/ShapeGenerator.cs +++ b/Assets/PCG/Planet Procedural Generation/Scripts/ShapeGenerator.cs @@ -1,15 +1,18 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEngine; -public class ShapeGenerator -{ - ShapeSettings settings; // Assigned in the constructor - public ShapeGenerator(ShapeSettings settings) { +public class ShapeGenerator { + + ShapeSettings settings; + + public ShapeGenerator(ShapeSettings settings) + { this.settings = settings; } - public Vector3 CalculatePointOnPlanet(Vector3 pointOnUnitSphere) { + public Vector3 CalculatePointOnPlanet(Vector3 pointOnUnitSphere) + { return pointOnUnitSphere * settings.planetRadius; } } diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/ShapeGenerator.cs.meta b/Assets/PCG/Planet Procedural Generation/Scripts/ShapeGenerator.cs.meta index 1eb267f59..2dc63dc9a 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/ShapeGenerator.cs.meta +++ b/Assets/PCG/Planet Procedural Generation/Scripts/ShapeGenerator.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7d94a0b57f7d9425e9309a7be1105d7e +guid: c40ca591585634230bc9a35fba20a8b8 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/ShapeSettings.cs b/Assets/PCG/Planet Procedural Generation/Scripts/ShapeSettings.cs index c07f214a0..d130812cd 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/ShapeSettings.cs +++ b/Assets/PCG/Planet Procedural Generation/Scripts/ShapeSettings.cs @@ -1,8 +1,9 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEngine; [CreateAssetMenu()] public class ShapeSettings : ScriptableObject { + public float planetRadius = 1; } diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/ShapeSettings.cs.meta b/Assets/PCG/Planet Procedural Generation/Scripts/ShapeSettings.cs.meta index f3dd9953f..f33a59543 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/ShapeSettings.cs.meta +++ b/Assets/PCG/Planet Procedural Generation/Scripts/ShapeSettings.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a9b63090aeeb0411bbf8ce26688c294f +guid: d48e7d87040ce4f66a07c75b885f4f80 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs b/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs index 68b6cdc0b..5961f63ad 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs +++ b/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -35,7 +35,7 @@ public void ConstructMesh() int i = x + y * resolution; Vector2 percent = new Vector2(x, y) / (resolution - 1); Vector3 pointOnUnitCube = localUp + (percent.x - .5f) * 2 * axisA + (percent.y - .5f) * 2 * axisB; - Vector3 pointOnUnitSphere = pointOnUnitCube.normalized; // Make the game object a sphere + Vector3 pointOnUnitSphere = pointOnUnitCube.normalized; vertices[i] = shapeGenerator.CalculatePointOnPlanet(pointOnUnitSphere); if (x != resolution - 1 && y != resolution - 1) @@ -56,4 +56,4 @@ public void ConstructMesh() mesh.triangles = triangles; mesh.RecalculateNormals(); } -} \ No newline at end of file +} diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs.meta b/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs.meta index 13444f5e5..d6729c291 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs.meta +++ b/Assets/PCG/Planet Procedural Generation/Scripts/TerrainFace.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9f74753531418400492472844f5b9cf7 +guid: 859215c01402541afaa80c9fee15874c MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/Settings.meta b/Assets/PCG/Planet Procedural Generation/Settings.meta similarity index 77% rename from Assets/PCG/Planet Procedural Generation/Scripts/Settings.meta rename to Assets/PCG/Planet Procedural Generation/Settings.meta index f29ef6357..a0efa0374 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/Settings.meta +++ b/Assets/PCG/Planet Procedural Generation/Settings.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d138f091230f54c258db8c5132ee9b84 +guid: 1b7457104e1d74e9f9c8f046ccccc897 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/Settings/Color.asset b/Assets/PCG/Planet Procedural Generation/Settings/Colour.asset similarity index 53% rename from Assets/PCG/Planet Procedural Generation/Scripts/Settings/Color.asset rename to Assets/PCG/Planet Procedural Generation/Settings/Colour.asset index 5465c3517..91673a7ea 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/Settings/Color.asset +++ b/Assets/PCG/Planet Procedural Generation/Settings/Colour.asset @@ -4,12 +4,11 @@ MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} + m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dbfd93a1135b5497d9739bd17599d359, type: 3} - m_Name: Color + m_Script: {fileID: 11500000, guid: f6e6c8ca3ba8841e191076baacd2a9ab, type: 3} + m_Name: Colour m_EditorClassIdentifier: - planetColor: {r: 0, g: 0.8565588, b: 1, a: 0} + planetColour: {r: 0.9528302, g: 0, b: 0.12276398, a: 0} diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/Settings/Color.asset.meta b/Assets/PCG/Planet Procedural Generation/Settings/Colour.asset.meta similarity index 79% rename from Assets/PCG/Planet Procedural Generation/Scripts/Settings/Color.asset.meta rename to Assets/PCG/Planet Procedural Generation/Settings/Colour.asset.meta index c868e5f47..d4558f124 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/Settings/Color.asset.meta +++ b/Assets/PCG/Planet Procedural Generation/Settings/Colour.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cfdd4eb60d22146b192f8c87247df90a +guid: 4d2914748ff1c4089acd77328cfcb02e NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/Settings/Shape.asset b/Assets/PCG/Planet Procedural Generation/Settings/Shape.asset similarity index 65% rename from Assets/PCG/Planet Procedural Generation/Scripts/Settings/Shape.asset rename to Assets/PCG/Planet Procedural Generation/Settings/Shape.asset index a5749156e..c29e7ce79 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/Settings/Shape.asset +++ b/Assets/PCG/Planet Procedural Generation/Settings/Shape.asset @@ -4,12 +4,11 @@ MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} + m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a9b63090aeeb0411bbf8ce26688c294f, type: 3} + m_Script: {fileID: 11500000, guid: d48e7d87040ce4f66a07c75b885f4f80, type: 3} m_Name: Shape m_EditorClassIdentifier: planetRadius: 2 diff --git a/Assets/PCG/Planet Procedural Generation/Scripts/Settings/Shape.asset.meta b/Assets/PCG/Planet Procedural Generation/Settings/Shape.asset.meta similarity index 79% rename from Assets/PCG/Planet Procedural Generation/Scripts/Settings/Shape.asset.meta rename to Assets/PCG/Planet Procedural Generation/Settings/Shape.asset.meta index 18af68459..87ce4585a 100644 --- a/Assets/PCG/Planet Procedural Generation/Scripts/Settings/Shape.asset.meta +++ b/Assets/PCG/Planet Procedural Generation/Settings/Shape.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cd6681a60cc004066a8b7d1a8ecb2924 +guid: bb563e90654574d4cb7d931456630f79 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000