AB4D Forum

Full Version: TextFactory3D
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
for (int i = 0; i < Saha_Sutun; i++)
                {
                    TextVisual3D text = new TextVisual3D();
                    text.Text = Convert.ToString(i + 1);
                    text.Position = new Point3D(Saha_X, Saha_Y, Saha_Z);
                    text.UpDirection = new Vector3D(1, 0, 0);
                    text.TextDirection = new Vector3D(0, 0, 1);
                    text.TextColor = Colors.Red;
                    text.FontSize = 1;
                    Saha_Z += 2;
                    visual3D.Children.Add(text);
                }
                for (int i = 0; i < Saha_Satir; i++)
                {

                    TextVisual3D text = new TextVisual3D();
                    text.Text = Degiskenler.SahaHarfler[i];
                    text.Position = new Point3D(satirx, Saha_Y, s2ny - 2);
                    text.UpDirection = new Vector3D(1, 0, 0);
                    text.TextDirection = new Vector3D(0, 0, 1);
                    text.TextColor = Colors.Red;
                    text.FontSize = 1;
                    satirx -= 2;
                    visual3D.Children.Add(text);
                }

Text Visual3D add this to my project. Adding different BoxMeshlerin environment. BoxMeshlerin is repeated until the width and height. But as the number of TextVisual3D performance is bad. Are there any suggestions for a solution?

Width=1,2,3,4,5,....
Height = A,B,C,D,E,...
3D Text should not be used very much - each character creates many lines that all need to be updated when camera is changed. This can be very CPU intensive when many characters are shown.

I would recommend you to use Plane3D and render the text there as texture.

If you are using .Net 4 than I would advice you to use VisualBrush that would contain TextBlocks with required text. See internet on how to do that - there are also many performance twicks that can be set on VisualBrush.

On .Net 3.5 SP1 there could be some problems with VisualBrush - http://blogs.msdn.com/wpf3d/archive/2009...lable.aspx

Here you can use RenderTargetBitmap to render the TextBlocks to a bitmap image and use it as texture on Plane3D (use ImageBrush). Here you need to decide how big image you will create - bugger image means slower performance but better quality when the camera is closer to the image.

Similar technique is also used in cannon ball simulation sample that comes with Ab3d.PowerToys - see the SetSafeVisualBrush method.