Ejemplo n.º 1
0
        private static int GetSortingKey(string name, ActiveUniformType type)
        {
            switch (type)
            {
            case ActiveUniformType.Bool:
            case ActiveUniformType.Int:
                return(ShaderParams.GetSortingKey(name, typeof(int)));

            case ActiveUniformType.BoolVec2:
            case ActiveUniformType.IntVec2:
                return(ShaderParams.GetSortingKey(name, typeof(IntVector2)));

            case ActiveUniformType.Float:
                return(ShaderParams.GetSortingKey(name, typeof(float)));

            case ActiveUniformType.FloatVec2:
                return(ShaderParams.GetSortingKey(name, typeof(Vector2)));

            case ActiveUniformType.FloatVec3:
                return(ShaderParams.GetSortingKey(name, typeof(Vector3)));

            case ActiveUniformType.FloatVec4:
                return(ShaderParams.GetSortingKey(name, typeof(Vector4)));

            case ActiveUniformType.FloatMat4:
                return(ShaderParams.GetSortingKey(name, typeof(Matrix44)));

            default:
                throw new NotSupportedException();
            }
        }
Ejemplo n.º 2
0
 public DistortionMaterial(Blending blending)
 {
     Blending          = blending;
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
     amountKey         = shaderParams.GetParamKey <Vector4>("uAmount");
 }
Ejemplo n.º 3
0
        private static int GetSortingKey(string name, ShaderVariableType type)
        {
            switch (type)
            {
            case ShaderVariableType.Bool:
            case ShaderVariableType.Int:
                return(ShaderParams.GetSortingKey(name, typeof(int)));

            case ShaderVariableType.BoolVector2:
            case ShaderVariableType.IntVector2:
                return(ShaderParams.GetSortingKey(name, typeof(IntVector2)));

            case ShaderVariableType.Float:
                return(ShaderParams.GetSortingKey(name, typeof(float)));

            case ShaderVariableType.FloatVector2:
                return(ShaderParams.GetSortingKey(name, typeof(Vector2)));

            case ShaderVariableType.FloatVector3:
                return(ShaderParams.GetSortingKey(name, typeof(Vector3)));

            case ShaderVariableType.FloatVector4:
                return(ShaderParams.GetSortingKey(name, typeof(Vector4)));

            case ShaderVariableType.FloatMatrix4:
                return(ShaderParams.GetSortingKey(name, typeof(Matrix44)));

            default:
                throw new NotSupportedException($"name: {name}, type: {type.ToString()}");
            }
        }
Ejemplo n.º 4
0
 public BloomMaterial()
 {
     shaderParams               = new ShaderParams();
     shaderParamsArray          = new[] { Renderer.GlobalShaderParams, shaderParams };
     brightThresholdKey         = shaderParams.GetParamKey <float>("brightThreshold");
     inversedGammaCorrectionKey = shaderParams.GetParamKey <Vector3>("inversedGammaCorrection");
 }
Ejemplo n.º 5
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");
 }
Ejemplo n.º 6
0
 private ColorfulTextMaterial(Blending blending, int styleIndex)
 {
     colorIndex   = ShaderPrograms.ColorfulTextShaderProgram.StyleIndexToColorIndex(styleIndex);
     blendState   = blending.GetBlendState();
     shaderParams = new ShaderParams();
     shaderParams.Set(shaderParams.GetParamKey <float>("colorIndex"), colorIndex);
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 8
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");
 }
Ejemplo n.º 9
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");
 }
Ejemplo n.º 10
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");
 }
Ejemplo n.º 11
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");
 }
Ejemplo n.º 12
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");
 }
Ejemplo n.º 13
0
 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");
 }
Ejemplo n.º 14
0
        public CommonMaterial()
        {
            DiffuseColor = Color4.White;
            FogColor     = Color4.White;
            Blending     = Blending.Alpha;

            shaderParams      = new ShaderParams();
            shaderParamKeys   = new ShaderParamKeys(shaderParams);
            shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
        }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 18
0
 public YUVtoRGBMaterial()
 {
     blendState        = BlendState.Default;
     shaderParams      = new ShaderParams();
     shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams };
 }