예제 #1
0
 public NodeFactory()
 {
     m_builtin["Anchor"]                  = new AnchorNode();
     m_builtin["Appearance"]              = new AppearanceNode();
     m_builtin["Background"]              = new BackgroundNode();
     m_builtin["Billboard"]               = new BillboardNode();
     m_builtin["Box"]                     = new BoxNode();
     m_builtin["Color"]                   = new ColorNode();
     m_builtin["ColorInterpolator"]       = new ColorInterpolatorNode();
     m_builtin["Cone"]                    = new ConeNode();
     m_builtin["Coordinate"]              = new CoordinateNode();
     m_builtin["CoordinateInterpolator"]  = new CoordinateInterpolatorNode();
     m_builtin["Cylinder"]                = new CylinderNode();
     m_builtin["DirectionalLight"]        = new DirectionalLightNode();
     m_builtin["Extrusion"]               = new ExtrusionNode();
     m_builtin["FontStyle"]               = new FontStyleNode();
     m_builtin["Group"]                   = new GroupNode();
     m_builtin["IndexedFaceSet"]          = new IndexedFaceSetNode();
     m_builtin["IndexedLineSet"]          = new IndexedLineSetNode();
     m_builtin["Material"]                = new MaterialNode();
     m_builtin["NavigationInfo"]          = new NavigationInfoNode();
     m_builtin["OrientationInterpolator"] = new OrientationInterpolatorNode();
     m_builtin["Normal"]                  = new NormalNode();
     m_builtin["PixelTexture"]            = new PixelTextureNode();
     m_builtin["PointLight"]              = new PointLightNode();
     m_builtin["PositionInterpolator"]    = new PositionInterpolatorNode();
     m_builtin["ScalarInterpolator"]      = new ScalarInterpolationNode();
     m_builtin["Shape"]                   = new ShapeNode();
     m_builtin["Sphere"]                  = new SphereNode();
     m_builtin["SpotLight"]               = new SpotLightNode();
     m_builtin["Text"]                    = new TextNode();
     m_builtin["TextureCoordinate"]       = new TextureCoordinateNode();
     m_builtin["TimeSensor"]              = new TimeSensorNode();
     m_builtin["TouchSensor"]             = new TouchSensorNode();
     m_builtin["Transform"]               = new TransformNode();
     m_builtin["Viewpoint"]               = new ViewpointNode();
     m_builtin["WorldInfo"]               = new WorldInfoNode();
 }
예제 #2
0
        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();
        }