开发者

WPF - Render text in Viewport3D

I want to present up to 300 strings (ju开发者_JS百科st a few words) in a Viewport3D - fast! I want to render them on different Z positions and zoom in and out fluently.

The ways I have found so far to render text in a Viewport3D:

  • Put a TextBlock in a Viewport2DVisual3D.
  • This guy's PlanarText class.
  • The same guy's SolidText class.
  • Create my own 2D panel and align TextBlocks on it. Call InvalidateArrange() every time I update the camera position.

All of these are extremely slow and far apart from zooming fluently even with 10 strings only. Does anyone have a solution for this handy? It's got to be possible to render some text in a Viewport3D without waiting seconds!


Have you tried using a VisualBrush as the material for each GeometryModel3D?

Something like this:

<GeometryModel3D>
  <GeometryModel3D.Geometry>
    <MeshGeometry3D Positions="0,0,0 1,0,0 1,1,0 0,1,0" TriangleIndices="0,1,2 2,3,0" />
  </GeometryModel3D.Geometry>
  <GeometryModel3D.Material>
    <VisualBrush ...>
      <VisualBrush.Visual>
        <TextBlock Text="Some text here" />
      </VisualBrush.Visual>
    </VisualBrush>
   </GeometryModel3D.Material>
 </GeometryModel3D>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