Exemplo n.º 1
0
        protected void ResetByPrefix(string prefix)
        {
            SettingsBuffer.ClearByPrefix(prefix);
            SettingsBuffer.Parent.ClearByPrefix(prefix);

            ItemsChanged = true;
        }
Exemplo n.º 2
0
        private void SetShaderParameters(DeviceContext deviceContext, Matrix world, Matrix view, Matrix projection, float flags, Vector2 brightnessCoeffs)
        {
            try
            {
                // Transpose the matrices to prepare them for shader.
                world.Transpose();
                view.Transpose();
                projection.Transpose();

                // Lock the constant buffer so it can be written to.
                DataStream mappedResource;
                deviceContext.MapSubresource(ConstantMatrixBuffer, MapMode.WriteDiscard, MapFlags.None, out mappedResource);

                // Copy the matrices into the constant buffer.
                var matrixBuffer = new MatrixBuffer()
                {
                    world      = world,
                    view       = view,
                    projection = projection
                };

                mappedResource.Write(matrixBuffer);

                // Unlock the constant buffer.
                deviceContext.UnmapSubresource(ConstantMatrixBuffer, 0);

                // Set the position of the constant buffer in the vertex shader.
                var bufferNumber = 0;

                // Finally set the constant buffer in the vertex shader with the updated values.
                deviceContext.VertexShader.SetConstantBuffer(bufferNumber, ConstantMatrixBuffer);

                // Lock the settings constant buffer so it can be written to.
                deviceContext.MapSubresource(ConstantSettingsBuffer, MapMode.WriteDiscard, MapFlags.None, out mappedResource);

                // Copy the values into the settings buffer.
                var settingsBuffer = new SettingsBuffer()
                {
                    flags            = flags,
                    brightnessCoeffs = brightnessCoeffs
                };
                mappedResource.Write(settingsBuffer);

                // Unlock the constant buffer
                deviceContext.UnmapSubresource(ConstantSettingsBuffer, 0);

                // Set the position of the constant buffer in the pixel shader.
                bufferNumber = 0;

                // Finally set the constant buffer in the pixel shader with the updated values.
                deviceContext.PixelShader.SetConstantBuffer(bufferNumber, ConstantSettingsBuffer);
            }
            catch (Exception ex)
            {
                throw new Exception("Could not set shader parameters: " + ex.Message);
            }
        }
Exemplo n.º 3
0
        private void ClearConfirmations()
        {
            SettingsBuffer.ClearByPrefix("confirmation.");
            SettingsBuffer.Parent.ClearByPrefix("confirmation.");

            Dirty                 = false;
            ItemsChanged          = true;
            AdvancedSettingsClean = true;
        }
Exemplo n.º 4
0
        private void ClearUserSettings()
        {
            SettingsBuffer.Clear();
            SettingsBuffer.Parent.Clear();

            Dirty                 = false;
            ItemsChanged          = true;
            AdvancedSettingsClean = true;
        }
Exemplo n.º 5
0
        private void ApplyChanges()
        {
            SettingsBuffer.SetParent();
            SettingsBuffer.Clear();

            StyleBuffer.SetParent();
            StyleBuffer.Clear();

            Dirty        = false;
            ItemsChanged = true;
        }
Exemplo n.º 6
0
 protected void SetSetting(string key, object value)
 {
     SettingsBuffer.Set(key, value);
     Dirty = true;
 }
Exemplo n.º 7
0
 protected string GetSetting(string key)
 {
     return(SettingsBuffer.Get(key));
 }