Ejemplo n.º 1
0
Archivo: Asset.cs Proyecto: yooyke/work
        public static AssetIrrMemory GetIrrScene(string url, string auth, string filename)
        {
            AssetBase irrfile = Get(url, auth, filename);
            AssetIrrMemory irrs = new AssetIrrMemory(irrfile);

            Irr.Parser parser = new OxViewer.Irr.Parser();
            MemoryStream ms = new MemoryStream(irrfile.Data);
            parser.Run(ms);

            if (parser.Scene == null)
                return irrs;

            Irr.IrrNode[] nodes = parser.Scene.GetNodes();
            if (nodes.Length == 0)
                return irrs;

            List<string> list = new List<string>();

            foreach (Irr.IrrNode node in nodes)
            {
                string[] a = node.GetAssets();
                if (a == null || a.Length == 0)
                    continue;

                foreach (string m in a)
                {
                    if (list.Contains(m))
                        continue;

                    list.Add(m);
                }
            }

            if (list.Count == 0)
                return irrs;

            foreach (string asset in list)
            {
                AssetBase ab = Get(url, auth, asset);
                irrs.AddMaterial(ab);
            }

            return irrs;
        }
Ejemplo n.º 2
0
Archivo: Asset.cs Proyecto: yooyke/work
        public static AssetIrrFile LoadIrrScene(string path)
        {
            AssetIrrFile irrs = new AssetIrrFile(path);
            Irr.Parser parser = new OxViewer.Irr.Parser();
            parser.Run(path);

            if (parser.Scene == null)
                return irrs;

            Irr.IrrNode[] nodes = parser.Scene.GetNodes();
            if (nodes.Length == 0)
                return irrs;

            List<string> list = new List<string>();

            foreach (Irr.IrrNode node in nodes)
            {
                string[] a = node.GetAssets();
                if (a == null || a.Length == 0)
                    continue;

                foreach (string m in a)
                {
                    if (list.Contains(m))
                        continue;

                    list.Add(m);
                }
            }

            if (list.Count == 0)
                return irrs;

            foreach (string asset in list)
            {
                irrs.AddMaterial(asset);
            }

            return irrs;
        }