• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# EffectTechnique类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EffectTechnique的典型用法代码示例。如果您正苦于以下问题:C# EffectTechnique类的具体用法?C# EffectTechnique怎么用?C# EffectTechnique使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EffectTechnique类属于命名空间,在下文中一共展示了EffectTechnique类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VisualEffect

        protected VisualEffect(IServiceProvider services, string effectAsset,
            int effectLayerCount, IEnumerable<RenderTargetLayerType> requiredRenderTargets)
        {
            if (services == null)
                throw new ArgumentNullException("services");
            if (effectAsset == null)
                throw new ArgumentNullException("effectAsset");
            if (requiredRenderTargets == null)
                throw new ArgumentNullException("requiredRenderTargets");
            if (effectLayerCount < 0)
                throw new ArgumentOutOfRangeException("affectedLayers", "Parameter should have non-negative value.");

            renderer = (Renderer)services.GetService(typeof(Renderer));
            resourceManager = (ResourceManager)services.GetService(typeof(ResourceManager));

            this.requiredRenderTargets = requiredRenderTargets;
            this.effectLayerCount = effectLayerCount > 0 ? effectLayerCount : renderer.KBufferManager.Configuration.LayerCount;

            effect = resourceManager.Load<Effect>(effectAsset);
            effectTechnique = effect.GetTechniqueByName(VisualEffectTechniqueName);
            if (!effectTechnique.IsValid)
                throw new ArgumentException(
                    string.Format("Given effect asset '{0}' does not contain technique {1}.", effectAsset, VisualEffectTechniqueName),
                    "effectAsset");
        }
开发者ID:TheProjecter,项目名称:romantiquex,代码行数:25,代码来源:VisualEffect.cs


示例2: D3D10Renderer

        public D3D10Renderer(Device1 device3D)
        {
            Contract.Requires(device3D != null);

            _Device3D = device3D;

            string shader = GetShaderText(Properties.Resources.RenderingEffects);

            using(var byteCode = ShaderBytecode.Compile(
                    shader, "fx_4_0", ShaderFlags.None, EffectFlags.None))
            {
                _Effect = new Effect(_Device3D, byteCode);
            }

            _EffectTechnique = _Effect.GetTechniqueByName("WithTexture");

            Contract.Assert(_EffectTechnique != null);

            _EffectPass = _EffectTechnique.GetPassByIndex(0);

            Contract.Assert(_EffectPass != null);

            _InputLayout = new InputLayout(
                _Device3D, _EffectPass.Description.Signature, _InputLayoutData);

            const int byteSize = _Stride * _VertexCount;

            using(DataStream stream = new DataStream(byteSize, true, true))
            {
                for(int i = 0; i < _QuadPrimitiveData.Length; i += 2)
                {
                    float fx = (2.0f * _QuadPrimitiveData[i + 0].X) - 1.0f;
                    float fy = (2.0f * _QuadPrimitiveData[i + 0].Y) - 1.0f;

                    stream.Write(new Vector3(fx, -fy, 0.5f));
                    stream.Write(_QuadPrimitiveData[i + 1]);
                }

                stream.Seek(0, SeekOrigin.Begin);

                BufferDescription description = new BufferDescription
                {
                    BindFlags = BindFlags.VertexBuffer,
                    CpuAccessFlags = CpuAccessFlags.None,
                    OptionFlags = ResourceOptionFlags.None,
                    Usage = ResourceUsage.Immutable,
                    SizeInBytes = byteSize
                };

                description.SizeInBytes = byteSize;

                _VertexBuffer = new Buffer(_Device3D, stream, description);

                _VertexBufferBinding = new VertexBufferBinding(
                    _VertexBuffer, _Stride, _Offset);
            }
        }
开发者ID:fealty,项目名称:Frost,代码行数:57,代码来源:D3D10Renderer.cs


