Esempio n. 1
0
        public void Draw(RenderContext context)
        {
            if (context.layerPass != RenderContext.LayerPass.UI_PASS)
            {
                return;
            }
            if (debugLinesBuffer == null)
            {
                BlobCollection blobs = OSMReader.GetAllBlobs(sector);
                debugLinesBuffer = OSMLineBufferGenerator.GenerateDebugLines(context.graphicsDevice, blobs);
            }
            // draw those lines
            Effect effect = GlobalContent.DebugLinesShader;

            effect.Parameters["Texture"].SetValue(debugLinesBuffer.texture);
            effect.Parameters["WVP"].SetValue(context.WVP.toMatrix());
            effect.Parameters["LineWidth"].SetValue((float)Math.Pow(0.5, context.cameraZoom) * 50);
            context.graphicsDevice.Indices = debugLinesBuffer.indices;
            context.graphicsDevice.SetVertexBuffer(debugLinesBuffer.vertices);
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                context.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, debugLinesBuffer.indices.IndexCount / 3);
            }
            // TODO: need to call this once for all debug buffers somehow
            string  text = $"Nothing Selected";
            Vector2 size = GlobalContent.Arial.MeasureString(text);

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, DepthStencilState.Default, null, null, null);
            spriteBatch.DrawString(GlobalContent.Arial, text, new Vector2(context.graphicsDevice.Viewport.Width - 5 - size.X, 5), Color.White);
            spriteBatch.End();
        }
        public void GenerateBuffers(GraphicsDevice graphicsDevice)
        {
            double height = heightInFeet / 300000;

            buffer  = polygonSource.GetMap().Tesselate(graphicsDevice, Color.White);
            buffer2 = lineSource.GetLineGraph().ConstructViaExtrusion(graphicsDevice, new[] { new Vector2d(0, 0), new Vector2d(0, height) }, null, Color.White);
        }
Esempio n. 3
0
 public void Dispose()
 {
     if (debugLinesBuffer != null)
     {
         debugLinesBuffer.Dispose();
     }
     debugLinesBuffer = null;
 }
Esempio n. 4
0
        public void GenerateBuffers(GraphicsDevice graphicsDevice)
        {
            var allDescriptors = new List <IDescriptor>();

            allDescriptors.AddRange(descriptors);
            allDescriptors.AddRange(treeDescriptors);
            allDescriptors.AddRange(grassDescriptors);
            foreach (var descriptor in allDescriptors)
            {
                descriptor.GenerateBuffers(graphicsDevice);
            }
            treeBuffer  = new TreeGeometryBuffer(graphicsDevice);
            debugBuffer = new DebugBuffer(graphicsDevice, sector);
            waterBuffer = GenerateWaterBuffer(graphicsDevice);
        }
 public void GenerateBuffers(GraphicsDevice graphicsDevice)
 {
     buffer = polygonSource.GetMap().Tesselate(graphicsDevice, Color.White);
 }
Esempio n. 6
0
 internal void Add(GraphicsDevice graphicsDevice, BasicVertexBuffer buffer, ISector sector)
 {
     buffers.Add(buffer);
 }
 public void GenerateBuffers(GraphicsDevice graphicsDevice)
 {
     buffer = lineSource.ConstructAsRoads(graphicsDevice, widthInFeet, outerOnly);
 }