DPSF Default Effect

Top  Previous  Next

DPSF provides an Effect that is used by default to draw the particles.  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, Point 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

 

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

// Pixel, Point Sprite, Quad, and Textured Quad Specific Variables

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

float4x4 xView;                                        // The View matrix

float4x4 xProjection;                        // The Projection matrix

float4x4 xWorld;                                // The World matrix

 

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

// Point Sprite Specific Variables

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

// The Height of the Viewport (needed for re-sizing Point Sprites according to their distance from the Camera)

float xViewportHeight = 0;                // Set this to zero to not use perspective scaling (i.e. don't re-size Point Sprites)

 

// The Width and Height of the Texture to take the Texture Coordinates from.

// These must be set if using the PointSpritesTextureCoordinates technique.

float xTextureWidth = 0;

float xTextureHeight = 0;