示例3: TestEffect

        /// <summary>
        /// Create our test RenderEffect.
        /// </summary>
        /// <param name="Device"></param>
        public TestEffect(Device Device)
        {
            this.Device = Device;
            ImmediateContext = Device.ImmediateContext;

            // Compile our shader...
            string compileErrors;
            var compiledShader = SlimDX.D3DCompiler.ShaderBytecode.CompileFromFile
            (
                "../../Effects/TestEffect/TestEffect.fx",
                null,
                "fx_5_0",
                SlimDX.D3DCompiler.ShaderFlags.None,
                SlimDX.D3DCompiler.EffectFlags.None,
                null,
                null,
                out compileErrors
            );

            if (compileErrors != null && compileErrors != "")
            {
                throw new EffectBuildException(compileErrors);
            }

            Effect = new Effect(Device, compiledShader);
            EffectTechnique = Effect.GetTechniqueByName("TestTechnique");

            var vertexDesc = new[]
            {
                new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                new InputElement("COLOR", 0, SlimDX.DXGI.Format.R32G32B32A32_Float, 12, 0, InputClassification.PerVertexData, 0)
            };

            WorldViewProj = SlimDX.Matrix.Identity;
            CPO_WorldViewProj = Effect.GetVariableByName("gWorldViewProj").AsMatrix();
            InputLayout = new InputLayout(Device, EffectTechnique.GetPassByIndex(0).Description.Signature, vertexDesc);

            Util.ReleaseCom(ref compiledShader);
        }
开发者ID:sessamekesh,项目名称:OutsideSimulator,代码行数:43,代码来源:TestEffect.cs


示例4: Blit

        public void Blit(Effect effect, EffectTechnique technique, params RenderTargetView[] targets)
        {
            view.Device10.OutputMerger.SetTargets(targets);
            /*foreach(var target in targets)
                view.Device10.ClearRenderTargetView(target, Color.Black);*/
            view.Device10.Rasterizer.SetViewports(new SlimDX.Direct3D10.Viewport
            {
                Width = ((Texture2D)targets[0].Resource).Description.Width,
                Height = ((Texture2D)targets[0].Resource).Description.Height,
                MaxZ = 1
            });

            var sp = view.Content.Acquire<Content.Mesh10>(screenPlane);

            sp.Setup(view.Device10, view.Content.Acquire<InputLayout>(new Graphics.Content.VertexStreamLayoutFromEffect
            {
                Signature10 = technique.GetPassByIndex(0).Description.Signature,
                Layout = sp.VertexStreamLayout
            }));

            technique.GetPassByIndex(0).Apply();
            sp.Draw(view.Device10);
            view.Device10.OutputMerger.SetTargets((RenderTargetView)null);
        }
开发者ID:ChristianMarchiori,项目名称:DeadMeetsLead,代码行数:24,代码来源:RenderingUtil.cs


