Example #1
0
        public static X3DTransform GetSmoothButton(X3DTransform parent, string text, string url, Vector3 translation)
        {
            var bp = new X3DTransform();

            parent.AddChild(bp);
            bp.Scale       = new Vector3(0.22, 0.1, -0.007);
            bp.Translation = translation;

            var sb = X3DTransform.AddTransFormWithShape(ShapeType.Prefab);

            sb.Scale       = new Vector3(1.7, 1, 1);
            sb.Shape.Item  = "smoothcube";
            sb.Shape.Group = "primitives";
            sb.Shape.Appearance.Material.DiffuseColor = new Vector3(0.7, 0.7, 0.7);
            sb.Shape.Appearance.Material.DEF          = "button_color";
            sb.Shape.Url    = url;
            sb.Shape.Target = Target._Blank;
            bp.AddChild(sb);
            var t = GetTextTransform(bp, text, new Vector3(-0.14, 0, 1.4));

            t.Scale = Vector3.One(0.23);
            //t.Shape.FontStyle.Justify = Justify.MIDDLE;
            t.Shape.RectLength = 10;
            return(bp);
        }
Example #2
0
        X3DTransform CreateSmoothCubePanel(IWebSceneProps websceneProps)
        {
            X3DTransform panel = CreateSmoothCubeTransForm(new Vector3(), new Vector3(0.4, 0.4, 0.02));

            panel.Shape.Url = websceneProps.Url;
            panel.Shape.Appearance.ImageTexture.Url = websceneProps.ImageUrl;
            return(panel);
        }
Example #3
0
        X3DTransform CreateSmoothCubeTransForm(Vector3 translation, Vector3 scale)
        {
            X3DTransform panel = X3DTransform.AddTransFormWithShape(ShapeType.Prefab, null, null, scale);

            panel.Shape.Group = "primitives";
            panel.Shape.Item  = "smoothcube";
            panel.Translation = translation;
            return(panel);
        }
Example #4
0
        public static X3DTransform GetPrefab(X3DTransform parent, string group, string item)
        {
            var prefabT = X3DTransform.AddTransFormWithShape(ShapeType.Prefab);

            prefabT.Shape.Group = group;
            prefabT.Shape.Item  = item;
            parent.AddChild(prefabT);
            return(prefabT);
        }
Example #5
0
        public static X3DTransform GetBoard(X3DTransform parent, string imageUrl = null, Vector3 translation = null)
        {
            var boardT = X3DTransform.AddTransFormWithShape(ShapeType.Cube);

            boardT.Translation   = translation;
            boardT.EulerRotation = new Vector3(0, 180, 0);
            boardT.Shape.Appearance.Material.DiffuseColor = new Vector3(1);
            boardT.Shape.Appearance.ImageTexture.Url      = imageUrl;
            boardT.Scale = new Vector3(1, 1, 0.01);
            parent.AddChild(boardT);
            return(boardT);
        }
Example #6
0
        public static X3DTransform GetTextTransform(X3DTransform parent, string text, Vector3 translation = null, double rectLength = 20)
        {
            var llabel = X3DTransform.AddTransFormWithShape(ShapeType.Text, null, null, Vector3.One(0.05));

            llabel.Shape.Text  = text;
            llabel.Translation = translation;
            llabel.Shape.Appearance.Material.DEF          = "mat_text";
            llabel.Shape.Appearance.Material.DiffuseColor = new Vector3();
            llabel.Shape.FontStyle.Justify = Justify.LEFT;
            llabel.Shape.RectHeight        = 3;
            llabel.Shape.RectLength        = rectLength;
            parent.AddChild(llabel);
            return(llabel);
        }
Example #7
0
        public static X3DTransform AddTransFormWithShape(ShapeType shapeType, Vector3 position = null, Quaternion rotation = null, Vector3 scale = null)
        {
            X3DTransform transform = new X3DTransform();

            if (shapeType != ShapeType.Null)
            {
                transform.Shape           = new X3DShape();
                transform.Shape.ShapeType = shapeType;
            }
            transform.Rotation = rotation;
            transform.Scale    = scale;
            transform.Position = position;
            return(transform);
        }
