Ejemplo n.º 1
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            //animate the camera
            _camAngle = _camAngle + 50.0f * M.Pi / 180.0f * DeltaTime;

            //setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);

            //animate the cube1
            _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), -1 * 5 * M.Sin(3 * TimeSinceStart));

            //animate cube2

            _cubeTransform2.Scale    = _cubeTransform2.Scale + new float3(0, 0.01f * M.Sin(TimeSinceStart), 0);
            _cubeTransform2.Rotation = _cubeTransform2.Rotation + new float3(0, 0, 0.05f);
            //color
            cubeShader2.Effect.SetEffectParam("DiffuseColor", new float3(0, M.Sin(3 * TimeSinceStart), 0));

            _sceneRenderer.Render(RC);


            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer.
            Present();
        }
Ejemplo n.º 2
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            Diagnostics.Log(TimeSinceStart);

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Animate the camera angle
            _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime;

            // Animate the cube
            _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0);

            // Animate Würfel1
            _cubeTransform1.Rotation = new float3(0, 4 * M.Sin(6 * TimeSinceStart), 0);

            //Animate Würfel2
            _cubeTransform2.Scale = new float3(M.Sin(TimeSinceStart) + 3, M.Sin(TimeSinceStart) + 5, M.Sin(TimeSinceStart) + 1);


            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);


            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 3
0
        public override void RenderAFrame()
        {
            Diagnostics.Log(TimeSinceStart);


            RC.Clear(ClearFlags.Color | ClearFlags.Depth);


            _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime;


            _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0);

            _cubeTransform1.Rotation = new float3(0, 4 * M.Sin(6 * TimeSinceStart), 0);

            _cubeTransform2.Scale = new float3(M.Sin(TimeSinceStart) + 3, M.Sin(TimeSinceStart) + 5, M.Sin(TimeSinceStart) + 1);

            _cubeTransform3.Scale = new float3(M.Sin(TimeSinceStart) + 8, M.Sin(TimeSinceStart) + 10, M.Sin(TimeSinceStart) + 2);


            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);


            _sceneRenderer.Render(RC);


            Present();
        }
Ejemplo n.º 4
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Animate the camera angle
            _camAngle = _camAngle + 20.0f * M.Pi / 180.0f * DeltaTime;   //Drehung von 90° pro Sekunde (bei 90*M.Pi/180), egal wie mit vielen Frames die Animation läuft

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);

            // Animate the cube
            _cube1Transform.Translation = new float3(0, 2 * M.Sin(1.75f * TimeSinceStart), 0);
            _cube2Transform.Scale       = new float3(0.5f * M.Sin(4 * TimeSinceStart) + 1, 1, 1);
            _cube3Transform.Translation = new float3(-20, 5, 5 * M.Sin(1.5f * TimeSinceStart));
            _cube3Transform.Rotation    = new float3(0, 0, (-M.Pi / 4 * TimeSinceStart));
            cube3Shader.Effect          = SimpleMeshes.MakeShaderEffect(new float3(0.5f * M.Sin(2 * TimeSinceStart) + 0.5f, 0.09f, 0.3f), new float3(1, 1, 1), 4);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            Diagnostics.Log(Time.DeltaTime);
            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 5
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            if (Mouse.LeftButton)
            {
                _mouseSpeed = Mouse.Velocity.x * 0.00001f;
                _camAngle  -= _mouseSpeed;
            }
            else
            {
                _camAngle  -= _mouseSpeed;
                _mouseSpeed = _mouseSpeed * 0.8f;
            }

            RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle);

            //Move the Robot
            _bodyTransform.Rotation      = new float3(0, _bodyTransform.Rotation.y + Keyboard.LeftRightAxis * Time.DeltaTime, 0);
            _upperArmTransform.Rotation  = new float3(_upperArmTransform.Rotation.x + Keyboard.UpDownAxis * Time.DeltaTime, 0, 0);
            _foreArmTransform.Rotation   = new float3(_foreArmTransform.Rotation.x + Keyboard.WSAxis * Time.DeltaTime, 0, 0);
            _GreifArm1Transform.Rotation = new float3(0, 0, _GreifArm1Transform.Rotation.z + Keyboard.ADAxis * Time.DeltaTime);
            _GreifArm2Transform.Rotation = new float3(0, 0, _GreifArm2Transform.Rotation.z - Keyboard.ADAxis * Time.DeltaTime);


            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 6
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            Diagnostics.Log(TimeSinceStart);

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Animate the camera angle
            _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime;

            // Animate the cube                       Amplitude   Geschwindigkeit
            _cubeTransform.Translation = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0);

            //neu
            _cubeTransform1.Translation = new float3(0, 10 * M.Sin(1 * TimeSinceStart), 15);

            //neu
            _cubeTransform2.Translation = new float3(5, 3 * M.Sin(7 * TimeSinceStart), 0);

            // Setup the camera               ändert Position der Kamera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer.
            Present();
        }
