Пример #1
0
        public override void GetObjectProperties(Mogre.NameValuePairList retList)
        {
            retList.Clear();
            retList["Name"]             = this.name;
            retList["SceneManagerType"] = SceneMangerType;
            retList["Ambient"]          = Mogre.StringConverter.ToString(this.ambient);
            retList["SkyBoxActive"]     = Mogre.StringConverter.ToString(this.skyBoxActive);
            retList["SkyBoxMaterial"]   = this.skyBoxMaterial;
            retList["SkyBoxDistance"]   = Mogre.StringConverter.ToString(this.skyBoxDistance);

            switch (this.fogMode)
            {
            case Mogre.FogMode.FOG_NONE:
                retList["FogMode"] = "None";
                break;

            case Mogre.FogMode.FOG_LINEAR:
                retList["FogMode"] = "Linear";
                break;

            case Mogre.FogMode.FOG_EXP:
                retList["FogMode"] = "Exp";
                break;

            case Mogre.FogMode.FOG_EXP2:
                retList["FogMode"] = "Exp2";
                break;
            }

            retList["FogColour"]  = Mogre.StringConverter.ToString(this.fogColour);
            retList["FogStart"]   = Mogre.StringConverter.ToString(this.fogStart);
            retList["FogEnd"]     = Mogre.StringConverter.ToString(this.fogEnd);
            retList["FogDensity"] = Mogre.StringConverter.ToString(this.fogDensity);
        }
Пример #2
0
 public override void GetObjectProperties(Mogre.NameValuePairList retList)
 {
     retList.Clear();
     retList["Name"]            = this.name;
     retList["Position"]        = Mogre.StringConverter.ToString(this.position);
     retList["Orientation"]     = Mogre.StringConverter.ToString(this.orientation);
     retList["Scale"]           = Mogre.StringConverter.ToString(this.scale);
     retList["AutoTrackTarget"] = this.autoTrackTarget;
 }
Пример #3
0
 public override void GetObjectProperties(Mogre.NameValuePairList retList)
 {
     retList.Clear();
     retList["Name"]         = Name;
     retList["Position"]     = Mogre.StringConverter.ToString(Position);
     retList["Orientation"]  = Mogre.StringConverter.ToString(Orientation);
     retList["ClipDistance"] = Mogre.StringConverter.ToString(ClipDistance);
     retList["FOV"]          = Mogre.StringConverter.ToString(FOV);
 }
Пример #4
0
        public void AfterLoadScene()
        {
            CreateGizmo();
            GizmoMode = EditorTools.Select;
            ViewportEditor.ResetCommonValues();

            if (ActiveViewport == null)
            {
                Mogre.NameValuePairList parameters = new Mogre.NameValuePairList();
                parameters.Clear();
                parameters["Name"]   = "Viewport1";
                parameters["Colour"] = "0 0 0";
                parameters["Index"]  = "1";
                ActiveViewport       = CreateEditorObject(null, "Viewport Object", parameters, false, false) as ViewportEditor;
            }

            system.UpdateLoadProgress(60, "Loading scene objects");

            this.rootEditor.Load();
            this.rootEditor.LoadAllChildren();

            if (SceneUpdated != null)
            {
                SceneUpdated(this, new SceneUpdatedEventArgs(SceneManager, ActiveViewport.CameraEditor.Camera, RenderTarget));
            }
            SceneUpdated = null;

            FillTreeView();

            system.UpdateLoadProgress(100, "Rendering...");

            IsSceneLoaded   = true;
            IsSceneModified = false;

            if (SceneLoaded != null)
            {
                SceneLoaded(this, EventArgs.Empty);
            }
        }
Пример #5
0
        public override SceneFileResult Import(string importFile)
        {
            MogitorsRoot   mogRoot = MogitorsRoot.Instance;
            MogitorsSystem system  = MogitorsSystem.Instance;

            if (importFile == "")
            {
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "";
                dlg.DefaultExt = ".mogscene";
                dlg.Filter     = "Mogitor Scene File (.mogscene)|*.mogscene";
                Nullable <bool> result = dlg.ShowDialog();
                if (result != true)
                {
                    return(SceneFileResult.Cancel);
                }
                importFile = dlg.FileName;
            }

            string filePath = system.ExtractFilePath(importFile);
            string fileName = system.ExtractFileName(importFile);

            XmlTextReader textReader = new XmlTextReader(importFile);

            system.UpdateLoadProgress(5, "Loading scene objects");

            if (!textReader.ReadToFollowing("MogitorScene"))
            {
                return(SceneFileResult.ErrParse);
            }

            // Check version
            string fileVersion = textReader.GetAttribute("Version");

            if (fileVersion != null)
            {
                if (int.Parse(fileVersion) != 1)
                {
                    return(SceneFileResult.ErrParse);
                }
            }

            // Read project options
            if (textReader.ReadToFollowing("ProjectOptions") == true)
            {
                system.UpdateLoadProgress(15, "Parsing project options");
                mogRoot.LoadProjectOptions(textReader);

                mogRoot.ProjectOptions.ProjectDir  = filePath;
                mogRoot.ProjectOptions.ProjectName = fileName;

                mogRoot.PrepareProjectResources();
            }

            //// Moves the reader back to the "MogitorScene" element node.
            //textReader.MoveToElement();

            system.UpdateLoadProgress(30, "Creating scene objects");

            // Load objects
            Mogre.NameValuePairList param = new Mogre.NameValuePairList();
            while (textReader.ReadToNextSibling("Object"))
            {
                string objectType = textReader.GetAttribute("Type");
                if (objectType == "")
                {
                    continue;
                }

                param.Clear();
                while (textReader.MoveToNextAttribute())
                {
                    param.Insert(textReader.Name, textReader.Value);
                }

                BaseEditor result = MogitorsRoot.Instance.CreateEditorObject(null, objectType, param, false, false);
            }

            mogRoot.AfterLoadScene();

            return(SceneFileResult.Ok);
        }
