I am using HelixToolkit on a WPF (.net core) application. I've set up a Viewport3Dx with a cube inside like so:
XAML:
<Window x:Class="Test1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hx="http://helix-toolkit.org/wpf/SharpDX"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<hx:Viewport3DX x:Name="Viewport3Dx"
Grid.Row="0"
Grid.Column="0"
Background="White"
BackgroundColor="White"
Title="SharpDXView"
ShowCoordinateSystem="False">
<hx:AmbientLight3D Color="#515151" />
<hx:DirectionalLight3D Direction="-0.5, -1, -0.2"
Color="White" />
</hx:Viewport3DX>
</Grid>
Code behind:
using HelixToolkit.SharpDX.Core;
using HelixToolkit.Wpf.SharpDX;
using System.Windows;
using System.Windows.Media.Media3D;
namespace Test1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Viewport3Dx.Camera = new HelixToolkit.Wpf.SharpDX.PerspectiveCamera();
Viewport3Dx.Camera.Position = new Point3D(5, 0, 0);
Viewport3Dx.Camera.LookAt(new Point3D(0, 0, 0), 0);
Viewport3Dx.EffectsManager = new DefaultEffectsManager();
var mb = new MeshBuilder();
mb.AddCube();
var meshGeometry = new MeshGeometryModel3D
{
Material = PhongMaterials.Green,
Transform = Transform3D.Identity,
Geometry = mb.ToMeshGeometry3D()
};
Viewport3Dx.Items.Add(meshGeometry);
}
}
}
Now I would like to add some text to every side of the cube (in the center). The text should be on the cubes' surface. If possible I would like to not use a texture, because the cube might have different side lengths later.
Texture coordinate is not affected by cube side length as long as your model is a cube.