Esempio n. 1
0
		public void Init(GLWindow glcontrol, GLTextureStream.ReadImageMetaDataDelegate ReadImageMetaData)
		{
			this.glcontrol = glcontrol;
			glcontrol.GotFocus += (object sender, EventArgs e) => { glcontrol_focused = true; };
			glcontrol.LostFocus += (object sender, EventArgs e) => { glcontrol_focused = false; };
			glcontrol_focused = true;

			// Define actions
			SetViewControlAction = ActionManager.CreateAction("Set View Control", this, "SetViewControl");
			EnableDepthRenderingAction = ActionManager.CreateAction("Enable Depth Rendering", "enable depth", this, "EnableDepthRendering");
			DisableDepthRenderingAction = ActionManager.CreateAction("Disable Depth Rendering", "disable depth", this, "DisableDepthRendering");
			MoveAction = ActionManager.CreateAction("Move images", this, "Move");
			/*ActionManager.CreateAction("Select all", "all", this, "SelectAll");
			ActionManager.CreateAction("Select and focus all", "focus all", delegate(object[] parameters) {
				this.SelectAll();
				this.FocusSelection();
			});*/

			// Load shaders
			sdrAabb = new GLShader(new string[] {AABB_SHADER.VS}, new string[] {AABB_SHADER.FS});

			// Create mesh for non-depth rendering
#if USE_GS_QUAD
			mesh2D = new GLMesh(new Vector3[] {new Vector3(0.0f, 0.0f, 0.0f)}, null, null, null, null, null, PrimitiveType.Points); // Use this when rendering geometry shader quads
#else
			mesh2D = Common.meshQuad2;
#endif

			texstream = new GLTextureStream(256*1024*1024, ReadImageMetaData); // Optimize for 1GB of VRAM
			//texstream = new GLTextureStream(64*1024*1024, ReadImageMetaData); // Optimize for 256MB of VRAM
			//texstream = new GLTextureStream(8*1024*1024, ReadImageMetaData); // Optimize for 32MB of VRAM
			//texstream = new GLTextureStream(1024*1024, ReadImageMetaData); // Optimize for 4MB of VRAM
			//texstream = new GLTextureStream(128*1024, ReadImageMetaData); // Optimize for 512KB of VRAM

			#if USE_ARG_IDX
			argIndex.Bounds = new Rectangle(250, 10, Width - 250, 16);
			//argIndex.Bounds = new Rectangle(150, 10, Width - 150, 16);
			argIndex.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
			argIndex.Init();
			argIndex.SelectionChanged += SelectionChanged;//() => { SelectionChanged(); };
			//argIndex.ArgumentLabelMouseDown += ArgumentIndex_ArgumentLabelMouseDown;
			this.Controls.Add(argIndex);
			#endif

			#if USE_PARAM_IDX
			//paramIndex.Bounds = new Rectangle(200, 0, Width - 200, 16);
			//paramIndex.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
			paramIndex.Bounds = new Rectangle(16, 0, 300, 16);
			paramIndex.Anchor = AnchorStyles.Top | AnchorStyles.Right;
			paramIndex.Init();
			paramIndex.ParameterChanged += (Cinema.CinemaStore.Parameter parameter, int paramidx) => {
				foreach(TransformedImage image in images)
					image.OnParameterChanged(parameter, paramidx);
			};
			this.Controls.Add(paramIndex);
			#endif

			#if USE_CUSTOM_CONTROLS
			ccContainer.Bounds = new Rectangle(250, 10, Width - 300, 16);
			ccContainer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
			ccContainer.Init();
			/*ccContainer.CustomControlValueChanged += (int controlIdx, float value) => {
				//EDIT
			};*/
			this.Controls.Add(ccContainer);
			#endif

			colorTableMgr = new ColorTableManager(glcontrol);
			colorTableMgr.Visible = false;
			this.Controls.Add(colorTableMgr);

			coordsys = new CoordinateSystem();
			grid = new LineGrid();

			ContextMenu = new ImageContextMenu();

			fragmentcounter = GL.GenQuery();

//ccContainer.CreateSlider("testSlider", new float[] { 0.0f, 0.5f, 1.0f });
		}
