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); }
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); }
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); }
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); }
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); }
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); }