Example #8
0
        void AddSmoothCubeWebSite(IWebSceneProps websceneProps, int counter, double angle, double radius, X3DTransform group)
        {
            string       name     = websceneProps.Name;
            string       url      = websceneProps.Url;
            string       imageUrl = websceneProps.ImageUrl;
            Target       t        = websceneProps.Target;
            int          visitors = websceneProps.Visitors;
            double       tangle   = angle + counter * Calc.ToRadians(40);
            double       x        = Math.Sin(tangle) * radius;
            double       y        = Math.Cos(tangle) * radius;
            Vector3      pos      = new Vector3(x, 1, y);
            X3DTransform cubeT    = null;

            cubeT              = X3DTransform.AddTransFormWithShape(ShapeType.Prefab, pos, null, new Vector3(0.2, 0.2, 0.03));
            cubeT.Shape.Name   = "smoothcube2";
            cubeT.Shape.Group  = "primitives";
            cubeT.Shape.Url    = url;
            cubeT.Shape.Target = t;
            cubeT.Shape.Appearance.Material.DEF           = "Material" + name;
            cubeT.Shape.Appearance.Material.DiffuseColor  = Vector3.One();
            cubeT.Shape.Appearance.ImageTexture.Url       = imageUrl;
            cubeT.Shape.Appearance.Movement.Rotate        = new Vector3(0.03, 1.2, 0);
            cubeT.Shape.Appearance.Movement.ApplyToParent = false;
            //transform5.Shape.Appearance.Movement.Center = "0.001 0 0";
            //           transform5.Shape.FaceCamera = FaceCamera.face_lock_y;
            group.AddChild(cubeT);
            Vector3      postxt = new Vector3(x, 0.7, y);
            X3DTransform textT  = X3DTransform.AddTransFormWithShape(ShapeType.Text, postxt, null, new Vector3(0.03, 0.03, 0.03));

            textT.Shape.Url    = url;
            textT.Shape.Target = t;
            textT.Shape.Text   = "\"" + name + "\"";
            if (visitors > 0)
            {
                string txt = visitors == 1 ? "(1 visitor)" : string.Format("({0} visitors)", visitors);
                textT.Shape.Text += "\"" + txt + "\"";
            }
            textT.Shape.Appearance.Material.USE          = "Material" + name;
            textT.Shape.Appearance.Material.DiffuseColor = new Vector3(0.1, 0.35, 0.46);
            group.AddChild(textT);
        }
Example #9
0
        public void CircleHalfPanel(X3DTransform parent, List <IWebSceneProps> webScenePropes, int pageNo, CallingDevices callingApp, out bool hasNextPage, WebPanelLayout webPanelLayout = null)
        {
            int counter = 0;

            counter     = -pageNo * PageSize;
            hasNextPage = false;
            float   angle    = 0;
            Vector3 pos      = null;
            int     lcounter = 0;

            if (webPanelLayout == null)
            {
                webPanelLayout = new WebPanelLayout(callingApp);
            }
            foreach (var website in webScenePropes)
            {
                string webUrl = website.Url;
                if ((!string.IsNullOrWhiteSpace(webUrl) && webUrl.ToLower() != "http://www.v-slam.org/index.aspx") || HasNewSlamVersion)
                {
                    if (counter >= 0)
                    {
                        var w = CreateBusinesWebsite(website, webPanelLayout);
                        GetProps(lcounter, out angle, out pos);
                        w.Translation   = pos;
                        w.EulerRotation = new Vector3(0, angle, 0);

                        parent.Children.Add(w);
                        lcounter++;
                    }
                    counter++;
                    if (counter > PageSize - 1)
                    {
                        hasNextPage = true;
                        break;
                    }
                }
            }
        }
Example #10
0
        public void CircleHalf(X3DTransform parent, List <IWebSceneProps> webScenePropes, int pageNo, float radius, float angle, out bool hasNextPage)
        {
            int counter = 0;

            counter     = -pageNo * PageSize;
            hasNextPage = false;
            foreach (var website in webScenePropes)
            {
                string webUrl = website.Url;
                if ((!string.IsNullOrWhiteSpace(webUrl) && webUrl.ToLower() != "http://www.v-slam.org/index.aspx") || HasNewSlamVersion)
                {
                    if (counter >= 0)
                    {
                        AddSmoothCubeWebSite(website, counter, angle, radius, parent);
                    }
                    counter++;
                    if (counter > PageSize)
                    {
                        hasNextPage = true;
                        break;
                    }
                }
            }
        }