Ejemplo n.º 7
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);
            // Animate the camera angle
            _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime;
            // Animate the cube

            _cubeTransform.Translation  = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0);
            _cubeTransform.Rotation     = new float3(2 * TimeSinceStart, TimeSinceStart / 3, 0);
            _cube2Transform.Scale       = new float3(TimeSinceStart / 2, 2, 3);
            _cube2Transform.Rotation    = new float3(0, 6 * TimeSinceStart, TimeSinceStart / 2);
            _cube3Transform.Translation = new float3(0, 7 * M.Sin(3 * TimeSinceStart), 0);
            _cube3Transform.Rotation    = new float3(0, 2 * TimeSinceStart, TimeSinceStart / 2);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);

            _sceneRenderer.Render(RC);
            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(0.8f);



            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer.
            Present();
        }
Ejemplo n.º 8
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime;

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            //EPILEPSIE-GEFAHR!
            RC.ClearColor = new float4(RC.ClearColor.r, RC.ClearColor.g + gCi, RC.ClearColor.b, RC.ClearColor.a);
            if (RC.ClearColor.g >= 1 || RC.ClearColor.g >= 0)
            {
                gCi = -gCi;
            }

            //camera postition
            RC.View = float4x4.CreateTranslation(0, 0, 200) * float4x4.CreateRotationY(_camAngle);

            //_cubeTransform.Translation = new float3(0, 5 * M.Sin(3 *TimeSinceStart), 0);

            _sceneRenderer.Render(RC);


            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer.
            Present();
        }
Ejemplo n.º 9
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Animate the cubes
            for (int i = 0; i < 5; i++)
            {
                _cubes[i].GetTransform().Translation = new float3((i - 2) * 15, 15 * M.Sin((3 * TimeSinceStart) + (i * M.Pi / 4)), 0);
                _cubes[i].GetTransform().Rotation    = new float3(0, 3 * TimeSinceStart, 0);
                _cubes[i].GetTransform().Scale       = new float3(0.4f * M.Sin(TimeSinceStart + (i * M.Pi / 4)) + 0.6f, 0.4f * M.Sin(TimeSinceStart + (i * M.Pi / 4)) + 0.6f, 0.4f * M.Sin(TimeSinceStart + (i * M.Pi / 4)) + 0.6f);
                _cubes[i].GetMaterial().Diffuse      = new MatChannelContainer {
                    Color = new float3(1 - (i / 4.0f), 0.5f * M.Sin(3 * TimeSinceStart) + 0.5f, i / 4.0f)
                };
            }

            // Animate the camera angle
            _camAngle = _camAngle + 10.0f * M.Pi / 180.0f * DeltaTime;

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 100) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rerndered farame) on the front buffer.
            Present();
        }
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);

            // Animate the cube
            for (int i = 0; i < _count; i++)
            {
                int rotationDirection = -1;
                if (i % 2 == 0)
                {
                    rotationDirection = 1;                                                                                          //if index is even then rotation direction is positive, if it's odd then direction is negative
                }
                float amplitude = 10 * M.Sin((float)i / (_count - 1) * 2 * M.Pi);                                                   //makes line of cubes swing as sine
                float scale     = (float)1 / 20 * M.Max(_cubeTransform[i].Translation.y, -1 * _cubeTransform[i].Translation.y) + 1; //substitute for M.Abs (which doesn't seem to exist)

                _cubeTransform[i].Scale.y       = scale;
                _cubeTransform[i].Scale.z       = scale;
                _cubeTransform[i].Translation.y = amplitude * M.Sin(3 * TimeSinceStart);
                _cubeTransform[i].Rotation.x   += rotationDirection * 90.0f * M.Pi / 180.0f * DeltaTime;
            }

            // Animate the camera angle (45 deg per second)
            _camAngle += 45.0f * M.Pi / 180.0f * DeltaTime;

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer.
            Present();
        }
