Esempio n. 1
0
        public void ParseDotScene(String SceneName, String groupName, SceneManager yourSceneMgr, SceneNode pAttachNode, String sPrependNode)
        {
            //Mogre.Root root = new Mogre.Root();
            if (groupName == null)
                groupName = "General";// Mogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME;

            // set up shared object values
            m_sGroupName = groupName;
            mSceneMgr = yourSceneMgr;
            m_sPrependNode = sPrependNode;
            this.StaticObjects = new List<string>();
            this.DynamicObjects = new List<string>();

            XmlDocument XMLDoc = null;
            XmlElement XMLRoot;

            System.IO.StreamReader sreader = System.IO.File.OpenText(SceneName);
            string data = sreader.ReadToEnd();

            //Mogre.StringVectorPtr vectorPtr = Mogre.ResourceGroupManager.Singleton.ListResourceNames(Mogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
            //for (int i = 0; i < vectorPtr.Count; i++)
            //{
            //    m_log.Info("res: " + vectorPtr[i]);
            //}
            string path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            if(path.StartsWith("file:\\"))
            {
                path = path.Replace("file:\\", "");
            }
            //Mogre.ResourceGroupManager.Singleton.AddResourceLocation(path,"FileSystem", "General");
            //Mogre.DataStreamPtr pStream = Mogre.ResourceGroupManager.Singleton.OpenResource(SceneName, groupName);

            //String data = pStream.AsString;
            // Open the .scene File
            XMLDoc = new XmlDocument();
            XMLDoc.LoadXml(data);
            //pStream.Close();

            // Validate the File
            XMLRoot = XMLDoc.DocumentElement;
            if (XMLRoot.Name != "scene")
            {
                m_log.Error("[DotSceneLoader] Error: Invalid .scene File. Missing <scene>");
                return;
            }

            // figure out where to attach any nodes we create
            mAttachNode = pAttachNode;
            if (mAttachNode == null)
                mAttachNode = mSceneMgr.RootSceneNode;

            // Process the scene
            processScene(XMLRoot);
        }
Esempio n. 2
0
 public void ParseDotScene(String SceneName, String groupName, SceneManager yourSceneMgr, SceneNode pAttachNode)
 {
     ParseDotScene(SceneName, groupName, yourSceneMgr, pAttachNode, "");
 }
Esempio n. 3
0
 public void ParseDotScene(String SceneName, String groupName, SceneManager yourSceneMgr)
 {
     ParseDotScene(SceneName, groupName, yourSceneMgr, null, "");
 }