本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.EffectTechnique类的典型用法代码示例。如果您正苦于以下问题:C# EffectTechnique类的具体用法?C# EffectTechnique怎么用?C# EffectTechnique使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EffectTechnique类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了EffectTechnique类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Effect
internal Effect(GraphicsDevice device)
{
graphicsDevice = device;
Parameters = new EffectParameterCollection();
Techniques = new EffectTechniqueCollection();
CurrentTechnique = new EffectTechnique(this);
}
示例2: Draw
public void Draw(EffectTechnique technique)
{
if (vertices.Count > 0)
{
UniversalEffect effect = RendererAssetPool.UniversalEffect;
if (technique == null)
effect.CurrentTechnique = this.Technique;
else
effect.CurrentTechnique = technique;
Ready();
effect.Begin();
foreach (EffectPass pass in effect.CurrentTechnique.Passes)//TODO1 remove this when shading i
{
pass.Begin();
GraphicsDevice device = GraphicOptions.graphics.GraphicsDevice;
device.VertexDeclaration = vertDeclaration;
device.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionColorTexture.SizeInBytes);
device.DrawUserPrimitives<VertexPositionColorTexture>(
PrimitiveType.LineList, vertices.ToArray(), 0, 2);
pass.End();
}
effect.End();
}
}
示例3: createBasicEffect
private void createBasicEffect()
{
var et = new EffectTechnique(this);
Techniques["Wtf"] = et;
CurrentTechnique = et;
et.Passes["Wtf2"] = new EffectPass(et);
}
示例4: EffectTechnique
internal EffectTechnique(Effect effect, EffectTechnique cloneSource)
{
// Share all the immutable types.
Name = cloneSource.Name;
Annotations = cloneSource.Annotations;
// Clone the mutable types.
Passes = new EffectPassCollection(effect, cloneSource.Passes);
}
示例5: createBasicEffect
private void createBasicEffect()
{
var et = new EffectTechnique(this);
Techniques["Wtf"] = et;
CurrentTechnique = et;
var pass = new EffectPass(et);
pass.Name = "Wtf2";
et.Passes[pass.Name] = pass;
}
示例6: EffectTechniqueDescription
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="EffectTechniqueDescription"/> class.
/// </summary>
/// <param name="effect">The effect.</param>
/// <param name="technique">The effect technique.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="effect"/> or <paramref name="technique"/> is <see langword="null"/>.
/// </exception>
public EffectTechniqueDescription(Effect effect, EffectTechnique technique)
{
if (effect == null)
throw new ArgumentNullException("effect");
if (technique == null)
throw new ArgumentNullException("technique");
Technique = technique;
Index = GetIndex(effect, technique);
#if !MONOGAME
// Check if there is an associated technique for hardware instancing.
var annotation = technique.Annotations["InstancingTechnique"];
if (annotation != null && annotation.ParameterType == EffectParameterType.String)
{
var techniqueName = annotation.GetValueString();
if (!string.IsNullOrEmpty(techniqueName))
{
InstancingTechnique = effect.Techniques[techniqueName];
if (InstancingTechnique == null)
{
string message = string.Format(CultureInfo.InvariantCulture, "Could not find instancing technique \"{0}\" in the effect \"{1}\".", techniqueName, effect.Name);
throw new GraphicsException(message);
}
}
}
#else
// Workaround: MonoGame does not support effect semantics and annotations.
if (technique.Name.IndexOf("INSTANCING", StringComparison.OrdinalIgnoreCase) == -1)
{
if (effect.Techniques.Count == 2
&& effect.Techniques[1].Name.IndexOf("INSTANCING", StringComparison.OrdinalIgnoreCase) >= 0)
{
InstancingTechnique = effect.Techniques[1];
}
if (InstancingTechnique == null)
{
foreach (var otherTechnique in effect.Techniques)
{
if (technique == otherTechnique)
continue;
if (otherTechnique.Name.IndexOf(technique.Name, StringComparison.OrdinalIgnoreCase) >= 0
&& otherTechnique.Name.IndexOf("INSTANCING", StringComparison.OrdinalIgnoreCase) >= 0)
{
InstancingTechnique = otherTechnique;
break;
}
}
}
}
#endif
}
示例7: RenderScreenQuad
public void RenderScreenQuad(Effect effect, EffectTechnique technique, Texture2D texture)
{
effect.CurrentTechnique = technique;
sb.Begin(SpriteBlendMode.None, SpriteSortMode.Immediate, SaveStateMode.None);
effect.Begin();
technique.Passes[0].Begin();
sb.Draw(texture, screen, Color.White);
technique.Passes[0].End();
effect.End();
sb.End();
}
示例8: GetDescription
/// <inheritdoc/>
public override EffectTechniqueDescription GetDescription(Effect effect, EffectTechnique technique)
{
if (effect is AlphaTestEffect
|| effect is BasicEffect
|| effect is DualTextureEffect
|| effect is EnvironmentMapEffect
|| effect is SkinnedEffect)
{
return new EffectTechniqueDescription(effect, technique);
}
return null;
}
示例9: Draw
public override void Draw(EffectTechnique technique)
{
if (!flag)
flag = true;
else
{
flag = false;
return;
}
if (ServiceManager.Game.Options.GamePlay.ShowNames)
{
/*GraphicsDevice device = GraphicOptions.graphics.GraphicsDevice;
Vector3 offset = new Vector3(0, 0, 0);
Vector3 pPosition = Vector3.Zero;// position + offset;
Matrix projection = GraphicOptions.CurrentCamera.Projection;
Matrix view = GraphicOptions.CurrentCamera.View;
Matrix world = Matrix.CreateTranslation(position + offset);//Matrix.Identity;// Matrix.Invert(GraphicOptions.CurrentCamera.View);
Vector3 projectedPosition = device.Viewport.Project(pPosition, projection, view, world);
Vector2 newPosition = new Vector2(projectedPosition.X, projectedPosition.Y);
newPosition.X = newPosition.X - (width / 2.0f);
newPosition.Y = newPosition.Y - (height / 2.0f);
ServiceManager.Game.Batch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
ServiceManager.Game.Batch.DrawString(ServiceManager.Game.Font, text, newPosition, Color.Black);
ServiceManager.Game.Batch.End();*/
GraphicsDevice device = GraphicOptions.graphics.GraphicsDevice;
device.RenderState.AlphaBlendEnable = true;
device.RenderState.SourceBlend = Blend.SourceAlpha;
device.RenderState.DestinationBlend = Blend.InverseSourceAlpha;
device.RenderState.AlphaFunction = CompareFunction.Greater;
device.RenderState.SeparateAlphaBlendEnabled = false;
device.RenderState.AlphaTestEnable = true;
base.Draw(technique);
device.RenderState.AlphaBlendEnable = false;
device.RenderState.SourceBlend = Blend.One;
device.RenderState.DestinationBlend = Blend.Zero;
}
}
示例10: SsaoMapBlur
public SsaoMapBlur(Effect effect, SpriteBatch spriteBatch, int width, int height, SurfaceFormat format, int radius, float amount)
{
if (effect == null) throw new ArgumentNullException("effect");
if (spriteBatch == null) throw new ArgumentNullException("spriteBatch");
if (width < 1) throw new ArgumentOutOfRangeException("width");
if (height < 1) throw new ArgumentOutOfRangeException("height");
if (radius < MinAmount || MaxRadius < radius) throw new ArgumentOutOfRangeException("value");
if (amount < MinAmount) throw new ArgumentOutOfRangeException("value");
this.effect = effect;
this.spriteBatch = spriteBatch;
Width = width;
Height = height;
Radius = radius;
Amount = amount;
graphicsDevice = effect.GraphicsDevice;
normalDepthMap = effect.Parameters["NormalDepthMap"];
horizontalBlurTechnique = effect.Techniques["HorizontalBlur"];
verticalBlurTechnique = effect.Techniques["VerticalBlur"];
InitializeEffectParameters();
backingRenderTarget = new RenderTarget2D(graphicsDevice, width, height, false, format,
DepthFormat.None, 0, RenderTargetUsage.PlatformContents);
}
示例11: ShadowEffect
public ShadowEffect(Effect clone)
: base(clone)
{
SoftShadowEnabled = true;
RenderShadowmap = Techniques["RenderShadowmap"];
RenderLightmap = Techniques["RenderLightmap"];
BlurLightmap = Techniques["BlurLightmap"];
}
示例12: ShapeEffect
public ShapeEffect(Effect clone)
: base(clone)
{
NormalmapEnabled = true;
HeightmapEnabled = false;
ShadowEnabled = false;
SpotlightEnabled = false;
RenderScene = Techniques["RenderScene"];
}
示例13: DrawHelper
public DrawHelper(GraphicsDeviceManager ingraphics, Effect ineffect)
{
graphics = ingraphics;
effect = ineffect;
techniqueBasicTexturedRender = effect.Techniques["BasicTexturedRender"];
techniqueBasicColorRender = effect.Techniques["BasicColorRender"];
paramBoundTexture = effect.Parameters["xBoundTexture"];
paramViewMatrix = effect.Parameters["xViewMatrix"];
ortho = Matrix.CreateOrthographicOffCenter(0, 1, 0, 1, -1, 1);
}
示例14: init
public void init(Effect effect)
{
this.effect = effect;
masterTechnique = effect.Techniques["Master"];
color = new MasterTechnique(MasterTechnique.Mode.Color, effect, masterTechnique);
texture = new MasterTechnique(MasterTechnique.Mode.Texture, effect, masterTechnique);
textureAlpha = new MasterTechnique(MasterTechnique.Mode.TextureAlpha, effect, masterTechnique);
gradient = new MasterTechnique(MasterTechnique.Mode.Gradient, effect, masterTechnique);
silhouette = new MasterTechnique(MasterTechnique.Mode.Silhouette, effect, masterTechnique);
modulate = new MasterTechnique(MasterTechnique.Mode.Modulate, effect, masterTechnique);
add = new MasterTechnique(MasterTechnique.Mode.Add, effect, masterTechnique);
}
示例15: LoadContent
public void LoadContent(GraphicsDevice g, ContentManager cm)
{
e = cm.Load<Effect>(@"shaders/bloom");
luminosityExtractTechnique = e.Techniques["LuminosityExtract"];
gaussianBlurTechnique = e.Techniques["Blur"];
compositeTechnique = e.Techniques["Composite"];
PresentationParameters pp = g.PresentationParameters;
rTarget1 = new RenderTarget2D(g, pp.BackBufferWidth, pp.BackBufferHeight, 1, g.DisplayMode.Format);
rTarget2 = new RenderTarget2D(g, pp.BackBufferWidth, pp.BackBufferHeight, 1, g.DisplayMode.Format);
// calculate the blur parameters
SetBlur(8);
}