/// <summary> /// Overridden. See <see cref="PCamera.PaintDebugFullBounds">PaintDebugFullBounds</see>. /// </summary> protected override void PaintDebugFullBounds(PPaintContext paintContext, Brush fullBoundsBrush, RectangleF nodeBounds) { Device device = (paintContext as P3PaintContext).Device; CustomVertex.PositionColored[] colVerts = new CustomVertex.PositionColored[VERTEX_COUNT]; P3Util.CreateColoredRectangle(colVerts, 0, nodeBounds, (fullBoundsBrush as SolidBrush).Color.ToArgb()); device.VertexFormat = CustomVertex.PositionColored.Format; device.DrawUserPrimitives(PrimitiveType.TriangleList, 2, colVerts); }
/// <summary> /// Override this method to fill the vertex buffer with the appropriate data. Most nodes /// that extend P3Node will need to override this method since their number and type of /// vertices will vary. /// </summary> /// <remarks> /// It is not safe to call GetValidVertexBuffer() here, since that method may call /// FillVertexBuffer(). /// </remarks> /// <param name="vb">The vertex buffer to fill.</param> protected virtual void FillVertexBuffer(VertexBuffer vb) { if (Brush != null) { GraphicsStream stm = vb.Lock(0, 0, 0); CustomVertex.PositionColored[] colVerts = new CustomVertex.PositionColored[VERTEX_COUNT]; P3Util.CreateColoredRectangle(colVerts, 0, Bounds, (Brush as SolidBrush).Color.ToArgb()); stm.Write(colVerts); vb.Unlock(); } }