Ejemplo n.º 11
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            Console.WriteLine("hallo");
            Diagnostics.Log(TimeSinceStart);

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Animate the camera angle
            //_camAngle = _camAngle + 90.0f * M.Pi/180.0f * DeltaTime ;

            // Animate the cube 1
            _cubeTransform.Translation = new float3(0, 6 * M.Sin(2 * TimeSinceStart) + 10, 0);
            _cubeTransform.Rotation    = _cubeTransform.Rotation + new float3(0.05f * Time.DeltaTime, 0, 0);
            /* muss mit Time.DeltaTime multipiziert werden, damit auf jedem System die Animation gleich schnell abgespielt wird*/
            _cubeTransform.Scale = new float3(1 * M.Sin(1 * TimeSinceStart), 1, 1 * M.Sin(4 * TimeSinceStart));
            // Animation Quader 2
            _quaderTransform.Translation = new float3(6 * M.Cos(10 * TimeSinceStart), -10, 0);
            _quaderTransform.Rotation    = _quaderTransform.Rotation + new float3(0, 0.7f * Time.DeltaTime, 0.7f * Time.DeltaTime);

            //Animation Cube 3

            _wuerfelDreiTransform.Translation = new float3(15, 2 * M.Sin(6 * TimeSinceStart), 15 * M.Sin(1 * TimeSinceStart));
            _wuerfelDreiShader.Effect         = SimpleMeshes.MakeShaderEffect(new float3(1, M.Sin(3 * TimeSinceStart), 0), new float3(1, 1, 1), 4);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);


            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);

            // Animate the camera angle
            _camAngle = _camAngle + 90.0f * M.Pi / 180.0f * DeltaTime;


            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();

            // Animate the cube
            _cubeTransform.Translation  = new float3(0, 5 * M.Sin(3 * TimeSinceStart), 0);
            _cube1Transform.Translation = new float3(2, 1 * M.Sin(4 * TimeSinceStart), 0);
            _cube2Transform.Translation = new float3(4, 2 * M.Sin(2 * TimeSinceStart), 0);
            _cube3Transform.Translation = new float3(6, 3 * M.Sin(1 * TimeSinceStart), 0);
            _cube4Transform.Translation = new float3(8, 4 * M.Sin(5 * TimeSinceStart), 0);
        }
Ejemplo n.º 13
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Animate the cubes
            for (int i = 0; i < 5; i++)
            {
                _cubes[i].GetTransform().Translation = new float3((i * 2) * 10, 2 * M.Sin((2 * TimeSinceStart) + i), M.Cos(2 * TimeSinceStart));
                _cubes[i].GetTransform().Rotation    = new float3(0, 5 * M.Sin((2 * TimeSinceStart) + i), 0);
                _cubes[i].GetTransform().Scale       = new float3(0.5f * M.Cos(TimeSinceStart + (i * M.PiOver4)) + 0.5f, 0.5f * M.Cos(TimeSinceStart + (i * M.PiOver4)) + 0.5f, 0.5f * M.Cos(TimeSinceStart + (i * M.PiOver4)) + 0.5f);
            }

            // Animate the camera angle
            _camAngle = _camAngle + 15.0f * M.Pi / 180.0f * DeltaTime;

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 100) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rerndered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 14
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Animation cube
            //_cubeTransform.Translation = new float3(0, 10.0f * M.Sin(5 * TimeSinceStart), 0);
            //_cubeTransform.Rotation = new float3(4.5f * Time.DeltaTime, 0, 0);
            _cubeTransform.Scale = new float3(1, 1 - (M.Sin(3.5f * TimeSinceStart)), 1);


            // Animation cube2
            _cube2Transform.Translation = new float3(10.0f * M.Sin(5 * TimeSinceStart), 0, 0);
            _cube2Transform.Rotation    = new float3(0, 0, 1.5f * M.Sin(5 * TimeSinceStart));

            // Animation cube3
            _cube3Transform.Translation = new float3(-10.0f * M.Sin(5 * TimeSinceStart), 0, 20);
            _cube3Transform.Rotation    = new float3(0, 0, -1.5f * M.Sin(5 * TimeSinceStart));

            // Animate the camera angle
            _camAngle = _camAngle + 12.0f * M.Pi / 180.0f * DeltaTime;

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 50) * float4x4.CreateRotationY(_camAngle);

            _sceneRenderer.Render(RC);


            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer.
            Present();
        }
