Пример #1
0
        } // CarPaintShader

        #endregion

        #region Get Parameters Handles

        /// <summary>
        /// Get the handles of the parameters from the shader.
        /// </summary>
        /// <remarks>
        /// Creating and assigning a EffectParameter instance for each technique in your Effect is significantly faster than using the Parameters indexed property on Effect.
        /// </remarks>
        protected override sealed void GetParametersHandles()
        {
            try
            {
                spSpecularIntensity       = new ShaderParameterFloat("specularIntensity", this);
                spMicroflakePerturbation  = new ShaderParameterFloat("microflakePerturbation", this);
                spMicroflakePerturbationA = new ShaderParameterFloat("microflakePerturbationA", this);
                spNormalPerturbation      = new ShaderParameterFloat("normalPerturbation", this);
                spFlakeScale                  = new ShaderParameterFloat("flakesScale", this);
                spFlakesExponent              = new ShaderParameterFloat("flakesExponent", this);
                spMaxRange                    = new ShaderParameterFloat("maxRange", this);
                spHalfPixel                   = new ShaderParameterVector2("halfPixel", this);
                spCameraPosition              = new ShaderParameterVector3("cameraPosition", this);
                spWorldMatrix                 = new ShaderParameterMatrix("world", this);
                spWorldITMatrix               = new ShaderParameterMatrix("worldIT", this);
                spWorldViewProjMatrix         = new ShaderParameterMatrix("worldViewProj", this);
                spViewInverseMatrix           = new ShaderParameterMatrix("viewI", this);
                spBasePaintColor              = new ShaderParameterColor("basePaintColor1", this);
                spSecondBasePaintColor        = new ShaderParameterColor("basePaintColor2", this);
                spThridBasePaintColor         = new ShaderParameterColor("basePaintColor3", this);
                spFlakeLayerColor             = new ShaderParameterColor("flakeLayerColor", this);
                spNormalTexture               = new ShaderParameterTexture("normalTexture", this, SamplerState.PointClamp, 1);
                spDiffuseAccumulationTexture  = new ShaderParameterTexture("diffuseAccumulationTexture", this, SamplerState.PointClamp, 4);
                spSpecularAccumulationTexture = new ShaderParameterTexture("specularAccumulationTexture", this, SamplerState.PointClamp, 5);
                spReflectionTexture           = new ShaderParameterTextureCube("reflectionTexture", this, SamplerState.LinearClamp, 3);
                spSparkleNoiseTexture         = new ShaderParameterTexture("microflakeMap", this, SamplerState.LinearWrap, 0);
                spIsRGBM = new ShaderParameterBool("isRGBM", this);
            }
            catch
            {
                throw new InvalidOperationException("The parameter's handles from the " + Name + " shader could not be retrieved.");
            }
        }         // GetParametersHandles
