|
关于HelixToolkit-这个3D呈现的交互处理推荐使用,因为功能比较强大一个开源3D库,根据MIT许可证获得许可。MIT许可证非常宽松,允许在专有软件中使用。该库基于 .NET,目前专注于 WPF 平台。HelixToolkit是.NET Framework的一个开源3D图形库,它主要用于创建和操作3D图形1。HelixToolkit包含许多实用的3D图形工具,例如3D视图、3D模型、3D场景、3D渲染、3D动画等,它们可以帮助开发者快速创建出高质量的3D图形应用程序1。HelixToolkit的文档和教程可以在官方网站上找到,开发者可以根据需要查看和使用地址:https://github.com/helix-toolkit Nuget安装- <Grid>
-
-
-
-
-
-
-
-
-
-
-
- <h:HelixViewport3D ShowViewCube="True"
- ViewCubeWidth="100"
- ViewCubeHeight="100"
- ViewCubeHorizontalPosition="Right"
- ViewCubeVerticalPosition="Bottom"
- ViewCubeFrontText="前"
- ViewCubeTopText="上"
- ViewCubeBackText="后"
- ViewCubeLeftText="左"
- ViewCubeRightText="右"
- ViewCubeBottomText="下"
-
- ShowCoordinateSystem="True"
- CoordinateSystemLabelForeground="#5000"
- CoordinateSystemHorizontalPosition="Left"
- CoordinateSystemVerticalPosition="Bottom" Margin="-10,0,10,0"
- >
-
- <h:HelixViewport3D.Camera>
-
-
-
-
-
-
-
- <PerspectiveCamera Position="10,10,10"
- LookDirection="-2,-2,-2"
- FieldOfView="50"
- UpDirection="0,1,0"
- FarPlaneDistance="1000"
- NearPlaneDistance="1">
-
- <PerspectiveCamera.Transform>
-
- <Transform3DGroup>
-
- <RotateTransform3D CenterX="3" CenterY="0" CenterZ="0">
-
- <RotateTransform3D.Rotation>
-
-
-
- <AxisAngleRotation3D Angle="0" Axis="0 1 0" x:Name="aar"/>
- </RotateTransform3D.Rotation>
- </RotateTransform3D>
-
-
- <TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0" x:Name="tt"/>
-
-
-
- <ScaleTransform3D ScaleX="1" ScaleY="1" ScaleZ="1"/>
- </Transform3DGroup>
- </PerspectiveCamera.Transform>
- </PerspectiveCamera>
-
-
-
- </h:HelixViewport3D.Camera>
-
-
- <h:HelixViewport3D.RotateGesture>
-
-
- <MouseGesture MouseAction="LeftClick"/>
- </h:HelixViewport3D.RotateGesture>
-
- <h:HelixViewport3D.PanGesture>
-
- <MouseGesture MouseAction="RightClick"/>
- </h:HelixViewport3D.PanGesture>
-
-
-
- <ModelVisual3D>
-
- <ModelVisual3D.Content>
-
- <Model3DGroup>
-
-
- <AmbientLight Color="White"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
- </Model3DGroup>
- </ModelVisual3D.Content>
- </ModelVisual3D>
-
-
-
-
-
- <ModelUIElement3D MouseLeftButtonDown="ModelUIElement3D_MouseLeftButtonDown">
- <ModelUIElement3D.Model>
-
- <GeometryModel3D>
-
-
- <GeometryModel3D.Material>
- <MaterialGroup>
-
-
-
-
-
- <DiffuseMaterial>
- <DiffuseMaterial.Brush>
- <ImageBrush ImageSource="Arrow.png"/>
- </DiffuseMaterial.Brush>
- </DiffuseMaterial>
-
-
-
- </MaterialGroup>
- </GeometryModel3D.Material>
-
- <GeometryModel3D.BackMaterial>
- <DiffuseMaterial Brush="Green"/>
- </GeometryModel3D.BackMaterial>
-
- <GeometryModel3D.Geometry>
-
-
-
-
- <MeshGeometry3D Positions="0,0,0 3,0,0 3,2,0 0,2,0"
- TriangleIndices="0,2,3 0,1,2"
- TextureCoordinates="1,1 1,0 0,0 0,1"/>
-
-
-
-
-
- </GeometryModel3D.Geometry>
- </GeometryModel3D>
- </ModelUIElement3D.Model>
- </ModelUIElement3D>
-
- <Viewport2DVisual3D>
-
- <Viewport2DVisual3D.Geometry>
-
-
-
-
- <MeshGeometry3D Positions="0,0,1 3,0,1 3,2,1 0,2,1"
- TriangleIndices="0,2,3 0,1,2"
- TextureCoordinates="0,1 1,1 1,0 0,0"/>
- </Viewport2DVisual3D.Geometry>
-
- <Viewport2DVisual3D.Material>
-
- <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True"/>
- </Viewport2DVisual3D.Material>
- <Border>
- <Button Content="Hello" Click="Button_Click"/>
- </Border>
- </Viewport2DVisual3D>
-
-
- <ModelUIElement3D>
- <ModelUIElement3D.Model>
-
- <GeometryModel3D>
-
-
- <GeometryModel3D.Material>
- <MaterialGroup>
-
-
-
- <DiffuseMaterial Brush="Red"/>
-
-
-
-
-
- </MaterialGroup>
- </GeometryModel3D.Material>
-
- <GeometryModel3D.BackMaterial>
- <DiffuseMaterial Brush="Blue"/>
- </GeometryModel3D.BackMaterial>
-
- <GeometryModel3D.Geometry>
-
-
-
- <MeshGeometry3D Positions="3,2,1 3,2,0 3,0,0 3,0,1"
- TriangleIndices="0,3,1 1,3,2"/>
- </GeometryModel3D.Geometry>
- </GeometryModel3D>
- </ModelUIElement3D.Model>
- </ModelUIElement3D>
- </h:HelixViewport3D>
- </Grid>
复制代码 代码实例效果图:
代码实例:
来源:https://www.cnblogs.com/wjygxjz/archive/2023/10/16/17766612.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作! |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|