本文整理汇总了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);
}
}