public AutoSplatTerrainDisplay(WorldTerrain parent, WorldEditor worldEditor, XmlReader r)
        {
            this.parent = parent;
            this.app = worldEditor;

            FromXml(r);
        }
        public AlphaSplatTerrainDisplay(WorldTerrain parent, WorldEditor worldEditor, XmlReader r)
        {
            this.parent = parent;
            this.app    = worldEditor;

            FromXml(r);
        }
Ejemplo n.º 3
0
        public WorldRoot(String worldName, MultiSelectTreeView tree, WorldEditor worldEditor)
        {
            instance = this;
            name     = worldName;
            treeView = tree;
            app      = worldEditor;

            worldTerrain     = new WorldTerrain(app);
            ocean            = new Ocean(this, app);
            skybox           = new Skybox(this, app);
            fog              = new GlobalFog(this, app);
            ambientLight     = new GlobalAmbientLight(this, app);
            directionalLight = new GlobalDirectionalLight(this, app);
            worldCollections = new List <WorldObjectCollection>();
            pathObjectTypes  = new PathObjectTypeContainer(this, app);
        }
Ejemplo n.º 4
0
        protected void FromXml(XmlReader r, bool loadCollections)
        {
            string filename = "";
            string baseName = worldFilePath.Substring(0, worldFilePath.LastIndexOf('\\'));
            bool loadColl = loadCollections;

            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);
                switch (r.Name)
                {
                    case "Name":
                        name = r.Value;
                        break;
                }
            }
            r.MoveToElement();

            while (r.Read())
            {
                // look for the start of an element
                if (r.NodeType == XmlNodeType.Whitespace)
                {
                    continue;
                }
                if (r.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (r.NodeType == XmlNodeType.Element)
                {
                    switch (r.Name)
                    {
                        case "CameraPosition":
                            cameraPosition = XmlHelperClass.ParseVectorAttributes(r);
                            break;
                        case "CameraOrientation":
                            cameraOrientation = XmlHelperClass.ParseQuaternion(r);
                            break;
                        case "Terrain":
                            worldTerrain = new WorldTerrain(app, r);
                            break;
                        case "TerrainDisplay":
                            worldTerrain.DisplayParamsFromXml(r);
                            break;
                        case "Ocean":
                            ocean = new Ocean(this, app, r);
                            break;
                        case "Skybox":
                            skybox = new Skybox(this, app, r);
                            break;
                        case "GlobalFog":
                            fog = new GlobalFog(this, app, r);
                            break;
                        case "GlobalAmbientLight":
                            ambientLight = new GlobalAmbientLight(this, app, app.Scene, r);
                            break;
                        case "GlobalDirectionalLight":
                            directionalLight = new GlobalDirectionalLight(this, app, r);
                            break;
                        case "PathObjectTypes":
                            pathObjectTypes = new PathObjectTypeContainer(app, this, r);
                            break;
                        case "WorldCollection":
                            string collectionName = null;
                            filename = "";
                            for (int i = 0; i < r.AttributeCount; i++)
                            {
                                r.MoveToAttribute(i);
                                switch (r.Name)
                                {
                                    case "Name":
                                        collectionName = r.Value;
                                        break;
                                    case "Filename":
                                        filename = r.Value;
                                        break;
                                }
                            }
                            string filepath = String.Format("{0}\\{1}", baseName, filename);
                            if (filename != "")
                            {
                                if (filename.EndsWith("~.mwc"))
                                {
                                    string autofilepath = String.Format("{0}\\{1}", baseName, filename);
                                    string normalfilepath = String.Format("{0}\\{1}", baseName, filename.Remove(filename.LastIndexOf("~"), 1));
                                    if ((File.Exists(autofilepath) && File.Exists(normalfilepath) &&
                                        (new FileInfo(autofilepath)).LastWriteTime < (new FileInfo(normalfilepath).LastWriteTime))
                                        || (!File.Exists(autofilepath) && File.Exists(normalfilepath)))
                                    {
                                        filename = filename.Remove(filename.LastIndexOf("~"), 1);
                                        filepath = normalfilepath;
                                    }
                                    else
                                    {
                                        filepath = autofilepath;
                                    }
                                }
                                XmlReader childReader = XmlReader.Create(filepath, app.XMLReaderSettings);
                                WorldObjectCollection collection = new WorldObjectCollection(childReader, collectionName, this, app, baseName, loadColl);
                                collection.Filename = filename;
                                while (collection.Filename.Contains("~"))
                                {
                                    collection.Filename = collection.Filename.Remove(collection.Filename.LastIndexOf("~"), 1);
                                }
                                Add(collection);
                                childReader.Close();

                            }
                            else
                            {
                                XmlReader childReader = XmlReader.Create(String.Format("{0}\\{1}.mwc", baseName, collectionName), app.XMLReaderSettings);
                                WorldObjectCollection collection = new WorldObjectCollection(childReader, collectionName, this, app, baseName, loadColl);
                                collection.Filename = filename;
                                Add(collection);
                                while (collection.Filename.Contains("~"))
                                {
                                    collection.Filename = collection.Filename.Remove(collection.Filename.LastIndexOf("~"), 1);
                                }
                                childReader.Close();
                            }

                            r.MoveToElement();

                            break;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public WorldRoot(String worldName, MultiSelectTreeView tree, WorldEditor worldEditor)
        {
            instance = this;
            name = worldName;
            treeView = tree;
            app = worldEditor;

            worldTerrain = new WorldTerrain(app);
            ocean = new Ocean(this, app);
            skybox = new Skybox(this, app);
            fog = new GlobalFog(this, app);
            ambientLight = new GlobalAmbientLight(this, app);
            directionalLight = new GlobalDirectionalLight(this, app);
            worldCollections = new List<WorldObjectCollection>();
            pathObjectTypes = new PathObjectTypeContainer(this, app);
        }
 public AutoSplatTerrainDisplay(WorldTerrain parent, WorldEditor worldEditor)
 {
     this.parent = parent;
     this.app = worldEditor;
 }
 public AlphaSplatTerrainDisplay(WorldTerrain parent, WorldEditor worldEditor)
 {
     this.parent = parent;
     this.app    = worldEditor;
 }
Ejemplo n.º 8
0
        protected void FromXml(XmlReader r, bool loadCollections)
        {
            string filename = "";
            string baseName = worldFilePath.Substring(0, worldFilePath.LastIndexOf('\\'));
            bool   loadColl = loadCollections;


            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);
                switch (r.Name)
                {
                case "Name":
                    name = r.Value;
                    break;
                }
            }
            r.MoveToElement();

            while (r.Read())
            {
                // look for the start of an element
                if (r.NodeType == XmlNodeType.Whitespace)
                {
                    continue;
                }
                if (r.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (r.NodeType == XmlNodeType.Element)
                {
                    switch (r.Name)
                    {
                    case "CameraPosition":
                        cameraPosition = XmlHelperClass.ParseVectorAttributes(r);
                        break;

                    case "CameraOrientation":
                        cameraOrientation = XmlHelperClass.ParseQuaternion(r);
                        break;

                    case "Terrain":
                        worldTerrain = new WorldTerrain(app, r);
                        break;

                    case "TerrainDisplay":
                        worldTerrain.DisplayParamsFromXml(r);
                        break;

                    case "Ocean":
                        ocean = new Ocean(this, app, r);
                        break;

                    case "Skybox":
                        skybox = new Skybox(this, app, r);
                        break;

                    case "GlobalFog":
                        fog = new GlobalFog(this, app, r);
                        break;

                    case "GlobalAmbientLight":
                        ambientLight = new GlobalAmbientLight(this, app, app.Scene, r);
                        break;

                    case "GlobalDirectionalLight":
                        directionalLight = new GlobalDirectionalLight(this, app, r);
                        break;

                    case "PathObjectTypes":
                        pathObjectTypes = new PathObjectTypeContainer(app, this, r);
                        break;

                    case "WorldCollection":
                        string collectionName = null;
                        filename = "";
                        for (int i = 0; i < r.AttributeCount; i++)
                        {
                            r.MoveToAttribute(i);
                            switch (r.Name)
                            {
                            case "Name":
                                collectionName = r.Value;
                                break;

                            case "Filename":
                                filename = r.Value;
                                break;
                            }
                        }
                        string filepath = String.Format("{0}\\{1}", baseName, filename);
                        if (filename != "")
                        {
                            if (filename.EndsWith("~.mwc"))
                            {
                                string autofilepath   = String.Format("{0}\\{1}", baseName, filename);
                                string normalfilepath = String.Format("{0}\\{1}", baseName, filename.Remove(filename.LastIndexOf("~"), 1));
                                if ((File.Exists(autofilepath) && File.Exists(normalfilepath) &&
                                     (new FileInfo(autofilepath)).LastWriteTime < (new FileInfo(normalfilepath).LastWriteTime)) ||
                                    (!File.Exists(autofilepath) && File.Exists(normalfilepath)))
                                {
                                    filename = filename.Remove(filename.LastIndexOf("~"), 1);
                                    filepath = normalfilepath;
                                }
                                else
                                {
                                    filepath = autofilepath;
                                }
                            }
                            XmlReader             childReader = XmlReader.Create(filepath, app.XMLReaderSettings);
                            WorldObjectCollection collection  = new WorldObjectCollection(childReader, collectionName, this, app, baseName, loadColl);
                            collection.Filename = filename;
                            while (collection.Filename.Contains("~"))
                            {
                                collection.Filename = collection.Filename.Remove(collection.Filename.LastIndexOf("~"), 1);
                            }
                            Add(collection);
                            childReader.Close();
                        }
                        else
                        {
                            XmlReader             childReader = XmlReader.Create(String.Format("{0}\\{1}.mwc", baseName, collectionName), app.XMLReaderSettings);
                            WorldObjectCollection collection  = new WorldObjectCollection(childReader, collectionName, this, app, baseName, loadColl);
                            collection.Filename = filename;
                            Add(collection);
                            while (collection.Filename.Contains("~"))
                            {
                                collection.Filename = collection.Filename.Remove(collection.Filename.LastIndexOf("~"), 1);
                            }
                            childReader.Close();
                        }

                        r.MoveToElement();

                        break;
                    }
                }
            }
        }