Пример #2
0
        } // GBufferShader

        #endregion

        #region Get Parameters Handles

        /// <summary>
        /// Get the handles of the parameters from the shader.
        /// </summary>
        /// <remarks>
        /// Creating and assigning a EffectParameter instance for each technique in your Effect is significantly faster than using the Parameters indexed property on Effect.
        /// </remarks>
        protected override void GetParametersHandles()
        {
            try
            {
                // Matrices //
                spWorldViewProj = new ShaderParameterMatrix("worldViewProj", this);
                spWorldView     = new ShaderParameterMatrix("worldView", this);
                spWorldViewIT   = new ShaderParameterMatrix("worldViewIT", this);
                // Floats //
                spFarPlane       = new ShaderParameterFloat("farPlane", this);
                spSpecularPower  = new ShaderParameterFloat("specularPower", this);
                spHeightMapScale = new ShaderParameterFloat("heightMapScale", this);
                // Bool //
                spSpecularTextured = new ShaderParameterBool("specularTextured", this);
                // Ints //
                spLODThreshold         = new ShaderParameterInt("LODThreshold", this);
                spMinimumNumberSamples = new ShaderParameterInt("minimumNumberSamples", this);
                spMaximumNumberSamples = new ShaderParameterInt("maximumNumberSamples", this);
                // Vector2 //
                spObjectNormalTextureSize = new ShaderParameterVector2("objectNormalTextureSize", this);
                // Textures //
                spObjectNormalTexture   = new ShaderParameterTexture("objectNormalTexture", this, SamplerState.AnisotropicWrap, 0);
                spObjectSpecularTexture = new ShaderParameterTexture("objectSpecularTexture", this, SamplerState.LinearWrap, 1);
                spNormalsFittingTexture = new ShaderParameterTexture("normalsFittingTexture", this, SamplerState.LinearClamp, 7);
                // Skinning //
                spBones = new ShaderParameterMatrixArray("Bones", this, ModelAnimationClip.MaxBones);
            }
            catch
            {
                throw new InvalidOperationException("The parameter's handles from the " + Name + " shader could not be retrieved.");
            }
        } // GetParameters
 /// <summary>
 /// Get the handles of the parameters from the shader.
 /// </summary>
 /// <remarks>
 /// Creating and assigning a EffectParameter instance for each technique in your Effect is significantly faster than using the Parameters indexed property on Effect.
 /// </remarks>
 protected override sealed void GetParametersHandles()
 {
     try
     {
         spLODThreshold         = new ShaderParameterInt("LODThreshold", this);
         spMinimumNumberSamples = new ShaderParameterInt("minimumNumberSamples", this);
         spMaximumNumberSamples = new ShaderParameterInt("maximumNumberSamples", this);
         spSpecularIntensity    = new ShaderParameterFloat("specularIntensity", this);
         spMaxRange             = new ShaderParameterFloat("maxRange", this);
         spHeightMapScale       = new ShaderParameterFloat("heightMapScale", this);
         spHalfPixel            = new ShaderParameterVector2("halfPixel", this);
         spNormalTextureSize    = new ShaderParameterVector2("objectNormalTextureSize", this);
         spCameraPosition       = new ShaderParameterVector3("cameraPosition", this);
         spWorldMatrix          = new ShaderParameterMatrix("world", this);
         spWorldITMatrix        = new ShaderParameterMatrix("worldIT", this);
         spWorldViewProjMatrix  = new ShaderParameterMatrix("worldViewProj", this);
         spViewInverseMatrix    = new ShaderParameterMatrix("viewI", this);
         spBones                       = new ShaderParameterMatrixArray("Bones", this, ModelAnimationClip.MaxBones);
         spDiffuseColor                = new ShaderParameterColor("diffuseColor", this);
         spDiffuseTexture              = new ShaderParameterTexture("diffuseTexture", this, SamplerState.AnisotropicWrap, 0);
         spNormalTexture               = new ShaderParameterTexture("normalTexture", this, SamplerState.PointClamp, 1); // SamplerState.AnisotropicWrap;
         spSpecularTexture             = new ShaderParameterTexture("specularTexture", this, SamplerState.AnisotropicWrap, 2);
         spDiffuseAccumulationTexture  = new ShaderParameterTexture("diffuseAccumulationTexture", this, SamplerState.PointClamp, 4);
         spSpecularAccumulationTexture = new ShaderParameterTexture("specularAccumulationTexture", this, SamplerState.PointClamp, 5);
         spReflectionTexture           = new ShaderParameterTextureCube("reflectionTexture", this, SamplerState.LinearClamp, 3);
         spReflectionTextured          = new ShaderParameterBool("reflectionTextured", this);
         spIsRGBM                      = new ShaderParameterBool("isRGBM", this);
     }
     catch
     {
         throw new InvalidOperationException("The parameter's handles from the " + Name + " shader could not be retrieved.");
     }
 }         // GetParametersHandles
