Skip to content

Commit

Permalink
Fix #68: any material preview in URP tries to render splats
Browse files Browse the repository at this point in the history
  • Loading branch information
aras-p committed Nov 9, 2023
1 parent 58715c6 commit 8f5ab54
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package/Runtime/GaussianSplatURPFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData
}

GSRenderPass m_Pass;
bool m_HasCamera;

public override void Create()
{
Expand All @@ -67,16 +68,20 @@ public override void Create()

public override void OnCameraPreCull(ScriptableRenderer renderer, in CameraData cameraData)
{
m_HasCamera = false;
var system = GaussianSplatRenderSystem.instance;
if (!system.GatherSplatsForCamera(cameraData.camera))
return;

CommandBuffer cmb = system.InitialClearCmdBuffer(cameraData.camera);
m_Pass.m_Cmb = cmb;
m_HasCamera = true;
}

public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
if (!m_HasCamera)
return;
m_Pass.m_Renderer = renderer;
renderer.EnqueuePass(m_Pass);
}
Expand Down

0 comments on commit 8f5ab54

Please sign in to comment.