GeometryModel3D.Geometry 属性

定义

获取或设置 Geometry3D,它可描述此 GeometryModel3D 的形状。

public:
 property System::Windows::Media::Media3D::Geometry3D ^ Geometry { System::Windows::Media::Media3D::Geometry3D ^ get(); void set(System::Windows::Media::Media3D::Geometry3D ^ value); };
public System.Windows.Media.Media3D.Geometry3D Geometry { get; set; }
member this.Geometry : System.Windows.Media.Media3D.Geometry3D with get, set
Public Property Geometry As Geometry3D

属性值

构成模型的 Geometry3D

示例

以下代码摘录 GeometryModel3D 在多维数据集的形状中创建 。

<GeometryModel3D>
  <GeometryModel3D.Geometry>
          <MeshGeometry3D 
              Positions="-1 -1 0  1 -1 0  -1 1 0  1 1 0"
              Normals="0 0 1  0 0 1  0 0 1  0 0 1"
              TextureCoordinates="0 1  1 1  0 0  1 0   "
              TriangleIndices="0 1 2  1 3 2" />
      </GeometryModel3D.Geometry>
      <GeometryModel3D.Material>
          <DiffuseMaterial>
              <DiffuseMaterial.Brush>
                  <SolidColorBrush Color="Cyan" Opacity="0.3"/>
              </DiffuseMaterial.Brush>
          </DiffuseMaterial>
      </GeometryModel3D.Material>
  <!-- Translate the plane. -->
      <GeometryModel3D.Transform>
          <TranslateTransform3D
            OffsetX="2" OffsetY="0" OffsetZ="-1"   >
          </TranslateTransform3D>
      </GeometryModel3D.Transform>
  </GeometryModel3D>

以下代码摘录使用 GeometryModel3D 定义为 Geometry 静态资源的 。

<ModelVisual3D>
  <ModelVisual3D.Content>
    <GeometryModel3D Geometry="{StaticResource myTeapot}">
      <GeometryModel3D.Material>
        <DiffuseMaterial>
          <DiffuseMaterial.Brush>
            <SolidColorBrush Color="Blue" Opacity="1.0" />
          </DiffuseMaterial.Brush>
        </DiffuseMaterial>
      </GeometryModel3D.Material>
      <GeometryModel3D.Transform>
        <RotateTransform3D>
          <RotateTransform3D.Rotation>
            <AxisAngleRotation3D x:Name="myAngleRotation" Axis="0,3,0" Angle="1" />
          </RotateTransform3D.Rotation>
        </RotateTransform3D>
      </GeometryModel3D.Transform>
    </GeometryModel3D>
  </ModelVisual3D.Content>
</ModelVisual3D>

注解

依赖项属性信息

标识符字段 GeometryProperty
元数据属性设置为 true

适用于