示例5: CompileShader

        private void CompileShader(Device device, string fullPath)
        {
            _File = fullPath;

            _CompiledEffect = ShaderBytecode.CompileFromFile(_File, "SpriteTech", "fx_5_0");

            if (_CompiledEffect.HasErrors) {
                Log.Write("Shader compilation failed with status code: {0} - {1} | Path: {2}", _CompiledEffect.ResultCode.Code, _CompiledEffect.Message, _File);
                return;
            }

            _Effect = new Effect(device, _CompiledEffect);
            _EffectTechnique = _Effect.GetTechniqueByName("SpriteTech");
            _SpriteMap = _Effect.GetVariableByName("SpriteTex").AsShaderResource();
            var _EffectPass = _EffectTechnique.GetPassByIndex(0).Description.Signature;

            InputElement[] _LayoutDescription = {
                new InputElement("POSITION", 0, SharpDX.DXGI.Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                new InputElement("TEXCOORD", 0, SharpDX.DXGI.Format.R32G32_Float, 12, 0, InputClassification.PerVertexData, 0),
                new InputElement("COLOR", 0, SharpDX.DXGI.Format.R32G32B32A32_Float, 20, 0, InputClassification.PerVertexData, 0)
            };

            _InputLayout = new InputLayout(device, _EffectPass, _LayoutDescription);
        }
开发者ID:JoshuaTyree,项目名称:OverlayEngine,代码行数:24,代码来源:Shader.cs


示例6: ShapesDemo

        public ShapesDemo(IntPtr hInstance)
            : base(hInstance) {
            _vb = null;
            _ib = null;
            _fx = null;
            _tech = null;
            _fxWVP = null;
            _inputLayout = null;
            _wireframeRS = null;
            _theta = 1.5f * MathF.PI;
            _phi = 0.1f * MathF.PI;
            _radius = 15.0f;

            MainWindowCaption = "Shapes Demo";

            _lastMousePos = new Point(0, 0);

            _gridWorld = Matrix.Identity;
            _view = Matrix.Identity;
            _proj = Matrix.Identity;

            _boxWorld = Matrix.Scaling(2.0f, 1.0f, 2.0f) * Matrix.Translation(0, 0.5f, 0);
            _centerSphere = Matrix.Scaling(2.0f, 2.0f, 2.0f) * Matrix.Translation(0, 2, 0);

            for (int i = 0; i < 5; ++i) {
                _cylWorld[i * 2] = Matrix.Translation(-5.0f, 1.5f, -10.0f + i * 5.0f);
                _cylWorld[i * 2 + 1] = Matrix.Translation(5.0f, 1.5f, -10.0f + i * 5.0f);

                _sphereWorld[i * 2] = Matrix.Translation(-5.0f, 3.5f, -10.0f + i * 5.0f);
                _sphereWorld[i * 2 + 1] = Matrix.Translation(5.0f, 3.5f, -10.0f + i * 5.0f);
            }

        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:33,代码来源:Program.cs


示例7: LoadResources

		public override void LoadResources()
		{
			if (m_Disposed == true)
			{
				m_Effect = m_Effect = new Effect(GameEnvironment.Device, Bytecode); // Effect.FromFile(GameEnvironment.Device, Helper.ResolvePath(m_ShaderLocation), "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
				m_Technique = m_Effect.GetTechniqueByName("RenderParticles");
				m_ParticlePass_Add = m_Technique.GetPassByName("Add");

				m_Layout = new InputLayout(GameEnvironment.Device, m_ParticlePass_Add.Description.Signature, new[] {
					new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
					new InputElement("TEXCOORD", 0, Format.R32G32_Float, 16, 0),				
					new InputElement("INST_POSITION", 0, Format.R32G32B32_Float, 0, 1, InputClassification.PerInstanceData, 1),
					new InputElement("INST_COLOR", 0, Format.R32G32B32A32_Float, 12, 1, InputClassification.PerInstanceData, 1), 					
				});

				m_WorldViewProj = m_Effect.GetVariableByName("worldViewProj").AsMatrix();
				m_ParticleTexture = m_Effect.GetVariableByName("particle_texture").AsResource();
				m_AmpScale = m_Effect.GetVariableByName("ampScale").AsScalar();
				m_PartScaleX = m_Effect.GetVariableByName("partScaleX").AsScalar();
				m_PartScaleY = m_Effect.GetVariableByName("partScaleY").AsScalar(); 
				m_MaxDistance = m_Effect.GetVariableByName("maxDistance").AsScalar();
				m_MinDistance = m_Effect.GetVariableByName("minDistance").AsScalar();
				m_ScaleDistance = m_Effect.GetVariableByName("scaleDistance").AsScalar();

				m_Disposed = false;
			}
		}
开发者ID:RugCode,项目名称:drg-pt,代码行数:27,代码来源:ParticleEffect.cs


示例8: FowardLightingEffect

        public FowardLightingEffect(Device device, string filename)
            : base(device, filename) {

            Ambient = FX.GetTechniqueByName("Ambient");
            DepthPrePass = FX.GetTechniqueByName("DepthPrePass");
            Directional = FX.GetTechniqueByName("Directional");
            PointLight = FX.GetTechniqueByName("Point");

            _worldViewProj = FX.GetVariableByName("WorldViewProjection").AsMatrix();
            _world = FX.GetVariableByName("World").AsMatrix();
            _worldInvTranspose = FX.GetVariableByName("gWorldInvTranspose").AsMatrix();

            _ambientDown = FX.GetVariableByName("AmbientDown").AsVector();
            _ambientRange = FX.GetVariableByName("AmbientRange").AsVector();

            _dirToLight = FX.GetVariableByName("DirToLight").AsVector();
            _dirLightColor = FX.GetVariableByName("DirLightColor").AsVector();

            _eyePosition = FX.GetVariableByName("EyePosition").AsVector();
            _specularExponent = FX.GetVariableByName("specExp").AsScalar();
            _specularIntensity = FX.GetVariableByName("specIntensity").AsScalar();

            _pointLightPosition = FX.GetVariableByName("PointLightPosition").AsVector();
            _pointLightRangeRcp = FX.GetVariableByName("PointLightRangeRcp").AsScalar();
            _pointLightColor = FX.GetVariableByName("PointLightColor").AsVector();

            _diffuseMap = FX.GetVariableByName("DiffuseTexture").AsResource();
        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:28,代码来源:FowardLightingEffect.cs


示例9: LoadResources

		public override void LoadResources()
		{
			if (m_Disposed == true)
			{
				m_TextFont.LoadResources();

				//SlimDX.D3DCompiler.ShaderBytecode blob = SlimDX.D3DCompiler.ShaderBytecode.CompileFromFile(Helper.ResolvePath(m_ShaderLocation), "fx_4_0", SlimDX.D3DCompiler.ShaderFlags.EnableStrictness, SlimDX.D3DCompiler.EffectFlags.None);

				m_Effect = new Effect(GameEnvironment.Device, Bytecode);

				m_Technique = m_Effect.GetTechniqueByName("LinesAndBoxes");
				m_Pass_BoxesAndText = m_Technique.GetPassByName("BoxesAndText");
				m_Pass_Lines = m_Technique.GetPassByName("Lines");
				
				m_Layout = new InputLayout(GameEnvironment.Device, m_Pass_Lines.Description.Signature, new[] {
					new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0),
					new InputElement("TEXCOORD", 0, Format.R32G32_Float, 12, 0),
					new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 20, 0),				
				});

				m_UiElementsTexture = m_Effect.GetVariableByName("UiElementsTexture").AsResource();
				m_UiElementsTexture.SetResource(m_TextFont.TexureView); 

				m_Disposed = false;
			}
		}
开发者ID:RugCode,项目名称:drg-pt,代码行数:26,代码来源:UiEffect.cs


示例10: Attach

        public override void Attach(IRenderHost host)
        {
            /// --- attach
            this.renderTechnique = Techniques.RenderCubeMap;
            base.Attach(host);

            /// --- get variables               
            this.vertexLayout = EffectsManager.Instance.GetLayout(this.renderTechnique);
            this.effectTechnique = effect.GetTechniqueByName(this.renderTechnique.Name);
            this.effectTransforms = new EffectTransformVariables(this.effect);

            /// -- attach cube map 
            if (this.Filename != null)
            {
                /// -- attach texture
                using (var texture = Texture2D.FromFile<Texture2D>(this.Device, this.Filename))
                {
                    this.texCubeMapView = new ShaderResourceView(this.Device, texture);
                }
                this.texCubeMap = effect.GetVariableByName("texCubeMap").AsShaderResource();
                this.texCubeMap.SetResource(this.texCubeMapView);
                this.bHasCubeMap = effect.GetVariableByName("bHasCubeMap").AsScalar();
                this.bHasCubeMap.Set(true);

                /// --- set up geometry
                var sphere = new MeshBuilder(false,true,false);
                sphere.AddSphere(new Vector3(0, 0, 0));
                this.geometry = sphere.ToMeshGeometry3D();

                /// --- set up vertex buffer
                this.vertexBuffer = Device.CreateBuffer(BindFlags.VertexBuffer, CubeVertex.SizeInBytes, this.geometry.Positions.Select((x, ii) => new CubeVertex() { Position = new Vector4(x, 1f) }).ToArray());

                /// --- set up index buffer
                this.indexBuffer = Device.CreateBuffer(BindFlags.IndexBuffer, sizeof(int), geometry.Indices.Array);

                /// --- set up rasterizer states
                var rasterStateDesc = new RasterizerStateDescription()
                {
                    FillMode = FillMode.Solid,
                    CullMode = CullMode.Back,
                    IsMultisampleEnabled = true,
                    IsAntialiasedLineEnabled = true,
                    IsFrontCounterClockwise = false,
                };
                this.rasterState = new RasterizerState(this.Device, rasterStateDesc);

                /// --- set up depth stencil state
                var depthStencilDesc = new DepthStencilStateDescription()
                {
                    DepthComparison = Comparison.LessEqual,
                    DepthWriteMask = global::SharpDX.Direct3D11.DepthWriteMask.All,
                    IsDepthEnabled = true,
                };
                this.depthStencilState = new DepthStencilState(this.Device, depthStencilDesc);
            }

            /// --- flush
            this.Device.ImmediateContext.Flush();
        }
开发者ID:dermeister0,项目名称:helix-toolkit,代码行数:59,代码来源:EnvironmentMapModel3D.cs


示例11: LoadResources

		public override void LoadResources()
		{
			if (m_Disposed == true)
			{
				m_Effect = m_Effect = new Effect(GameEnvironment.Device, Bytecode); // Effect.FromFile(GameEnvironment.Device, Helper.ResolvePath(m_ShaderLocation), "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
				m_Technique = m_Effect.GetTechniqueByName("Imposter");

				m_Pass_NoBlend = m_Technique.GetPassByName("NoBlend");
				m_Pass_OverlayAdd = m_Technique.GetPassByName("OverlayAdd");
				m_Pass_OverlaySubtract = m_Technique.GetPassByName("OverlaySubtract");
				m_Pass_OverlayInvert = m_Technique.GetPassByName("OverlayInvert");
				m_Pass_OverlayAlpha = m_Technique.GetPassByName("OverlayAlpha");

				m_Technique_BrightPass = m_Effect.GetTechniqueByName("Imposter_BrightPass");

				m_Pass_NoBlend_BrightPass = m_Technique_BrightPass.GetPassByName("NoBlend");
				m_Pass_OverlayAdd_BrightPass = m_Technique_BrightPass.GetPassByName("OverlayAdd");
				m_Pass_OverlaySubtract_BrightPass = m_Technique_BrightPass.GetPassByName("OverlaySubtract");
				m_Pass_OverlayAlpha_BrightPass = m_Technique_BrightPass.GetPassByName("OverlayAlpha");

				m_ImposterTextureResource = m_Effect.GetVariableByName("imposter").AsResource();

				m_BrightPassThreshold = m_Effect.GetVariableByName("brightPassThreshold").AsScalar();

				m_Layout = new InputLayout(GameEnvironment.Device, m_Pass_NoBlend.Description.Signature, new[] {
					new InputElement("POSITION", 0, Format.R32G32_Float, 0, 0),
					new InputElement("TEXCOORD", 0, Format.R32G32_Float, 8, 0)		
				});

				float minX = -1f, miny = -1f, maxX = 1f, maxY = 1f;

				using (DataStream stream = new DataStream(4 * Marshal.SizeOf(typeof(Vertex2D)), true, true))
				{
					stream.WriteRange(new Vertex2D[] {					
						new Vertex2D() { Position = new Vector2(maxX, miny), TextureCoords =  new Vector2(1.0f, 1.0f) }, 
						new Vertex2D() { Position = new Vector2(minX, miny), TextureCoords =  new Vector2(0.0f, 1.0f) }, 
						new Vertex2D() { Position = new Vector2(maxX, maxY), TextureCoords = new Vector2(1.0f, 0.0f) },  
						new Vertex2D() { Position = new Vector2(minX, maxY), TextureCoords =  new Vector2(0.0f, 0.0f) } 
					});
					stream.Position = 0;

					m_Vertices = new SlimDX.Direct3D11.Buffer(GameEnvironment.Device, stream, new BufferDescription()
					{
						BindFlags = BindFlags.VertexBuffer,
						CpuAccessFlags = CpuAccessFlags.None,
						OptionFlags = ResourceOptionFlags.None,
						SizeInBytes = 4 * Marshal.SizeOf(typeof(Vertex2D)),
						Usage = ResourceUsage.Default
					});
				}

				m_VerticesBindings = new VertexBufferBinding(m_Vertices, Marshal.SizeOf(typeof(Vertex2D)), 0);

				m_Disposed = false;
			}
		}
开发者ID:RugCode,项目名称:drg-pt,代码行数:56,代码来源:ImposterFloatEffect.cs


示例12: SsaoBlurEffect

        public SsaoBlurEffect(Device device, string filename) : base(device, filename) {
            HorzBlurTech = FX.GetTechniqueByName("HorzBlur");
            VertBlurTech = FX.GetTechniqueByName("VertBlur");

            _texelWidth = FX.GetVariableByName("gTexelWidth").AsScalar();
            _texelHeight = FX.GetVariableByName("gTexelHeight").AsScalar();

            _normalDepthMap = FX.GetVariableByName("gNormalDepthMap").AsResource();
            _inputImage = FX.GetVariableByName("gInputImage").AsResource();
        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:10,代码来源:SsaoBlurEffect.cs


示例13: SsaoNormalDepthEffect

        public SsaoNormalDepthEffect(Device device, string filename) : base(device, filename) {
            NormalDepthTech = FX.GetTechniqueByName("NormalDepth");
            NormalDepthAlphaClipTech = FX.GetTechniqueByName("NormalDepthAlphaClip");

            _worldView = FX.GetVariableByName("gWorldView").AsMatrix();
            _worldInvTransposeView = FX.GetVariableByName("gWorldInvTransposeView").AsMatrix();
            _worldViewProj = FX.GetVariableByName("gWorldViewProj").AsMatrix();
            _texTransform = FX.GetVariableByName("gTexTransform").AsMatrix();
            _diffuseMap = FX.GetVariableByName("gDiffuseMap").AsResource();
        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:10,代码来源:SsaoNormalDepthEffect.cs


示例14: DebugTexEffect

        public DebugTexEffect(Device device, string filename) : base(device, filename) {
            ViewArgbTech = FX.GetTechniqueByName("ViewArgbTech");
            ViewRedTech = FX.GetTechniqueByName("ViewRedTech");
            ViewGreenTech = FX.GetTechniqueByName("ViewGreenTech");
            ViewBlueTech = FX.GetTechniqueByName("ViewBlueTech");
            ViewAlphaTech = FX.GetTechniqueByName("ViewAlphaTech");

            _texture = FX.GetVariableByName("gTexture").AsResource();
            _wvp = FX.GetVariableByName("gWorldViewProj").AsMatrix();
        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:10,代码来源:DebugTexEffect.cs


示例15: Blender

        protected Blender(IServiceProvider services, string effectAsset)
        {
            if (services == null)
                throw new ArgumentNullException("services");
            if (effectAsset == null)
                throw new ArgumentNullException("effectAsset");

            resourceManager = (ResourceManager) services.GetService(typeof (ResourceManager));
            renderer = (Renderer) services.GetService(typeof (Renderer));

            effect = resourceManager.Load<Effect>(effectAsset);
            effectTechnique = effect.GetTechniqueByName(BlenderTechniqueName);
        }
开发者ID:TheProjecter,项目名称:romantiquex,代码行数:13,代码来源:Blender.cs


示例16: InstancedNormalMapEffect

        public InstancedNormalMapEffect(Device device, string filename) : base(device, filename) {
            Light1Tech = FX.GetTechniqueByName("Light1");
            Light3TexTech = FX.GetTechniqueByName("Light3Tex");

            _viewProj = FX.GetVariableByName("gViewProj").AsMatrix();
            _texTransform = FX.GetVariableByName("gTexTransform").AsMatrix();
            _eyePosW = FX.GetVariableByName("gEyePosW").AsVector();

            _dirLights = FX.GetVariableByName("gDirLights");
            _mat = FX.GetVariableByName("gMaterial");
            _diffuseMap = FX.GetVariableByName("gDiffuseMap").AsResource();
            _normalMap = FX.GetVariableByName("gNormalMap").AsResource();
        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:13,代码来源:InstancedNormalMapEffect.cs


示例17: ForwardLightingEffect

        public ForwardLightingEffect(Device device, string filename)
            : base(device, filename) {

            Ambient = FX.GetTechniqueByName("Ambient");

            _worldViewProj = FX.GetVariableByName("WorldViewProjection").AsMatrix();
            _world = FX.GetVariableByName("World").AsMatrix();
            _worldInvTranspose = FX.GetVariableByName("gWorldInvTranspose").AsMatrix();

            _ambientDown = FX.GetVariableByName("AmbientDown").AsVector();
            _ambientRange = FX.GetVariableByName("AmbientRange").AsVector();

            _diffuseMap = FX.GetVariableByName("DiffuseTexture").AsResource();
        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:14,代码来源:ForwardLightingEffect.cs


示例18: LoadResources

		public override void LoadResources()
		{
			if (m_Disposed == true)
			{
				m_Effect = new Effect(GameEnvironment.Device, Bytecode); // Helper.ResolvePath(m_ShaderLocation), "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
				m_Technique = m_Effect.GetTechniqueByName("BlurBilinear");

				m_Pass_Gaussian = m_Technique.GetPassByName("Gaussian");

				m_SourceTex = m_Effect.GetVariableByName("g_SourceTex").AsResource();
				m_GWeights = m_Effect.GetVariableByName("g_GWeights").AsScalar();

				//m_ElementCount = 1 + GAUSSIAN_MAX_SAMPLES;
				m_DataStride = Marshal.SizeOf(typeof(Vector2)) * (1 + GAUSSIAN_MAX_SAMPLES);

				InputElement[] IADesc = new InputElement[1 + (GAUSSIAN_MAX_SAMPLES / 2)];

				IADesc[0] = new InputElement()
				{
					SemanticName = "POSITION",
					SemanticIndex = 0,
					AlignedByteOffset = 0,
					Slot = 0,
					Classification = InputClassification.PerVertexData,
					Format = Format.R32G32_Float
				};


				for (int i = 1; i < 1 + (GAUSSIAN_MAX_SAMPLES / 2); i++)
				{
					IADesc[i] = new InputElement()
					{
						SemanticName = "TEXCOORD",
						SemanticIndex = i - 1,
						AlignedByteOffset = 8 + (i - 1) * 16,
						Slot = 0,
						Classification = InputClassification.PerVertexData,
						Format = Format.R32G32B32A32_Float
					};
				}

				// Real number of "sematinc based" elements
				//m_ElementCount = 1 + GAUSSIAN_MAX_SAMPLES / 2;

				EffectPassDescription PassDesc = m_Pass_Gaussian.Description;
				m_Layout = new InputLayout(GameEnvironment.Device, PassDesc.Signature, IADesc);

				m_Disposed = false;
			}
		}
开发者ID:RugCode,项目名称:drg-pt,代码行数:50,代码来源:BloomEffect.cs


示例19: EffectDescription

        public EffectDescription(string filename)
        {
            this.filename = filename;
            instanceParameters = new SortedList<string, InstanceParameter>();
            staticParameters = new SortedList<string, SharedParameter>();
            dynamicParameters = new SortedList<string, SharedParameter>();

            effect = EffectManager.LoadEffect(Global.FXPath + filename);

            if (effect == null)
                Application.Exit();
            else
                technique = effect.GetTechniqueByIndex(0);
        }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:14,代码来源:EffectDescription.cs


示例20: TreeSpriteEffect

        public TreeSpriteEffect(Device device, string filename) : base(device, filename) {
            Light3Tech = FX.GetTechniqueByName("Light3");
            Light3TexAlphaClipTech = FX.GetTechniqueByName("Light3TexAlphaClip");
            Light3TexAlphaClipFogTech = FX.GetTechniqueByName("Light3TexAlphaClipFog");

            _viewProj = FX.GetVariableByName("gViewProj").AsMatrix();
            _eyePosW = FX.GetVariableByName("gEyePosW").AsVector();
            _fogColor = FX.GetVariableByName("gFogColor").AsVector();
            _fogStart = FX.GetVariableByName("gFogStart").AsScalar();
            _fogRange = FX.GetVariableByName("gFogRange").AsScalar();
            _dirLights = FX.GetVariableByName("gDirLights");
            _mat = FX.GetVariableByName("gMaterial");
            _treeTextureMapArray = FX.GetVariableByName("gTreeMapArray").AsResource();
        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:14,代码来源:TreeSpriteEffect.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EffectType类代码示例发布时间:2022-05-24
下一篇:
C# EffectNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap