From c12980ee6967949fce690216c68a133b87053740 Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 5 May 2020 14:32:07 -0500 Subject: [PATCH] correct cube to sphere, remove extraneous offset arg --- .../Assets/{CubeRendering.cs => PointRendering.cs} | 13 +++++++------ ...CubeRendering.cs.meta => PointRendering.cs.meta} | 0 2 files changed, 7 insertions(+), 6 deletions(-) rename procedural-placement/Assets/{CubeRendering.cs => PointRendering.cs} (85%) rename procedural-placement/Assets/{CubeRendering.cs.meta => PointRendering.cs.meta} (100%) diff --git a/procedural-placement/Assets/CubeRendering.cs b/procedural-placement/Assets/PointRendering.cs similarity index 85% rename from procedural-placement/Assets/CubeRendering.cs rename to procedural-placement/Assets/PointRendering.cs index 44cfcf2..5c052b0 100644 --- a/procedural-placement/Assets/CubeRendering.cs +++ b/procedural-placement/Assets/PointRendering.cs @@ -3,19 +3,20 @@ using System.Collections.Generic; using System.Net; using UnityEditor; using UnityEngine; +using UnityEngine.Serialization; public enum SamplingTypes { Random, Poisson }; -public class CubeRendering : MonoBehaviour { +public class PointRendering : MonoBehaviour { [Tooltip("The sampling method used to generate points")] public SamplingTypes samplingMethod = SamplingTypes.Random; [Tooltip("The number of points (spheres) placed inside the region")] public int numPoints = 100; - [Tooltip("The size of the rendered cubes")] - public float cubeSize = 1; + [Tooltip("The size of the rendered spheres")] + public float sphereSize = 1; [Tooltip("The Size of the region points are generated in")] public Vector2 regionSize = Vector2.one; @@ -37,7 +38,7 @@ public class CubeRendering : MonoBehaviour { switch (samplingMethod) { case SamplingTypes.Random: - _points = PointGeneration.random_sampling(numPoints, regionSize, transform.position); + _points = PointGeneration.random_sampling(numPoints, regionSize); break; case SamplingTypes.Poisson: _points = new List(); @@ -51,12 +52,12 @@ public class CubeRendering : MonoBehaviour { private void OnDrawGizmos() { // Draw a wireframe around the entire region Gizmos.DrawWireCube(this.transform.position, - new Vector3(regionSize.x * 2 + cubeSize, regionSize.y * 2 + cubeSize, cubeSize)); + new Vector3(regionSize.x * 2 + sphereSize, regionSize.y * 2 + sphereSize, sphereSize)); // Render spheres at every point if (_points == null) return; var pos = transform.position; foreach (var point in _points) - Gizmos.DrawSphere(new Vector3(point.x + pos.x, point.y + pos.y, pos.z), cubeSize); + Gizmos.DrawSphere(new Vector3(point.x + pos.x, point.y + pos.y, pos.z), sphereSize); } } \ No newline at end of file diff --git a/procedural-placement/Assets/CubeRendering.cs.meta b/procedural-placement/Assets/PointRendering.cs.meta similarity index 100% rename from procedural-placement/Assets/CubeRendering.cs.meta rename to procedural-placement/Assets/PointRendering.cs.meta