Viewport2DVisual3D

Aug 25, 2011 at 2:21 AM

Are there any examples showing Viewport2DVisual3D with HelixView3D.  Can this type of 2D on 3D be achieved with the HelixToolKit.

 

Thanks

Coordinator
Aug 25, 2011 at 6:44 AM

Hi DuaneTNM, sorry there is no example using Viewport2DVisual3D. But I don't think there should be any problem to use it with the controls in HelixToolkit! 

Aug 30, 2011 at 4:42 PM
Edited Aug 30, 2011 at 4:43 PM

First, thank you for this project.

How can I use common WPF controls (buttons, sliders) with this toolkit (with supporting button click, slider value changed and etc.)? I'm using Viewport2DVisual3D for this, render is ok, but events are not triggered. What I'm doing wrong?

Thanks

Here is my code:

             <helix:HelixView3D IsHeadLightEnabled="True" ZoomToFitWhenLoaded="True" ShowFrameRate="True" ShowFieldOfView="True" ShowCoordinateSystem="True" MouseDown="HelixView3D_MouseDown" Name="helixView3D" IsHitTestVisible="true">
                <helix:HelixView3D.Camera>
                    <PerspectiveCamera Position="0, 0, 4"/>
                </helix:HelixView3D.Camera>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <Model3DGroup x:Name="group">
                            <DirectionalLight Color="White" Direction="-1, -1, -3" />
                        </Model3DGroup>
                    </ModelVisual3D.Content>
                    <Viewport2DVisual3D>
                        <Viewport2DVisual3D.Geometry>
                            <MeshGeometry3D Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0"
TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>
                        </Viewport2DVisual3D.Geometry>

                        <Viewport2DVisual3D.Material>
                            <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
                        </Viewport2DVisual3D.Material>
                        <Viewport2DVisual3D.Visual>

                            <StackPanel Orientation="Vertical">
                                <Button Click="Button_Click">Button</Button>
                                <Slider Value="100" ValueChanged="Slider_ValueChanged" />
                            </StackPanel>
                        </Viewport2DVisual3D.Visual>
                    </Viewport2DVisual3D>
                </ModelVisual3D>
            </helix:HelixView3D>

Coordinator
Aug 31, 2011 at 7:36 PM

I think this is related to issue 8172, and it is not solved yet...

http://helixtoolkit.codeplex.com/workitem/8172

Aug 31, 2011 at 11:06 PM
Edited Aug 31, 2011 at 11:07 PM

Thanks for the reply, I solved it with IsViewportHitTestVisible="True"

Here is good article about it: http://msdn.microsoft.com/en-us/library/ms752097.aspx

I have one another question, what's the difference between HelixView3D and ViewPort3DConrtroller?

And here is my working code:

<helix:HelixView3D IsViewportHitTestVisible="True">
	<helix:HelixView3D.Camera>
		<PerspectiveCamera LookDirection="-10,-10,-10" Position="10,10,10" UpDirection="0,0,1"/>
	</helix:HelixView3D.Camera>
	<helix:DefaultLightsVisual3D/>
	<ModelVisual3D>
		<Viewport2DVisual3D >
			<Viewport2DVisual3D.Transform>
				<RotateTransform3D>
					<RotateTransform3D.Rotation>
						<AxisAngleRotation3D x:Name="uiRotate" Angle="40" Axis="0, 1, 0" />
					</RotateTransform3D.Rotation>
				</RotateTransform3D>
			</Viewport2DVisual3D.Transform>
			<Viewport2DVisual3D.Geometry>
				<MeshGeometry3D Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0"
TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>
			</Viewport2DVisual3D.Geometry>
			<Viewport2DVisual3D.Material>
				<DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
			</Viewport2DVisual3D.Material>
			<Viewport2DVisual3D.Visual>
				<StackPanel Orientation="Vertical">
					<Button Background="Yellow" Click="Button_Click">Button1</Button>
					<Slider Value="100" ValueChanged="Slider_ValueChanged" />
				</StackPanel>
			</Viewport2DVisual3D.Visual>
		</Viewport2DVisual3D>
	</ModelVisual3D>
</helix:HelixView3D> 
Coordinator
Sep 14, 2011 at 8:24 AM

try the newest version of the library, hopefully the fix on UIElements works.

Note that HelixView3D is renamed to HelixViewport3D and the IsViewportHitTestVisible property is removed.

Sep 27, 2011 at 6:33 PM

Thanks, it works now correctly!