コード例 #1
0
        private void AddPlaneVisual3D(Point3D centerPosition, System.Windows.Media.Media3D.Material material, Size planeSize, bool isBillboard)
        {
            PlaneVisual3D planeVisual3D;

            if (isBillboard)
            {
                planeVisual3D = new BillboardVisual3D(); // BillboardVisual3D is defined in this sample and is the same as PlaneVisual3D but when BillboardVisual3D is there, we know that it needs to be aligned with the camera on each camera change
            }
            else
            {
                planeVisual3D = new PlaneVisual3D();
            }

            planeVisual3D.CenterPosition  = centerPosition;
            planeVisual3D.Size            = planeSize;
            planeVisual3D.Normal          = new Vector3D(0, 0, 1);
            planeVisual3D.HeightDirection = new Vector3D(0, 1, 0);
            planeVisual3D.Material        = material;

            if (!isBillboard)
            {
                planeVisual3D.BackMaterial = material;
            }

            SemiTransparentRootVisual3D.Children.Add(planeVisual3D);
        }
コード例 #2
0
    private void CreateBilboard()
    {
        BitmapImage im     = new BitmapImage(new System.Uri(@"C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg"));
        var         mat    = MaterialHelper.CreateImageMaterial(im, 1);
        var         bboard = new BillboardVisual3D();

        bboard.Material = mat;
        var position = new System.Windows.Media.Media3D.Point3D(0, 0, 0);
        var width    = 100;
        var height   = 100;

        //set coordinates
        bboard.Position = position;
        bboard.Width    = width;
        bboard.Height   = height;
        //add the billboard
        viewPort.Children.Add(bboard);
    }