Example #1
0
        protected override void ParseElements()
        {
            models  = new Models(root);
            actors  = new Actors(root);
            physics = new Physics(root);
            lights  = new Lights(root);
            plugins = new Plugins(root);

            var gravityStr = (IsValidNode("gravity"))? GetValue <string>("gravity"): "0 0 -9.8";

            gravity.FromString(gravityStr);

            // Console.WriteLine("{0}", GetType().Name);

            // Console.WriteLine("[{0}] {1} {2} {3} {4}", GetType().Name,
            // isStatic, isSelfCollide, allowAutoDisable, enableWind);

            if (IsValidNode("gui"))
            {
                gui            = new Gui();
                gui.fullscreen = GetAttributeInPath <bool>("gui", "fullscreen");

                if (IsValidNode("gui/camera"))
                {
                    gui.camera = new Gui.Camera(GetNode("gui/camera"));
                }
            }

            if (IsValidNode("audio"))
            {
                // Console.WriteLine("<audio> tag is NOT supported yet.");
            }

            if (IsValidNode("wind"))
            {
                // Console.WriteLine("<wind> tag is NOT supported yet.");
            }

            if (IsValidNode("magnetic_field"))
            {
                // Console.WriteLine("<magnetic_field> tag is NOT supported yet.");
            }

            if (IsValidNode("atmosphere"))
            {
                // Console.WriteLine("<atmosphere> tag is NOT supported yet.");
            }

            if (IsValidNode("physics"))
            {
                // Console.WriteLine("<physics> tag is NOT supported yet.");
            }

            if (IsValidNode("scene"))
            {
                // Console.WriteLine("<scene> tag is NOT supported yet.");
            }

            if (IsValidNode("frame"))
            {
                // Console.WriteLine("<frame> tag is NOT supported yet.");
            }

            if (IsValidNode("road"))
            {
                // Console.WriteLine("<road> tag is NOT supported yet.");
            }

            if (IsValidNode("spherical_coordinates"))
            {
                spherical_coordinates = new SphericalCoordinates();

                if (IsValidNode("spherical_coordinates/surface_model"))
                {
                    spherical_coordinates.surface_model = GetValue <string>("spherical_coordinates/surface_model");
                }

                if (IsValidNode("spherical_coordinates/world_frame_orientation"))
                {
                    spherical_coordinates.world_frame_orientation = GetValue <string>("spherical_coordinates/world_frame_orientation");
                }

                if (IsValidNode("spherical_coordinates/latitude_deg"))
                {
                    spherical_coordinates.latitude_deg = GetValue <double>("spherical_coordinates/latitude_deg");
                }

                if (IsValidNode("spherical_coordinates/longitude_deg"))
                {
                    spherical_coordinates.longitude_deg = GetValue <double>("spherical_coordinates/longitude_deg");
                }

                if (IsValidNode("spherical_coordinates/elevation"))
                {
                    spherical_coordinates.elevation = GetValue <double>("spherical_coordinates/elevation");
                }

                if (IsValidNode("spherical_coordinates/heading_deg"))
                {
                    spherical_coordinates.heading_deg = GetValue <double>("spherical_coordinates/heading_deg");
                }
            }

            if (IsValidNode("state"))
            {
                // Console.WriteLine("<state> tag is NOT supported yet.");
            }

            if (IsValidNode("population"))
            {
                // Console.WriteLine("<population> tag is NOT supported yet.");
            }
        }
Example #2
0
        protected override void ParseElements()
        {
            models  = new Models(root);
            physics = new Physics(root);
            light   = new Light(root);
            plugins = new Plugins(root);

            var gravityStr = GetValue <string>("static");

            gravity = new Vector3 <double>();
            gravity.FromString(gravityStr);

            // Console.WriteLine("{0}", GetType().Name);

            // Console.WriteLine("[{0}] {1} {2} {3} {4}", GetType().Name,
            // isStatic, isSelfCollide, allowAutoDisable, enableWind);

            if (IsValidNode("gui"))
            {
                if (IsValidNode("gui/camera"))
                {
                    if (IsValidNode("gui/camera/pose"))
                    {
                        var value = GetValue <string>("gui/camera/pose").ToLower();
                        // Console.WriteLine(value);

                        // x y z roll pitch yaw
                        string[] poseStr = value.Split(' ');

                        gui_camera_pose           = new Pose <double>();
                        gui_camera_pose.Pos.X     = Convert.ToDouble(poseStr[0]);
                        gui_camera_pose.Pos.Y     = Convert.ToDouble(poseStr[1]);
                        gui_camera_pose.Pos.Z     = Convert.ToDouble(poseStr[2]);
                        gui_camera_pose.Rot.Roll  = Convert.ToDouble(poseStr[3]);
                        gui_camera_pose.Rot.Pitch = Convert.ToDouble(poseStr[4]);
                        gui_camera_pose.Rot.Yaw   = Convert.ToDouble(poseStr[5]);

                        // Console.WriteLine(gui_camera_pose);
                    }
                }
            }

            if (IsValidNode("audio"))
            {
                // Console.WriteLine("<audio> tag is NOT supported yet.");
            }

            if (IsValidNode("wind"))
            {
                // Console.WriteLine("<wind> tag is NOT supported yet.");
            }

            if (IsValidNode("magnetic_field"))
            {
                // Console.WriteLine("<magnetic_field> tag is NOT supported yet.");
            }

            if (IsValidNode("atmosphere"))
            {
                // Console.WriteLine("<atmosphere> tag is NOT supported yet.");
            }

            if (IsValidNode("physics"))
            {
                // Console.WriteLine("<physics> tag is NOT supported yet.");
            }

            if (IsValidNode("scene"))
            {
                // Console.WriteLine("<scene> tag is NOT supported yet.");
            }

            if (IsValidNode("light"))
            {
                // Console.WriteLine("<light> tag is NOT supported yet.");
            }

            if (IsValidNode("frame"))
            {
                // Console.WriteLine("<frame> tag is NOT supported yet.");
            }

            if (IsValidNode("actor"))
            {
                actors = new Actors(root);
            }

            if (IsValidNode("road"))
            {
                // Console.WriteLine("<road> tag is NOT supported yet.");
            }

            if (IsValidNode("spherical_coordinates"))
            {
                // Console.WriteLine("<spherical_coordinates> tag is NOT supported yet.");
            }

            if (IsValidNode("state"))
            {
                // Console.WriteLine("<state> tag is NOT supported yet.");
            }

            if (IsValidNode("population"))
            {
                // Console.WriteLine("<population> tag is NOT supported yet.");
            }
        }