本文整理汇总了C#中Stage.GetLights方法的典型用法代码示例。如果您正苦于以下问题:C# Stage.GetLights方法的具体用法?C# Stage.GetLights怎么用?C# Stage.GetLights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stage
的用法示例。
在下文中一共展示了Stage.GetLights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public RenderTarget Render(Stage stage, Camera camera)
{
if (!HandlesInitialized)
{
InitializeHandles();
HandlesInitialized = true;
}
RenderedLights = 0;
// Init common matrices
Matrix4 view, projection;
camera.GetViewMatrix(out view);
camera.GetProjectionMatrix(out projection);
// Render scene to GBuffer
var clearColor = stage.ClearColor;
clearColor.W = 0;
Backend.ProfileBeginSection(Profiler.GBuffer);
Backend.BeginPass(GBuffer, clearColor, true);
RenderScene(stage, camera, ref view, ref projection);
Backend.EndPass();
Backend.ProfileEndSection(Profiler.GBuffer);
// Render light accumulation
Backend.ProfileBeginSection(Profiler.Lighting);
Backend.BeginPass(LightAccumulation, new Vector4(0.0f, 0.0f, 0.0f, 1.0f), true);
RenderAmbientLight(stage);
RenderLights(camera, ref view, ref projection, stage.GetLights(), stage);
Backend.EndPass();
Backend.ProfileEndSection(Profiler.Lighting);
var currentRenderTarget = Temporary;
var currentSource = LightAccumulation;
if (FogSettings.Enable)
{
Backend.BeginPass(currentRenderTarget, new Vector4(0.0f, 0.0f, 0.0f, 1.0f), false);
Backend.BeginInstance(FogShader.Handle, new int[] { currentSource.Textures[0].Handle, GBuffer.Textures[2].Handle }, new int[] { Backend.DefaultSamplerNoFiltering, Backend.DefaultSamplerNoFiltering }, LightAccumulatinRenderState);
Backend.BindShaderVariable(FogParams.SamplerScene, 0);
Backend.BindShaderVariable(FogParams.SamplerGBuffer2, 1);
Backend.BindShaderVariable(FogParams.FogStart, FogSettings.Start);
Backend.BindShaderVariable(FogParams.FogEnd, FogSettings.End);
Backend.BindShaderVariable(FogParams.FogColor, ref FogSettings.Color);
Vector2 screenSize = new Vector2(LightAccumulation.Width, LightAccumulation.Height);
Backend.BindShaderVariable(FogParams.ScreenSize, ref screenSize);
Backend.DrawMesh(QuadMesh.MeshHandle);
Backend.EndPass();
var tmp = currentRenderTarget;
currentRenderTarget = currentSource;
currentSource = tmp;
}
Backend.BeginPass(Output, new Vector4(0.0f, 0.0f, 0.0f, 1.0f), false);
Backend.BeginInstance(CombineShader.Handle, new int[] { currentSource.Textures[0].Handle }, new int[] { Backend.DefaultSamplerNoFiltering }, LightAccumulatinRenderState);
Backend.BindShaderVariable(CombineParams.SamplerLight, 0);
Backend.DrawMesh(QuadMesh.MeshHandle);
Backend.EndPass();
return Output;
}