当前位置: 首页>>代码示例>>C#>>正文


C# EffectParameter.SetValue方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.EffectParameter.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# EffectParameter.SetValue方法的具体用法?C# EffectParameter.SetValue怎么用?C# EffectParameter.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Graphics.EffectParameter的用法示例。


在下文中一共展示了EffectParameter.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PointLight

        public PointLight(Vector3 position, Vector3 color, EffectParameter lightParameter)
        {
            this.position = position;
            this.color = color;
            this.lightParameter = lightParameter;

            positionParameter = lightParameter.StructureMembers["vPosition"];
            rangeParameter = lightParameter.StructureMembers["fRange"];
            colorParameter = lightParameter.StructureMembers["vColor"];

            lightParameter.StructureMembers["fFalloff"].SetValue(2.0f);
            positionParameter.SetValue(position);
            positionParameter.SetValue(position);
            rangeParameter.SetValue(100);
            colorParameter.SetValue(color);
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:16,代码来源:PointLight.cs

示例2: SetWorldViewProjAndFog

 internal static EffectDirtyFlags SetWorldViewProjAndFog(EffectDirtyFlags dirtyFlags, ref Matrix world, ref Matrix view, ref Matrix projection, ref Matrix worldView, bool fogEnabled, float fogStart, float fogEnd, EffectParameter worldViewProjParam, EffectParameter fogVectorParam)
 {
   if ((dirtyFlags & EffectDirtyFlags.WorldViewProj) != ~EffectDirtyFlags.All)
   {
     Matrix.Multiply(ref world, ref view, out worldView);
     Matrix result;
     Matrix.Multiply(ref worldView, ref projection, out result);
     worldViewProjParam.SetValue(result);
     dirtyFlags &= ~EffectDirtyFlags.WorldViewProj;
   }
   if (fogEnabled)
   {
     if ((dirtyFlags & (EffectDirtyFlags.Fog | EffectDirtyFlags.FogEnable)) != ~EffectDirtyFlags.All)
     {
       EffectHelpers.SetFogVector(ref worldView, fogStart, fogEnd, fogVectorParam);
       dirtyFlags &= ~(EffectDirtyFlags.Fog | EffectDirtyFlags.FogEnable);
     }
   }
   else if ((dirtyFlags & EffectDirtyFlags.FogEnable) != ~EffectDirtyFlags.All)
   {
     fogVectorParam.SetValue(Vector4.Zero);
     dirtyFlags &= ~EffectDirtyFlags.FogEnable;
   }
   return dirtyFlags;
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:25,代码来源:EffectHelpers.cs

示例3: SetLightingMatrices

        /// <summary>
        /// Lazily recomputes the world inverse transpose matrix and
        /// eye position based on the current effect parameter settings.
        /// </summary>
        internal static EffectDirtyFlags SetLightingMatrices(EffectDirtyFlags dirtyFlags, ref Matrix world, ref Matrix view,
                                                             EffectParameter worldParam, EffectParameter worldInverseTransposeParam, EffectParameter eyePositionParam)
        {
            // Set the world and world inverse transpose matrices.
            if ((dirtyFlags & EffectDirtyFlags.World) != 0)
            {
                Matrix worldTranspose;
                Matrix worldInverseTranspose;

                Matrix.Invert(ref world, out worldTranspose);
                Matrix.Transpose(ref worldTranspose, out worldInverseTranspose);

                worldParam.SetValue(world);
                worldInverseTransposeParam.SetValue(worldInverseTranspose);

                dirtyFlags &= ~EffectDirtyFlags.World;
            }

            // Set the eye position.
            if ((dirtyFlags & EffectDirtyFlags.EyePosition) != 0)
            {
                Matrix viewInverse;

                Matrix.Invert(ref view, out viewInverse);

                eyePositionParam.SetValue(viewInverse.Translation);

                dirtyFlags &= ~EffectDirtyFlags.EyePosition;
            }

            return dirtyFlags;
        }
开发者ID:jdcook,项目名称:Veishea,代码行数:36,代码来源:EffectHelpers.cs

示例4: OnInit

        protected override void OnInit()
        {
            base.OnInit();
            Texture2D texture = Texture;

            dtAfterGolUpdate = 0f;
            golUpdatePeriod = 60f / 140f;
            needFirstUpdate = true;

            spriteBatch = new SpriteBatch(Screen.graphicsDevice);
            eff = TTengineMaster.ActiveGame.Content.Load<Effect>("Effects/GoL");
            effTime = eff.Parameters["Time"];
            effDeltaPixelX = eff.Parameters["DeltaPixelX"];
            effDeltaPixelY = eff.Parameters["DeltaPixelY"];
            effDoGolUpdate = eff.Parameters["DoGolUpdate"];
            effDeltaPixelX.SetValue(1f/((float)texture.Width));
            effDeltaPixelY.SetValue(1f / ((float)texture.Height));
            VertexShaderInit(eff);

            renderBufInput = new RenderTarget2D(spriteBatch.GraphicsDevice, texture.Width, texture.Height);
            renderBufOutput = new RenderTarget2D(spriteBatch.GraphicsDevice, texture.Width, texture.Height);
            blendState = new BlendState();
            blendState.AlphaDestinationBlend = Blend.Zero;
            // first time rendering into buffer using BufferInit technique
            eff.CurrentTechnique = eff.Techniques[0];
            spriteBatch.Begin(SpriteSortMode.Deferred,blendState,null,null,null,eff);
            spriteBatch.GraphicsDevice.SetRenderTarget(renderBufInput);
            spriteBatch.Draw(texture, renderBufInput.Bounds, Color.White);
            spriteBatch.End();
        }
开发者ID:IndiegameGarden,项目名称:TTR,代码行数:30,代码来源:GoLEffect.cs

示例5: SpriteLinesEffect

		public SpriteLinesEffect() : base( Core.graphicsDevice, EffectResource.spriteLinesEffectBytes )
		{
			_lineColorParam = Parameters["_lineColor"];
			_lineSizeParam = Parameters["_lineSize"];

			_lineColorParam.SetValue( _lineColor );
			_lineSizeParam.SetValue( _lineSize );
		}
开发者ID:RastaCow,项目名称:Nez,代码行数:8,代码来源:SpriteLinesEffect.cs

示例6: DotsEffect

		public DotsEffect() : base( Core.graphicsDevice, EffectResource.dotsBytes )
		{
			_scaleParam = Parameters["scale"];
			_angleParam = Parameters["angle"];

			_scaleParam.SetValue( _scale );
			_angleParam.SetValue( _angle );
		}
开发者ID:prime31,项目名称:Nez,代码行数:8,代码来源:DotsEffect.cs

示例7: ScanlinesEffect

		public ScanlinesEffect() : base( Core.graphicsDevice, EffectResource.scanlinesBytes )
		{
			_attenuationParam = Parameters["_attenuation"];
			_linesFactorParam = Parameters["_linesFactor"];

			_attenuationParam.SetValue( _attenuation );
			_linesFactorParam.SetValue( _linesFactor );
		}
开发者ID:RastaCow,项目名称:Nez,代码行数:8,代码来源:ScanlinesEffect.cs

示例8: onAddedToScene

		public override void onAddedToScene()
		{
			effect = scene.content.loadEffect<Effect>( "vignette", EffectResource.letterboxBytes );

			_colorParam = effect.Parameters["_color"];
			_letterboxSizeParam = effect.Parameters["_letterboxSize"];
			_colorParam.SetValue( _color.ToVector4() );
			_letterboxSizeParam.SetValue( _letterboxSize );
		}
开发者ID:prime31,项目名称:Nez,代码行数:9,代码来源:CinematicLetterboxPostProcessor.cs

示例9: SetFogVector

 private static void SetFogVector(ref Matrix worldView, float fogStart, float fogEnd, EffectParameter fogVectorParam)
 {
   if ((double) fogStart == (double) fogEnd)
   {
     fogVectorParam.SetValue(new Vector4(0.0f, 0.0f, 0.0f, 1f));
   }
   else
   {
     float num = (float) (1.0 / ((double) fogStart - (double) fogEnd));
     fogVectorParam.SetValue(new Vector4()
     {
       X = worldView.M13 * num,
       Y = worldView.M23 * num,
       Z = worldView.M33 * num,
       W = (worldView.M43 + fogStart) * num
     });
   }
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:18,代码来源:EffectHelpers.cs

示例10: onAddedToScene

        public override void onAddedToScene()
        {
            effect = scene.contentManager.loadEffect<Effect>( "vignette", EffectResource.vignetteBytes );

            _powerParam = effect.Parameters["_power"];
            _radiusParam = effect.Parameters["_radius"];
            _powerParam.SetValue( _power );
            _radiusParam.SetValue( _radius );
        }
开发者ID:RastaCow,项目名称:Nez,代码行数:9,代码来源:VignettePostProcessor.cs

示例11: m000001

 public static void m000001()
 {
     f000058 = new SpriteBatch(c000074.m0000d4());
     f0000c1 = c000074.f0000b0.Load<Effect>("Blur");
     f0000e0 = f0000c1.Parameters["pixelSize"];
     f0000e0.SetValue(new Vector2(1f / ((float) c000074.m00000f()), 1f / ((float) c000074.m000010())));
     f0000c1.CommitChanges();
     f00000a = true;
 }
开发者ID:bing2008,项目名称:CastNetGame,代码行数:9,代码来源:c00008b.cs

示例12: TwistEffect

		public TwistEffect() : base( Core.graphicsDevice, EffectResource.twistBytes )
		{
			_radiusParam = Parameters["radius"];
			_angleParam = Parameters["angle"];
			_offsetParam = Parameters["offset"];

			_radiusParam.SetValue( _radius );
			_angleParam.SetValue( _angle );
			_offsetParam.SetValue( _offset );
		}
开发者ID:RastaCow,项目名称:Nez,代码行数:10,代码来源:TwistEffect.cs

示例13: ReflectionEffect

		public ReflectionEffect() : base( Core.graphicsDevice, EffectResource.reflectionBytes )
		{
			_reflectionIntensityParam = Parameters["_reflectionIntensity"];
			_renderTextureParam = Parameters["_renderTexture"];
			_normalMapParam = Parameters["_normalMap"];
			_matrixTransformParam = Parameters["_matrixTransform"];
			_normalMagnitudeParam = Parameters["_normalMagnitude"];

			_reflectionIntensityParam.SetValue( _reflectionIntensity );
			_normalMagnitudeParam.SetValue( _normalMagnitude );
		}
开发者ID:prime31,项目名称:Nez,代码行数:11,代码来源:ReflectionEffect.cs

示例14: BlurEffect

        public BlurEffect()
        {
            if (!GeneralManager.Effects.ContainsKey("Effects/Blur"))
            {
                GeneralManager.LoadEffect("Effects/Blur");
            }

            BloomEffect = GeneralManager.Effects["Effects/Blur"];
            Value = BloomEffect.Parameters["Param"];
            Value.SetValue(0.05f);
        }
开发者ID:BartoszF,项目名称:ArtifactsRider,代码行数:11,代码来源:BlurEffect.cs

示例15: onAddedToScene

        public override void onAddedToScene()
        {
            effect = scene.contentManager.loadEffect<Effect>( "pixelGlitch", EffectResource.pixelGlitchBytes );

            _verticalSizeParam = effect.Parameters["_verticalSize"];
            _horizontalOffsetParam = effect.Parameters["_horizontalOffset"];
            _screenSizeParam = effect.Parameters["_screenSize"];

            _verticalSizeParam.SetValue( _verticalSize );
            _horizontalOffsetParam.SetValue( _horizontalOffset );
            _screenSizeParam.SetValue( new Vector2( Screen.width, Screen.height ) );
        }
开发者ID:RastaCow,项目名称:Nez,代码行数:12,代码来源:PixelGlitchPostProcessor.cs


注:本文中的Microsoft.Xna.Framework.Graphics.EffectParameter.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。