From 5549f15029c8470a88b5bbe75626d1d519d83af6 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 25 Feb 2020 20:34:00 -0500 Subject: [PATCH] rename numEdgeVertices -> NUM_EDGE_VERTICES GitOrigin-RevId: c7a67e06ea330f1fd3de4abdbeb8021402b6f330 --- Shared/LinesOfSight.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Shared/LinesOfSight.cs b/Shared/LinesOfSight.cs index de3c708..f861fbe 100644 --- a/Shared/LinesOfSight.cs +++ b/Shared/LinesOfSight.cs @@ -5,20 +5,20 @@ using System; namespace SemiColinGames { class LinesOfSight : IDisposable { - const int numEdgeVertices = 60; + const int NUM_EDGE_VERTICES = 60; readonly VertexBuffer vertexBuffer; readonly IndexBuffer indexBuffer; // coneVertices[0] is the eye position; the rest are the edge vertices. - readonly VertexPositionColor[] coneVertices = new VertexPositionColor[numEdgeVertices + 1]; + readonly VertexPositionColor[] coneVertices = new VertexPositionColor[NUM_EDGE_VERTICES + 1]; // The number of total triangles drawn is one less than the number of edge points. - readonly int[] indices = new int[(numEdgeVertices - 1) * 3]; + readonly int[] indices = new int[(NUM_EDGE_VERTICES - 1) * 3]; Color color = Color.FromNonPremultiplied(new Vector4(0, 0, 1, 0.6f)); public LinesOfSight(GraphicsDevice graphics) { vertexBuffer = new VertexBuffer( - graphics, typeof(VertexPositionColor), numEdgeVertices * 3, BufferUsage.WriteOnly); + graphics, typeof(VertexPositionColor), NUM_EDGE_VERTICES * 3, BufferUsage.WriteOnly); indexBuffer = new IndexBuffer( graphics, typeof(int), indices.Length, BufferUsage.WriteOnly); } @@ -40,10 +40,10 @@ namespace SemiColinGames { float fov = player.FieldOfView; float visionRangeSq = visionRange * visionRange; - float fovStep = fov / (numEdgeVertices - 1); + float fovStep = fov / (NUM_EDGE_VERTICES - 1); coneVertices[0] = new VertexPositionColor(new Vector3(player.EyePosition, 0), color); - for (int i = 0; i < numEdgeVertices; i++) { + for (int i = 0; i < NUM_EDGE_VERTICES; i++) { float angle = -fov / 2 + fovStep * i; Vector2 rotated = ray.Rotate(angle); Vector2 closestHit = Vector2.Add(eyePos, rotated); @@ -77,7 +77,7 @@ namespace SemiColinGames { public void Draw(GraphicsDevice graphics, BasicEffect lightingEffect) { - for (int i = 0; i < numEdgeVertices - 1; i++) { + for (int i = 0; i < NUM_EDGE_VERTICES - 1; i++) { indices[i * 3] = 0; indices[i * 3 + 1] = i + 1; indices[i * 3 + 2] = i + 2;