示例#1
0
        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);
            }
        }
示例#2
0
 public PPtr(PPtr <T> copy)
 {
     FileIndex = copy.FileIndex;
     PathID    = copy.PathID;
 }
 protected EditorExtension(AssetInfo assetInfo) :
     base(assetInfo)
 {
     PrefabInternal = new PPtr <Prefab>();
 }