Ejemplo n.º 15
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Mouse and keyboard movement
            if (Input.Keyboard.LeftRightAxis != 0 || Input.Keyboard.UpDownAxis != 0)
            {
                _keys = true;
            }

            if (Input.Mouse.LeftButton)
            {
                _keys         = false;
                _angleVelHorz = -RotationSpeed * Input.Mouse.XVel * Time.DeltaTime * 0.0005f;
                _angleVelVert = -RotationSpeed * Input.Mouse.YVel * Time.DeltaTime * 0.0005f;
            }
            else if (Input.Touch.GetTouchActive(TouchPoints.Touchpoint_0))
            {
                _keys = false;
                var touchVel = Input.Touch.GetVelocity(TouchPoints.Touchpoint_0);
                _angleVelHorz = -RotationSpeed * touchVel.x * Time.DeltaTime * 0.0005f;
                _angleVelVert = -RotationSpeed * touchVel.y * Time.DeltaTime * 0.0005f;
            }
            else
            {
                if (_keys)
                {
                    _angleVelHorz = -RotationSpeed * Input.Keyboard.LeftRightAxis * Time.DeltaTime;
                    _angleVelVert = -RotationSpeed * Input.Keyboard.UpDownAxis * Time.DeltaTime;
                }
                else
                {
                    var curDamp = (float)System.Math.Exp(-Damping * Time.DeltaTime);
                    _angleVelHorz *= curDamp;
                    _angleVelVert *= curDamp;
                }
            }


            _angleHorz += _angleVelHorz;
            _angleVert += _angleVelVert;

            // Create the camera matrix and set it as the current ModelView transformation
            var mtxRot = float4x4.CreateRotationX(_angleVert) * float4x4.CreateRotationY(_angleHorz);
            var mtxCam = float4x4.LookAt(0, 20, -600, 0, 150, 0, 0, 1, 0);

            RC.ModelView = mtxCam * mtxRot;

            // Render the scene loaded in Init()
            _sceneRenderer.Render(RC);

            #if GUI_SIMPLE
            _guiHandler.RenderGUI();
            #endif

            // Swap buffers: Show the contents of the backbuffer (containing the currently rerndered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 16
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            float bodyRot     = _bodyTransform.Rotation.y;
            float upperArmRot = _upperArmTransform.Rotation.x;
            float foreArmRot  = _foreArmTransform.Rotation.x;

            upperArmRot += 0.1f * Keyboard.UpDownAxis * DeltaTime * 100;
            bodyRot     += 0.1f * Keyboard.LeftRightAxis * DeltaTime * 50;
            foreArmRot  += 0.1f * Keyboard.WSAxis * DeltaTime * 50;

            _bodyTransform.Rotation     = new float3(0, bodyRot, 0);
            _upperArmTransform.Rotation = new float3(upperArmRot, 0, 0);
            _foreArmTransform.Rotation  = new float3(foreArmRot, 0, 0);


            if (Keyboard.GetKey(KeyCodes.Z) && !gCfinished) //Deutsches "Y" !!
            {
                gC         = true;
                gOfinished = false;
            }

            if (Keyboard.GetKey(KeyCodes.X) && !gOfinished)
            {
                gO         = true;
                gCfinished = false;
            }

            if (gC && !gCfinished)
            {
                gClosing();
            }

            if (gO && !gOfinished)
            {
                gOpening();
            }

            if (Mouse.LeftButton)
            {
                _camAngle -= 0.0001f * Mouse.Velocity.x;
            }

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 17
0
 // RenderAFrame is called once a frame
 public override void RenderAFrame()
 {
     // Clear the backbuffer
     RC.Clear(ClearFlags.Color | ClearFlags.Depth);
     RC.View = float4x4.CreateTranslation(0, 0, 60) * float4x4.CreateRotationY(_camAngle);
     cubeTransform1.Rotation += new float3(.1f, 0, 0);
     _camAngle += 90.0f * M.Pi / 180.0f * DeltaTime;
     cubeTransform2.Translation = new float3(0, 5 * M.Sin(3 * DeltaTime), 0);
     _sceneRenderer.Render(RC);
     // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer.
     Present();
 }
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 40) * float4x4.CreateRotationX(-(float)Atan(15.0 / 40.0));

            if (Mouse.LeftButton)
            {
                float2 pickPosClip = Mouse.Position * new float2(2.0f / Width, -2.0f / Height) + new float2(-1, 1);
                _scenePicker.View       = RC.View;
                _scenePicker.Projection = RC.Projection;
                List <PickResult> pickResults = _scenePicker.Pick(pickPosClip).ToList();
                PickResult        newPick     = null;
                if (pickResults.Count > 0)
                {
                    pickResults.Sort((a, b) => Sign(a.ClipPos.z - b.ClipPos.z));
                    newPick = pickResults[0];
                }
                if (newPick?.Node != _currentPick?.Node)
                {
                    if (_currentPick != null)
                    {
                        _currentPick.Node.GetMaterial().Diffuse.Color = _oldColour;
                    }
                    if (newPick != null)
                    {
                        var mat = newPick.Node.GetMaterial();
                        _oldColour        = mat.Diffuse.Color;
                        mat.Diffuse.Color = new float3(1, 0.4f, 0.4f);
                    }
                    _currentPick = newPick;
                }
            }
            float cabinRot = _cabinTransform.Rotation.y;

            cabinRot += 0.1f * Keyboard.ADAxis;
            _cabinTransform.Rotation = new float3(0, cabinRot, 0);

            if (_currentPick != null)
            {
                _pickTransform = _currentPick.Node.GetTransform();
                float zRot = _pickTransform.Rotation.z;
                zRot += 0.1f * Keyboard.WSAxis;
                _pickTransform.Rotation = new float3(0, 0, zRot);
            }
            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 19
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            HandleCameraAndPicking();
            InteractionHandler();
            _renderer.Render(RC);
            RC.ClearColor = new float4(.7f, .7f, .7f, 1);

            Present();
        }
