Example #1
0
        public static OBJData LoadOBJ(Stream lStream)
        {
            OBJLoader.m_OBJData         = new OBJData();
            OBJLoader.m_CurrentMaterial = null;
            OBJLoader.m_CurrentGroup    = null;
            StreamReader    streamReader = new StreamReader(lStream);
            Action <string> action       = null;

            while (!streamReader.EndOfStream)
            {
                string text = streamReader.ReadLine();
                if (!StringExt.IsNullOrWhiteSpace(text) && text[0] != '#')
                {
                    string[] array = text.Trim().Split(null, 2);
                    if (array.Length >= 2)
                    {
                        string text2 = array[0].Trim();
                        string obj   = array[1].Trim();
                        action = null;
                        OBJLoader.m_ParseOBJActionDictionary.TryGetValue(text2.ToLowerInvariant(), out action);
                        if (action != null)
                        {
                            action(obj);
                        }
                    }
                }
            }
            OBJData oBJData = OBJLoader.m_OBJData;

            OBJLoader.m_OBJData = null;
            return(oBJData);
        }