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

SetValue() public method

public SetValue ( int value ) : void
value int
return void
		public void SetValue (int value)
		{
            if (ParameterClass != EffectParameterClass.Scalar || ParameterType != EffectParameterType.Int32)
                throw new InvalidCastException();

#if DIRECTX
            ((int[])Data)[0] = value;
#else
            // MojoShader encodes integers into a float.
            ((float[])Data)[0] = value;
#endif
            StateKey = unchecked(NextStateKey++);
		}

Same methods

EffectParameter::SetValue ( System.Matrix value ) : void
EffectParameter::SetValue ( Quaternion value ) : void
EffectParameter::SetValue ( System.Single value ) : void
EffectParameter::SetValue ( Texture 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

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