private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(-3, -2, -5) * 0.5f, new vec3(0, 0, 0), new vec3(0, -1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; this.scene = new Scene(camera, this.glCanvas1); this.scene.RootViewPort.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { GreyFilterRenderer renderer = GreyFilterRenderer.Create(); SceneObject obj = renderer.WrapToSceneObject(generateBoundingBox: true); this.scene.RootObject.Children.Add(obj); this.renderer = renderer; } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); rotator.BindingMouseButtons = System.Windows.Forms.MouseButtons.Left | System.Windows.Forms.MouseButtons.Right; this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { IBufferable bufferable = new Teapot(); var renderer = new OrderIndependentTransparencyRenderer( bufferable, Teapot.strPosition, Teapot.strNormal); renderer.Name = "OIT Renderer"; renderer.Initialize(); SceneObject obj = renderer.WrapToSceneObject(); this.scene.RootObject.Children.Add(obj); } this.form03 = new Form03OrderDependentTransparency(this); this.form03.Show(); }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 1), new vec3(0, 0, 0), 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; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { var renderer = new PointSpriteRenderer(10000); renderer.Initialize(); this.renderer = renderer; 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 void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, -1), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.scene.RootViewPort.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { var renderer = new ImageProcessingRenderer(); renderer.Initialize(); SceneObject obj = renderer.WrapToSceneObject(new UpdateImageScript(this.glCanvas1)); this.scene.RootObject.Children.Add(obj); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(5, 4, 3) * 0.5f, new vec3(0, 0, 0), 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; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { const int particleCount = 10000; PointSpriteRenderer renderer = PointSpriteRenderer.Create(particleCount); this.renderer = renderer; SceneObject obj = renderer.WrapToSceneObject(generateBoundingBox: true); this.scene.RootObject.Children.Add(obj); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("O: to select image."); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); rotator.BindingMouseButtons = System.Windows.Forms.MouseButtons.Left | System.Windows.Forms.MouseButtons.Right; this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { Teapot model = new Teapot(); OrderDependentTransparencyRenderer renderer = OrderDependentTransparencyRenderer.Create(model, model.Lengths, Teapot.strPosition, Teapot.strColor); SceneObject obj = renderer.WrapToSceneObject(); this.scene.RootObject.Children.Add(obj); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(5, 4, 3) * 4, new vec3(0, 0, 0), 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; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { var renderer = ConditionalRenderer.Create(); renderer.Initialize(); SceneObject obj = renderer.WrapToSceneObject(name: "Conditional Renderer Demo"); this.scene.RootObject.Children.Add(obj); this.conditionalRenderer = renderer; } //{ // var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, // new Padding(3, 3, 3, 3), new Size(128, 128)); // uiAxis.Initialize(); // this.scene.UIRoot.Children.Add(uiAxis); //} { var builder = new StringBuilder(); builder.AppendLine("O: to select image."); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas's property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 1), new vec3(0, 0, 0), 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 renderer = new AnalyzedPointSpriteRenderer(10000); renderer.Initialize(); this.renderer = renderer; } { 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.renderer); frmPropertyGrid.Show(); this.formPropertyGrid = frmPropertyGrid; } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), 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; } { IBufferable bufferable = new Teapot(); var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\Transparent.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\Transparent.frag"), ShaderType.FragmentShader); var map = new PropertyNameMap(); map.Add("in_Position", "position"); map.Add("in_Color", "color"); var renderer = new PickableRenderer(bufferable, shaderCodes, map, "position"); renderer.Name = "Order-Dependent Transparent Renderer"; renderer.Initialize(); { GLSwitch blendSwitch = new BlendSwitch(BlendingSourceFactor.SourceAlpha, BlendingDestinationFactor.OneMinusSourceAlpha); renderer.SwitchList.Add(blendSwitch); } this.renderer = renderer; } { var frmPropertyGrid = new FormProperyGrid(); frmPropertyGrid.DisplayObject(this.renderer); frmPropertyGrid.Show(); this.formPropertyGrid = frmPropertyGrid; } }
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(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); rotator.BindingMouseButtons = System.Windows.Forms.MouseButtons.Left | System.Windows.Forms.MouseButtons.Right; this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { Teapot model = new Teapot(); OrderDependentTransparencyRenderer renderer = OrderDependentTransparencyRenderer.Create(model, model.Size, Teapot.strPosition, Teapot.strColor); SceneObject obj = renderer.WrapToSceneObject(); this.scene.RootObject.Children.Add(obj); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(-3, -2, -5) * 0.5f, new vec3(0, 0, 0), new vec3(0, -1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; this.scene = new Scene(camera, this.glCanvas1); this.scene.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { GreyFilterRenderer renderer = GreyFilterRenderer.Create(); SceneObject obj = renderer.WrapToSceneObject(generateBoundingBox: true); this.scene.RootObject.Children.Add(obj); this.renderer = renderer; } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.UIRoot.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), 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; } { IBufferable bufferable = new Teapot(); var OITRenderer = new OrderIndependentTransparencyRenderer( bufferable, Teapot.strPosition, Teapot.strNormal); OITRenderer.Name = "OIT Renderer"; OITRenderer.Initialize(); this.OITRenderer = OITRenderer; } { var frmPropertyGrid = new FormProperyGrid(); frmPropertyGrid.DisplayObject(this.OITRenderer); frmPropertyGrid.Show(); this.formPropertyGrid = frmPropertyGrid; } this.form03 = new Form03OrderDependentTransparency(this); this.form03.Show(); }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), 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.scene.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { const int gridsPer2Unit = 20; const int scale = 2; var ground = GroundRenderer.Create(new GroundModel(gridsPer2Unit * scale)); ground.Scale = new vec3(scale, scale, scale); var obj = new SceneObject(); obj.Renderer = ground; this.scene.RootObject.Children.Add(obj); } { SimpleRenderer movableRenderer = SimpleRenderer.Create(new Teapot()); movableRenderer.RotationAxis = new vec3(0, 1, 0); movableRenderer.Scale = new vec3(0.1f, 0.1f, 0.1f); this.movableRenderer = movableRenderer; SceneObject obj = movableRenderer.WrapToSceneObject(); this.scene.RootObject.Children.Add(obj); } { BillboardRenderer billboardRenderer = BillboardRenderer.Create(new BillboardModel()); SceneObject obj = billboardRenderer.WrapToSceneObject(new UpdateBillboardPosition(movableRenderer)); this.scene.RootObject.Children.Add(obj); } { LabelRenderer labelRenderer = LabelRenderer.Create(); labelRenderer.Text = "Teapot - CSharpGL"; SceneObject obj = labelRenderer.WrapToSceneObject(new UpdateLabelPosition(movableRenderer)); this.scene.RootObject.Children.Add(obj); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { var frmPropertyGrid = new FormProperyGrid(this.scene); frmPropertyGrid.Show(); } { var frmPropertyGrid = new FormProperyGrid(this.glCanvas1); frmPropertyGrid.Show(); } { this.scene.Start(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), 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.scene.RootViewPort.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { const int gridsPer2Unit = 20; const int scale = 2; var ground = GroundRenderer.Create(new GroundModel(gridsPer2Unit * scale)); ground.Scale = new vec3(scale, scale, scale); var obj = new SceneObject(); obj.Renderer = ground; this.scene.RootObject.Children.Add(obj); } { SimpleRenderer movableRenderer = SimpleRenderer.Create(new Teapot()); movableRenderer.RotationAxis = new vec3(0, 1, 0); movableRenderer.Scale = new vec3(0.1f, 0.1f, 0.1f); this.movableRenderer = movableRenderer; SceneObject obj = movableRenderer.WrapToSceneObject(); this.scene.RootObject.Children.Add(obj); } { BillboardRenderer billboardRenderer = BillboardRenderer.Create(new BillboardModel()); SceneObject obj = billboardRenderer.WrapToSceneObject(new UpdateBillboardPosition(movableRenderer)); this.scene.RootObject.Children.Add(obj); } { LabelRenderer labelRenderer = LabelRenderer.Create(); labelRenderer.Text = "Teapot - CSharpGL"; SceneObject obj = labelRenderer.WrapToSceneObject(new UpdateLabelPosition(movableRenderer)); this.scene.RootObject.Children.Add(obj); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { var frmPropertyGrid = new FormProperyGrid(this.scene); frmPropertyGrid.Show(); } { var frmPropertyGrid = new FormProperyGrid(this.glCanvas1); frmPropertyGrid.Show(); } { this.scene.Start(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(5, 3, 4), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; this.scene = new Scene(camera, this.glCanvas1); this.scene.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { PointLightRenderer renderer = PointLightRenderer.Create(); SceneObject obj = renderer.WrapToSceneObject(true, new ModelScript(this.glCanvas1, this.scene.FirstCamera)); this.scene.RootObject.Children.Add(obj); this.renderer = renderer; var frmPropertyGrid = new FormProperyGrid(renderer); frmPropertyGrid.Show(); } { SimplexNoiseRenderer renderer = SimplexNoiseRenderer.Create(); renderer.Scale = new vec3(0.2f); renderer.WorldPosition = new vec3(3, 3, 3); SceneObject obj = renderer.WrapToSceneObject(true, new LightScript(this.glCanvas1, this.scene.FirstCamera, renderer)); this.scene.RootObject.Children.Add(obj); this.sunRenderer = renderer; } { SceneObject obj = this.renderer.BindingSceneObject; obj.Scripts.Add(new UpdatePointLightPosition(this.sunRenderer)); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { this.glCanvas1.MouseDown += glCanvas1_MouseDown; this.glCanvas1.MouseMove += glCanvas1_MouseMove; this.glCanvas1.MouseUp += glCanvas1_MouseUp; } { var builder = new StringBuilder(); builder.AppendLine("1: Scenes' property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } { this.scene.Start(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(5, 3, 4), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; this.scene = new Scene(camera, this.glCanvas1); this.scene.RootViewPort.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { PointLightRenderer renderer = PointLightRenderer.Create(); SceneObject obj = renderer.WrapToSceneObject(true, new ModelScript(this.glCanvas1, this.scene.FirstCamera)); this.scene.RootObject.Children.Add(obj); this.renderer = renderer; var frmPropertyGrid = new FormProperyGrid(renderer); frmPropertyGrid.Show(); } { SimplexNoiseRenderer renderer = SimplexNoiseRenderer.Create(); renderer.Scale = new vec3(0.2f); renderer.WorldPosition = new vec3(3, 3, 3); SceneObject obj = renderer.WrapToSceneObject(true, new LightScript(this.glCanvas1, this.scene.FirstCamera, renderer)); this.scene.RootObject.Children.Add(obj); this.sunRenderer = renderer; } { SceneObject obj = this.renderer.BindingSceneObject; obj.Scripts.Add(new UpdatePointLightPosition(this.sunRenderer)); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { this.glCanvas1.MouseDown += glCanvas1_MouseDown; this.glCanvas1.MouseMove += glCanvas1_MouseMove; this.glCanvas1.MouseUp += glCanvas1_MouseUp; } { var builder = new StringBuilder(); builder.AppendLine("1: Scenes' property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } { this.scene.Start(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(5, 3, 4), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var scene = new Scene(camera, this.glCanvas1); scene.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += scene.Resize; this.scene = scene; var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; } { const int gridsPer2Unit = 20; const int scale = 2; GroundRenderer renderer = GroundRenderer.Create(new GroundModel(gridsPer2Unit * scale)); renderer.Scale = new vec3(scale, scale, scale); SceneObject obj = renderer.WrapToSceneObject(generateBoundingBox: true); this.scene.RootObject.Children.Add(obj); } { var arcballManipulater = new ArcBallManipulater(); arcballManipulater.Bind(this.scene.Camera, this.glCanvas1); SimpleRenderer renderer = SimpleRenderer.Create(new Teapot()); SceneObject obj = renderer.WrapToSceneObject(); obj.Scripts.Add(new ArcballScript(arcballManipulater)); { BoundingBoxRenderer box = renderer.GetBoundingBoxRenderer(); var boxObj = box.WrapToSceneObject(); boxObj.Scripts.Add(new ArcballScript(arcballManipulater)); obj.Children.Add(boxObj); } this.scene.RootObject.Children.Add(obj); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); uiAxis.Initialize(); this.scene.UIRoot.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas' property grid."); builder.AppendLine("3: Form's property grid."); MessageBox.Show(builder.ToString()); } { this.scene.Start(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); this.camera = camera; var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; var arcballManipulater = new ArcBallManipulater(); arcballManipulater.Bind(camera, this.glCanvas1); this.arcballManipulater = arcballManipulater; } { const int gridsPer2Unit = 20; const int scale = 2; GroundRenderer ground = GroundRenderer.Create(new GroundModel(gridsPer2Unit * scale)); ground.Initialize(); ground.Scale = scale; this.ground = ground; } { var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\Teapot.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\Teapot.frag"), ShaderType.FragmentShader); var map = new PropertyNameMap(); map.Add("in_Position", "position"); map.Add("in_Color", "color"); var teapotRenderer = new Renderer(new Teapot(), shaderCodes, map); teapotRenderer.Initialize(); this.teapotRenderer = teapotRenderer; } { var UIRoot = new UIRoot(); UIRoot.Initialize(); this.uiRoot = UIRoot; var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128), -100, 100); uiAxis.Initialize(); this.uiAxis = uiAxis; UIRoot.Children.Add(uiAxis); } { var frmPropertyGrid = new FormProperyGrid(this.teapotRenderer); frmPropertyGrid.Show(); } { var frmPropertyGrid = new FormProperyGrid(this.glCanvas1); frmPropertyGrid.Show(); } }
private void FormMain_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(); //var rotator = new FirstPerspectiveManipulater(); rotator.Bind(camera, this.glCanvas1); this.camera = camera; } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(5, 3, 4), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var scene = new Scene(camera, this.glCanvas1); scene.RootViewPort.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += scene.Resize; this.scene = scene; var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; } { const int gridsPer2Unit = 20; const int scale = 2; GroundRenderer renderer = GroundRenderer.Create(new GroundModel(gridsPer2Unit * scale)); renderer.Scale = new vec3(scale, scale, scale); SceneObject obj = renderer.WrapToSceneObject(generateBoundingBox: true); this.scene.RootObject.Children.Add(obj); } { var arcballManipulater = new ArcBallManipulater(); arcballManipulater.Bind(this.scene.FirstCamera, this.glCanvas1); SimpleRenderer renderer = SimpleRenderer.Create(new Teapot()); SceneObject obj = renderer.WrapToSceneObject(new ArcballScript(arcballManipulater)); { BoundingBoxRenderer box = renderer.GetBoundingBoxRenderer(); var boxObj = box.WrapToSceneObject(); obj.Children.Add(boxObj); } this.scene.RootObject.Children.Add(obj); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); uiAxis.Initialize(); this.scene.RootUI.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas' property grid."); builder.AppendLine("3: Form's property grid."); MessageBox.Show(builder.ToString()); } { this.scene.Start(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); this.camera = camera; var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; var arcballManipulater = new ArcBallManipulater(); arcballManipulater.Bind(camera, this.glCanvas1); this.arcballManipulater = arcballManipulater; } { const int gridsPer2Unit = 20; const int scale = 2; GroundRenderer ground = GroundRenderer.Create(new GroundModel(gridsPer2Unit * scale)); ground.Initialize(); ground.Scale = scale; this.ground = ground; } { var renderer = UpdatingTextureRenderer.Create(new TexturedRectangleModel()); renderer.Initialize(); this.renderer = renderer; } { var UIRoot = new UIRoot(); UIRoot.Initialize(); this.uiRoot = UIRoot; var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128), -100, 100); uiAxis.Initialize(); this.uiAxis = uiAxis; UIRoot.Children.Add(uiAxis); } { var frmPropertyGrid = new FormProperyGrid(this.renderer); frmPropertyGrid.Show(); } { var frmPropertyGrid = new FormProperyGrid(this.glCanvas1); frmPropertyGrid.Show(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(3, 4, 5) * 4, new vec3(0, 0, 0), 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 scene = new Scene(camera, this.glCanvas1); this.scene = scene; this.glCanvas1.Resize += this.scene.Resize; } var frmSelectRenderer = new FormSelectType(typeof(RendererBase), false, x => !x.IsAbstract && x.GetCustomAttributes(typeof(DemoRendererAttribute), true).Length > 0); frmSelectRenderer.StartPosition = FormStartPosition.CenterScreen; frmSelectRenderer.Size = new Size(600, 500); if (frmSelectRenderer.ShowDialog() == System.Windows.Forms.DialogResult.OK) { RendererBase renderer = DemoRendererFactory.Create(frmSelectRenderer.SelectedType); if (renderer == null) { throw new Exception("Please add this renderer type to Factory."); } SceneObject obj = renderer.WrapToSceneObject(generateBoundingBox: true); this.scene.RootObject.Children.Add(obj); this.scene.Camera.ZoomCamera(renderer.GetBoundingBox()); var frmProperty = new FormProperyGrid(renderer); frmProperty.Show(); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.UIRoot.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, -100), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { var renderer = new ParticleSimulatorRenderer(); SceneObject obj = renderer.WrapToSceneObject(); this.scene.RootObject.Children.Add(obj); var frmPropertyGrid = new FormProperyGrid(this.scene); frmPropertyGrid.Show(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(3, 4, 5) * 4, new vec3(0, 0, 0), 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 scene = new Scene(camera, this.glCanvas1); this.scene = scene; this.glCanvas1.Resize += this.scene.Resize; } var frmSelectRenderer = new FormSelectType(typeof(RendererBase), false, x => !x.IsAbstract && x.GetCustomAttributes(typeof(DemoRendererAttribute), true).Length > 0); frmSelectRenderer.StartPosition = FormStartPosition.CenterScreen; frmSelectRenderer.Size = new Size(600, 500); if (frmSelectRenderer.ShowDialog() == System.Windows.Forms.DialogResult.OK) { RendererBase renderer = DemoRendererFactory.Create(frmSelectRenderer.SelectedType); if (renderer == null) { throw new Exception("Please add this renderer type to Factory."); } SceneObject obj = renderer.WrapToSceneObject(generateBoundingBox: true); this.scene.RootObject.Children.Add(obj); this.scene.FirstCamera.ZoomCamera(renderer.GetBoundingBox()); var frmProperty = new FormProperyGrid(renderer); frmProperty.Show(); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, -100), new vec3(0, 0, 0), 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 renderer = new ParticleSimulatorRenderer(); this.renderer = renderer; } { var frmPropertyGrid = new FormProperyGrid(); frmPropertyGrid.DisplayObject(this.renderer); frmPropertyGrid.Show(); this.formPropertyGrid = frmPropertyGrid; } }
private void Form_Load(object sender, EventArgs e) { { this.glCanvas1.ShowSystemCursor = false; } { var camera = new Camera( new vec3(0, 0, 1), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { var glText = new UIText(AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right, new Padding(10, 10, 10, 10), new Size(550, 50), -100, 100); glText.Initialize(); glText.SwitchList.Add(new ClearColorSwitch());// show black back color to indicate glText's area. glText.Text = "The quick brown fox jumps over the lazy dog!"; this.glText = glText; this.scene.UIRoot.Children.Add(glText); } { 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); this.UpdateLabel(); } { var frmPropertyGrid = new FormProperyGrid(this.glText); frmPropertyGrid.Show(); this.formPropertyGrid = frmPropertyGrid; } }
private void Form_Load(object sender, EventArgs e) { { //this.glCanvas1.ShowSystemCursor = false; } { var camera = new Camera( new vec3(0, 0, 1), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.scene.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { var glText = new UIText(AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right, new Padding(10, 10, 10, 10), new Size(550, 50), -100, 100); glText.SwitchList.Add(new ClearColorSwitch());// show black back color to indicate glText's area. glText.Text = "The quick brown fox jumps over the lazy dog!"; this.glText = glText; this.scene.UIRoot.Children.Add(glText); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.UIRoot.Children.Add(uiAxis); this.UpdateLabel(); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Cavas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { //this.glCanvas1.ShowSystemCursor = false; } { var camera = new Camera( new vec3(0, 0, 1), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.scene.RootViewPort.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { var glText = new UIText(AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right, new Padding(10, 10, 10, 10), new Size(550, 50), -100, 100); glText.StateList.Add(new ClearColorState());// show black back color to indicate glText's area. glText.Text = "The quick brown fox jumps over the lazy dog!"; this.glText = glText; this.scene.RootUI.Children.Add(glText); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); this.UpdateLabel(); } { var builder = new StringBuilder(); builder.AppendLine("1: Scene's property grid."); builder.AppendLine("2: Cavas' property grid."); MessageBox.Show(builder.ToString()); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(5, 3, 4), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; this.scene = new Scene(camera, this.glCanvas1); this.scene.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { HemisphereLightingRenderer renderer = HemisphereLightingRenderer.Create(); SceneObject obj = renderer.WrapToSceneObject(true, new ModelScript(this.glCanvas1, this.scene.FirstCamera)); this.scene.RootObject.Children.Add(obj); this.renderer = renderer; var frmPropertyGrid = new FormProperyGrid(renderer); frmPropertyGrid.Show(); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("1: Scenes' property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } { this.scene.Start(); } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(5, 3, 4), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this.glCanvas1); this.cameraManipulater = cameraManipulater; this.scene = new Scene(camera, this.glCanvas1); this.scene.RootViewPort.ClearColor = Color.SkyBlue; this.glCanvas1.Resize += this.scene.Resize; } { HemisphereLightingRenderer renderer = HemisphereLightingRenderer.Create(); SceneObject obj = renderer.WrapToSceneObject(true, new ModelScript(this.glCanvas1, this.scene.FirstCamera)); this.scene.RootObject.Children.Add(obj); this.renderer = renderer; var frmPropertyGrid = new FormProperyGrid(renderer); frmPropertyGrid.Show(); } { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128)); this.scene.RootUI.Children.Add(uiAxis); } { var builder = new StringBuilder(); builder.AppendLine("1: Scenes' property grid."); builder.AppendLine("2: Canvas' property grid."); MessageBox.Show(builder.ToString()); } { this.scene.Start(); } }
private void ScientificCanvas_Load(object sender, EventArgs e) { var camera = new Camera(new vec3(4, 1.6f, 3), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.Width, this.Height); var cameraManipulater = new SatelliteManipulater(); cameraManipulater.Bind(camera, this); this.cameraManipulater = cameraManipulater; this.Scene = new Scene(camera, this); //this.Scene.Cursor.Enabled = false; { var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(10, 10, 10, 10), new Size(128, 128)); uiAxis.Initialize(); //// display this UI control's area. //uiAxis.StateList.Add(new ClearColorState()); this.Axis = uiAxis; this.Scene.RootUI.Children.Add(uiAxis); } { var uiColorPalette = new UIColorPaletteRenderer(100, CodedColor.GetDefault(), AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right, new Padding(148, 10, 60, 10 + 40), new Size(400, 40), -100, 100); uiColorPalette.Initialize(); this.ColorPalette = uiColorPalette; this.Scene.RootUI.Children.Add(uiColorPalette); } this.Resize += this.Scene.Resize; this.OpenGLDraw += ScientificCanvas_OpenGLDraw; //this.MouseDown += ScientificCanvas_MouseDown; //this.MouseMove += ScientificCanvas_MouseMove; //this.MouseUp += ScientificCanvas_MouseUp; //this.MouseWheel += ScientificCanvas_MouseWheel; }
private void Form_Load(object sender, EventArgs e) { { this.glCanvas1.ShowSystemCursor = false; } { var camera = new Camera( new vec3(0, 0, 1), new vec3(0, 0, 0), new vec3(0, 1, 0), CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height); var rotator = new SatelliteManipulater(); rotator.Bind(camera, this.glCanvas1); this.rotator = rotator; this.scene = new Scene(camera, this.glCanvas1); this.glCanvas1.Resize += this.scene.Resize; } { var labelRenderer = new LabelRenderer(1000, 640); labelRenderer.Text = "LABEL 1"; labelRenderer.Initialize(); labelRenderer.SetPosition(new vec3(1, 0, 0)); SceneObject obj = labelRenderer.WrapToSceneObject("label 1"); this.scene.RootObject.Children.Add(obj); this.blendSwitch1 = labelRenderer.SwitchList.Find(x => x is BlendSwitch) as BlendSwitch; this.labelRenderer1 = labelRenderer; } { var labelRenderer = new LabelRenderer(1000, 640); labelRenderer.Text = "LABEL 2"; labelRenderer.Initialize(); labelRenderer.SetPosition(new vec3(-1, 0, 0)); SceneObject obj = labelRenderer.WrapToSceneObject("label 2"); this.scene.RootObject.Children.Add(obj); this.blendSwitch2 = labelRenderer.SwitchList.Find(x => x is BlendSwitch) as BlendSwitch; this.labelRenderer2 = labelRenderer; } }
private void Form_Load(object sender, EventArgs e) { { var camera = new Camera( new vec3(0, 0, 5), new vec3(0, 0, 0), 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; } { const int gridsPer2Unit = 20; const int scale = 2; var ground = GroundRenderer.Create(new GroundModel(gridsPer2Unit * scale)); ground.Scale = scale; //ground.Initialize(); //this.ground = ground; var obj = new SceneObject(); obj.Renderer = ground; this.scene.RootObject.Children.Add(obj); } //MovableRenderer movableRenderer; { movableRenderer = MovableRenderer.Create(new Teapot()); //movableRenderer.Initialize(); movableRenderer.Scale = 0.1f; var obj = new SceneObject(); obj.Renderer = movableRenderer; this.scene.RootObject.Children.Add(obj); } { BillboardRenderer billboardRenderer = BillboardRenderer.GetRenderer(new BillboardModel()); //billboardRenderer.Initialize(); var obj = new SceneObject(); obj.Renderer = billboardRenderer; var updatePosition = new UpdateBillboardPosition(movableRenderer); obj.ScriptList.Add(updatePosition); this.scene.RootObject.Children.Add(obj); } { var labelRenderer = new LabelRenderer(); labelRenderer.Initialize(); labelRenderer.Text = "Teapot - CSharpGL"; SceneObject obj = labelRenderer.WrapToSceneObject(new UpdateLabelPosition(movableRenderer)); 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(); } { var frmPropertyGrid = new FormProperyGrid(this.glCanvas1); frmPropertyGrid.Show(); } { this.scene.Start(); } }
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; } { // build several models Random random = new Random(); var bufferables = new IBufferable[] { new Axis(), new BigDipper(), new Chain(new ChainModel(random.Next(7, 100), 5, 5)), new Tetrahedron(), new Cube(), new Sphere(), new Teapot(), }; var keys = new GeometryModel[] { GeometryModel.Axis, GeometryModel.BigDipper, GeometryModel.Chain, GeometryModel.Tetrahedron, GeometryModel.Cube, GeometryModel.Sphere, GeometryModel.Teapot, }; ShaderCode[] simpleShader = new ShaderCode[2]; simpleShader[0] = new ShaderCode(File.ReadAllText(@"shaders\Simple.vert"), ShaderType.VertexShader); simpleShader[1] = new ShaderCode(File.ReadAllText(@"shaders\Simple.frag"), ShaderType.FragmentShader); ShaderCode[] emitNormalLineShader = new ShaderCode[3]; emitNormalLineShader[0] = new ShaderCode(File.ReadAllText(@"shaders\EmitNormalLine.vert"), ShaderType.VertexShader); emitNormalLineShader[1] = new ShaderCode(File.ReadAllText(@"shaders\EmitNormalLine.geom"), ShaderType.GeometryShader); emitNormalLineShader[2] = new ShaderCode(File.ReadAllText(@"shaders\EmitNormalLine.frag"), ShaderType.FragmentShader); var shaderCodesGroup = new ShaderCode[][] { simpleShader, simpleShader, simpleShader, emitNormalLineShader, emitNormalLineShader, emitNormalLineShader, emitNormalLineShader, }; var simpleShaderPropertyNameMap = new PropertyNameMap(); simpleShaderPropertyNameMap.Add("in_Position", "position"); simpleShaderPropertyNameMap.Add("in_Color", "color"); var emitNormalLineShaderPropertyNameMap = new PropertyNameMap(); emitNormalLineShaderPropertyNameMap.Add("in_Position", "position"); emitNormalLineShaderPropertyNameMap.Add("in_Normal", "normal"); var propertyNameMaps = new PropertyNameMap[] { simpleShaderPropertyNameMap, simpleShaderPropertyNameMap, simpleShaderPropertyNameMap, emitNormalLineShaderPropertyNameMap, emitNormalLineShaderPropertyNameMap, emitNormalLineShaderPropertyNameMap, emitNormalLineShaderPropertyNameMap, }; var positionNameInIBufferables = new string[] { "position", "position", "position", "position", "position", "position", "position", }; for (int i = 0; i < bufferables.Length; i++) { GeometryModel key = keys[i]; IBufferable bufferable = bufferables[i]; ShaderCode[] shaders = shaderCodesGroup[i]; var propertyNameMap = propertyNameMaps[i]; string positionNameInIBufferable = positionNameInIBufferables[i]; var highlightRenderer = new HighlightRenderer( bufferable, positionNameInIBufferable); highlightRenderer.Name = string.Format("Highlight: [{0}]", key); highlightRenderer.Initialize(); var pickableRenderer = new PickableRenderer( bufferable, shaders, propertyNameMap, positionNameInIBufferable); pickableRenderer.Name = string.Format("Pickable: [{0}]", key); pickableRenderer.Initialize(); if (i > 2) { pickableRenderer.SetUniform("normalLength", 0.5f); pickableRenderer.SetUniform("showModel", true); pickableRenderer.SetUniform("showNormal", false); } HighlightedPickableRenderer renderer = new HighlightedPickableRenderer( highlightRenderer, pickableRenderer); renderer.Initialize(); { GLSwitch lineWidthSwitch = new LineWidthSwitch(5); pickableRenderer.SwitchList.Add(lineWidthSwitch); GLSwitch pointSizeSwitch = new PointSizeSwitch(10); pickableRenderer.SwitchList.Add(pointSizeSwitch); GLSwitch polygonModeSwitch = new PolygonModeSwitch(PolygonModes.Filled); pickableRenderer.SwitchList.Add(polygonModeSwitch); //GLSwitch blendSwitch = new BlendSwitch(); //pickableRenderer.SwitchList.Add(blendSwitch); } this.rendererDict.Add(key, renderer); } this.SelectedModel = GeometryModel.Tetrahedron; } { var frmBulletinBoard = new FormBulletinBoard(); //frmBulletinBoard.Dump = true; frmBulletinBoard.Show(); this.pickedGeometryBoard = frmBulletinBoard; } { var UIRoot = new UIRoot(); UIRoot.Initialize(); this.uiRoot = UIRoot; var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(3, 3, 3, 3), new Size(128, 128), -100, 100); uiAxis.Initialize(); UIRoot.Children.Add(uiAxis); this.uiAxis = uiAxis; var font = new Font("Courier New", 32); var uiText = new UIText(AnchorStyles.Left | AnchorStyles.Bottom, new Padding(0, 0, 0, 0), new Size(250, 20), -100, 100, font.GetFontBitmap("[index: 0123456789]").GetFontTexture()); uiText.Text = ""; uiRoot.Children.Add(uiText); this.uiText = uiText; } { var frmPropertyGrid = new FormProperyGrid(this.rendererDict[this.SelectedModel].PickableRenderer); frmPropertyGrid.Show(); this.pickableRendererPropertyGrid = frmPropertyGrid; } { var frmPropertyGrid = new FormProperyGrid(this.rendererDict[this.SelectedModel].Highlighter); frmPropertyGrid.Show(); this.highlightRendererPropertyGrid = frmPropertyGrid; } { var frmPropertyGrid = new FormProperyGrid(this); frmPropertyGrid.Show(); this.formPropertyGrid = frmPropertyGrid; } { var frmPropertyGrid = new FormProperyGrid(this.uiText); frmPropertyGrid.Show(); } { var frmIndexBufferPtrBoard = new FormIndexBufferPtrBoard(); frmIndexBufferPtrBoard.SetTarget(this.rendererDict[this.SelectedModel].PickableRenderer.IndexBufferPtr); frmIndexBufferPtrBoard.Show(); this.frmIndexBufferPtrBoard = frmIndexBufferPtrBoard; } }