Esempio n. 2
0
		public void Free()
		{
			if(texstream != null)
			{
				texstream.Free();
				texstream = null;
			}
			sdrAabb = null;
			if(mesh2D != null)
				mesh2D.Free();
			mesh2D = null;
			if(colorTableMgr != null)
			{
				//colorTableMgr.Free();
				colorTableMgr = null;
			}
		}
Esempio n. 3
0
            public InputSection(ColorTableManager colorTableMgr, GLFont font)
            {
                this.colorTableMgr = colorTableMgr;
                this.font = font;

                InsertSplitterPinAction = ActionManager.CreateAction("Insert splitter pin", this, "InsertSplitterPin");
                InsertNestedPinAction = ActionManager.CreateAction("Insert nesting pin", this, "InsertNestedPin");
                MovePinAction = ActionManager.CreateAction("Move pin", this, "MovePin");
                RemovePinAction = ActionManager.CreateAction("Remove pin", this, "RemovePin");
                SetSectionColormapAction = ActionManager.CreateAction("Set colormap of section", this, "SetSectionColormap");
                ResetColorTableAction = ActionManager.CreateAction("Reset colormap", this, "ResetColorTable");

                // Create colormap
                colormapTexture = new GLTexture1D("colormap", new byte[4 * FINAL_COLORMAP_SIZE], FINAL_COLORMAP_SIZE, PixelFormat.Rgba, false);

                // Create histogram grid as line list mesh
                List<Vector3> positions = new List<Vector3>();
                /*positions.AddRange(new Vector3[] {
                    // Outline
                    new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 0.5f, 0.0f),
                    new Vector3(0.0f, 0.5f, 0.0f), new Vector3(1.0f, 0.5f, 0.0f),
                    new Vector3(1.0f, 0.5f, 0.0f), new Vector3(1.0f, 0.0f, 0.0f),
                    new Vector3(1.0f, 0.0f, 0.0f), new Vector3(0.0f, 0.0f, 0.0f)
                });*/
                for(int i = 0; i <= 10; ++i)
                {
                    float y = (float)i / 10.0f * 0.9f + 0.1f;
                    positions.Add(new Vector3(0.0f, y, 0.0f));
                    positions.Add(new Vector3(1.0f, y, 0.0f));
                }
                for(int i = 0; i <= 10; ++i)
                {
                    float x = (float)i / 10.0f;
                    positions.Add(new Vector3(x, 0.1f, 0.0f));
                    positions.Add(new Vector3(x, 1.0f, 0.0f));
                }
                meshLines = new GLMesh(positions.ToArray(), null, null, null, null, null, PrimitiveType.Lines);

                // Create textures
                texSplitter = GLTexture2D.FromFile(Global.EXE_DIR + "splitter.png", false);
                texInterjectorLeft = GLTexture2D.FromFile(Global.EXE_DIR + "interjectorLeft.png", false);
                texInterjectorRight = GLTexture2D.FromFile(Global.EXE_DIR + "interjectorRight.png", false);

                // Create number font
                //font = new GLNumberFont("HelveticaNeue_12.png", new FontDefinition(new int[] {0, 14, 26, 39, 53, 67, 80, 93, 106, 120, 133}, new int[] {0, 19}), Common.meshQuad, true);
                //font = new GLNumberFont("HelveticaNeue_16.png", new FontDefinition(new int[] {0, 18, 34, 53, 71, 89, 106, 124, 142, 160, 178}, new int[] {0, 25}), true);
                //font = new GLTextFont("fntDefault.png", new Vector2(19.0f, 32.0f), Common.meshQuad);
            }