Example #1
0
 static Renderer()
 {
     projectionParamKey  = GlobalShaderParams.GetParamKey <Matrix44>("matProjection");
     colorFactorParamKey = GlobalShaderParams.GetParamKey <Vector4>("colorFactor");
     PlatformRenderer.RenderTargetChanged += OnRenderTargetChanged;
     ColorFactor = Color4.White;
 }
Example #2
0
 public DistortionMaterial(Blending blending)
 {
     Blending          = blending;
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     amountKey         = shaderParams.GetParamKey <Vector4>("uAmount");
 }
Example #3
0
 public BloomMaterial()
 {
     shaderParams               = new ShaderParams();
     shaderParamsArray          = new[] { Renderer.GlobalShaderParams, shaderParams };
     brightThresholdKey         = shaderParams.GetParamKey <float>("brightThreshold");
     inversedGammaCorrectionKey = shaderParams.GetParamKey <Vector3>("inversedGammaCorrection");
 }
Example #4
0
 public AlphaIntensityMaterial()
 {
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     radiusKey         = shaderParams.GetParamKey <float>("radius");
     brightnessKey     = shaderParams.GetParamKey <float>("brightness");
     colorKey          = shaderParams.GetParamKey <Vector4>("glowColor");
 }
Example #5
0
 public DissolveMaterial()
 {
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     brightnessKey     = shaderParams.GetParamKey <float>("brightness");
     rangeKey          = shaderParams.GetParamKey <Vector2>("range");
     colorKey          = shaderParams.GetParamKey <Vector4>("glowColor");
 }
Example #6
0
 public FXAAMaterial(Blending blending)
 {
     Blending          = blending;
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     texelStepKey      = shaderParams.GetParamKey <Vector2>("uTexelStep");
     amountKey         = shaderParams.GetParamKey <Vector4>("uAmount");
 }
Example #7
0
 public NoiseMaterial()
 {
     shaderParams       = new ShaderParams();
     shaderParamsArray  = new[] { Renderer.GlobalShaderParams, shaderParams };
     brightThresholdKey = shaderParams.GetParamKey <float>("brightThreshold");
     darkThresholdKey   = shaderParams.GetParamKey <float>("darkThreshold");
     softLightKey       = shaderParams.GetParamKey <float>("softLight");
 }
Example #8
0
 public SharpenMaterial(Blending blending)
 {
     Blending          = blending;
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     stepKey           = shaderParams.GetParamKey <Vector2>("step");
     sharpnessKey      = shaderParams.GetParamKey <Vector3>("uSharpness");
 }
Example #9
0
 public TwistMaterial()
 {
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     angleKey          = shaderParams.GetParamKey <float>("angle");
     uv0Key            = shaderParams.GetParamKey <Vector2>("uv0");
     uv1Key            = shaderParams.GetParamKey <Vector2>("uv1");
 }
Example #10
0
 public BlurMaterial(Blending blending)
 {
     Blending           = blending;
     shaderParams       = new ShaderParams();
     shaderParamsArray  = new[] { Renderer.GlobalShaderParams, shaderParams };
     stepKey            = shaderParams.GetParamKey <Vector2>("step");
     alphaCorrectionKey = shaderParams.GetParamKey <float>("inversedAlphaCorrection");
 }
 public ColorCorrectionMaterial(Blending blending)
 {
     Blending          = blending;
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     hslKey            = shaderParams.GetParamKey <Vector3>("inHsl");
     brightnessKey     = shaderParams.GetParamKey <float>("brightness");
     contrastKey       = shaderParams.GetParamKey <float>("contrast");
 }
Example #12
0
 private ShaderParam<T> GetParameter<T>(ShaderParamKey<T> key, int capacity)
 {
     var p = Items[key.Index] as ShaderParam<T>;
     if (p == null || p.Data.Length < capacity) {
         p = new ShaderParam<T>(capacity) { Name = key.Name };
         Items[key.Index] = p;
     }
     return p;
 }
Example #13
0
 public void Set<T>(ShaderParamKey<T> key, T value)
 {
     var p = GetParameter(key, 1);
     p.Data[0] = value;
     p.Count = 1;
     unchecked {
         p.Version++;
     }
 }
Example #14
0
 public void Set<T>(ShaderParamKey<T> key, T[] value, int count)
 {
     var p = GetParameter(key, count);
     Array.Copy(value, p.Data, count);
     p.Count = count;
     unchecked {
         p.Version++;
     }
 }
Example #15
0
 public WaveMaterial()
 {
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     phaseKey          = shaderParams.GetParamKey <Vector2>("phase");
     frequencyKey      = shaderParams.GetParamKey <Vector2>("frequency");
     pivotKey          = shaderParams.GetParamKey <Vector2>("pivot");
     amplitudeKey      = shaderParams.GetParamKey <Vector2>("amplitude");
     uv0Key            = shaderParams.GetParamKey <Vector2>("UV0");
     uv1Key            = shaderParams.GetParamKey <Vector2>("UV1");
 }
Example #16
0
 public VignetteMaterial(Blending blending)
 {
     Blending          = blending;
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     radiusKey         = shaderParams.GetParamKey <float>("radius");
     softnessKey       = shaderParams.GetParamKey <float>("softness");
     uv1Key            = shaderParams.GetParamKey <Vector2>("uv1");
     uvOffsetKey       = shaderParams.GetParamKey <Vector2>("uvOffset");
     colorKey          = shaderParams.GetParamKey <Vector4>("vignetteColor");
 }
Example #17
0
 public ShaderParamKeys(ShaderParams parameters)
 {
     WorldViewProj      = parameters.GetParamKey <Matrix44>("u_WorldViewProj");
     WorldView          = parameters.GetParamKey <Matrix44>("u_WorldView");
     World              = parameters.GetParamKey <Matrix44>("u_World");
     ColorFactor        = parameters.GetParamKey <Vector4>("u_ColorFactor");
     DiffuseColor       = parameters.GetParamKey <Vector4>("u_DiffuseColor");
     LightColor         = parameters.GetParamKey <Vector4>("u_LightColor");
     LightDirection     = parameters.GetParamKey <Vector3>("u_LightDirection");
     LightIntensity     = parameters.GetParamKey <float>("u_LightIntensity");
     LightStrength      = parameters.GetParamKey <float>("u_LightStrength");
     LightAmbient       = parameters.GetParamKey <float>("u_AmbientLight");
     LightWorldViewProj = parameters.GetParamKey <Matrix44>("u_LightWorldViewProjection");
     ShadowColor        = parameters.GetParamKey <Vector4>("u_ShadowColor");
     Bones              = parameters.GetParamKey <Matrix44>("u_Bones");
     FogColor           = parameters.GetParamKey <Vector4>("u_FogColor");
     FogStart           = parameters.GetParamKey <float>("u_FogStart");
     FogEnd             = parameters.GetParamKey <float>("u_FogEnd");
     FogDensity         = parameters.GetParamKey <float>("u_FogDensity");
 }