} // 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