Browse Source

small cleanups suggested by VS

GitOrigin-RevId: b1b3a687e3
master
Colin McMillen 4 years ago
parent
commit
af9a48bc5d
  1. 15
      Shared/LinesOfSight.cs
  2. 2
      Shared/Scene.cs

15
Shared/LinesOfSight.cs

@ -6,13 +6,15 @@ namespace SemiColinGames {
class LinesOfSight : IDisposable {
const int numEdgeVertices = 60;
readonly VertexBuffer vertexBuffer;
readonly IndexBuffer indexBuffer;
// coneVertices[0] is the eye position; the rest are the edge vertices.
VertexPositionColor[] coneVertices = new VertexPositionColor[numEdgeVertices + 1];
Color color = Color.FromNonPremultiplied(new Vector4(0, 0, 1, 0.6f));
readonly VertexPositionColor[] coneVertices = new VertexPositionColor[numEdgeVertices + 1];
// The number of total triangles drawn is one less than the number of edge points.
int[] indices = new int[(numEdgeVertices - 1) * 3];
VertexBuffer vertexBuffer;
IndexBuffer indexBuffer;
readonly int[] indices = new int[(numEdgeVertices - 1) * 3];
Color color = Color.FromNonPremultiplied(new Vector4(0, 0, 1, 0.6f));
public LinesOfSight(GraphicsDevice graphics) {
vertexBuffer = new VertexBuffer(
@ -72,8 +74,7 @@ namespace SemiColinGames {
}
}
public void Draw(Player player, AABB[] collisionTargets, GraphicsDevice graphics,
BasicEffect lightingEffect) {
public void Draw(GraphicsDevice graphics, BasicEffect lightingEffect) {
for (int i = 0; i < numEdgeVertices - 1; i++) {
indices[i * 3] = 0;

2
Shared/Scene.cs

@ -91,7 +91,7 @@ namespace SemiColinGames {
graphics.Clear(new Color(0, 0, 0, 0f));
lightingEffect.Projection = camera.Projection;
if (Debug.Enabled) {
linesOfSight.Draw(player, world.CollisionTargets, graphics, lightingEffect);
linesOfSight.Draw(graphics, lightingEffect);
}
// Draw debug rects & lines on top.

Loading…
Cancel
Save