CCT.NUI.WPFSamples.VideoSurface.VideoSurface C# (CSharp) 메소드

VideoSurface() 공개 메소드

public VideoSurface ( string mediaSource ) : System
mediaSource string
리턴 System
        public VideoSurface(string mediaSource)
        {
            this.ModelVisual3D = new ModelVisual3D();

            var geometryModel = new GeometryModel3D();
            this.ModelVisual3D.Content = geometryModel;

            this.geometry = new MeshGeometry3D();
            geometryModel.Geometry = geometry;

            var positions = new Point3DCollection();
            positions.Add(new Point3D(0, 0, 0));
            positions.Add(new Point3D(640, 0, 0));
            positions.Add(new Point3D(640, 480, 0));
            positions.Add(new Point3D(0, 480, 0));
            this.geometry.Positions = positions;

            var textureCoordinates = new PointCollection();
            textureCoordinates.Add(new System.Windows.Point(0, 1));
            textureCoordinates.Add(new System.Windows.Point(1, 1));
            textureCoordinates.Add(new System.Windows.Point(1, 0));
            textureCoordinates.Add(new System.Windows.Point(0, 0));
            this.geometry.TextureCoordinates = textureCoordinates;

            var triangleIndices = new Int32Collection();
            triangleIndices.Add(0);
            triangleIndices.Add(1);
            triangleIndices.Add(2);
            triangleIndices.Add(2);
            triangleIndices.Add(3);
            triangleIndices.Add(0);
            this.geometry.TriangleIndices = triangleIndices;

            var material = new EmissiveMaterial();
            var brush = new VisualBrush();
            this.border = new Border();
            this.border.BorderBrush = Brushes.White;
            this.border.BorderThickness = new Thickness(10);
            this.border.Opacity = 0;

            this.mediaElement = new MediaElement();
            mediaElement.LoadedBehavior = MediaState.Manual;
            mediaElement.Source = new Uri(mediaSource);

            this.border.Child = mediaElement;
            brush.Visual = border;
            material.Brush = brush;
            geometryModel.Material = material;

            this.mediaElement.MediaEnded += new RoutedEventHandler(mediaElement_MediaEnded);
        }