예제 #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;
 }
예제 #2
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);
        }
예제 #3
0
 private static void PushOBJMaterial(string lMaterialName)
 {
     OBJLoader.m_CurrentMaterial = new OBJMaterial(lMaterialName);
     OBJLoader.m_OBJData.m_Materials.Add(OBJLoader.m_CurrentMaterial);
 }
예제 #4
0
 private static void PushOBJMaterial(string lMaterialName)
 {
     OBJLoader.m_CurrentMaterial = new OBJMaterial(lMaterialName);
     OBJLoader.m_OBJData.m_Materials.Add(OBJLoader.m_CurrentMaterial);
 }