예제 #1
0
        /// <summary>
        ///     Add terrain to the VR world
        /// </summary>
        /// <param name="heights">Lit<foat> heights : for every point on the map a height value.</param>
        public void addTerrain(List <float> heights)
        {
            dynamic packet =
                new
            {
                id   = "tunnel/send",
                data =
                    new
                {
                    dest = vr.tunnelID,
                    data = new
                    {
                        id   = "scene/terrain/add",
                        data = new
                        {
                            size = new[] { width, length },
                            heights
                        }
                    }
                }
            };

            string packetString = JsonConvert.SerializeObject(packet);

            vr.sendData(packetString);
            //Console.WriteLine(this.vr.dataChecker());
            vr.dataChecker();
        }
예제 #2
0
        /// <summary>
        ///     Clear the panel
        /// </summary>
        /// <param name="id"></param>
        public void clearPanel(string id)
        {
            dynamic packet =
                new
            {
                id   = "tunnel/send",
                data = new { dest = vr.tunnelID, data = new { id = "scene/panel/clear", data = new { id } } }
            };

            string packetString = JsonConvert.SerializeObject(packet);

            vr.sendData(packetString);
            vr.dataChecker();
        }
예제 #3
0
        /// <summary>
        ///     Set the time in the VR world
        /// </summary>
        /// <param name="setTime">double setTime : value[0-24] > exmple 12.5 = 12:30</param>
        public void setTime(double setTime)
        {
            currentTime = setTime;
            dynamic packet =
                new
            {
                id   = "tunnel/send",
                data =
                    new
                {
                    dest = vr.tunnelID,
                    data = new { id = "scene/skybox/settime", data = new { time = setTime } }
                }
            };

            string packetString = JsonConvert.SerializeObject(packet);

            vr.sendData(packetString);
            vr.dataChecker();
        }
예제 #4
0
        public string createRoutew(List <Dictionary <string, object> > nodes)
        {
            if (nodes == null)
            {
                nodes = new List <Dictionary <string, object> >();
                // dictionaries with one position and direction
                var dict1 = new Dictionary <string, object>();
                dict1.Add("pos", new List <int> {
                    0, 0, 0
                });
                dict1.Add("dir", new List <int> {
                    10, 0, -10
                });
                var dict2 = new Dictionary <string, object>();
                dict2.Add("pos", new List <int> {
                    100, 0, 0
                });
                dict2.Add("dir", new List <int> {
                    10, 0, 10
                });
                var dict3 = new Dictionary <string, object>();
                dict3.Add("pos", new List <int> {
                    100, 0, 100
                });
                dict3.Add("dir", new List <int> {
                    -10, 0, 10
                });
                var dict4 = new Dictionary <string, object>();
                dict4.Add("pos", new List <int> {
                    0, 0, 100
                });
                dict4.Add("dir", new List <int> {
                    -10, 0, -10
                });
                nodes.Add(dict1);
                nodes.Add(dict2);
                nodes.Add(dict3);
                nodes.Add(dict4);
            }
            dynamic packet =
                new
            {
                id   = "tunnel/send",
                data = new { dest = vr.tunnelID, data = new { id = "route/add", data = new { nodes } } }
            };

            string packetString = JsonConvert.SerializeObject(packet);

            vr.sendData(packetString);

            var response = vr.dataChecker();

            Console.WriteLine("RESONSE ROAD CREATION " + response);
            var keys = new List <string> {
                "data.data.data.uuid"
            };
            var uuidDict = vr.parseDataDict(response, keys);

            routeID = string.Empty;
            uuidDict.TryGetValue(keys.ElementAt(0), out routeID);
            return(routeID);
        }
예제 #5
0
        /// <summary>
        ///     Creates a node using the dynamic method
        ///     Booleans for component names set the optional functions.
        ///     JSONconverter from the NewtonsoftJson used to convert it to JSON.
        ///     starting with o- means its optional
        /// </summary>
        /// <param name="name">name of the node</param>
        /// <param name="parent">o- parent object</param>
        /// <param name="transform">decides if the transformation component is added.</param>
        /// <param name="position">o- array with x, y, z in doubles</param>
        /// <param name="scale">o- scaloing in double</param>
        /// <param name="rotation">o- rotation in double array over x-axis, y-axis, z-axis</param>
        /// <param name="model">boolean if true model has to be set.</param>
        /// <param name="file">name of the 3d model file (.obj)</param>
        /// <param name="cullbackfaces">must be true</param>
        /// <param name="animated">decides if its animated</param>
        /// <param name="animation">name of the animation</param>
        /// <param name="terrain">decides if node is a terrain </param>
        /// <param name="smoothnomals">always true</param>
        /// <param name="panel">defines if panel should be used</param>
        /// <param name="size">size of the panel double[] x,y</param>
        /// <param name="resolution">panel resolution, double[] x,y</param>
        /// <param name="background">background in double[] R,G,B,A</param>
        /// <param name="water">defines if the node is water</param>
        /// <param name="watersize">size of the water in double[] x,y</param>
        /// <param name="waterresolution">resolution of the water in double[] x,y</param>
        public void addNode(
            string name,
            int[] position,
            float scale,
            int[] rotation,
            string file,
            bool cullbackfaces,
            bool animated,
            string animation)
        {
            dynamic packet =
                new
            {
                id   = "tunnel/send",
                data = new
                {
                    dest = vr.tunnelID,
                    data = new
                    {
                        id   = "scene/node/add",
                        data = new
                        {
                            name,
                            components = new
                            {
                                transform = new
                                {
                                    position,
                                    scale,
                                    rotation
                                },
                                model = new
                                {
                                    file,
                                    cullbackfaces,
                                    animated,
                                    animation
                                }
                            }
                        }
                    }
                }
            };
            string packetString = JsonConvert.SerializeObject(packet);

            vr.sendData(packetString);
            vr.dataChecker();
        }