1

我已将 png 图像设置为矩形的画笔背景,并将矩形设置为 Vieport3D 组。

但是当我试图增加相机图像的距离时,图像变得透明。但是这个问题在 XP 中只有 windows7 才能正常工作

PointCollection pc = new PointCollection();
        Uri url = new Uri(@"Model/somefile.png", UriKind.Relative);

        BitmapImage bmpimg = new BitmapImage();
        bmpimg.BeginInit();
        bmpimg.UriSource = url;
        bmpimg.CacheOption = BitmapCacheOption.OnLoad;
        bmpimg.EndInit();


        ImageBrush BrushView = new ImageBrush(bmpimg);
        BrushView.TileMode = TileMode.Tile;
        BrushView.Stretch = Stretch.Fill;
        Material MaterialView = new DiffuseMaterial(BrushView);
        MeshGeometry3D mesh_light = new MeshGeometry3D();

        double Zdeep = -40;
        double x = -110;
        double y = -45;
        double xEnd = 110;
        double yEnd = 90;


        // Draw rectangle and set Image to Mash geometry 
        //pc.makeRectangle(mesh_light, new Point3D(x, y, Zdeep), new Point3D(x + xEnd, y, Zdeep), new Point3D(x + xEnd, yEnd, Zdeep), new Point3D(x, yEnd, Zdeep), new Point(0, 0), new Point(0, 1), new Point(1, 1), new Point(1, 0));
        pc.makeRectangle(mesh_light, new Point3D(x, yEnd, Zdeep), new Point3D(x, y, Zdeep), new Point3D(xEnd, y, Zdeep), new Point3D( xEnd, yEnd, Zdeep), new Point(0, 0), new Point(0, 1), new Point(1, 1), new Point(1, 0));
        GeometryModel3D LightGeometry = new GeometryModel3D(mesh_light, MaterialView);
        group.Children.Add(LightGeometry);

这里当我设置 double Zdeep = 0; 它看起来不错,但如果我使用双 Zdeep = -40; 这个值然后图像变得透明

4

0 回答 0