Пример #6
0
        public void AfterLoadScene()
        {
            CreateGizmo();
            GizmoMode = EditorTools.Select;
            ViewportEditor.ResetCommonValues();

            if (ActiveViewport == null)
            {
                Mogre.NameValuePairList parameters = new Mogre.NameValuePairList();
                parameters.Clear();
                parameters["Name"] = "Viewport1";
                parameters["Colour"] = "0 0 0";
                parameters["Index"] = "1";
                ActiveViewport = CreateEditorObject(null, "Viewport Object", parameters, false, false) as ViewportEditor;
            }

            system.UpdateLoadProgress(60, "Loading scene objects");

            this.rootEditor.Load();
            this.rootEditor.LoadAllChildren();

            if (SceneUpdated != null)
                SceneUpdated(this, new SceneUpdatedEventArgs(SceneManager, ActiveViewport.CameraEditor.Camera, RenderTarget));
            SceneUpdated = null;

            FillTreeView();

            system.UpdateLoadProgress(100, "Rendering...");

            IsSceneLoaded = true;
            IsSceneModified = false;

            if (SceneLoaded != null)
                SceneLoaded(this, EventArgs.Empty);
        }
        public override SceneFileResult Import(string importFile)
        {
            MogitorsRoot mogRoot = MogitorsRoot.Instance;
            MogitorsSystem system = MogitorsSystem.Instance;

            if (importFile == "")
            {
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName = "";
                dlg.DefaultExt = ".mogscene";
                dlg.Filter = "Mogitor Scene File (.mogscene)|*.mogscene";
                Nullable<bool> result = dlg.ShowDialog();
                if (result != true)
                {
                    return SceneFileResult.Cancel;
                }
                importFile = dlg.FileName;
            }

            string filePath = system.ExtractFilePath(importFile);
            string fileName = system.ExtractFileName(importFile);

            XmlTextReader textReader = new XmlTextReader(importFile);

            system.UpdateLoadProgress(5, "Loading scene objects");

            if (!textReader.ReadToFollowing("MogitorScene"))
                return SceneFileResult.ErrParse;

            // Check version
            string fileVersion = textReader.GetAttribute("Version");
            if (fileVersion != null)
            {
                if (int.Parse(fileVersion) != 1)
                    return SceneFileResult.ErrParse;
            }

            // Read project options
            if (textReader.ReadToFollowing("ProjectOptions") == true)
            {
                system.UpdateLoadProgress(15, "Parsing project options");
                mogRoot.LoadProjectOptions(textReader);

                mogRoot.ProjectOptions.ProjectDir = filePath;
                mogRoot.ProjectOptions.ProjectName = fileName;

                mogRoot.PrepareProjectResources();
            }

            //// Moves the reader back to the "MogitorScene" element node.
            //textReader.MoveToElement();

            system.UpdateLoadProgress(30, "Creating scene objects");

            // Load objects
            Mogre.NameValuePairList param = new Mogre.NameValuePairList();
            while (textReader.ReadToNextSibling("Object"))
            {
                string objectType = textReader.GetAttribute("Type");
                if (objectType == "")
                    continue;

                param.Clear();
                while (textReader.MoveToNextAttribute())
                {
                    param.Insert(textReader.Name, textReader.Value);
                }

                BaseEditor result = MogitorsRoot.Instance.CreateEditorObject(null, objectType, param, false, false);
            }

            mogRoot.AfterLoadScene();

            return SceneFileResult.Ok;
        }
Пример #8
0
 public virtual void GetObjectProperties(Mogre.NameValuePairList retList)
 {
     retList.Clear();
     retList["Name"] = Name;
 }
Пример #9
0
 public override void GetObjectProperties(Mogre.NameValuePairList retList)
 {
     retList.Clear();
     retList["Name"] = this.name;
 }