Ejemplo n.º 1
0
 public void Dispose()
 {
     Scene = null;
     BackImage.ForEach(b => b.Dispose());
     BackImage = null;
     Material.ForEach(m => m.Dispose());
     Material = null;
     Object.ForEach(o => o.Dispose());
     Object = null;
 }
Ejemplo n.º 2
0
 public void Dispose()
 {
     Scene = null;
     BackImage.ForEach(b => b.Dispose());
     BackImage = null;
     Material.ForEach(m => m.Dispose());
     Material = null;
     Object.ForEach(o => o.Dispose());
     Object = null;
 }
Ejemplo n.º 3
0
 private bool parse(TextReader tr, bool triangle_only = false)
 {
     try
     {
         if (!parseHeader(tr)) return false;
         string str;
         while ((str = tr.ReadLine()) != null)
         {
             str = str.Trim();
             if (str.StartsWith("Eof")) return true;
             if (str.StartsWith("Scene"))
             {
                 Scene = new MQOScene();
                 if (!Scene.parse(tr)) return false;
                 continue;
             }
             if (str.StartsWith("BackImage"))
             {
                 if (!parseBackImage(tr)) return false;
                 continue;
             }
             if (str.StartsWith("Material"))
             {
                 if (!parseMaterial(tr)) return false;
                 continue;
             }
             if (str.StartsWith("Object"))
             {
                 Match m = MQORegex.Object.Match(str);
                 if (!m.Success) return false;
                 MQOObject mo = new MQOObject(m.Groups[1].Value);
                 if (!mo.parse(tr, triangle_only)) { mo.Dispose(); mo = null; return false; }
                 Object.Add(mo);
                 continue;
             }
             // unknown block
             if (str.EndsWith("{"))
             {
                 if (!skipBlock(tr)) return false;
                 continue;
             }
             // unknown line
         }
         // "Eof"行が出現する前に終端に達した場合
         return false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(),"エラー",MessageBoxButtons.OK,MessageBoxIcon.Error);
         return false;
     }
 }
Ejemplo n.º 4
0
 private bool parse(TextReader tr, bool triangle_only = false)
 {
     try
     {
         if (!parseHeader(tr))
         {
             return(false);
         }
         string str;
         while ((str = tr.ReadLine()) != null)
         {
             str = str.Trim();
             if (str.StartsWith("Eof"))
             {
                 return(true);
             }
             if (str.StartsWith("Scene"))
             {
                 Scene = new MQOScene();
                 if (!Scene.parse(tr))
                 {
                     return(false);
                 }
                 continue;
             }
             if (str.StartsWith("BackImage"))
             {
                 if (!parseBackImage(tr))
                 {
                     return(false);
                 }
                 continue;
             }
             if (str.StartsWith("Material"))
             {
                 if (!parseMaterial(tr))
                 {
                     return(false);
                 }
                 continue;
             }
             if (str.StartsWith("Object"))
             {
                 Match m = MQORegex.Object.Match(str);
                 if (!m.Success)
                 {
                     return(false);
                 }
                 MQOObject mo = new MQOObject(m.Groups[1].Value);
                 if (!mo.parse(tr, triangle_only))
                 {
                     mo.Dispose(); mo = null; return(false);
                 }
                 Object.Add(mo);
                 continue;
             }
             // unknown block
             if (str.EndsWith("{"))
             {
                 if (!skipBlock(tr))
                 {
                     return(false);
                 }
                 continue;
             }
             // unknown line
         }
         // "Eof"行が出現する前に終端に達した場合
         return(false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
 }