簡體   English   中英

Helix Toolkit 視圖多維數據集未顯示

[英]Helix Toolkit view cube not showing

我在基於 HelixToolkit package 的 WPF 應用程序中遇到了問題。

即使我將 ShowViewCube 參數設置為“true”,視圖立方體也沒有顯示。 有趣的是,我可以啟用並顯示視圖立方體邊緣,但立方體的 rest 仍然不可見。

這是視口代碼:

<hx:Viewport3DX
            x:Name="view1"
            Title="{Binding Title}"
            BackgroundColor="Black"
            Camera="{Binding Camera}"
            CoordinateSystemLabelForeground="#434343"
            UseDefaultGestures="True"
            EffectsManager="{Binding EffectsManager}"
            ModelUpDirection="{Binding UpDirection}"
            ShowViewCube="True"
            IsViewCubeEdgeClicksEnabled="True"
            ShowCoordinateSystem="True"
            SubTitle="{Binding SubTitle}"
            TextBrush="#FFFEFFF6"
            EnableSwapChainRendering="True" 
            EnableD2DRendering="False"
            FXAALevel="Low"
            EnableDeferredRendering="False"   
            ClipToBounds="False" Margin="0,0,0,0" 
            CameraRotationMode="Turnball"
            CoordinateSystemHorizontalPosition="0" 
            IsThreeFingerPanningEnabled="False"
            IsTouchRotateEnabled="False" 
            IsViewCubeMoverEnabled="False" 
            IsCoordinateSystemMoverEnabled="False"
            OITWeightMode="NonLinear" 
            Grid.ColumnSpan="1"
            Grid.Column="1" 
            Grid.RowSpan="2">

            
            <hx:Viewport3DX.InputBindings>

                <KeyBinding Key="B" Command="hx:ViewportCommands.BackView" />
                <KeyBinding Key="G" Command="hx:ViewportCommands.FrontView" />
                <KeyBinding Key="T" Command="hx:ViewportCommands.TopView" />
                <KeyBinding Key="V" Command="hx:ViewportCommands.BottomView" />
                <KeyBinding Key="G" Command="hx:ViewportCommands.LeftView" />
                <KeyBinding Key="H" Command="hx:ViewportCommands.RightView" />
                <KeyBinding Command="hx:ViewportCommands.ZoomExtents" Gesture="Control+E" />
                <MouseBinding Command="hx:ViewportCommands.Rotate" Gesture="RightClick" />
                <MouseBinding Command="hx:ViewportCommands.Zoom" Gesture="MiddleClick" />
                <MouseBinding Command="hx:ViewportCommands.Pan" Gesture="LeftClick" />
            </hx:Viewport3DX.InputBindings>

            <hx:AmbientLight3D Color="{Binding AmbientLightColor}" />
            <hx:DirectionalLight3D Direction="{Binding Camera.LookDirection}" 
                                   Color="{Binding DirectionalLightColor}" />
            <hx:ScreenQuadModel3D Texture="{Binding BackgroundTexture}" />

            <hx:LineGeometryModel3D
                x:Name="pointlines"
                Thickness="0.5"
                Geometry="{Binding PointGrid.GridGeometry}"
                Transform="{Binding Points.PointsTransform}"
                Color="{Binding Grid.GridColor}" IsHitTestVisible="False" IsEnabled="False" 
                IsDepthClipEnabled="False" IsMultisampleEnabled="False" IsScissorEnabled="False"/>

            <hx:LineGeometryModel3D
                x:Name="grid"
                Thickness="0.2"
                Geometry="{Binding Grid.GridGeometry}"
                Transform="{Binding Grid.GridTransform}"
                Color="{Binding Grid.GridColor}" 
                IsHitTestVisible="False" 
                IsEnabled="False" 
                IsDepthClipEnabled="False" 
                IsMultisampleEnabled="False" 
                IsScissorEnabled="False"/>

            <hx:LineGeometryModel3D
                x:Name="arrows"                
                Thickness="1"
                Geometry="{Binding Axis.AxisGeometry}"
                Transform="{Binding Axis.AxisTransform}"
                Color="{Binding Axis.AxisColor}" 
                IsHitTestVisible="False" 
                IsEnabled="False" 
                IsDepthClipEnabled="False" 
                IsMultisampleEnabled="False" 
                IsScissorEnabled="False"/>

            <hx:PointGeometryModel3D
                x:Name="points"
                Geometry="{Binding Points.PointsGeometry}"
                Transform="{Binding Points.PointsTransform}"
                Color="{Binding Points.PointsColor}" 
                IsDepthClipEnabled="False" IsEnabled="False" IsHitTestVisible="False" IsMultisampleEnabled="True" 
                IsScissorEnabled="False"  FixedSize="True" Size="2,2"/>

            <hx:MeshGeometryModel3D
                x:Name="MeshModel"
                ></hx:MeshGeometryModel3D>

        </hx:Viewport3DX>

和代碼隱藏:

public MainViewModel()
        {
            EffectsManager = new DefaultEffectsManager();            

            // camera setup
            Camera = new HelixToolkit.Wpf.SharpDX.PerspectiveCamera
            {
                Position = new Point3D(0, 0, 0),
                LookDirection = new Vector3D(0, 0, 0),
                UpDirection = new Vector3D(0, 0, 0),
                FarPlaneDistance = 0
            };
            // setup lighting            
            AmbientLightColor = Colors.DimGray;
            DirectionalLightColor = Colors.White; 

            DirectionalLightDirection = Camera.LookDirection;
        }

這就是 View Cube 現在的樣子:
這就是 View Cube 現在的樣子

我終於找到了答案。 視圖多維數據集綁定到視圖中的“ModelUpDirection”屬性。 自定義它會導致立方體顯示出現問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM