eyeshot

Only one (first) overlay item is painted, the rest are not


Eyeshot 11.847; Good afternoon, I've run into a problem that for some reason the internal fill has only one (first) OverlayItem (and all small circles should be filled). Here is a code snippet in which rendering takes place. Moreover, all the necessary OverlayItems fall into this block, but only one element is painted over. Tell me please, what could be the problem?

Here is Filling problem image: Filling problem

internal sealed class ViewportOverlayDrawer : IOverlayItemVisitor
{
    private readonly RenderContextBase _renderContext;

    public void Visit(OverlayItem item)
    {
      if (!item.IsVisible || item.Vertices == null || item.Vertices.Length == 0)
      {
        return;
      }

      var points = item.Vertices.Select(vertex => new Point3D(vertex.X, _viewportLayout.RealHeight - vertex.Y, 0.0)).ToArray();

      if (item.BrushColor != Color.Empty)
      {
        _renderContext.SetState(blendStateType.Blend);

        _renderContext.SetColorWireframe(item.BrushColor);

        _renderContext.DrawTrianglesFan(points, Vector3D.AxisZ);

        _renderContext.SetState(blendStateType.NoBlend);
      }
    }
}

Solution

  • The problem was that the RenderContextBase property CurrentShader itself changed at some point (after the first element was filled) and because of this the painting was not done. Everything was decided by the fact that before each painting, you need to do RenderContextBase.SetShader(shaderType.NoLights)