Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormSceneSample"/> class.
        /// </summary>
        public FormSceneSample()
        {
            InitializeComponent();

            sceneControl1.MouseDown += new MouseEventHandler(FormSceneSample_MouseDown);
            sceneControl1.MouseMove += new MouseEventHandler(FormSceneSample_MouseMove);
            sceneControl1.MouseUp += new MouseEventHandler(sceneControl1_MouseUp);

            //  Add some design-time primitives.
            sceneControl1.Scene.SceneContainer.AddChild(new
                UnU.OpenGL.SceneGraph.Primitives.Grid());
            sceneControl1.Scene.SceneContainer.AddChild(new
                UnU.OpenGL.SceneGraph.Primitives.Axies());

            //  Create a light.
            Light light = new Light()
            {
                On = true,
                Position = new Vertex(3, 10, 3),
                GLCode = OpenGL.GL_LIGHT0
            };

            //  Add the light.
            sceneControl1.Scene.SceneContainer.AddChild(light);

            //  Create a sphere.
            Cube cube = new Cube();
            cube.AddEffect(arcBallEffect);

            //  Add it.
            sceneControl1.Scene.SceneContainer.AddChild(cube);

            //  Add the root element to the tree.
            AddElementToTree(sceneControl1.Scene.SceneContainer, treeView1.Nodes);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormSceneSample"/> class.
        /// </summary>
        public FormSceneSample()
        {
            InitializeComponent();

            sceneControl1.MouseDown += new MouseEventHandler(FormSceneSample_MouseDown);
            sceneControl1.MouseMove += new MouseEventHandler(FormSceneSample_MouseMove);
            sceneControl1.MouseUp += new MouseEventHandler(sceneControl1_MouseUp);

            //  Add some design-time primitives.
            sceneControl1.Scene.SceneContainer.AddChild(new
                SharpGL.SceneGraph.Primitives.Grid());
            sceneControl1.Scene.SceneContainer.AddChild(new 
                SharpGL.SceneGraph.Primitives.Axies());

            //  Create a light.
            Light light = new Light()
            {
                On = true,
                Position = new Vertex(3, 10, 3),
                GLCode = OpenGL.GL_LIGHT0
            };

            //  Add the light.
            sceneControl1.Scene.SceneContainer.AddChild(light);

            //  Create a sphere.
            Cube cube = new Cube();
            cube.AddEffect(arcBallEffect);
            
            //  Add it.
            sceneControl1.Scene.SceneContainer.AddChild(cube);

            //  Add the root element to the tree.
            AddElementToTree(sceneControl1.Scene.SceneContainer, treeView1.Nodes);
        }
Exemplo n.º 3
0
        private void 立方体ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            sceneControl1.Scene.OpenGL.NewQuadric();
            Cube 立方 = new Cube()
            {
                Name = "立方体"
            };

            立方.Material = new Material();
            立方.AddEffect(objectArcBallEffect);
            sceneControl1.Scene.SceneContainer.AddChild(立方);
            treeView1.Nodes.Clear();
            AddElementToTree(sceneControl1.Scene.SceneContainer, treeView1.Nodes);
        }