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


C# Light.ApplyEffectParams方法代码示例

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


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

示例1: Render

        public void Render(Light light)
        {
            EffectTechnique fxTech = light.ApplyEffectParams(this);

            Matrix wvp;
            Matrix.Multiply(ref light.LocalToWorld, ref _engine.Camera.ViewProjection, out wvp);

            _engine.Device.DepthStencilState = DepthStencilState.None;
            //_engine.Device.DepthStencilState = light.ShadowType == ShadowType.Occluded
            //    ? _dssOccludedLight
            //    : DepthStencilState.None;
            _engine.Device.BlendState = _bsLight;
            _engine.Device.RasterizerState = _engine.Rs;
            _engine.Device.SetVertexArrayObject(_quadVao);
            _fxLightParamWvp.SetValue(wvp);
            fxTech.Passes[0].Apply();
            _engine.Device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, _quadVao.VertexCount - 2);

            if (_engine.Debug)
            {
                _engine.Device.BlendState = BlendState.Opaque;
                _engine.Device.RasterizerState = _engine.RsDebug;

                // Draw debug quad.
                //const float factor = 0.41f;
                //wvp.M11 = wvp.M11 * factor;
                //wvp.M22 = wvp.M22 * factor;

                //_fxLightParamWvp.SetValue(wvp);
                //_fxDebugLightTech.Passes[0].Apply();
                //_engine.Device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, _quadVao.VertexCount - 2);

                Matrix world = Matrix.Identity;
                // Scaling.
                world.M11 = light.Radius;
                world.M22 = light.Radius;
                // Translation.
                world.M41 = light.Position.X;
                world.M42 = light.Position.Y;
                Matrix.Multiply(ref world, ref _engine.Camera.ViewProjection, out wvp);

                _engine.Device.SetVertexArrayObject(_circleVao);
                _fxLightParamWvp.SetValue(wvp);
                _fxDebugLightTech.Passes[0].Apply();
                _engine.Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, _circleVao.VertexCount, 0, _circleVao.IndexCount / 3);
            }
        }
开发者ID:infinitespace-studios,项目名称:penumbra,代码行数:47,代码来源:LightRenderer.cs


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