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(); } }
public DistortionMaterial(Blending blending) { Blending = blending; shaderParams = new ShaderParams(); shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams }; amountKey = shaderParams.GetParamKey <Vector4>("uAmount"); }
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()}"); } }
public BloomMaterial() { shaderParams = new ShaderParams(); shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams }; brightThresholdKey = shaderParams.GetParamKey <float>("brightThreshold"); inversedGammaCorrectionKey = shaderParams.GetParamKey <Vector3>("inversedGammaCorrection"); }
public SharpenMaterial(Blending blending) { Blending = blending; shaderParams = new ShaderParams(); shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams }; stepKey = shaderParams.GetParamKey <Vector2>("step"); sharpnessKey = shaderParams.GetParamKey <Vector3>("uSharpness"); }
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 }; }
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"); }
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"); }
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"); }
public FXAAMaterial(Blending blending) { Blending = blending; shaderParams = new ShaderParams(); shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams }; texelStepKey = shaderParams.GetParamKey <Vector2>("uTexelStep"); amountKey = shaderParams.GetParamKey <Vector4>("uAmount"); }
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 TwistMaterial() { shaderParams = new ShaderParams(); shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams }; angleKey = shaderParams.GetParamKey <float>("angle"); uv0Key = shaderParams.GetParamKey <Vector2>("uv0"); uv1Key = shaderParams.GetParamKey <Vector2>("uv1"); }
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"); }
public CommonMaterial() { DiffuseColor = Color4.White; FogColor = Color4.White; Blending = Blending.Alpha; shaderParams = new ShaderParams(); shaderParamKeys = new ShaderParamKeys(shaderParams); shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams }; }
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"); }
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"); }
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"); }
public YUVtoRGBMaterial() { blendState = BlendState.Default; shaderParams = new ShaderParams(); shaderParamsArray = new[] { Renderer.GlobalShaderParams, shaderParams }; }