本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.EffectPass类的典型用法代码示例。如果您正苦于以下问题:C# EffectPass类的具体用法?C# EffectPass怎么用?C# EffectPass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EffectPass类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了EffectPass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render(GraphicsDevice myDevice, EffectPass pass)
{
pass.Apply();
myDevice.Textures[0] = Texture;
myDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, Vertices, 0, 4, Indexes, 0, 2);
}
示例2: ProjectorLightRenderer
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="ProjectorLightRenderer"/> class.
/// </summary>
/// <param name="graphicsService">The graphics service.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="graphicsService"/> is <see langword="null"/>.
/// </exception>
public ProjectorLightRenderer(IGraphicsService graphicsService)
{
if (graphicsService == null)
throw new ArgumentNullException("graphicsService");
_effect = graphicsService.Content.Load<Effect>("DigitalRune/Deferred/ProjectorLight");
_parameterWorldViewProjection = _effect.Parameters["WorldViewProjection"];
_parameterViewportSize = _effect.Parameters["ViewportSize"];
_parameterFrustumCorners = _effect.Parameters["FrustumCorners"];
_parameterDiffuseColor = _effect.Parameters["ProjectorLightDiffuse"];
_parameterSpecularColor = _effect.Parameters["ProjectorLightSpecular"];
_parameterPosition = _effect.Parameters["ProjectorLightPosition"];
_parameterRange = _effect.Parameters["ProjectorLightRange"];
_parameterAttenuation = _effect.Parameters["ProjectorLightAttenuation"];
_parameterTexture = _effect.Parameters["ProjectorLightTexture"];
_parameterTextureMatrix = _effect.Parameters["ProjectorLightTextureMatrix"];
_parameterGBuffer0 = _effect.Parameters["GBuffer0"];
_parameterGBuffer1 = _effect.Parameters["GBuffer1"];
_parameterShadowMaskChannel = _effect.Parameters["ShadowMaskChannel"];
_parameterShadowMask = _effect.Parameters["ShadowMask"];
_passClip = _effect.CurrentTechnique.Passes["Clip"];
_passDefaultRgb = _effect.CurrentTechnique.Passes["DefaultRgb"];
_passDefaultAlpha = _effect.CurrentTechnique.Passes["DefaultAlpha"];
_passShadowedRgb = _effect.CurrentTechnique.Passes["ShadowedRgb"];
_passShadowedAlpha = _effect.CurrentTechnique.Passes["ShadowedAlpha"];
}
示例3: ScatteringSkyRenderer
public ScatteringSkyRenderer(IGraphicsService graphicsService)
{
if (graphicsService == null)
throw new ArgumentNullException("graphicsService");
if (graphicsService.GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
throw new NotSupportedException("The ScatteringSkyRenderer does not support the Reach profile.");
_effect = graphicsService.Content.Load<Effect>("DigitalRune/Sky/ScatteringSky");
_parameterView = _effect.Parameters["View"];
_parameterProjection = _effect.Parameters["Projection"];
_parameterSunDirection = _effect.Parameters["SunDirection"];
_parameterRadii = _effect.Parameters["Radii"];
_parameterNumberOfSamples = _effect.Parameters["NumberOfSamples"];
_parameterBetaRayleigh = _effect.Parameters["BetaRayleigh"];
_parameterBetaMie = _effect.Parameters["BetaMie"];
_parameterGMie = _effect.Parameters["GMie"];
_parameterSunIntensity = _effect.Parameters["SunIntensity"];
_parameterTransmittance = _effect.Parameters["Transmittance"];
_parameterBaseHorizonColor = _effect.Parameters["BaseHorizonColor"];
_parameterBaseZenithColor = _effect.Parameters["BaseZenithColor"];
_passLinear = _effect.Techniques[0].Passes["Linear"];
_passGamma = _effect.Techniques[0].Passes["Gamma"];
_passLinearWithBaseColor = _effect.Techniques[0].Passes["LinearWithBaseColor"];
_passGammaWithBaseColor = _effect.Techniques[0].Passes["GammaWithBaseColor"];
_submesh = MeshHelper.GetBox(graphicsService);
}
示例4: GradientTextureSkyRenderer
public GradientTextureSkyRenderer(IGraphicsService graphicsService)
{
if (graphicsService == null)
throw new ArgumentNullException("graphicsService");
if (graphicsService.GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
throw new NotSupportedException("The GradientTextureSkyRenderer does not support the Reach profile.");
_effect = graphicsService.Content.Load<Effect>("DigitalRune/Sky/GradientTextureSky");
_parameterView = _effect.Parameters["View"];
_parameterProjection = _effect.Parameters["Projection"];
_parameterSunDirection = _effect.Parameters["SunDirection"];
_parameterTime = _effect.Parameters["Time"];
_parameterColor = _effect.Parameters["Color"];
_parameterFrontTexture = _effect.Parameters["FrontTexture"];
_parameterBackTexture = _effect.Parameters["BackTexture"];
_parameterAbcd = _effect.Parameters["Abcd"];
_parameterEAndStrength = _effect.Parameters["EAndStrength"];
_passLinear = _effect.Techniques[0].Passes["Linear"];
_passGamma = _effect.Techniques[0].Passes["Gamma"];
_passCieLinear = _effect.Techniques[0].Passes["CieLinear"];
_passCieGamma = _effect.Techniques[0].Passes["CieGamma"];
_submesh = MeshHelper.GetBox(graphicsService);
}
示例5: GdxSpriteBatch
public GdxSpriteBatch(GraphicsDevice graphicsDevice)
{
if (graphicsDevice == null)
throw new ArgumentNullException("graphicsDevice");
_device = graphicsDevice;
_spriteEffect = new LocalSpriteEffect(graphicsDevice);
_matrixTransform = _spriteEffect.Parameters["MatrixTransform"];
_spritePass = _spriteEffect.CurrentTechnique.Passes[0];
_transformMatrix = Matrix.Identity;
//_projectionMatrix = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, 0, 0, 1);
_projectionMatrix = XnaExt.Matrix.CreateOrthographic2D(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, -1, 0);
Color = Color.White;
CalculateIndexBuffer();
_rasterizerScissorState = new RasterizerState() {
CullMode = CullMode.None,
ScissorTestEnable = true,
};
// projection uses CreateOrthographicOffCenter to create 2d projection
// matrix with 0,0 in the upper left.
/*_basicEffect.Projection = Matrix.CreateOrthographicOffCenter
(0, graphicsDevice.Viewport.Width,
graphicsDevice.Viewport.Height, 0,
0, 1);
this._basicEffect.World = Matrix.Identity;
this._basicEffect.View = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward,
Vector3.Up);*/
}
示例6: DepthOfFieldFilter
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="DepthOfFieldFilter"/> class.
/// </summary>
/// <param name="graphicsService">The graphics service.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="graphicsService"/> is <see langword="null"/>.
/// </exception>
public DepthOfFieldFilter(IGraphicsService graphicsService)
: base(graphicsService)
{
_effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/DepthOfFieldFilter");
_screenSizeParameter = _effect.Parameters["ScreenSize"];
_depthTextureParameter = _effect.Parameters["DepthTexture"];
_nearBlurDistanceParameter = _effect.Parameters["NearBlurDistance"];
_nearFocusDistanceParameter = _effect.Parameters["NearFocusDistance"];
_farFocusDistanceParameter = _effect.Parameters["FarFocusDistance"];
_farBlurDistanceParameter = _effect.Parameters["FarBlurDistance"];
_farParameter = _effect.Parameters["Far"];
_blurTextureParameter = _effect.Parameters["BlurTexture"];
_downsampledDepthTextureParameter = _effect.Parameters["DownsampledDepthTexture"];
_downsampledCocTextureParameter = _effect.Parameters["DownsampledCocTexture"];
_offsetsParameter = _effect.Parameters["Offsets"];
_weightsParameter = _effect.Parameters["Weights"];
_sceneTextureParameter = _effect.Parameters["SceneTexture"];
_circleOfConfusionPass = _effect.CurrentTechnique.Passes["CircleOfConfusion"];
_blurPass = _effect.CurrentTechnique.Passes["Blur"];
_depthOfFieldPass = _effect.CurrentTechnique.Passes["DepthOfField"];
_downsampleFilter = PostProcessHelper.GetDownsampleFilter(graphicsService);
_cocBlur = new Blur(graphicsService);
_cocBlur.InitializeBoxBlur(5, false);
NearBlurDistance = 2;
NearFocusDistance = 5;
FarFocusDistance = 6;
FarBlurDistance = 10;
_downsampleFactor = 2;
BlurStrength = 1;
}
示例7: ParticleEffect
public ParticleEffect(Effect _fx, ParticleEffectConfig conf)
{
fx = _fx;
fx.CurrentTechnique = fx.Techniques[0];
fxPassSimple = fx.CurrentTechnique.Passes[conf.PassSimple];
fxpVP = fx.Parameters[conf.ParamVP];
fxpTime = fx.Parameters[conf.ParamTime];
fxpMapSize = fx.Parameters[conf.ParamMapSize];
fxPassLightning = fx.CurrentTechnique.Passes[conf.PassLightning];
fxpLSplits = fx.Parameters[conf.ParamSplits];
fxPassFire = fx.CurrentTechnique.Passes[conf.PassFire];
fxpFRates = fx.Parameters[conf.ParamRates];
fxpFScales = fx.Parameters[conf.ParamScales];
fxpFOff1 = fx.Parameters[conf.ParamOffset1];
fxpFOff2 = fx.Parameters[conf.ParamOffset2];
fxpFOff3 = fx.Parameters[conf.ParamOffset3];
fxpFDistortScale = fx.Parameters[conf.ParamDistortScale];
fxpFDistortBias = fx.Parameters[conf.ParamDistortBias];
fxPassAlert = fx.CurrentTechnique.Passes[conf.PassAlert];
// Set Default Values
LightningSplits = DEFAULT_SPLITS;
FireDistortScale = DEFAULT_DISTORT_SCALE;
FireDistortBias = DEFAULT_DISTORT_BIAS;
FireOffset1 = DEFAULT_OFFSET;
FireOffset2 = DEFAULT_OFFSET;
FireOffset3 = DEFAULT_OFFSET;
FireRates = DEFAULT_RATES;
FireScales = DEFAULT_SCALES;
}
示例8: EdgeFilter
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="EdgeFilter"/> class.
/// </summary>
/// <param name="graphicsService">The graphics service.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="graphicsService"/> is <see langword="null"/>.
/// </exception>
public EdgeFilter(IGraphicsService graphicsService)
: base(graphicsService)
{
_effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/EdgeFilter");
_parameterViewportSize = _effect.Parameters["ViewportSize"];
_parameterHalfEdgeWidth = _effect.Parameters["HalfEdgeWidth"];
_parameterDepthThreshold = _effect.Parameters["DepthThreshold"];
_parameterDepthSensitivity = _effect.Parameters["DepthSensitivity"];
_parameterNormalThreshold = _effect.Parameters["NormalThreshold"];
_parameterNormalSensitivity = _effect.Parameters["NormalSensitivity"];
_parameterCameraBackward = _effect.Parameters["CameraBackward"];
_parameterSourceTexture = _effect.Parameters["SourceTexture"];
_parameterSilhouetteColor = _effect.Parameters["SilhouetteColor"];
_parameterCreaseColor = _effect.Parameters["CreaseColor"];
_parameterGBuffer0 = _effect.Parameters["GBuffer0"];
_parameterGBuffer1 = _effect.Parameters["GBuffer1"];
_passEdge = _effect.Techniques[0].Passes["Edge"];
_passOnePixelEdge = _effect.Techniques[0].Passes["OnePixelEdge"];
EdgeWidth = 2.0f;
DepthThreshold = 0.001f; // = minDistance / farPlaneDistance
DepthSensitivity = 1000; // = farPlaneDistance / (maxDistance - minDistance)
NormalThreshold = 0.1f;
NormalSensitivity = 2f;
SilhouetteColor = new Vector4F(0, 0, 0, 1);
CreaseColor = new Vector4F(0, 0, 0, 1);
}
示例9: StencilSolidEffect
public StencilSolidEffect(Effect effect)
{
_effect = effect;
_pass = _effect.CurrentTechnique.Passes[0];
_projection = effect.Parameters["Projection"];
_transformation = effect.Parameters["Transformation"];
}
示例10: SaoFilter
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="SsaoFilter"/> class.
/// </summary>
/// <param name="graphicsService">The graphics service.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="graphicsService"/> is <see langword="null"/>.
/// </exception>
public SaoFilter(IGraphicsService graphicsService)
: base(graphicsService)
{
Effect effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/SaoFilter");
_frustumInfoParameter = effect.Parameters["FrustumInfo"];
_numberOfAOSamplesParameter = effect.Parameters["NumberOfAOSamples"];
_aoParameters0 = effect.Parameters["AOParameters0"];
_aoParameters1 = effect.Parameters["AOParameters1"];
_aoParameters2 = effect.Parameters["AOParameters2"];
_sourceTextureParameter = effect.Parameters["SourceTexture"];
_occlusionTextureParameter = effect.Parameters["OcclusionTexture"];
_gBuffer0Parameter = effect.Parameters["GBuffer0"];
//_viewParameter = _effect.Parameters["View"];
//_gBuffer1Parameter = _effect.Parameters["GBuffer1"];
_createAOPass = effect.CurrentTechnique.Passes["CreateAO"];
_blurHorizontalPass = effect.CurrentTechnique.Passes["BlurHorizontal"];
_blurVerticalPass = effect.CurrentTechnique.Passes["BlurVertical"];
_blurVerticalAndCombinePass = effect.CurrentTechnique.Passes["BlurVerticalAndCombine"];
Strength = 1;
MaxOcclusion = 1;
Radius = 0.5f;
MinBias = 0.02f;
Bias = 0.0004f;
NumberOfSamples = 11;
SampleDistribution = 7;
BlurScale = 2;
EdgeSoftness = 0.5f;
CombineWithSource = true;
}
示例11: LuminanceFilter
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="LuminanceFilter"/> class.
/// </summary>
/// <param name="graphicsService">The graphics service.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="graphicsService"/> is <see langword="null"/>.
/// </exception>
public LuminanceFilter(IGraphicsService graphicsService)
: base(graphicsService)
{
_effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/LuminanceFilter");
_useGeometricMeanParameter = _effect.Parameters["UseGeometricMean"];
_useAdaptionParameter = _effect.Parameters["UseAdaption"];
_deltaTimeParameter = _effect.Parameters["DeltaTime"];
_adaptionSpeedParameter = _effect.Parameters["AdaptionSpeed"];
_lastLuminanceTextureParameter = _effect.Parameters["LastLuminanceTexture"];
_textureParameter = _effect.Parameters["SourceTexture"];
_sourceSizeParameter = _effect.Parameters["SourceSize"];
_targetSizeParameter = _effect.Parameters["TargetSize"];
_createPass = _effect.CurrentTechnique.Passes["Create"];
_downsamplePass = _effect.CurrentTechnique.Passes["Downsample"];
_finalPass = _effect.CurrentTechnique.Passes["Final"];
_downsampleFilter = PostProcessHelper.GetDownsampleFilter(graphicsService);
_copyFilter = PostProcessHelper.GetCopyFilter(graphicsService);
UseGeometricMean = true;
UseAdaption = true;
AdaptionSpeed = 0.02f;
DefaultTargetFormat = new RenderTargetFormat(1, 1, false, SurfaceFormat.HalfVector4, DepthFormat.None);
}
示例12: ObjectMotionBlur
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="ObjectMotionBlur"/> class.
/// </summary>
/// <param name="graphicsService">The graphics service.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="graphicsService"/> is <see langword="null"/>.
/// </exception>
public ObjectMotionBlur(IGraphicsService graphicsService)
: base(graphicsService)
{
_effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/ObjectMotionBlur");
_viewportSizeParameter = _effect.Parameters["ViewportSize"];
_sourceTextureParameter = _effect.Parameters["SourceTexture"];
_numberOfSamplesParameter = _effect.Parameters["NumberOfSamples"];
_velocityTextureParameter = _effect.Parameters["VelocityTexture"];
_velocityTexture2Parameter = _effect.Parameters["VelocityTexture2"];
_maxBlurRadiusParameter = _effect.Parameters["MaxBlurRadius"];
_sourceSizeParameter = _effect.Parameters["SourceSize"];
_gBuffer0Parameter = _effect.Parameters["GBuffer0"];
_jitterTextureParameter = _effect.Parameters["JitterTexture"];
_softZExtentParameter = _effect.Parameters["SoftZExtent"];
_singlePass = _effect.CurrentTechnique.Passes["Single"];
_dualPass = _effect.CurrentTechnique.Passes["Dual"];
_downsampleMaxParameter = _effect.CurrentTechnique.Passes["DownsampleMax"];
_downsampleMaxFromFloatBufferParameter = _effect.CurrentTechnique.Passes["DownsampleMaxFromFloatBuffer"];
_neighborMaxPass = _effect.CurrentTechnique.Passes["NeighborMax"];
_softEdgePass = _effect.CurrentTechnique.Passes["SoftEdge"];
_jitterTexture = NoiseHelper.GetGrainTexture(GraphicsService, 128);
NumberOfSamples = 9;
MaxBlurRadius = 20;
}
示例13: GodRayFilter
//--------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="GodRayFilter"/> class.
/// </summary>
/// <param name="graphicsService">The graphics service.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="graphicsService"/> is <see langword="null"/>.
/// </exception>
public GodRayFilter(IGraphicsService graphicsService)
: base(graphicsService)
{
Effect effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/GodRayFilter");
_viewportSizeParameter = effect.Parameters["ViewportSize"];
_parameters0Parameter = effect.Parameters["Parameters0"];
_parameters1Parameter = effect.Parameters["Parameters1"];
_intensityParameter = effect.Parameters["Intensity"];
_numberOfSamplesParameter = effect.Parameters["NumberOfSamples"];
_sourceTextureParameter = effect.Parameters["SourceTexture"];
_gBuffer0Parameter = effect.Parameters["GBuffer0"];
_rayTextureParameter = effect.Parameters["RayTexture"];
_createMaskPass = effect.CurrentTechnique.Passes["CreateMask"];
_blurPass = effect.CurrentTechnique.Passes["Blur"];
_combinePass = effect.CurrentTechnique.Passes["Combine"];
_downsampleFilter = graphicsService.GetDownsampleFilter();
Scale = 1;
LightDirection = new Vector3F(0, -1, 0);
LightRadius = 0.2f;
Intensity = new Vector3F(1, 1, 1);
DownsampleFactor = 4;
NumberOfSamples = 8;
NumberOfPasses = 2;
Softness = 1;
}
示例14: DrawDebugWorld
public void DrawDebugWorld(DynamicsWorld world)
{
world.DebugDrawWorld();
if (lines.Count == 0)
return;
if (effect == null)
{
effect = new BasicEffect(graphics.Device);
effect.World = Microsoft.Xna.Framework.Matrix.Identity;
effect.VertexColorEnabled = true;
pass = effect.CurrentTechnique.Passes[0];
}
effect.Projection = graphics.GetEffect().Projection;
effect.View = graphics.GetEffect().View;
pass.Apply();
int pointCount = lines.Count;
int linesCount = pointCount / 2;
VertexPositionColor[] linesArray = new VertexPositionColor[pointCount];
for (int i = 0; i < pointCount; i++)
{
int color = lines[i].Color;
linesArray[i].Color = new Color(color & 0xff, (color & 0xff00) >> 8, (color & 0xff0000) >> 16, 1);
linesArray[i].Position = MathHelper.Convert(lines[i].Position);
}
graphics.Device.DrawUserPrimitives(PrimitiveType.LineList, linesArray, 0, linesCount);
lines.Clear();
}
示例15: SwapProgram
public void SwapProgram(string passName)
{
_passName = passName;
if (passName == null)
return;
_effectPass = _shader.CurrentTechnique.Passes[passName];
}