private void Form_Load(object sender, EventArgs e)
        {
            {
                var camera = new Camera(
                    new vec3(0, 0, 5), new vec3(), new vec3(0, 1, 0),
                    CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                var rotator = new SatelliteManipulater();
                rotator.Bind(camera, this.glCanvas1);
                this.camera = camera;
                this.rotator = rotator;
            }
            {
                var simplexNoiseRenderer = new SimplexNoiseRenderer();
                simplexNoiseRenderer.Name = string.Format("Pickable: [{0}]", "Sphere");
                simplexNoiseRenderer.Initialize();
                this.simplexNoiseRenderer = simplexNoiseRenderer;
            }
            {
                var UIRoot = new UIRoot();
                UIRoot.Initialize();
                this.uiRoot = UIRoot;

                var glAxis = new UIAxis(AnchorStyles.Right | AnchorStyles.Bottom,
                    new Padding(3, 3, 3, 3), new Size(70, 70), -100, 100);
                glAxis.Initialize();
                this.glAxis = glAxis;

                UIRoot.Children.Add(glAxis);
            }
            {
                var frmPropertyGrid = new FormProperyGrid();
                frmPropertyGrid.DisplayObject(this.simplexNoiseRenderer);
                frmPropertyGrid.Show();
            }
        }
Example #2
0
        private void Form01Renderer_Load(object sender, EventArgs e)
        {
            {
                var camera = new Camera(
                    new vec3(0, 0, 5), new vec3(), new vec3(0, 1, 0),
                    CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                var rotator = new SatelliteRotator(camera);
                this.camera  = camera;
                this.rotator = rotator;
            }
            {
                var simplexNoiseRenderer = new SimplexNoiseRenderer();
                simplexNoiseRenderer.Name = string.Format("Pickable: [{0}]", "Sphere");
                simplexNoiseRenderer.Initialize();
                this.simplexNoiseRenderer = simplexNoiseRenderer;
            }
            {
                var UIRoot = new GLControl(this.glCanvas1.Size, -100, 100);
                UIRoot.Initialize();
                this.uiRoot = UIRoot;

                var glAxis = new GLAxis(AnchorStyles.Right | AnchorStyles.Bottom,
                                        new Padding(3, 3, 3, 3), new Size(70, 70), -100, 100);
                glAxis.Initialize();
                this.glAxis = glAxis;

                UIRoot.Controls.Add(glAxis);
            }
            {
                var frmPropertyGrid = new FormProperyGrid();
                frmPropertyGrid.DisplayObject(this.simplexNoiseRenderer);
                frmPropertyGrid.Show();
            }
        }
 private void Form_Load(object sender, EventArgs e)
 {
     {
         var camera = new Camera(
             new vec3(0, 0, 5), new vec3(), new vec3(0, 1, 0),
             CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
         var rotator = new SatelliteManipulater();
         rotator.Bind(camera, this.glCanvas1);
         this.scene             = new Scene(camera, this.glCanvas1);
         this.glCanvas1.Resize += this.scene.Resize;
     }
     {
         var renderer = new SimplexNoiseRenderer();
         renderer.Initialize();
         SceneObject obj = renderer.WrapToSceneObject();
         this.scene.RootObject.Children.Add(obj);
     }
     {
         var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom,
                                 new Padding(3, 3, 3, 3), new Size(128, 128), -100, 100);
         uiAxis.Initialize();
         this.scene.UIRoot.Children.Add(uiAxis);
     }
     {
         var frmPropertyGrid = new FormProperyGrid(this.scene);
         frmPropertyGrid.Show();
     }
 }
        private List <PickableRenderer> GetPickableRenderers()
        {
            List <PickableRenderer> list = new List <PickableRenderer>();

            {
                SimpleRenderer pickableRenderer = SimpleRenderer.Create(new Tetrahedron());
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                SimpleRenderer pickableRenderer = SimpleRenderer.Create(new Teapot());
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                SimpleRenderer pickableRenderer = SimpleRenderer.Create(new Sphere());
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                SimpleRenderer pickableRenderer = SimpleRenderer.Create(new Chain());
                pickableRenderer.SwitchList.Add(new LineWidthSwitch(5));
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                SimpleRenderer pickableRenderer = SimpleRenderer.Create(new BigDipper());
                pickableRenderer.SwitchList.Add(new LineWidthSwitch(5));
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                SimpleRenderer pickableRenderer = SimpleRenderer.Create(new Axis(partCount: 6, radius: 1.0f));
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                SimpleRenderer pickableRenderer = SimpleRenderer.Create(new Cube(new vec3(5, 4, 3)));
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                var points = new List <vec3>()
                {
                    new vec3(-4.0f, 0.0f, 0.0f),
                    new vec3(-6.0f, 4.0f, 0.0f),
                    new vec3(6.0f, -4.0f, 0.0f),
                    new vec3(4.0f, 0.0f, 0.0f),
                };
                BezierRenderer pickableRenderer = BezierRenderer.Create(points, BezierType.Curve);
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                // note: the points are not centered at (0, 0, 0). Thus the renderer will not be placed at (0, 0, 0).
                var points = new List <vec3>()
                {
                    new vec3(-4.0f, 0.0f, 4.0f),
                    new vec3(-2.0f, 4.0f, 4.0f),
                    new vec3(4.0f, 0.0f, 4.0f),
                    new vec3(-4.0f, 0.0f, 0.0f),
                    new vec3(-2.0f, 4.0f, 0.0f),
                    new vec3(4.0f, 0.0f, 0.0f),
                    new vec3(-4.0f, 0.0f, -4.0f),
                    new vec3(-2.0f, 4.0f, -4.0f),
                    new vec3(4.0f, 0.0f, -4.0f)
                };
                BezierRenderer pickableRenderer = BezierRenderer.Create(points, BezierType.Surface);
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                SimplexNoiseRenderer pickableRenderer = SimplexNoiseRenderer.Create();
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            {
                KleinBottleRenderer pickableRenderer = KleinBottleRenderer.Create(new KleinBottleModel());
                pickableRenderer.Scale = new vec3(0.1f, 0.1f, 0.1f);
                pickableRenderer.Initialize();
                list.Add(pickableRenderer);
            }
            return(list);
        }