private SceneNodeBase GetTree() { const float length = 6; var group = new GroupNode(); { var floor = CubeNode.Create(); floor.Scale = new vec3(length, 0.1f, length); floor.Color = Color.Brown.ToVec4(); group.Children.Add(floor); } { var textureSource = new BitmapTextureSource("Lenna.png"); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { float x = -length / 2 + length / 2 * i; float y = 0.25f; float z = -length / 2 + length / 2 * j; var stick = CubeNode.Create(); stick.Scale = new vec3(0.1f, y * 2, 0.1f); stick.WorldPosition = new vec3(x, y, z); stick.Color = Color.Green.ToVec4(); group.Children.Add(stick); { //var billboard = TextBillboardNodeBackup.Create(textureSource, 200, 40); var billboard = TextBillboardNode.Create(200, 40, 100); billboard.Text = string.Format("Hello Billboard[{0}]!", i * 3 + j); billboard.Color = Color.White.ToVec3(); billboard.EnableRendering = ThreeFlags.None;// we don't render it in RenderAction. we render it in BillboardRenderAction. billboard.WorldPosition = new vec3(0, y * 4, 0); stick.Children.Add(billboard); } } } } return(group); }
private void button1_Click(object sender, EventArgs e) { switch (listBox1.SelectedItem) { case "SkyboxNode": string sn_skybox = "Content/skybox.png"; InputBoxes.ShowInputDialog(ref sn_skybox, "Skybox"); SkyboxNode node = SkyboxNode.Create(new Bitmap(Image.FromFile(sn_skybox))); node.Name = "NewSkybox"; node.Parent = nodebase; break; case "TextBillboardNode": string sn_billboard = "Hello World!"; TextBillboardNode textBillboardNode = TextBillboardNode.Create(200, 40, 65535); textBillboardNode.Name = "NewBillboard"; textBillboardNode.Parent = nodebase; textBillboardNode.Text = sn_billboard; textBillboardNode.EnableRendering = ThreeFlags.None; break; case "CubeNode": CubeNode cube = CubeNode.Create(); cube.Name = "NewCube"; cube.Parent = nodebase; break; case "ShadowVolumeNode": CubeModel model = new CubeModel(); string sv_pos = CubeModel.strPosition; string sv_normal = "0 0 0"; InputBoxes.ShowInputDialog(ref sv_pos, "Volume Position"); InputBoxes.ShowInputDialog(ref sv_pos, "Volume Normal"); ShadowVolumeNode shadow = ShadowVolumeNode.Create(model, sv_pos, sv_normal, new vec3(1, 1, 1)); shadow.Name = "NewLight"; shadow.Parent = nodebase; break; case "TerrainNode": TerrainNode terrain = TerrainNode.Create(); terrain.Parent = nodebase; terrain.Name = "NewTerrain"; break; case "SpotLightNode": CubeModel sp_model = new CubeModel(); string sp_pos = "0 0 0"; string sp_target = "0 0 0"; InputBoxes.ShowInputDialog(ref sp_pos, "Volume Position"); InputBoxes.ShowInputDialog(ref sp_target, "Volume Target"); string[] sppositions_STR = sp_pos.Split(' '); vec3 sp_posv = new vec3(float.Parse(sppositions_STR[0]), float.Parse(sppositions_STR[1]), float.Parse(sppositions_STR[2])); string[] sptarget_STR = sp_target.Split(' '); vec3 sp_tarv = new vec3(float.Parse(sptarget_STR[0]), float.Parse(sptarget_STR[1]), float.Parse(sptarget_STR[2])); SpotLight spotlight = new SpotLight(sp_posv, sp_tarv, 45); SpotLightNode spotlightnode = SpotLightNode.Create(spotlight, sp_model, sp_pos, sp_pos, new vec3(1, 1, 1)); spotlightnode.Parent = nodebase; spotlightnode.Name = "NewSpotlight"; lastspotlight = spotlight; break; case "CubeLightTestNode": CubeLightTestNode cubeLightTest = CubeLightTestNode.Create(); cubeLightTest.Parent = nodebase; cubeLightTest.Name = "NewCubeLightTest"; cubeLightTest.SetLight(lastspotlight); break; } src_form.Match(src_form.treeView, nodebase); AudioSystem.PlayAudio("GameSounds/clickfast.wav"); Close(); }