Ab3d.PowerToys with Model3ds visual from Ab3d.Reader3ds




                        
<UserControl x:Class="Ab3d.PowerToys.Reader3dsSamples.Reader3ds.Model3dsSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:visuals="clr-namespace:Ab3d.Visuals;assembly=Ab3d.PowerToys"            
    xmlns:visula3ds="clr-namespace:Ab3d.Visuals;assembly=Ab3d.Reader3ds"
    xmlns:cameras="clr-namespace:Ab3d.Cameras;assembly=Ab3d.PowerToys"
    xmlns:cameraContoller="clr-namespace:Ab3d.Controls;assembly=Ab3d.PowerToys"
    MinHeight="600" MinWidth="1000">
    <Grid Name="MainGrid">
        <Grid Name="MainEventsGrid" Background="Transparent">
            <Viewport3D Name="MainViewport3d">
                <!-- Bottom -->
                <visuals:BoxVisual3D Size="600 20 200" Material="Gray"/>
                
                <!-- Bases for the robot arms -->
                <visuals:BoxVisual3D CenterPosition="-200 15 0" Size="100 10 100" Material="Gray"/>
                <visuals:BoxVisual3D CenterPosition="0 15 0" Size="100 10 100" Material="Gray"/>
                <visuals:BoxVisual3D CenterPosition="200 15 0" Size="100 10 100" Material="Gray"/>

                <!-- Columns -->
                <visuals:BoxVisual3D CenterPosition="-295 90 95" Size="10 160 10" Material="Gray"/>
                <visuals:BoxVisual3D CenterPosition="-295 90 -95" Size="10 160 10" Material="Gray"/>
                <visuals:BoxVisual3D CenterPosition="295 90 95" Size="10 160 10" Material="Gray"/>
                <visuals:BoxVisual3D CenterPosition="295 90 -95" Size="10 160 10" Material="Gray"/>

                <!-- Roof -->
                <visuals:BoxVisual3D CenterPosition="0 175 0" Size="600 10 200" Material="Gray"/>

                <!-- 3 robot arms -->
                <!-- Shown as only a part of the models from robotarm.3ds -->
                <visula3ds:Model3ds Source="/Resources/robotarm.3ds" ObjectName="Base__Group" 
                                    Position="-225 20 0" PositionType="BottomCenter" SizeX="100">
                    <visula3ds:Model3ds.Transform>
                        <RotateTransform3D CenterX="-200">
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Angle="90" Axis="0 1 0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </visula3ds:Model3ds.Transform>
                </visula3ds:Model3ds>

                <visula3ds:Model3ds Source="/Resources/robotarm.3ds" ObjectName="Base__Group" 
                                    Position="-25 20 0" PositionType="BottomCenter" SizeX="100">
                    <visula3ds:Model3ds.Transform>
                        <RotateTransform3D CenterX="0">
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Angle="90" Axis="0 1 0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </visula3ds:Model3ds.Transform>
                </visula3ds:Model3ds>

                <visula3ds:Model3ds Source="/Resources/robotarm.3ds" ObjectName="Base__Group" 
                                    Position="175 20 0" PositionType="BottomCenter" SizeX="100">
                    <visula3ds:Model3ds.Transform>
                        <RotateTransform3D CenterX="200">
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Angle="90" Axis="0 1 0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </visula3ds:Model3ds.Transform>
                </visula3ds:Model3ds>

                <!-- GLASS -->
                <!-- NOTE: Transparent objects must be defined as last to correctly display the objects behind them -->
                <visuals:PlaneVisual3D CenterPosition="0 90 100" Size="580 160" 
                                       HeightDirection="0 1 0" Normal="0 0 1"
                                       Material="#55CCCCFF" BackMaterial="#55CCCCFF"/>

            </Viewport3D>
        </Grid>
        
        <cameras:SceneCamera Name="ScenaCamera1" Heading="50" Attitude="-10" IsDistancePercent="True" Distance="1.2"/>

        <cameraContoller:CameraControlPanel Width="180" Height="60" ShowMoveButtons="True" VerticalAlignment="Top" HorizontalAlignment="Left"/>
        <cameraContoller:MouseCameraController EventsSourceElementName="MainEventsGrid"
                                               RotateCameraConditions="LeftMouseButtonPressed" MoveCameraConditions="RightMouseButtonPressed"/>
    </Grid>
</UserControl>