The Microsoft.Xna.Framework.Graphics Effect Clone method is used for creating a copy of an existing effect object for reuse. It is a useful feature when we need to instantiate multiple effects with the same property values. It returns a duplicate of the source Effect with the same parameter values, textures, and states.
Code examples:
// Initialize and clone an effect var sourceEffect = Content.Load("myeffect"); var clonedEffect = sourceEffect.Clone();
// Modify some parameter values clonedEffect.Parameters["myParameter"].SetValue(1.0f);
// Use both effects foreach (var model in myModels) { model.draw(sourceEffect, view, projection, world); model.draw(clonedEffect, view, projection, world); }
In the above example, we load the effect "myeffect" from the content pipeline and clone it into a new variable "clonedEffect". We then modify a parameter value of the cloned effect and use both effects to draw some models.
The Microsoft.Xna.Framework.Graphics namespace provides the Effect class and Clone method. It is part of the XNA Game Studio framework that is used for developing games on the Windows platform.
C# (CSharp) Microsoft.Xna.Framework.Graphics Effect.Clone - 30 examples found. These are the top rated real world C# (CSharp) examples of Microsoft.Xna.Framework.Graphics.Effect.Clone extracted from open source projects. You can rate examples to help us improve the quality of examples.