本文整理汇总了C#中Quad.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Quad.Draw方法的具体用法?C# Quad.Draw怎么用?C# Quad.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quad
的用法示例。
在下文中一共展示了Quad.Draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreDepth
public static void RestoreDepth(Renderer renderer, Quad quad, Material restoreDepth, bool clearDepth = true)
{
// work arround for a bug in xna 4.0
renderer.Device.SamplerStates[0] = SamplerState.LinearClamp;
renderer.Device.SamplerStates[0] = SamplerState.PointClamp;
if (clearDepth)
renderer.Device.Clear(ClearOptions.DepthBuffer, Color.Transparent, 1, 0);
renderer.Device.DepthStencilState = DepthStencilState.Default;
renderer.Device.BlendState = BlendState.Additive;
quad.Draw(restoreDepth, renderer.Data);
}
示例2: PerformLightingPass
internal static void PerformLightingPass(Renderer renderer, bool ssao, Quad quad, Material restoreDepth, Material copyTexture, IReadOnlyList<IDirectLight> directLights, IReadOnlyList<IIndirectLight> indirectLights, out RenderTarget2D directLightBuffer, out RenderTarget2D indirectLightBuffer)
{
//Get some handy objects
var device = renderer.Device;
var resolution = renderer.Data.GetValue(new TypedName<Vector2>("resolution"));
var width = (int)resolution.X;
var height = (int)resolution.Y;
//Enable or disable SSAO
renderer.Data.Set("ssao", ssao);
// prepare direct lights
for (int i = 0; i < directLights.Count; i++)
directLights[i].Prepare(renderer);
// set and clear direct light buffer
directLightBuffer = RenderTargetManager.GetTarget(device, width, height, SurfaceFormat.HdrBlendable, DepthFormat.Depth24Stencil8);
device.SetRenderTarget(directLightBuffer);
device.Clear(Color.Transparent);
// work around for a bug in xna 4.0
renderer.Device.SamplerStates[0] = SamplerState.LinearClamp;
renderer.Device.SamplerStates[0] = SamplerState.PointClamp;
// set render states to draw opaque geometry
device.BlendState = BlendState.Opaque;
device.DepthStencilState = DepthStencilState.Default;
// restore depth
quad.Draw(restoreDepth, renderer.Data);
// set render states to additive blend
device.BlendState = BlendState.Additive;
// draw direct lights
foreach (IDirectLight light in directLights)
light.Draw(renderer);
// prepare indirect lights
for (int i = 0; i < indirectLights.Count; i++)
indirectLights[i].Prepare(renderer);
// set and clear indirect light buffer
indirectLightBuffer = RenderTargetManager.GetTarget(device, width, height, SurfaceFormat.HdrBlendable, DepthFormat.Depth24Stencil8);
device.SetRenderTarget(indirectLightBuffer);
device.Clear(Color.Transparent);
//draw indirect lights
foreach (IIndirectLight light in indirectLights)
light.Draw(renderer);
// blend direct lighting into the indirect light buffer
copyTexture.Parameters["Texture"].SetValue(directLightBuffer);
quad.Draw(copyTexture, renderer.Data);
}