本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.EffectTechnique类的典型用法代码示例。如果您正苦于以下问题:C# EffectTechnique类的具体用法?C# EffectTechnique怎么用?C# EffectTechnique使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EffectTechnique类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了EffectTechnique类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Effect
internal Effect(GraphicsDevice device)
{
graphicsDevice = device;
Parameters = new EffectParameterCollection();
Techniques = new EffectTechniqueCollection();
CurrentTechnique = new EffectTechnique(this);
}
开发者ID:HaKDMoDz,项目名称:Zazumo,代码行数:7,代码来源:Effect.cs
示例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();
}
}
开发者ID:summer-of-software,项目名称:vtank,代码行数:25,代码来源:VertexPositionColorTextureGroup.cs
示例3: createBasicEffect
private void createBasicEffect()
{
var et = new EffectTechnique(this);
Techniques["Wtf"] = et;
CurrentTechnique = et;
et.Passes["Wtf2"] = new EffectPass(et);
}
开发者ID:adison,项目名称:Tank-Wars,代码行数:8,代码来源:BasicEffect.cs
示例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);
}
开发者ID:fragcastle,项目名称:MonoGame,代码行数:9,代码来源:EffectTechnique.cs
示例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;
}
开发者ID:Nick0n,项目名称:MonoGame,代码行数:9,代码来源:BasicEffect.cs
示例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
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:64,代码来源:EffectTechniqueDescription.cs
示例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();
}
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:12,代码来源:PostProcessManager.cs
示例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;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:14,代码来源:StockEffectInterpreter.cs
示例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;
}
}
开发者ID:summer-of-software,项目名称:vtank,代码行数:44,代码来源:TextObject.cs
示例10: SilverlightEffect
///// <summary>
///// Dispose(bool disposing) executes in two distinct scenarios.
///// If disposing equals true, the method has been called directly
///// or indirectly by a user's code. Managed and unmanaged resources
///// can be disposed.
///// If disposing equals false, the method has been called by the
///// runtime from inside the finalizer and you should not reference
///// other objects. Only unmanaged resources can be disposed.
///// </summary>
//protected override void Dispose(bool disposing)
//{
// if (IsDisposed)
// return;
// base.Dispose(disposing);
// if (disposing)
// {
// if (vertexShader != null)
// {
// vertexShader.Dispose();
// vertexShader = null;
// }
// if (pixelShader != null)
// {
// pixelShader.Dispose();
// pixelShader = null;
// }
// }
//}
#endregion
#region Creation
/// <summary>
/// Creates a new SilverlightEffect with default parameter settings.
/// </summary>
internal SilverlightEffect(EffectTechnique[] techniques)
: base(techniques)
{
Dictionary<string, SilverlightEffectParameter> tempParameters = new Dictionary<string, SilverlightEffectParameter>();
foreach (var technique in techniques)
{
foreach (SilverlightEffectPass pass in technique.Passes)
{
pass.ParentEffect = this;
foreach (SilverlightEffectInternalParameter parameter in pass.Parameters)
{
if (!tempParameters.ContainsKey(parameter.Name))
{
tempParameters.Add(parameter.Name, new SilverlightEffectParameter(parameter.Name));
}
}
}
}
parameters = new SilverlightEffectParametersCollection(tempParameters.Values);
}
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:61,代码来源:SilverlightEffect.cs
示例11: WindowsSceneEffect
public WindowsSceneEffect(ContentManager content)
{
_basicEffect = content.Load<Effect>(ResourceNames.Effects.BasicEffect);
PostProcessingEffect = content.Load<Effect>(ResourceNames.Effects.PostProcessing);
_shadowCasterTechnique = _basicEffect.Techniques["ShadowCaster"];
_shadowCasterTransparentTechnique = _basicEffect.Techniques["ShadowCasterTransparent"];
ShadowMapDebugEffect = content.Load<Effect>(ResourceNames.Effects.DebugShadowMap);
_effectsByLightingFlags = new Dictionary<int, EffectTechnique>()
{
{ LightTechniqueFlag.Lit | LightTechniqueFlag.ReceiveShadows,_basicEffect.Techniques["LitNoTextureShadowReceiver"] },
{ LightTechniqueFlag.Lit | LightTechniqueFlag.ReceiveShadows | LightTechniqueFlag.SoftShadows , _basicEffect.Techniques["LitNoTextureShadowReceiverPCF"] },
{ LightTechniqueFlag.Lit | LightTechniqueFlag.UseTexture, _basicEffect.Techniques["Lit"] },
{ LightTechniqueFlag.Lit | LightTechniqueFlag.UseTexture | LightTechniqueFlag.ReceiveShadows, _basicEffect.Techniques["LitShadowReceiver"] },
{ LightTechniqueFlag.Lit | LightTechniqueFlag.UseTexture | LightTechniqueFlag.ReceiveShadows | LightTechniqueFlag.SoftShadows, _basicEffect.Techniques["LitShadowReceiverPCF"] },
{ 0, _basicEffect.Techniques["UnlitNoTexture"] },
{ LightTechniqueFlag.UseTexture, _basicEffect.Techniques["Unlit"] },
{ LightTechniqueFlag.UseTexture | LightTechniqueFlag.LinearTextureSampling, _basicEffect.Techniques["UnlitLinearSampled"] },
};
_lightViewProjection = _basicEffect.Parameters["LightViewProjection"];
_world = _basicEffect.Parameters["World"];
_worldLight = _basicEffect.Parameters["WorldLight"];
_view = _basicEffect.Parameters["View"];
_projection = _basicEffect.Parameters["Projection"];
_lightDirection = _basicEffect.Parameters["LightDirection"];
_shadowMap = _basicEffect.Parameters["ShadowMap"];
_diffuseTexture = _basicEffect.Parameters["DiffuseTexture"];
_texcoordOffset = _basicEffect.Parameters["TexcoordOffset"];
_texcoordScale = _basicEffect.Parameters["TexcoordScale"];
_ambientLight = _basicEffect.Parameters["AmbientLight"];
_ambientIntensity = _basicEffect.Parameters["AmbientIntensity"];
_diffuseIntensity = _basicEffect.Parameters["DiffuseIntensity"];
_shadowScale = _basicEffect.Parameters["ShadowScale"];
_materialColor = _basicEffect.Parameters["MaterialColor"];
}
开发者ID:nilllzz,项目名称:Pokemon3D,代码行数:37,代码来源:WindowsSceneEffect.cs
示例12: Draw
/// <summary>
/// Draws all vertices in the vertex buffer.
/// </summary>
///
public override void Draw(EffectTechnique technique)
{
UniversalEffect effect = RendererAssetPool.UniversalEffect;
if (technique == effect.Techniques.UseDefault)
effect.CurrentTechnique = RendererAssetPool.UniversalEffect.Techniques.Colored;
else
effect.CurrentTechnique = technique;
effect.ColorParameters.TransparencyEnabled = this.TransparencyEnabled && GraphicOptions.TransparentWalls;
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, VertexPositionColor.SizeInBytes);
device.DrawUserPrimitives<VertexPositionColor>(
PrimitiveType.TriangleStrip, vertices.ToArray(), 0, 2);
pass.End();
}
effect.End();
}
开发者ID:summer-of-software,项目名称:vtank,代码行数:28,代码来源:VertexColorGroup.cs
示例13: 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);
}
开发者ID:willcraftia,项目名称:TestBlocks,代码行数:27,代码来源:SsaoMapBlur.cs
示例14: ShadowEffect
public ShadowEffect(Effect clone)
: base(clone)
{
SoftShadowEnabled = true;
RenderShadowmap = Techniques["RenderShadowmap"];
RenderLightmap = Techniques["RenderLightmap"];
BlurLightmap = Techniques["BlurLightmap"];
}
开发者ID:sp-alex-osou,项目名称:Shaders,代码行数:9,代码来源:ShadowEffect.cs
示例15: ShapeEffect
public ShapeEffect(Effect clone)
: base(clone)
{
NormalmapEnabled = true;
HeightmapEnabled = false;
ShadowEnabled = false;
SpotlightEnabled = false;
RenderScene = Techniques["RenderScene"];
}
开发者ID:sp-alex-osou,项目名称:Shaders,代码行数:10,代码来源:ShapeEffect.cs
示例16: 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);
}
开发者ID:luqui,项目名称:luqui-misc,代码行数:10,代码来源:DrawHelper.cs
示例17: 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);
}
开发者ID:Gayo,项目名称:Gayo-CAROT,代码行数:12,代码来源:Graphics.Techniques.cs
示例18: 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);
}
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:14,代码来源:Bloom.cs
示例19: StencilStrokeEffect
public StencilStrokeEffect(Effect effect)
{
_effect = effect;
_scalingTechnique = effect.Techniques["StencilStroke_Scaling"];
_nonscalingTechnique = effect.Techniques["StencilStroke_Nonscaling"];
_passSolid = _scalingTechnique.Passes["Solid"];
_passRadial = _scalingTechnique.Passes["Radial"];
_passSolidNS = _nonscalingTechnique.Passes["Solid"];
_passRadialNS = _nonscalingTechnique.Passes["Radial"];
_projection = effect.Parameters["Projection"];
_transformation = effect.Parameters["Transformation"];
_offset = effect.Parameters["Offset"];
_thickness = effect.Parameters["Thickness"];
}
开发者ID:liwq-net,项目名称:XnaVG,代码行数:14,代码来源:StencilStrokeEffect.cs
示例20: SkySphereEffect
public SkySphereEffect(Effect effect)
{
if (effect == null) throw new ArgumentNullException("effect");
this.effect = effect;
viewProjection = effect.Parameters["ViewProjection"];
skyColor = effect.Parameters["SkyColor"];
sunDirection = effect.Parameters["SunDirection"];
sunDiffuseColor = effect.Parameters["SunDiffuseColor"];
sunThreshold = effect.Parameters["SunThreshold"];
sunVisible = effect.Parameters["SunVisible"];
defaultTechnique = effect.Techniques["Default"];
currentPass = effect.CurrentTechnique.Passes[0];
}
开发者ID:willcraftia,项目名称:TestBlocks,代码行数:16,代码来源:SkySphereEffect.cs
注:本文中的Microsoft.Xna.Framework.Graphics.EffectTechnique类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论