private void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            ImageBrush      brush = FindResource("MeshBrush") as ImageBrush;
            GeometryModel3D model = new GeometryModel3D();

            model.Geometry     = MeshCreator.CreateMesh(SurfaceType.Plane, 100, 100);
            model.Material     = new DiffuseMaterial(brush);
            model.BackMaterial = new DiffuseMaterial(Brushes.Gray);

            NameScope scope = NameScope.GetNameScope(this) as NameScope;

            scope.RegisterName("MeshGeometry", model.Geometry);

            _modelGroup.Children.Add(model);

            Trackball b = new Trackball();

            b.EventSource = this;
            _viewport.Camera.Transform = b.Transform;
        }
Example #2
0
        protected override Point3DCollection GetCurrentValueCore(Point3DCollection src,
                                                                 Point3DCollection dest,
                                                                 AnimationClock clock)
        {
            if (!_collectionsCreated)
            {
                _startPoints = StartSurface.HasValue
                                                ? MeshCreator.CreatePositions(StartSurface.Value, HorizontalPoints, VerticalPoints)
                                                : src;
                _endPoints = EndSurface.HasValue
                                                ? MeshCreator.CreatePositions(EndSurface.Value, HorizontalPoints, VerticalPoints)
                                                : dest;
                _collectionsCreated = true;
                return(_startPoints);
            }
            if (clock.CurrentProgress >= 1)
            {
                return(_endPoints);
            }

            return(Interpolate(clock.CurrentProgress.Value));
        }