Ejemplo n.º 20
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            _baseTransform.Rotation = new float3(0, _baseTransform.Rotation.y + Keyboard.ADAxis * DeltaTime * 3, 0);
            canon.Rotation          = new float3(0, canon.Rotation.y + Keyboard.LeftRightAxis * DeltaTime * 3, 0);
            vr.Rotation             = new float3(vr.Rotation.x + Keyboard.WSAxis * DeltaTime * 3, 0, 0);
            hr.Rotation             = new float3(hr.Rotation.x + Keyboard.WSAxis * DeltaTime * 3, 0, 0);
            vl.Rotation             = new float3(vl.Rotation.x + Keyboard.WSAxis * DeltaTime * 3, 0, 0);
            hl.Rotation             = new float3(hl.Rotation.x + Keyboard.WSAxis * DeltaTime * 3, 0, 0);

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 40) * float4x4.CreateRotationX(-0.7f) * float4x4.CreateRotationY(1.3f);

            if (Mouse.LeftButton)
            {
                float2 pickPosClip = Mouse.Position * new float2(2.0f / Width, -2.0f / Height) + new float2(-1, 1);
                _scenePicker.View       = RC.View;
                _scenePicker.Projection = RC.Projection;

                List <PickResult> pickResults = _scenePicker.Pick(pickPosClip).ToList();

                PickResult newPick = null;

                if (pickResults.Count > 0)
                {
                    pickResults.Sort((a, b) => Sign(a.ClipPos.z - b.ClipPos.z));
                    newPick = pickResults[0];
                }
                if (newPick?.Node != _currentPick?.Node)
                {
                    if (_currentPick != null)
                    {
                        _currentPick.Node.GetMaterial().Diffuse.Color = _oldColor;
                    }
                    if (newPick != null)
                    {
                        var mat = newPick.Node.GetMaterial();
                        _oldColor         = mat.Diffuse.Color;
                        mat.Diffuse.Color = new float3(1, 0.4f, 0.4f);
                    }
                    _currentPick = newPick;
                }
            }

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 21
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            float bodyRot = _bodyTransform.Rotation.y;

            bodyRot += 0.05f * Keyboard.LeftRightAxis;
            _bodyTransform.Rotation = new float3(0, bodyRot, 0);


            float greenarm = _upperArmTransform.Rotation.x;

            greenarm += 0.05f * Keyboard.UpDownAxis;
            _upperArmTransform.Rotation = new float3(greenarm, 0, 0);


            float bluearm = _sideArmTransform.Rotation.x;

            bluearm += 0.05f * Keyboard.WSAxis;
            _sideArmTransform.Rotation = new float3(bluearm, 0, 0);

            float bluearm2 = _othersideArmTransform.Rotation.x;

            bluearm2 += 0.05f * Keyboard.ADAxis;
            _othersideArmTransform.Rotation = new float3(bluearm2, 0, 0);

            if (Mouse.LeftButton == true)
            {
                _camAngle -= (Mouse.Velocity.x * DeltaTime) / 100;
            }

            //float greifarm1 = _ersterGreifArmTransform.Rotation.x;
            // greifarm1 += 0.05f * Keyboard.ADAxis;
            //_ersterGreifArmTransform.Rotation = new float3(greifarm1,0,0);

            //float greifarm2 = _ersterGreifArmTransform.Rotation.x;
            //greifarm2 += 0.05f * Keyboard.ADAxis;
            //_ersterGreifArmTransform.Rotation = new float3(greifarm2,0,0);



            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 22
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 23
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()

        {
            // Clear the backbuffer

            RC.Clear(ClearFlags.Color | ClearFlags.Depth);



            // Switch between Drone and Freefly
            if (_cameraType == CameraType.Reset)
            {
                _cameraType = CameraType.FREE;
            }

            wait++;

            if (wait >= 25)
            {
                if (Keyboard.IsKeyUp(KeyCodes.Q))
                {
                    _cameraType++;
                    wait = 0;

                    Diagnostics.Log(_cameraType);
                }
            }

            if (_cameraType == CameraType.FREE)
            {
                view = _camera.Update(_cameraType);
            }
            if (_cameraType == CameraType.FOLLOW || _cameraType == CameraType.DRONE)
            {
                view = _drone.Update(_cameraType);
            }

            RC.View = view;



            // Render the scene loaded in Init()

            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered frame) on the front buffer.

            Present();
        }
