public override void Load(ProgramWindow parent) { base.Load(parent); // Setup parameters for Points GL.PointSize(quadSize); GL.Enable(EnableCap.PointSmooth); GL.Enable(EnableCap.Blend); GL.Disable(EnableCap.DepthTest); GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One); GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); // Setup VBO state GL.EnableClientState(ArrayCap.TextureCoordArray); GL.EnableClientState(ArrayCap.VertexArray); GL.GenBuffers(1, out VBOHandle); // Since there's only 1 VBO in the app, might aswell setup here. GL.BindBuffer(BufferTarget.ArrayBuffer, VBOHandle); GL.TexCoordPointer(2, TexCoordPointerType.Float, VertexC4ubV3f.SizeInBytes, 0); GL.VertexPointer(3, VertexPointerType.Float, VertexC4ubV3f.SizeInBytes, (IntPtr)(Vector2.SizeInBytes)); VBO = new VertexC4ubV3f[0]; }
public override void Load(ProgramWindow parent) { base.Load(parent); // Setup parameters for Points GL.PointSize(pointSize); GL.Enable(EnableCap.PointSmooth); GL.Disable(EnableCap.DepthTest); GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); lightProgram.Load(); GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0); GL.Enable(EnableCap.Light1); GL.Enable(EnableCap.Light2); GL.Enable(EnableCap.Light3); GL.Enable(EnableCap.Light4); GL.Enable(EnableCap.Light5); GL.Enable(EnableCap.Light6); GL.Enable(EnableCap.Light7); // Setup VBO state GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.TextureCoordArray); GL.GenBuffers(1, out VBOHandle); // Since there's only 1 VBO in the app, might aswell setup here. GL.BindBuffer(BufferTarget.ArrayBuffer, VBOHandle); GL.VertexPointer(3, VertexPointerType.Float, Vertex.SizeInBytes, 0); GL.TexCoordPointer(2, TexCoordPointerType.Float, Vertex.SizeInBytes, Vector3.SizeInBytes); //GL.ColorPointer(4, ColorPointerType.UnsignedByte, VertexC4ubV3f.SizeInBytes, (IntPtr)0); //GL.VertexPointer(3, VertexPointerType.Float, VertexC4ubV3f.SizeInBytes, (IntPtr)(4 * sizeof(byte))); //GL.NormalPointer(NormalPointerType.Float, VertexC4ubV3f.SizeInBytes, (IntPtr)(4 * sizeof(byte) + Vector3.SizeInBytes)); vertices = new Vertex[0]; lights.UseInput(parent.Keyboard); //lights[0].Diffuse = new OpenTK.Graphics.Color4(253, 157, 100, 255); lights[0].Diffuse = new OpenTK.Graphics.Color4(253, 176, 130, 255); //lights[0].Diffuse = new OpenTK.Graphics.Color4(55,55,55, 255); lights[0].InUse = true; lights[0].Position = new Vector4(0, 0.4f, 10.3f, 1); lights[0].LinearAttenuation = 0f; lights[0].ConstantAttenuation = 1f; lights[0].SpotDirection = new Vector4(0, 0, 1, 0); }
/// <summary> /// 添加记录 /// </summary> /// <param name="bean">事件bean</param> public static void AddIncident(IncidentBean bean) { AddRecordAsyn addRecord = new AddRecordAsyn(); Log.Info("开始添加记录"); ProgramWindow window = new ProgramWindow(); object[] objs = { window, bean }; //建立异步线程来记录全盘文件 addRecord.thread = new Thread(addRecord.AddOne) { Name = "addRecord" }; addRecord.thread.Start(objs); window.ShowDialog(); }
public TaskItemButton(ProgramWindow programWindow) { InitializeComponent(); try { WindowIcon = new ImageBrush(programWindow.Icon.ToBitmap().ToBitmapSource()); } catch (Exception ex) { Debug.WriteLine(ex); } WindowTitle = programWindow.Name; Tag = programWindow; var doesThisWindowExist = new Timer { Interval = 100 }; var thisModule = (SuperbarModule)MainTools.GetFixedModule("Test Module"); doesThisWindowExist.Elapsed += delegate { Dispatcher.Invoke(new Action(() => { { if (!IsWindow(programWindow.Hwnd)) { foreach (TaskbarGroupStackPanel t in thisModule.Taskbars[0].Taskband.Children) { foreach (var p in t.ProgramWindowsList) { if (p.Hwnd == programWindow.Hwnd) { t.RemoveButtonByHwnd(programWindow.Hwnd); } } } } } })); }; }
private void ShowProgress(object obj) { ProgramWindow window = (ProgramWindow)obj; bool a = true; while (isRunning) { window.WriteAll(plies2Path + "\n已记录:" + beanCount); if (a) { a = false; window.WriteLine(" *"); } else { a = true; window.Write("\n"); } window.Write("当前线程状态:" + thread.ThreadState); //窗口的刷新时间 Thread.Sleep(300); } }
public override void Load(ProgramWindow parent) { base.Load(parent); // Setup parameters for Points GL.PointSize(pointSize); GL.Enable(EnableCap.PointSmooth); GL.Disable(EnableCap.DepthTest); GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); // Setup VBO state GL.EnableClientState(ArrayCap.VertexArray); GL.GenBuffers(1, out VBOHandle); // Since there's only 1 VBO in the app, might aswell setup here. GL.BindBuffer(BufferTarget.ArrayBuffer, VBOHandle); GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes, 0); //GL.ColorPointer(4, ColorPointerType.UnsignedByte, VertexC4ubV3f.SizeInBytes, (IntPtr)0); //GL.VertexPointer(3, VertexPointerType.Float, VertexC4ubV3f.SizeInBytes, (IntPtr)(4 * sizeof(byte))); //GL.NormalPointer(NormalPointerType.Float, VertexC4ubV3f.SizeInBytes, (IntPtr)(4 * sizeof(byte) + Vector3.SizeInBytes)); vertices = new Vector3[0]; }
public override void Load(ProgramWindow parent) { parent.MakeCurrent(); base.Load(parent); GL.Disable(EnableCap.Dither); GL.Enable(EnableCap.Texture2D); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.DstAlpha); GL.ClearColor(System.Drawing.Color.FromArgb(0,0,0,0)); var vs = parent.CreateShader(ShaderType.VertexShader, VSLighting); var fs = parent.CreateShader(ShaderType.FragmentShader, FSLighting); program = parent.CreateProgram(vs, fs); GL.DeleteShader(vs); GL.DeleteShader(fs); dynamicProgram.Load(); textures = new MultipleTextures(this); Bitmap white = new Bitmap(101, 101); QuickDraw.Start(white) .Fill(Color.White).Finish(); Bitmap gridBot = new Bitmap(101, 101); QuickDraw.Start(gridBot) .All((x, y) => { var lpp = 10; var xm = x % lpp; var ym = y % lpp; if (xm == 0 || ym == 0) return Color.Gray; return Color.FromArgb(150, 50, 50, 50); }, false).Finish(); Bitmap[] maps = new Bitmap[] { white, gridBot }; textures.Load(maps); if (lightStudio != null) lights = lightStudio.Lights; else lights = new MoveableLights(8); dynamicRenderer = new Renderer(dynamics = (Dynamight.ImageProcessing.CameraCalibration.Range.OfInts(6)).Select(_ => new DynamicRenderable()).ToArray()); staticRenderer = new Renderer(null, (new Renderable[] { Grid = new Renderable() { Visible = false, Shape = new Quad(new Vector3(0,0,0), 10, new Vector3(1,0,0), new Vector3(0,0,1), (v) => textures.Transform(v, 1)), Animatable = new Translator() }, }).Concat(LightsObjects = lights.Select(l => new LightRenderable(l, (v) => textures.Transform(v, 0))).ToArray()).ToArray()); windowSize = parent.Size; SetupCamera(); staticRenderer.Load(); dynamicRenderer.Load(); staticRenderer.Start(); dynamicRenderer.Start(); keyl = new KeyboardListener(parent.Keyboard); keyl.AddAction(() => Selection = (Selection == null ? (int?)1 : null), Key.C); keyl.AddAction(() => Grid.Visible = !Grid.Visible, Key.G); keyl.AddBinaryAction(0.01f, -0.01f, Key.Right, Key.Left, null, (f) => MoveX(f)); keyl.AddBinaryAction(0.01f, -0.01f, Key.Down, Key.Up, null, (f) => MoveY(f)); keyl.AddBinaryAction(0.01f, -0.01f, Key.Down, Key.Up, new Key[] { Key.ShiftLeft }, (f) => MoveZ(f)); keyl.AddBinaryAction(0.05f, -0.05f, Key.Right, Key.Left, new Key[] { Key.ControlLeft }, (f) => MoveX(f)); keyl.AddBinaryAction(0.05f, -0.05f, Key.Down, Key.Up, new Key[] { Key.ControlLeft }, (f) => MoveY(f)); keyl.AddBinaryAction(0.05f, -0.05f, Key.Down, Key.Up, new Key[] { Key.ShiftLeft, Key.ControlLeft }, (f) => MoveZ(f)); GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0); GL.Enable(EnableCap.Light1); GL.Enable(EnableCap.Light2); GL.Enable(EnableCap.Light3); GL.Enable(EnableCap.Light4); GL.Enable(EnableCap.Light5); GL.Enable(EnableCap.Light6); GL.Enable(EnableCap.Light7); }
public override void Load(ProgramWindow parent) { this.parent = parent; GL.Disable(EnableCap.Dither); GL.Enable(EnableCap.Texture2D); GL.Enable(EnableCap.DepthTest); GL.ClearColor(System.Drawing.Color.Black); var vs = parent.CreateShader(ShaderType.VertexShader, VERTEXSHADER); var fs = parent.CreateShader(ShaderType.FragmentShader, FRAGMENTSHADER); program = parent.CreateProgram(vs, fs); GL.DeleteShader(vs); GL.DeleteShader(fs); this.bitmap = this.bitmap ?? new System.Drawing.Bitmap(parent.Width, parent.Height); texture = parent.LoadTexture(this.bitmap, unit); CreateVBO(); }
public override void Load(ProgramWindow parent) { base.Load(parent); // Setup parameters for Points GL.PointSize(pointSize); GL.Enable(EnableCap.PointSmooth); GL.Enable(EnableCap.Blend); GL.Disable(EnableCap.DepthTest); GL.Enable(EnableCap.CullFace); GL.CullFace(CullFaceMode.Back); GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.Zero); GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); // Setup VBO state GL.EnableClientState(ArrayCap.ColorArray); GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.NormalArray); GL.GenBuffers(1, out VBOHandle); // Since there's only 1 VBO in the app, might aswell setup here. GL.BindBuffer(BufferTarget.ArrayBuffer, VBOHandle); GL.ColorPointer(4, ColorPointerType.UnsignedByte, VertexC4ubV3f.SizeInBytes, (IntPtr)0); GL.VertexPointer(3, VertexPointerType.Float, VertexC4ubV3f.SizeInBytes, (IntPtr)(4 * sizeof(byte))); GL.NormalPointer(NormalPointerType.Float, VertexC4ubV3f.SizeInBytes, (IntPtr)(4 * sizeof(byte) + Vector3.SizeInBytes)); GL.Light(LightName.Light0, LightParameter.Diffuse, OpenTK.Graphics.Color4.White); GL.Light(LightName.Light0, LightParameter.Ambient, new OpenTK.Graphics.Color4(100, 100, 100, 255)); GL.Light(LightName.Light0, LightParameter.ConstantAttenuation, 1); GL.Light(LightName.Light0, LightParameter.LinearAttenuation, 4f); GL.Light(LightName.Light0, LightParameter.QuadraticAttenuation, 0); GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0); GL.Material(MaterialFace.Front, MaterialParameter.Ambient, new float[] { 0.3f, 0.3f, 0.3f, 1.0f }); GL.Material(MaterialFace.Front, MaterialParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Material(MaterialFace.Front, MaterialParameter.Specular, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Material(MaterialFace.Front, MaterialParameter.Emission, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); VBO = new VertexC4ubV3f[0]; }
public override void Load(ProgramWindow parent) { base.Load(parent); // Setup parameters for Points GL.Enable(EnableCap.Blend); GL.Disable(EnableCap.DepthTest); GL.Enable(EnableCap.CullFace); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.CullFace(CullFaceMode.Back); textures = new MultipleTextures(this); Bitmap[] maps = new Bitmap[4]; { var bitmap = new Bitmap(300, 300); QuickDraw.Start(bitmap).All((xp, yp) => { var x = 0.5 - xp; var y = 0.5 - yp; var i = Math.Sqrt(x * x + y * y); if (i > 1) i = 1; i = Math.Pow(1 - i, 1); i += 0.4; if (i > 1) i = 1; else i = Math.Pow(i, 29); byte ii = (byte)(i * 255); return Color.FromArgb(ii, 245, 150, 135); }).Finish(); maps[0] = bitmap; } { var bitmap = new Bitmap(300, 300); QuickDraw.Start(bitmap).All((xp, yp) => { var x = 0.5 - xp; var y = 0.5 - yp; var i = Math.Sqrt(x * x + y * y); i = (Math.Sin(i * Math.PI * 8) + 1) / 2.0; byte ii = (byte)(i * 255); return Color.FromArgb(ii, 245, 150, 135); }).Finish(); maps[1] = bitmap; maps[2] = bitmap; maps[3] = bitmap; } textures.Load(maps); renderer = new Renderer(); }
public void AddOne(object obj) { DateTime startTime = DateTime.Now; Thread.Sleep(1000); object[] objs = (object[])obj; ProgramWindow programWindow = (ProgramWindow)objs[0]; IncidentBean bean = (IncidentBean)objs[1]; programWindow.WriteLine("初始化..."); try { //处理事件 bean.CreateTime = DateTime.Now; bean.State = 1; incidentId = IncidentMapper.AddOne(bean); isFirst = IncidentMapper.IsFirstRecord(); //第一次记录必须保证索引表为空 if (isFirst) { DirIndexMapper.CleanAll(); } //新建记录表 Extend.BuildTable(incidentId, isFirst); programWindow.WriteLine("开始记录硬盘使用空间..."); programWindow.WriteLine("(建议此时不要修改硬盘上的文件,以免影响最终的分析结果)"); programWindow.Freeze(); isRunning = true; Thread showProgress = new Thread(ShowProgress) { Name = "showProgress" }; showProgress.Start(programWindow); DriveInfo[] drives = DriveInfo.GetDrives(); //遍历分区 foreach (DriveInfo drive in drives) { DirectoryInfo rootDir = new DirectoryInfo(drive.Name); SeeDirectory(rootDir, 0); } isRunning = false; programWindow.WriteAll("记录完成,建立索引...\n"); Extend.BuildIndex(incidentId); //收尾工作 long count = RecordMapper.Count(incidentId); IncidentMapper.SetStateById(incidentId, 0); if (isFirst) { //删除以前记录失败的作废表格 Extend.DeleteErrorTable(incidentId); } TimeSpan consumption = DateTime.Now - startTime; Log.Info(string.Format("数据记录完成, 记录:{0}({1}), 耗时:{2}", count, beanCount, consumption)); programWindow.WriteLine(string.Format("数据记录完成,耗时:{0}小时{1}分。", consumption.Days * 24 + consumption.Hours, consumption.Minutes)); programWindow.RunOver(); } catch (Exception e) { Log.Add(e); isRunning = false; programWindow.WriteLine("\n错误:"); programWindow.WriteLine(e.Message); programWindow.RunOver(); //throw e; } }
/// <summary> Adds a Unicorn to the Program Window. /// <example> /// <code> /// Unicorn.addTo(programWindow)} /// </code> /// </example> /// <param> /// programWindow /// is the current Program Window /// </param> /// </summary> void AddTo(ProgramWindow programWindow) { programWindow.add(this); }
public AppControler() { programWindow = new ProgramWindow(); handleMenuPress = new HandleMenuPress(); todoDataStorage = new TodoDataStorage(); }
public override void Load(ProgramWindow parent) { this.parent = parent; GL.Disable(EnableCap.Dither); GL.Enable(EnableCap.Texture2D); GL.Enable(EnableCap.DepthTest); GL.ClearColor(System.Drawing.Color.Black); var vs = parent.CreateShader(ShaderType.VertexShader, GetVertexShader()); var fs = parent.CreateShader(ShaderType.FragmentShader, GetFragmentShader()); var gss = GetGeometryShader(); int? gs = null; if (gss != null) gs = parent.CreateShader(ShaderType.GeometryShader, gss); program = parent.CreateProgram(vs, fs, gs); GL.DeleteShader(vs); GL.DeleteShader(fs); base.Load(parent); }