Пример #4
0
 /// <summary>
 /// Get the handles of the parameters from the shader.
 /// </summary>
 /// <remarks>
 /// Creating and assigning a EffectParameter instance for each technique in your Effect is significantly faster than using the Parameters indexed property on Effect.
 /// </remarks>
 protected override sealed void GetParametersHandles()
 {
     try
     {
         spHalfPixel           = new ShaderParameterVector2("halfPixel", this);
         spSpecularIntensity   = new ShaderParameterFloat("specularIntensity", this);
         spSpecularPower       = new ShaderParameterFloat("specularPower", this);
         spAlphaBlending       = new ShaderParameterFloat("alphaBlending", this);
         spMaxRange            = new ShaderParameterFloat("maxRange", this);
         spCameraPosition      = new ShaderParameterVector3("cameraPosition", this);
         spWorldMatrix         = new ShaderParameterMatrix("world", this);
         spWorldITMatrix       = new ShaderParameterMatrix("worldIT", this);
         spWorldViewProjMatrix = new ShaderParameterMatrix("worldViewProj", this);
         spDiffuseColor        = new ShaderParameterColor("diffuseColor", this);
         spDiffuseTexture      = new ShaderParameterTexture("diffuseTexture", this, SamplerState.AnisotropicWrap, 0);
         spReflectionTexture   = new ShaderParameterTextureCube("reflectionTexture", this, SamplerState.LinearClamp, 4);
         spReflectionTextured  = new ShaderParameterBool("reflectionTextured", this);
         spIsRGBM = new ShaderParameterBool("isRGBM", this);
         // Ambient Light //
         spSphericalHarmonicBase        = new ShaderParameterVector3Array("sphericalHarmonicBase", this, 9);
         spAmbientIntensity             = new ShaderParameterFloat("ambientIntensity", this);
         spAmbientColor                 = new ShaderParameterColor("ambientColor", this);
         spHasAmbientSphericalHarmonics = new ShaderParameterBool("hasAmbientSphericalHarmonics", this);
         // Directional Light //
         spDirectionalLightDirection = new ShaderParameterVector3("directionalLightDirection", this);
         spDirectionalLightColor     = new ShaderParameterColor("directionalLightColor", this);
         spDirectionalLightIntensity = new ShaderParameterFloat("directionalLightIntensity", this);
         spShadowTexture             = new ShaderParameterTexture("shadowTexture", this, SamplerState.PointClamp, 3);
         spHasShadows = new ShaderParameterBool("hasShadows", this);
         // Spot //
         spSpotLightDirection        = new ShaderParameterVector3("spotLightDirection", this);
         spSpotLightPosition         = new ShaderParameterVector3("spotLightPos", this);
         spSpotLightColor            = new ShaderParameterColor("spotLightColor", this);
         spDirectionalLightIntensity = new ShaderParameterFloat("directionalLightIntensity", this);
         spSpotLightIntensity        = new ShaderParameterFloat("spotLightIntensity", this);
         spSpotLightInnerAngle       = new ShaderParameterFloat("spotLightInnerAngle", this);
         spSpotLightOuterAngle       = new ShaderParameterFloat("spotLightOuterAngle", this);
         spInvSpotLightRadius        = new ShaderParameterFloat("invSpotLightRadius", this);
         // Point
         spPointLightIntensity1 = new ShaderParameterFloat("pointLightIntensity", this);
         spInvPointLightRadius1 = new ShaderParameterFloat("invPointLightRadius", this);
         spPointLightIntensity2 = new ShaderParameterFloat("pointLightIntensity2", this);
         spInvPointLightRadius2 = new ShaderParameterFloat("invPointLightRadius2", this);
         spPointLightPos1       = new ShaderParameterVector3("pointLightPos", this);
         spPointLightPos2       = new ShaderParameterVector3("pointLightPos2", this);
         spPointLightColor1     = new ShaderParameterColor("pointLightColor", this);
         spPointLightColor2     = new ShaderParameterColor("pointLightColor2", this);
     }
     catch
     {
         throw new InvalidOperationException("The parameter's handles from the " + Name + " shader could not be retrieved.");
     }
 }         // GetParametersHandles
Пример #5
0
        /// <summary>
        /// Get the handles of the parameters from the shader.
        /// </summary>
        /// <remarks>
        /// Creating and assigning a EffectParameter instance for each technique in your Effect is significantly faster than using the Parameters indexed property on Effect.
        /// </remarks>
        protected override void GetParametersHandles()
        {
            try
            {
                spBloomThreshold       = new ShaderParameterFloat("bloomThreshold", this);
                spLensExposure         = new ShaderParameterFloat("lensExposure", this);
                spHalfPixel            = new ShaderParameterVector2("halfPixel", this);
                spAutoExposure         = new ShaderParameterBool("autoExposure", this);
                spSceneTexture         = new ShaderParameterTexture("sceneTexture", this, SamplerState.PointClamp, 8);
                spLastLuminanceTexture = new ShaderParameterTexture("lastLuminanceTexture", this, SamplerState.PointClamp, 12);

                Resource.CurrentTechnique = Resource.Techniques["Bloom"];
            }
            catch
            {
                throw new InvalidOperationException("The parameter's handles from the " + Name + " shader could not be retrieved.");
            }
        } // GetParameters