Ejemplo n.º 24
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            _baseTransform.Rotation = new float3(0, M.MinAngle(TimeSinceStart), 0);

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 40) * float4x4.CreateRotationX(-(float)Atan(15.0 / 40.0));

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 25
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            _rightRearTransform.Rotation = new float3(M.MinAngle(TimeSinceStart), 0, 0);

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 40) * float4x4.CreateRotationX(-(float)Atan(15.0 / 40.0));

            if (Mouse.LeftButton)
            {
                float2 pickPosClip = Mouse.Position * new float2(2.0f / Width, -2.0f / Height) + new float2(-1, 1);
                _scenePicker.View       = RC.View;
                _scenePicker.Projection = RC.Projection;

                List <PickResult> pickResults = _scenePicker.Pick(pickPosClip).ToList();
                PickResult        newPick     = null;
                if (pickResults.Count > 0)
                {
                    pickResults.Sort((a, b) => Sign(a.ClipPos.z - b.ClipPos.z));
                    newPick = pickResults[0];
                }

                if (newPick?.Node != _currentPick?.Node)
                {
                    if (_currentPick != null)
                    {
                        ShaderEffectComponent shaderEffectComponent = _currentPick.Node.GetComponent <ShaderEffectComponent>();
                        shaderEffectComponent.Effect.SetEffectParam("DiffuseColor", _oldColor);
                    }
                    if (newPick != null)
                    {
                        ShaderEffectComponent shaderEffectComponent = newPick.Node.GetComponent <ShaderEffectComponent>();
                        _oldColor = (float3)shaderEffectComponent.Effect.GetEffectParam("DiffuseColor");
                        shaderEffectComponent.Effect.SetEffectParam("DiffuseColor", new float3(1, 0.4f, 0.4f));
                    }
                    _currentPick = newPick;
                }
            }

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 26
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            float bodyRot = _bodyTransform.Rotation.y;

            bodyRot += 45.0f * M.Pi / 180 * Keyboard.LeftRightAxis * DeltaTime;
            _bodyTransform.Rotation = new float3(0, bodyRot, 0);

            float upperRot = _upperArmTransform.Rotation.x;

            upperRot += 30.0f * M.Pi / 180 * Keyboard.UpDownAxis * DeltaTime;
            _upperArmTransform.Rotation = new float3(upperRot, 0, 0);

            float foreRot = _foreArmTransform.Rotation.x;

            foreRot += 30.0f * M.Pi / 180 * Keyboard.WSAxis * DeltaTime;
            _foreArmTransform.Rotation = new float3(foreRot, 0, 0);

            float hand = _handTransform.Rotation.z;

            hand += 25.0f * M.Pi / 180 * Keyboard.ADAxis * DeltaTime;

            //Diagnostics.Log(hand);

            if (hand >= -0.25 && hand <= 0.25)
            {
                _handTransform.Rotation  = new float3(0, 0, hand);
                _hand2Transform.Rotation = new float3(0, 0, -hand);
            }

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            if (Mouse.LeftButton == true)
            {
                _camAngle += 0.01f * Mouse.Velocity.x * DeltaTime;
            }

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 27
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            //Roboter mit Tastatur steuern können
            //Body
            float bodyRot = _bodyTransform.Rotation.y;

            bodyRot += 0.4f * Keyboard.LeftRightAxis * Time.DeltaTime;
            _bodyTransform.Rotation = new float3(0, bodyRot, 0);
            //UpperArm
            float upperArmRot = _upperArmTransform.Rotation.x;

            upperArmRot += 0.4f * Keyboard.UpDownAxis * Time.DeltaTime;
            _upperArmTransform.Rotation = new float3(upperArmRot, 0, 0);
            //ForeArm
            float foreArmRot = _foreArmTransform.Rotation.x;

            foreArmRot += 0.4f * Keyboard.WSAxis * Time.DeltaTime;
            _foreArmTransform.Rotation = new float3(foreArmRot, 0, 0);

            //Greifarme
            //GreifarmBegrenzungLinks();
            //GreifarmBegrenzungRechts();
            GreifarmBegrenzungLinks();
            GreifarmBegrenzungRechts();


            //Maussteuerung
            if (Mouse.LeftButton)
            {
                _camAngle += 0.01f * Mouse.Velocity.x * Time.DeltaTime;
            }

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 28
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
//for (int i = 0; i <=a.Length; i++){



            Diagnostics.Log(TimeSinceStart);

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Animate the camera angle
            _camAngle = _camAngle + 180.0f * M.Pi / 360.0f * DeltaTime;

            // Animate the cube

            _cubeTransform.Translation  = new float3(0, 1 * M.Sin(4 * 2), 0);
            _cubeTransform1.Translation = new float3(0, 3 * M.Sin(8 * RealTimeSinceStart), 3);
            _cubeTransform2.Translation = new float3(0, 3 * M.Sin(8 * TimeSinceStart), 6);
            _cubeTransform2.Rotation    = new float3(0, 10, 10);
            _cubeTransform.Scale        = new float3(3, 5 * M.Sin(1 * TimeSinceStart), 1);
            _cubeTransform1.Scale       = new float3(1, 8 * M.Cos(1 * TimeSinceStart), 1);
            _cubeTransform3.Scale       = new float3(3, 2 * M.Cos(1 * TimeSinceStart), 7);
            _cubeTransform3.Rotation    = new float3(1 * TimeSinceStart, 0, 0);

            // cubeMaterial2.Diffuse = new float3(0.2f,0.3f,0.2f);



            //   }



            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, 0, 20) * float4x4.CreateRotationY(_camAngle);


            // Render the scene on the current render context
            _sceneRenderer.Render(RC);


            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            float bodyRot = _bodyTransform.Rotation.y;

            bodyRot += 0.1f * Keyboard.LeftRightAxis;
            _bodyTransform.Rotation = new float3(0, bodyRot, 0);

            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle);

            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 30
