private void SetIDs(IExportContainer container, OcclusionCullingSettings cullingSetting, OcclusionScene scene) { for (int i = 0; i < cullingSetting.StaticRenderers.Count; i++) { PPtr <Renderer> prenderer = cullingSetting.StaticRenderers[i]; Renderer renderer = prenderer.FindAsset(cullingSetting.File); m_staticRenderers[scene.IndexRenderers + i] = CreateObjectID(container, renderer); } for (int i = 0; i < cullingSetting.Portals.Count; i++) { PPtr <OcclusionPortal> pportal = cullingSetting.Portals[i]; OcclusionPortal portal = pportal.FindAsset(cullingSetting.File); m_portals[scene.IndexPortals + i] = CreateObjectID(container, portal); } }
public void SetIDs(IExportContainer container, UtinyGUID guid, IReadOnlyList <PPtr <Renderer> > renderers, IReadOnlyList <PPtr <OcclusionPortal> > portals) { if (m_staticRenderers.Length == 0 && renderers.Count != 0 || m_portals.Length == 0 && portals.Count != 0) { int maxRenderer = Scenes.Max(j => j.IndexRenderers); OcclusionScene rscene = Scenes.First(t => t.IndexRenderers == maxRenderer); m_staticRenderers = new SceneObjectIdentifier[rscene.IndexRenderers + rscene.SizeRenderers]; int maxPortal = Scenes.Max(j => j.IndexPortals); OcclusionScene pscene = Scenes.First(t => t.IndexPortals == maxPortal); m_portals = new SceneObjectIdentifier[pscene.IndexPortals + pscene.SizePortals]; } OcclusionScene curScene = Scenes.First(t => t.Scene == guid); if (curScene.SizeRenderers != renderers.Count) { throw new Exception($"Scene renderer count {curScene.SizeRenderers} doesn't match with given {renderers.Count}"); } if (curScene.SizePortals != portals.Count) { throw new Exception($"Scene portal count {curScene.SizeRenderers} doesn't match with given {renderers.Count}"); } for (int i = 0; i < renderers.Count; i++) { PPtr <Renderer> prenderer = renderers[i]; Renderer renderer = prenderer.FindObject(container); m_staticRenderers[curScene.IndexRenderers + i] = CreateObjectID(container, renderer); } m_portals = new SceneObjectIdentifier[portals.Count]; for (int i = 0; i < portals.Count; i++) { PPtr <OcclusionPortal> pportal = portals[i]; OcclusionPortal portal = pportal.FindObject(container); m_portals[i] = CreateObjectID(container, portal); } }