Пример #6
0
        } // PostProcessingShader

        #endregion

        #region Get Parameters Handles

        /// <summary>
        /// Get the handles of the parameters from the shader.
        /// </summary>
        /// <remarks>
        /// Creating and assigning a EffectParameter instance for each technique in your Effect is significantly faster than using the Parameters indexed property on Effect.
        /// </remarks>
        protected override void GetParametersHandles()
        {
            //try
            {
                // Bool
                spAutoExposureEnabled = new ShaderParameterBool("autoExposure", this);
                spBloomEnabled = new ShaderParameterBool("bloomEnabled", this);
                spAdjustLevelsEnabled = new ShaderParameterBool("adjustLevelsEnabled", this);
                spAdjustLevelsIndividualChannelsEnabled = new ShaderParameterBool("adjustLevelsIndividualChannelsEnabled", this);
                spColorCorrectOneLutEnabled = new ShaderParameterBool("colorCorrectOneLutEnabled", this);
                spColorCorrectTwoLutEnabled = new ShaderParameterBool("colorCorrectTwoLutEnabled", this);
                spFilmGrainEnabled = new ShaderParameterBool("filmGrainEnabled", this);
                // Exposure
                spLensExposure = new ShaderParameterFloat("lensExposure", this);
                spTimeDelta = new ShaderParameterFloat("timeDelta", this);
                spExposureAdjustTimeMultiplier = new ShaderParameterFloat("tau", this);
                spLuminanceLowThreshold = new ShaderParameterFloat("luminanceLowThreshold", this);
                spLuminanceHighThreshold = new ShaderParameterFloat("luminanceHighThreshold", this);
                // Tone Mapping
                spWhiteLevel = new ShaderParameterFloat("whiteLevel", this);
                spLuminanceSaturation = new ShaderParameterFloat("luminanceSaturation", this);
                spBias = new ShaderParameterFloat("bias", this);
                spShoulderStrength = new ShaderParameterFloat("shoulderStrength", this);
                spLinearStrength = new ShaderParameterFloat("linearStrength", this);
                spLinearAngle = new ShaderParameterFloat("linearAngle", this);
                spToeStrength = new ShaderParameterFloat("toeStrength", this);
                spToeNumerator = new ShaderParameterFloat("toeNumerator", this);
                spToeDenominator = new ShaderParameterFloat("toeDenominator", this);
                spLinearWhite = new ShaderParameterFloat("linearWhite", this);
                // Bloom
                spBloomScale = new ShaderParameterFloat("bloomScale", this);
                // Levels
                spInputBlack = new ShaderParameterFloat("inputBlack", this);
                spInputWhite = new ShaderParameterFloat("inputWhite", this);
                spInputGamma = new ShaderParameterFloat("inputGamma", this);
                spOutputBlack = new ShaderParameterFloat("outputBlack", this);
                spOutputWhite = new ShaderParameterFloat("outputWhite", this);
                // Color Correction
                spLookupTableScale = new ShaderParameterFloat("scale", this);
                spLookupTableOffset = new ShaderParameterFloat("offset", this);
                spLerpOriginalColorAmount = new ShaderParameterFloat("lerpOriginalColorAmount", this);
                spLerpLookupTablesAmount = new ShaderParameterFloat("lerpLookupTablesAmount", this);
                // Film Grain
                spFilmGrainStrength = new ShaderParameterFloat("filmGrainStrength", this);
                spAccentuateDarkNoisePower = new ShaderParameterFloat("accentuateDarkNoisePower", this);
                spRandomNoiseStrength = new ShaderParameterFloat("randomNoiseStrength", this);
                spRandomValue = new ShaderParameterFloat("randomValue", this);

                spHalfPixel = new ShaderParameterVector2("halfPixel", this);
                spFrustumCorners = new ShaderParameterVector3Array("frustumCorners", this, 4);

                // Leves Individual Channels
                spInputBlackRgb = new ShaderParameterVector3("inputBlackRGB", this);
                spInputWhiteRgb = new ShaderParameterVector3("inputWhiteRGB", this);
                spInputGammaRgb = new ShaderParameterVector3("inputGammaRGB", this);
                spOutputBlackRgb = new ShaderParameterVector3("outputBlackRGB", this);
                spOutputWhiteRgb = new ShaderParameterVector3("outputWhiteRGB", this);

                // Fog
                spCameraPosition = new ShaderParameterVector3("cameraPosition", this);

                spSceneTexture = new ShaderParameterTexture("sceneTexture", this, SamplerState.PointClamp, 9);
                spLastLuminanceTexture = new ShaderParameterTexture("lastLuminanceTexture", this, SamplerState.PointClamp, 12);
                spBloomTexture = new ShaderParameterTexture("bloomTexture", this, SamplerState.AnisotropicClamp, 10);
                spLensFlareTexture = new ShaderParameterTexture("lensFlareTexture", this, SamplerState.AnisotropicClamp, 8);
                spFilmLutTexture = new ShaderParameterTexture("filmLutTexture", this, SamplerState.AnisotropicClamp, 8);
                spDepthTexture = new ShaderParameterTexture("depthTexture", this, SamplerState.PointClamp, 0);

                spFirstlookupTable = new ShaderParameterLookupTable("firstlookupTableTexture", this, SamplerState.LinearClamp, 6);
                spSecondlookupTable = new ShaderParameterLookupTable("secondlookupTableTexture", this, SamplerState.LinearClamp, 7);
            }
            /*catch
            {
                throw new InvalidOperationException("The parameter's handles from the " + Name + " shader could not be retrieved.");
            }*/
        } // GetParametersHandles