0
        // RenderAFrame is called once a frame
        public override void RenderAFrame()
        {
            float bodyRot1 = _bodyTransform.Rotation.y;

            bodyRot1 += 3.1f * DeltaTime * Keyboard.LeftRightAxis;
            _bodyTransform.Rotation = new float3(0, bodyRot1, 0);

            float upperArmTransform = _upperArmTransform.Rotation.x;

            upperArmTransform          += 3.1f * DeltaTime * Keyboard.UpDownAxis;
            _upperArmTransform.Rotation = new float3(upperArmTransform, 0, 0);

            float foreArmTransform = _foreArmTransform.Rotation.x;

            foreArmTransform          += 3.1f * DeltaTime * Keyboard.WSAxis;
            _foreArmTransform.Rotation = new float3(foreArmTransform, 0, 0);



            // Clear the backbuffer
            RC.Clear(ClearFlags.Color | ClearFlags.Depth);

            // kamera maus x
            if (Mouse.LeftButton)
            {
                _camAnglerotationX = Mouse.Velocity.x / 5000;
            }
            _camAngle -= _camAnglerotationX;



            // Setup the camera
            RC.View = float4x4.CreateTranslation(0, -10, 50) * float4x4.CreateRotationY(_camAngle);



            // Render the scene on the current render context
            _sceneRenderer.Render(RC);

            // Swap buffers: Show the contents of the backbuffer (containing the currently rendered farame) on the front buffer.
            Present();
        }
