Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            //fix render Context Provider
            this.sceneControl1.Scene.OpenGL = this.sceneControl1.OpenGL;



            //clear the default scene
            this.sceneControl1.Scene.SceneContainer.Children.Clear();

            //create the default camera
            OrthographicCamera orthCamera = new OrthographicCamera();

            this.comboBox1.Items.Add(orthCamera);
            Size clientSize = this.sceneControl1.ClientSize;

            orthCamera.Left        = this.modelSpace.Left;
            orthCamera.Right       = this.modelSpace.Right;
            orthCamera.Bottom      = this.modelSpace.Bottom;
            orthCamera.Top         = this.modelSpace.Top;
            orthCamera.Near        = this.modelSpace.Near;
            orthCamera.Far         = this.modelSpace.Far;
            orthCamera.Position    = new Vertex(0.0f, 0.0f, 0.0f);
            orthCamera.AspectRatio = 1.0f;



            LookAtCamera persCamera = new LookAtCamera();

            this.comboBox1.Items.Add(persCamera);
            persCamera.Position = new Vertex(0.0f, 0.0f, (float)(modelSpace.Near + modelSpace.Near));
            persCamera.Near     = Math.Abs(modelSpace.Near);
            persCamera.Far      = float.MaxValue;
            persCamera.Target   = new Vertex(0, 0, 0);
            persCamera.UpVector = new Vertex(0, 1, 0);


            //create model
            BoundingBox space = new BoundingBox();

            space.Name = "Virtual Space";
            space.LBN  = new Vertex(-5000, -5000, 5000);
            space.RTF  = new Vertex(5000, 5000, -5000);
            this.sceneControl1.Scene.SceneContainer.AddChild(space);
            space.AddEffect(arcBallEffect);


            BoundingBox volume1 = new BoundingBox();

            volume1.Name = "volume1";
            volume1.LBN  = new Vertex(-4000, -2000, 4000);
            volume1.RTF  = new Vertex(-3500, -1500, 3500); //size is 5000
            space.AddChild(volume1);


            BoundingBox volume2 = new BoundingBox();

            volume2.Name = "volume2";
            volume2.LBN  = new Vertex(-2000, -2000, 2000);
            volume2.RTF  = new Vertex(2000, 2000, -2000);
            space.AddChild(volume2);

            this.comboBox1.SelectedIndex = 0;
        }