Пример #1
0
        public void InitScene()
        {
            Camera.LookDirection = new Vector3D(0, -2, -1);
            //Camera.Position = new Point3D(ApplicationSettings.worldSize * ApplicationSettings.chunkSize/2, 11, ApplicationSettings.worldSize * ApplicationSettings.chunkSize/2);
            Camera.Position          = new Point3D();
            Camera.UpDirection       = new Vector3D(0, 1, 0);
            Camera.NearPlaneDistance = 0.01;
            Camera.FarPlaneDistance  = 1010;
            Camera.FieldOfView       = 90;

            Viewport        = new Viewport3D();
            Viewport.Height = 720;
            Viewport.Width  = 1280;
            Viewport.BringIntoView();

            Light       = new AmbientLight();
            Light.Color = Color.FromRgb(64, 64, 64);

            ModelVisual.Content            = ModelGroup;
            WaterModelVisual.Content       = WaterModelGroup;
            TransparentModelVisual.Content = TransparentModelGroup;

            //TransparentModelVisual
            Viewport.Children.Add(ModelVisual);
            Viewport.Children.Add(WaterModelVisual);
            Viewport.Children.Add(TransparentModelVisual);
            Viewport.Camera           = Camera;
            Viewport.IsHitTestVisible = false;

            ModelGroup.Children.Add(Light);
            TransparentModelGroup.Children.Add(Light);
            WaterModelGroup.Children.Add(Light);

            this.Content = Viewport;
            this.Width   = 1280;
            this.Height  = 720;
            this.Show();
            this.Focus();
        }