Example #1
0
        public void Initialize(IExportContainer container, byte[] pvsData, EngineGUID guid,
                               IReadOnlyList <PPtr <Renderer> > renderers, IReadOnlyList <PPtr <OcclusionPortal> > portals)
        {
            m_PVSData = pvsData;
            OcclusionScene scene = new OcclusionScene(guid, renderers.Count, portals.Count);

            m_scenes = new OcclusionScene[] { scene };
            SetIDs(container, guid, renderers, portals);
        }
Example #2
0
 static EngineGUID()
 {
     MissingReference = new EngineGUID
     {
         Data0 = 0xD0000000,
         Data1 = 0x5DEADF00,
         Data2 = 0xEADBEEF1,
         Data3 = 0x0000000D
     };
 }
Example #3
0
        public void SetIDs(IExportContainer container,
                           EngineGUID 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);
            }
        }