DPSF Default Effect

Top  Previous  Next

DPSF provides an Effect that can be used to draw the particles (by default it uses the built-in XNA 4 effects so that everything works on Windows Phone, as Windows Phone doesn't support using custom effects).  This Effect can be access in the particle system through the DPSFDefaultEffect property.  This Effect supports all of the particle types that DPSF supports.

 

The DPSF Default Effect provides a number of global parameters that should be set in the particle system's overridden SetEffectParameters() function, depending on what type of particles are being used.  The non-default templates show how to set these effect parameters.  The global Effect parameters are:

 

//-------------------------------------------------------------------

// Sprite and Textured Quad Specific Variables

//-------------------------------------------------------------------

// How much of the vertex Color should be blended in with the Texture's Color

float xColorBlendAmount = 0.5;        // 0.0 = use Texture's Color, 1.0 = use specified Color

 

// NOTE: The final opacity of the Texture is based on the vertex Color's alpha value

texture xTexture;                        // The texture to use to draw the Particles

 

//-------------------------------------------------------------------

// Quad and Textured Quad Specific Variables

//-------------------------------------------------------------------

float4x4 xView;                        // The View matrix

float4x4 xProjection;                // The Projection matrix

float4x4 xWorld;                        // The World matrix