English 中文(简体)
A question about WPF. Size in Viewport3D
原标题:A question about WPF. Size in Viewport3D
<Window x:Class="Viewport2DVisual3DExample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Button on 3D"  
    WindowStyle="None"
    Background="{x:Null}"
    Foreground="{x:Null}"
    AllowsTransparency="True"
    >

    <Viewport3D>
        <Viewport3D.Camera>
            <PerspectiveCamera Position="0, 0, 4"/>
        </Viewport3D.Camera>

        <!-- Front -->
        <Viewport2DVisual3D>
            <!-- Give the plane a slight rotation -->
            <Viewport2DVisual3D.Transform>
                <RotateTransform3D>
                    <RotateTransform3D.Rotation>
                        <AxisAngleRotation3D x:Name="frontTransform" Angle="0" Axis="0, 1, 0" />
                    </RotateTransform3D.Rotation>
                </RotateTransform3D>
            </Viewport2DVisual3D.Transform>

            <!-- The Geometry, Material, and Visual for the 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>

            <!-- Here Here Here Here Here  -->
            <Image Source="i:\tempa\tm.png" Width="534" Height="458" />

    </Viewport2DVisual3D>

        <!-- Back -->
        <Viewport2DVisual3D>
            <!-- Give the plane a slight rotation -->
            <Viewport2DVisual3D.Transform>
                <RotateTransform3D >
                    <RotateTransform3D.Rotation>
                        <AxisAngleRotation3D x:Name="backTransform" Angle="180" Axis="0, 1, 0" />
                    </RotateTransform3D.Rotation>
                </RotateTransform3D>
            </Viewport2DVisual3D.Transform>

            <!-- The Geometry, Material, and Visual for the 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>

            <Button Name="btnBack">Back</Button>
        </Viewport2DVisual3D>

        <ModelVisual3D>
            <ModelVisual3D.Content>
                <DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/>
            </ModelVisual3D.Content>
        </ModelVisual3D>

    </Viewport3D>

我正试图利用Gisport3D建立一个2-Side窗口。 但当时我对规模有些麻烦。

                <!-- Here Here Here Here Here  -->
            <Image Source="i:\tempa\tm.png" Width="534" Height="458" />

我希望这一形象与来源形象完全相同。

既无特定价值,也无“托阿”作用。

我如何能够得到我想要的东西?

最佳回答

我的3d项知识有限,人们也许可以更好地回答这个问题,但在3d环境下,物体的大小取决于许多东西。 3d发动机在装满时就考虑到所有障碍。 树立形象只是其中的一部分。

也许会试图用照相机播放节目,或增加图像翻译。

问题回答

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4ca4dc7-0f25-446c-a42c-3c0b3a178a73/“rel=“nofollow” 这一矩阵将3D点变为2D点。 因此,通过MeshGeometry3 的3D坐标 你们可以找到2D坐标和大小。





相关问题
WPF convert 2d mouse click into 3d space

I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

WPF: writing smoke tests using ViewModels

I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to ...

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

How do WPF Markup Extensions raise compile errors?

Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签