0
How to fill with tile texture?
This discussion was imported from CodePlex
veerammalkumaran wrote at 2014-08-01 08:53:
I want to fill a polygon with image (tile).
below is my XAML
below is my XAML
<h:HelixViewport3D Name="viewPort3D" >
<h:SunLight />
<ModelVisual3D x:Name="vis3D">
</ModelVisual3D>
</h:HelixViewport3D>
below is my code var mb = new MeshBuilder(false, true);
IList<Point3D> pnts = new List<Point3D>();
pnts.Add(new Point3D(0, 0, 0));
pnts.Add(new Point3D(100, 0, 0));
pnts.Add(new Point3D(100, 100, 0));
pnts.Add(new Point3D(0, 100, 0));
mb.AddPolygon(pnts);
var mesh = mb.ToMesh(true);
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri(@"C:\box.jpg"));
brush.TileMode = TileMode.Tile;
brush.ViewportUnits = BrushMappingMode.Absolute;
brush.ViewboxUnits = BrushMappingMode.Absolute;
brush.Stretch = Stretch.None;
brush.AlignmentX = AlignmentX.Left;
brush.AlignmentY = AlignmentY.Top;
brush.Viewport = new Rect(0, 0, brush.ImageSource.Width, brush.ImageSource.Height);
DiffuseMaterial mat = new DiffuseMaterial(brush);
GeometryModel3D gModel3D = new GeometryModel3D { Geometry = mesh, Material = mat };
vis3D.Content = gModel3D;
The above code doesn't work. What I missed in this?veerammalkumaran wrote at 2014-08-01 10:12:
This is the output window I am getting
below is the box.jpg
below is the box.jpg
veerammalkumaran wrote at 2014-08-14 06:53:
I have found the solution and the detailed code is available here
http://uselesstechnical.wordpress.com/2014/08/14/helix-3d-toolkit-tile-texture/
http://uselesstechnical.wordpress.com/2014/08/14/helix-3d-toolkit-tile-texture/
Customer support service by UserEcho
You don't happen to know the Xaml do you?
For example, I'd like to pick up the image (Jpg, Png, whatever) from an embedded resource, etc, etc.
Thank you...