Описание
Флаги для настройки операции отбраковки в Scriptable Render Pipeline.
Unity устанавливает для некоторых флагов CullingOptions значения по умолчанию, а другие — в зависимости от свойств Камеры из который вы получили структуру ScriptableCullingParameters. Вы можете переопределить эти значения перед выполнением операции отбраковки.
В следующем примере показано, как получить объект ScriptableCullingParameters из камеры, отключить отбраковку окклюзии для объекта ScriptableCullingParameters, сняв флаг CullingOptions.OcclusionCull, а затем использовать объект ScriptableCullingParameters в операции отбраковки.
using UnityEngine;
using UnityEngine.Rendering;
public class ExampleRenderPipelineInstance : RenderPipeline
{
public ExampleRenderPipelineInstance()
{
}
protected override void Render(ScriptableRenderContext context, Camera[] cameras)
{
// Get the culling parameters from the desired Camera
if (cameras[0].TryGetCullingParameters(out var cullingParameters))
{
// Disable occlusion culling
cullingParameters.cullingOptions &= ~CullingOptions.OcclusionCull;
// Schedule the cull operation
CullingResults cullingResults = context.Cull(ref cullingParameters);
// Place code that schedules drawing operations using the CullingResults struct here
// See ScriptableRenderContext.DrawRenderers for details and examples
// …
// Execute all of the scheduled operations, in order
context.Submit();
}
}
}
Смотрите так же: ScriptableRenderContext.Cull, Camera.