Ejemplo n.º 31
0
    //--------------------------------------------------------------
    #region Creation & Cleanup
    //--------------------------------------------------------------

    public DeferredGraphicsScreen(IServiceLocator services)
      : base(services.GetInstance<IGraphicsService>())
    {
      _sampleFramework = services.GetInstance<SampleFramework>();
      var contentManager = services.GetInstance<ContentManager>();

      SpriteBatch = GraphicsService.GetSpriteBatch();

      // Let's create the necessary scene node renderers:
#if !XBOX360
      TerrainRenderer = new TerrainRenderer(GraphicsService);
#endif
      MeshRenderer = new MeshRenderer();

      // The _opaqueMeshSceneRenderer combines all renderers for opaque
      // (= not alpha blended) meshes.
      _opaqueMeshSceneRenderer = new SceneRenderer();
#if !XBOX360
      _opaqueMeshSceneRenderer.Renderers.Add(TerrainRenderer);
#endif
      _opaqueMeshSceneRenderer.Renderers.Add(MeshRenderer);

      _decalRenderer = new DecalRenderer(GraphicsService);
      _billboardRenderer = new BillboardRenderer(GraphicsService, 2048)
      {
        EnableSoftParticles = true,

        // If you have an extreme amount of particles that cover the entire screen,
        // you can turn on offscreen rendering to improve performance.
        //EnableOffscreenRendering = true,
      };

      // The AlphaBlendSceneRenderer combines all renderers for transparent
      // (= alpha blended) objects.
      AlphaBlendSceneRenderer = new SceneRenderer();
      AlphaBlendSceneRenderer.Renderers.Add(MeshRenderer);
      AlphaBlendSceneRenderer.Renderers.Add(_billboardRenderer);
      AlphaBlendSceneRenderer.Renderers.Add(new WaterRenderer(GraphicsService));
      AlphaBlendSceneRenderer.Renderers.Add(new FogSphereRenderer(GraphicsService));
      AlphaBlendSceneRenderer.Renderers.Add(new VolumetricLightRenderer(GraphicsService));

#if !XBOX360
      // Update terrain clipmaps. (Only necessary if TerrainNodes are used.)
      _terrainClipmapRenderer = new TerrainClipmapRenderer(GraphicsService);
#endif

      // Renderer for cloud maps. (Only necessary if LayeredCloudMaps are used.)
      _cloudMapRenderer = new CloudMapRenderer(GraphicsService);

      // Renderer for SceneCaptureNodes. See also SceneCapture2DSample.
      // In the constructor we specify a method which is called in SceneCaptureRenderer.Render() 
      // when the scene must be rendered for the SceneCaptureNodes.
      SceneCaptureRenderer = new SceneCaptureRenderer(context =>
      {
        // Get scene nodes which are visible by the current camera.
        CustomSceneQuery sceneQuery = Scene.Query<CustomSceneQuery>(context.CameraNode, context);
        // Render scene (with post-processing, with lens flares, no debug rendering, no reticle).
        RenderScene(sceneQuery, context, true, true, false, false);
      });

      // Renderer for PlanarReflectionNodes. See also PlanarReflectionSample.
      // In the constructor we specify a method which is called in PlanarReflectionRenderer.Render() 
      // to create the reflection images.
      _planarReflectionRenderer = new PlanarReflectionRenderer(context =>
      {
        // Get scene nodes which are visible by the current camera.
        CustomSceneQuery sceneQuery = Scene.Query<CustomSceneQuery>(context.CameraNode, context);

        var planarReflectionNode = (PlanarReflectionNode)context.ReferenceNode;

        // Planar reflections are often for WaterNodes. These nodes should not be rendered 
        // into their own reflection map because when the water surface is displaced by waves, 
        // some waves could be visible in the reflection. 
        // --> Remove the water node from the renderable nodes. (In our samples, the water
        // node is the parent of the reflection node.)
        if (planarReflectionNode.Parent is WaterNode)
        {
          var index = sceneQuery.RenderableNodes.IndexOf(planarReflectionNode.Parent);
          if (index >= 0)
            sceneQuery.RenderableNodes[index] = null;
        }

        // Render scene (no post-processing, no lens flares, no debug rendering, no reticle).
        RenderScene(sceneQuery, context, false, false, false, false);
      });

      _waterWavesRenderer = new WaterWavesRenderer(GraphicsService);

      // The shadow map renderer renders a depth image from the viewpoint of the light and
      // stores it in LightNode.Shadow.ShadowMap.
      ShadowMapRenderer = new ShadowMapRenderer(context =>
      {
        var query = context.Scene.Query<ShadowCasterQuery>(context.CameraNode, context);
        if (query.ShadowCasters.Count == 0)
          return false;

        _opaqueMeshSceneRenderer.Render(query.ShadowCasters, context);
        return true;
      });

      // The shadow mask renderer evaluates the shadow maps, does shadow filtering 
      // and stores the resulting shadow factor in a screen space image 
      //(see LightNode.Shadow.ShadowMask/ShadowMaskChannel).
      ShadowMaskRenderer = new ShadowMaskRenderer(GraphicsService, 2);

      // Optionally, we can blur the shadow mask to make the shadows smoother.
      var blur = new Blur(GraphicsService)
      {
        IsAnisotropic = false,
        IsBilateral = true,
        EdgeSoftness = 0.05f,
        Scale = 1f,
        Enabled = false,  // Disable blur by default.
      };
      blur.InitializeGaussianBlur(11, 3, true);
      ShadowMaskRenderer.Filter = blur;

      // Renderers which create the intermediate render targets:
      // Those 2 renderers are implemented in this sample. Those functions could
      // be implemented directly in this class but we have created separate classes
      // to make the code more readable.
      _gBufferRenderer = new GBufferRenderer(GraphicsService, _opaqueMeshSceneRenderer, _decalRenderer);
      LightBufferRenderer = new LightBufferRenderer(GraphicsService);

      // Other specialized renderers:
      _lensFlareRenderer = new LensFlareRenderer(GraphicsService);
      _skyRenderer = new SkyRenderer(GraphicsService);
      _fogRenderer = new FogRenderer(GraphicsService);
      _internalDebugRenderer = new DebugRenderer(GraphicsService, null);
      _rebuildZBufferRenderer = new RebuildZBufferRenderer(GraphicsService);

      Scene = new Scene();

      // This screen needs a HDR filter to map high dynamic range values back to
      // low dynamic range (LDR).
      PostProcessors = new PostProcessorChain(GraphicsService);
      PostProcessors.Add(new HdrFilter(GraphicsService)
      {
        EnableBlueShift = true,
        BlueShiftCenter = 0.0004f,
        BlueShiftRange = 0.5f,
        //BlueShiftColor = new Vector3F(1.05f / 4f, 0.97f / 4f, 1.27f / 4f),  // Default physically-based blue-shift
        BlueShiftColor = new Vector3F(0.25f, 0.25f, 0.7f),  // More dramatic blue-shift
        MinExposure = 0,
        MaxExposure = 10,
        BloomIntensity = 1,
        BloomThreshold = 0.6f,
      });
      _underwaterPostProcessor = new UnderwaterPostProcessor(GraphicsService, contentManager);
      PostProcessors.Add(_underwaterPostProcessor);

      // Use 2D texture for reticle.
      _reticle = contentManager.Load<Texture2D>("Reticle");

      // Use the sprite font of the GUI.
      var uiContentManager = services.GetInstance<ContentManager>("UIContent");
      var spriteFont = uiContentManager.Load<SpriteFont>("UI Themes/BlendBlue/Default");
      DebugRenderer = new DebugRenderer(GraphicsService, spriteFont)
      {
        DefaultColor = new Color(0, 0, 0),
        DefaultTextPosition = new Vector2F(10),
      };

      EnableLod = true;
    }