DPSF 2.1.0 to 2.2.0

DPSF 2.1.0 to 2.2.0

Top  Previous  Next

1 - Built-in XNA 4 Effects are used by default.

 

Previous to DPSF 2.2.0 the DPSFDefaultEffect was used by default for all Quad particle systems.  Now the built-in XNA 4 Effects are used by default.  Specifically, the Quad particle system uses the BasicEffect by default, and TexturedQuads use the AlphaTestEffect by default.  So if you were previously manually setting the particle system's Effect to be of these types, you no longer have to do this.  So if you had something like:

 

               protected override void InitializeRenderProperties()

               {

                       base.InitializeRenderProperties();

 

                       // Want to see the front and back of textures, since they don't always face the camera

                       RenderProperties.RasterizerState.CullMode = CullMode.None;

 

                       // Have to use the AlphaTest Effect in order to use alpha blending with depth sorting

                       this.Effect = new AlphaTestEffect(this.GraphicsDevice);

                       RenderProperties.DepthStencilState.DepthBufferWriteEnable = true;

               }

 

               protected override void SetEffectParameters()

               {

                       // Set the AlphaTest Effect's parameters

                       AlphaTestEffect effect = this.Effect as AlphaTestEffect;

                       effect.World = World;

                       effect.View = View;

                       effect.Projection = Projection;

                       effect.FogEnabled = false;

                       effect.Texture = Texture;

                       effect.VertexColorEnabled = false;        // Do not use the particle's specified color (i.e. use texture's color)

               }

 

you can just delete the line "this.Effect = new AlphaTestEffect(this.GraphicsDevice);" and remove the SetEffectParameters() function all together.

 

Also, because the DPSFDefaultEffect is no longer used by default, you may run into run-time errors in the SetEffectParameters() function where you were setting parameters specific to the DPSFDefaultEffect.  Here you have 2 options:

 

1 - Remove the code specific to the DPSF Default Effect and just use the new default effects.  So if you had something like the following code you could just delete the SetEffectParameters() function all together.

 

               protected override void SetEffectParameters()

               {

                       base.SetEffectParameters();

 

                       // Specify to not use the Color component when drawing (Texture color is not tinted)

                       Effect.Parameters["xColorBlendAmount"].SetValue(0.0f);

               }

 

2 - you can keep using the DPSF Default Effect by explicitly setting the particle system's Effect, by doing something like this:

 

               protected override void InitializeRenderProperties()

               {

                       base.InitializeRenderProperties();

 

                       // Use the DPSFDefaultEffect instead of the AlphaTestEffect

                       this.SetEffectAndTechnique(this.DPSFDefaultEffect, DPSFDefaultEffectTechniques.TexturedQuads.ToString());

               }

 

               protected override void SetEffectParameters()

               {

                       DPSFDefaultEffect effect = this.Effect as DPSFDefaultEffect;

                       effect.World = this.World;

                       effect.View = this.View;

                       effect.Projection = this.Projection;

                       effect.Texture = this.Texture;

                       effect.ColorBlendAmount = 0.5f;

               }