Example #11
0
        X3DTransform CreateBusinesWebsite(IWebSceneProps websceneProps,
                                          WebPanelLayout webPanelLayout
                                          )
        {
            X3DTransform t              = new X3DTransform();
            X3DTransform panel          = CreateSmoothCubePanel(websceneProps);
            var          panelZposition = 0.025f;

            t.AddChild(panel);
            panel.Scale = new Vector3(0.4f, 0.4f, 0.02f);
            if (websceneProps.Favorite >= 0)
            {
                panel.Shape.Favorite = websceneProps.Favorite;
            }
            if (websceneProps.History >= 0)
            {
                panel.Shape.History = websceneProps.History;
            }
            //backPanel//new Vector3(f, f, f)
            X3DTransform panelBorder = CreateSmoothCubeTransForm(new Vector3(0, 0, panelZposition), new Vector3(0.44, 0.44, 0.02));

            t.AddChild(panelBorder);
            panelBorder.Shape.Appearance.Material = webPanelLayout.TopPanelBackGround;
            if (websceneProps.Favorite >= 0)
            {
                panelBorder.Shape.Favorite = websceneProps.Favorite;
            }
            //bottomPanel
            X3DTransform bottomPanel = CreateSmoothCubeTransForm(new Vector3(0, -0.605, panelZposition), new Vector3(0.44, 0.16, 0.02));

            t.AddChild(bottomPanel);
            bottomPanel.Shape.Appearance.Material = webPanelLayout.BottomPanelBackGround;
            bottomPanel.Shape.Url    = websceneProps.Url;
            bottomPanel.Shape.Target = websceneProps.Target;
            if (websceneProps.Favorite >= 0)
            {
                bottomPanel.Shape.Favorite = websceneProps.Favorite;
            }
            if (websceneProps.History >= 0)
            {
                bottomPanel.Shape.History = websceneProps.History;
            }
            //bottomFrontPanel
            X3DTransform bottomFrontPanel = CreateSmoothCubeTransForm(new Vector3(0, -0.605, panelZposition), new Vector3(0.4, 0.147, 0.02));

            t.AddChild(bottomFrontPanel);
            bottomFrontPanel.Shape.Appearance.Material = webPanelLayout.BottomPanelForground;
            bottomFrontPanel.Shape.Url    = websceneProps.Url;
            bottomFrontPanel.Shape.Target = websceneProps.Target;
            if (websceneProps.Favorite >= 0)
            {
                bottomFrontPanel.Shape.Favorite = websceneProps.Favorite;
            }
            if (websceneProps.History >= 0)
            {
                bottomFrontPanel.Shape.History = websceneProps.History;
            }
            //text
            X3DTransform bottomText = X3DTransform.AddTransFormWithShape(ShapeType.Text, new Vector3(0, -0.584, 0), null, new Vector3(0.03, 0.03, 0.03));

            bottomText.Name = "txt";
            bottomText.Shape.Appearance.Material = webPanelLayout.BottomPanelText;
            bottomText.Shape.Url        = websceneProps.Url;
            bottomText.Shape.Target     = websceneProps.Target;
            bottomText.Shape.Text       = "\"" + websceneProps.Name + "\"";
            bottomText.Shape.RectLength = 29;
            if (websceneProps.Favorite >= 0)
            {
                bottomText.Shape.Favorite = websceneProps.Favorite;
            }
            if (websceneProps.History >= 0)
            {
                bottomText.Shape.History = websceneProps.History;
            }
            if (websceneProps.Visitors > 0)
            {
                string txt = websceneProps.Visitors == 1 ? "(1 visitor)" : string.Format("({0} visitors)", websceneProps.Visitors);
                bottomText.Shape.Text += "\"" + txt + "\"";
            }
            t.AddChild(bottomText);

            return(t);
        }