Beispiel #1
0
        private void OnModalDialogsRegionSelectionChanged(object sender, SelectionChangedEventArgs args)
        {
            var enableShaders = RenderCapability.IsPixelShaderVersionSupported(2, 0);

            if (ModalDialogsRegion.ActiveDialog == null)
            {
                GameScreensRegionBorder.ClearValue(OpacityProperty);
                GameScreensRegionBorder.ClearValue(EffectProperty);
                CheckScreenFocus();
            }
            else if (enableShaders)
            {
                GameScreensRegionBorder.Effect = new ColorToneEffect
                {
                    DarkColor    = Color.FromScRgb(1.0f, 0.1f, 0.075f, 0.125f),
                    LightColor   = Color.FromScRgb(1.0f, 0.4f, 0.3f, 0.5f),
                    Desaturation = .8,
                    ToneAmount   = 0
                };
            }
            else
            {
                GameScreensRegionBorder.Opacity = 0.4;
            }
        }
Beispiel #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is LinearColor linearColor))
            {
                return(Brushes.Transparent);
            }

            return(new SolidColorBrush(Color.FromScRgb(linearColor.A, linearColor.R, linearColor.G, linearColor.B)));
        }
Beispiel #3
0
 private void PositionPaddle(Side _side)
 {
     if (_side == Side.Left)
     {
         Brush    = new SolidColorBrush(Color.FromScRgb(1f, 1, 1, 1));
         Position = new Point(Boundry.X + (Boundry.Width / 100), (Boundry.Height / 2) - (Height / 2));
     }
     else if (_side == Side.Right)
     {
         Brush    = new SolidColorBrush(Color.FromScRgb(1f, 1, 1, 1));
         Position = new Point(Boundry.Width - (Boundry.Width / 100) - Width, (Boundry.Height / 2) - (Height / 2));
     }
 }
Beispiel #4
0
    void SetViewport()
    {
        view.EnableDesignModeRendering = false;
        view.FrameRate = 60;
        view.MSAA      = MSAALevel.Four;
        view.FXAALevel = FXAALevel.High;
        view.EnableDeferredRendering         = true;
        view.IsShadowMappingEnabled          = false;
        view.EnableSwapChainRendering        = true;
        view.EnableAutoOctreeUpdate          = false;
        view.ShowViewCube                    = false;
        view.ShowCoordinateSystem            = true;
        view.CoordinateSystemLabelForeground = Colors.White;
        view.EffectsManager                  = new DefaultEffectsManager();
        view.TextBrush           = new SolidColorBrush(Colors.White);
        view.BackgroundColor     = Color.FromRgb(40, 40, 40);
        view.CameraInertiaFactor = 0.2;
        view.ZoomSensitivity     = 4.0;
        view.RotationSensitivity = 0.5;
        view.ModelUpDirection    = new Vector3D(0, 0, 1);
        view.Camera = new PerspectiveCamera
        {
            Position          = new Point3D(0, -2000, 400),
            LookDirection     = new Vector3D(0, 2000, 0),
            UpDirection       = new Vector3D(0, 0, 1),
            FarPlaneDistance  = 10000,
            NearPlaneDistance = 10
        };
        view.CameraChanged += (o, e) => SetHeadLight();

        ambient.Color = Color.FromScRgb(1, 0.02f, 0.02f, 0.02f);

        light.Color = Colors.White;
        var lightDir = new Vector3D(0, -0.5, -1);

        lightDir.Normalize();
        light.Direction = lightDir;
        SetHeadLight();

        grid.Geometry  = LineBuilder.GenerateGrid(new Vector3(0, 0, 1), -10, 10, -10, 10);
        grid.Color     = Color.FromRgb(100, 100, 100);
        grid.Transform = new ScaleTransform3D(100, 100, 100);
        grid.Thickness = 0.5;
    }