Microsoft.Xna.Framework.Graphics.EffectParameter.SetValue C# (CSharp) Method

SetValue() public method

public SetValue ( Texture value ) : void
value Texture
return void
		public void SetValue (Texture value)
		{
            if (this.ParameterType != EffectParameterType.Texture && 
                this.ParameterType != EffectParameterType.Texture1D &&
                this.ParameterType != EffectParameterType.Texture2D &&
                this.ParameterType != EffectParameterType.Texture3D &&
                this.ParameterType != EffectParameterType.TextureCube) 
            {
                throw new InvalidCastException();
            }

			Data = value;
            StateKey = unchecked(NextStateKey++);
		}

Same methods

EffectParameter::SetValue ( System.Matrix value ) : void
EffectParameter::SetValue ( Quaternion value ) : void
EffectParameter::SetValue ( System.Single value ) : void
EffectParameter::SetValue ( System.Vector2 value ) : void
EffectParameter::SetValue ( System.Vector3 value ) : void
EffectParameter::SetValue ( System.Vector4 value ) : void
EffectParameter::SetValue ( bool value ) : void
EffectParameter::SetValue ( int value ) : void

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Lazily recomputes the world inverse transpose matrix and
        /// eye position based on the current effect parameter settings.
        /// </summary>
        internal static EffectDirtyFlags SetLightingMatrices(EffectDirtyFlags dirtyFlags, ref Matrix world, ref Matrix view,
                                                             EffectParameter worldParam, EffectParameter worldInverseTransposeParam, EffectParameter eyePositionParam)
        {
            // Set the world and world inverse transpose matrices.
            if ((dirtyFlags & EffectDirtyFlags.World) != 0)
            {
                Matrix worldTranspose;
                Matrix worldInverseTranspose;

                Matrix.Invert(ref world, out worldTranspose);
                Matrix.Transpose(ref worldTranspose, out worldInverseTranspose);

                worldParam.SetValue(world);
                worldInverseTransposeParam.SetValue(worldInverseTranspose);

                dirtyFlags &= ~EffectDirtyFlags.World;
            }

            // Set the eye position.
            if ((dirtyFlags & EffectDirtyFlags.EyePosition) != 0)
            {
                Matrix viewInverse;

                Matrix.Invert(ref view, out viewInverse);

                eyePositionParam.SetValue(viewInverse.Translation);

                dirtyFlags &= ~EffectDirtyFlags.EyePosition;
            }

            return dirtyFlags;
        }
All Usage Examples Of Microsoft.Xna.Framework.Graphics.EffectParameter::SetValue