Click to Rate and Give Feedback
Collapse All/Expand All Collapse All
XNA Game Studio 3.1
EffectParameter Class
Represents an Effect parameter.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

C#
public sealed class EffectParameter
Creating and assigning a EffectParameter instance for each technique in your Effect is significantly faster than using the Parameters indexed property on Effect.

To use a EffectParameter you must:

  1. Create a EffectParameter for each parameter in your Effect that you will be setting in Draw or Update.

    C#
    public EffectParameter mWorld;
    public EffectParameter mCameraView;
    public EffectParameter CameraPos;
    public EffectParameter mCameraProj;
  2. Assign an Effect parameter to your EffectParameter.

    C#
    mWorld = effect.Parameters["g_mWorld"];
    mCameraView = effect.Parameters["g_mCameraView"];
    CameraPos = effect.Parameters["g_CameraPos"];
    mCameraProj = effect.Parameters["g_mCameraProj"];
  3. Call SetValue on your EffectParameter to change the parameter value.

    C#
    MyEffect.CameraPos.SetValue(CameraPos);
    MyEffect.mCameraView.SetValue(view);
    MyEffect.mCameraProj.SetValue(projection);
    MyEffect.LightPos.SetValue(LightPos);
    MyEffect.mLightView.SetValue(Matrix.CreateLookAt(LightPos, 
        bounds.Center, Vector3.Up));
Xbox 360, Windows XP SP2, Windows Vista
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker