public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { if (LineCount < 1) { return; } int i = 0; LinkedListNode <GameObject> n = Nodes.Value.First; if (n != null) { while (n.Next != null) { Path3DNode p = (Path3DNode)n.Value; LineVerteces[i++].Position = p.GetPosition(); p = (Path3DNode)n.Next.Value; LineVerteces[i++].Position = p.GetPosition(); n = n.Next; } } ShapeRenderer.Load(); ShapeRenderer.ColorEffectHolder.SetFromCamera(camera); ShapeRenderer.ColorEffectHolder.SetWorld(Matrix.Identity); ShapeRenderer.ColorEffectHolder.Apply(); ShapeRenderer.ColorEffectHolder.MyEffect.Parameters["ObjectColor"].SetValue(drawColor); Game1.graphics.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColor>( PrimitiveType.LineList, LineVerteces, 0, LineCount * 2, LineIndicies, 0, LineCount); base.Draw3D(camera, DrawTag); }
private void NodeChange() { LineCount = Nodes.Value.Count - 1; if (LineCount < 0) { LineCount = 0; } LineVerteces = new VertexPositionColor[LineCount * 2]; LineIndicies = new short[LineCount * 2]; int i = 0; LinkedListNode <GameObject> n = Nodes.Value.First; if (n != null) { while (n.Next != null) { Path3DNode p = (Path3DNode)n.Value; LineVerteces[i++] = new VertexPositionColor(p.GetPosition(), Color.White); p = (Path3DNode)n.Next.Value; LineVerteces[i++] = new VertexPositionColor(p.GetPosition(), Color.White); n = n.Next; } } for (i = 0; i < LineCount * 2; i++) { LineIndicies[i] = (short)(i); } }