12-25-2019, 01:37 PM
Given the app shown the code as the end of this post, when I first execute I get shown in image1.png. Then when I move the mouse around I get image2.png (see attachment).
What I need to know is how the PlaneVisual3D object is drawn. For example, suppose in image1.png I wish to see the full rectangles, i.e. have the rectangle drawn along the x-y axis instead of the x-z axis. How would I do that? I assume that this has something to do with HeightDirection and Normal but I don't understand how these properties work. Thanks for any help you can give.
What I need to know is how the PlaneVisual3D object is drawn. For example, suppose in image1.png I wish to see the full rectangles, i.e. have the rectangle drawn along the x-y axis instead of the x-z axis. How would I do that? I assume that this has something to do with HeightDirection and Normal but I don't understand how these properties work. Thanks for any help you can give.
Code:
<Window x:Class="Rectangles.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:cameras="clr-namespace:Ab3d.Cameras;assembly=Ab3d.PowerToys"
xmlns:ab3d="clr-namespace:Ab3d.Controls;assembly=Ab3d.PowerToys"
xmlns:visuals="clr-namespace:Ab3d.Visuals;assembly=Ab3d.PowerToys"
xmlns:local="clr-namespace:Rectangles"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid Name="MainGrid">
<Border Name="ViewportBorder">
<Border.Background>
<LinearGradientBrush StartPoint="0 0" EndPoint="0 1">
<GradientStop Offset="0" Color="#033C62"/>
<GradientStop Offset="1" Color="#01131F"/>
</LinearGradientBrush>
</Border.Background>
<Viewport3D Name="MainViewport">
<visuals:ColoredAxisVisual3D Length="50"/>
<visuals:PlaneVisual3D CenterPosition="-150,50, -50" Size="100 100" HeightDirection="0 0 -1" Normal="0 -1 0" Material="Orange" />
<visuals:PlaneVisual3D CenterPosition="-150,50.01,-50" Size="100 100" HeightDirection="0 0 -1" Normal="0 1 0" Material="Orange" />
<visuals:PlaneVisual3D CenterPosition="-150,65, -50" Size="100 100" HeightDirection="0 0 -1" Normal="0 -1 0" Material="Yellow" />
<visuals:PlaneVisual3D CenterPosition="-150,65.01,-50" Size="100 100" HeightDirection="0 0 -1" Normal="0 1 0" Material="Yellow" />
</Viewport3D>
</Border>
<cameras:TargetPositionCamera Name="Camera1"
TargetPosition="0 0 0"
Heading="0" Attitude="-40" Bank="0"
Distance="700"
ShowCameraLight="Always"
TargetViewport3D="{Binding ElementName=MainViewport}" />
<ab3d:MouseCameraController Name="MouseCameraController1"
RotateCameraConditions="LeftMouseButtonPressed"
MoveCameraConditions="LeftMouseButtonPressed, ControlKey"
TargetCamera="{Binding ElementName=Camera1}"
EventsSourceElement="{Binding ElementName=ViewportBorder}"/>
</Grid>
</Window>
