Ejemplo n.º 1
0
        public SimpleUIColorIndicator(IUILayoutParam param, ColorPalette colorPalette, GLColor textColor, float min, float max, float step)
        {
            this.bar = new SimpleUIColorIndicatorBar(param, colorPalette, min, max, step);

            float[] coords = colorPalette.Coords;
            float coordLength = coords[coords.Length - 1] - coords[0];
            this.numbers = new SimpleUIPointSpriteStringElement[coords.Length];
            const float posY = -1.0f;
            this.numbers[0] = new SimpleUIPointSpriteStringElement(
                param, (-100.0f).ToShortString(), new vec3(-0.5f, posY, 0), textColor, 20);
            for (int i = 1; i < coords.Length; i++)
            {
                float x = (coords[i] - coords[0]) / coordLength - 0.5f;
                if (i + 1 == coords.Length)
                {
                    var number = new SimpleUIPointSpriteStringElement(param,
                        (100.0f).ToShortString(), new vec3(x, posY, 0), textColor, 20);
                    this.numbers[i] = number;
                }
                else
                {
                    var number = new SimpleUIPointSpriteStringElement(param,
                        (-100.0f + i * (100 - (-100)) / 5).ToShortString(), new vec3(x, posY, 0), textColor, 20);
                    this.numbers[i] = number;
                }
            }
        }
 public SimpleUIPointSpriteStringElement(IUILayoutParam param,
     string content, vec3 position, 
     GLColor color = null, int fontSize = 32, int maxRowWidth = 256, FontResource fontResource = null)
 {
     IUILayout layout = this;
     layout.Param = param;
     this.element = new PointSpriteStringElement(content, position, color, fontSize, maxRowWidth, fontResource);
 }
Ejemplo n.º 3
0
        public FormSimpleUIRect()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new ScientificCamera(CameraTypes.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            Padding padding = new System.Windows.Forms.Padding(10, 10, 10, 10);
            Size size = new Size(100, 100);
            IUILayoutParam param;
            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            uiLeftBottomRect = new SimpleUIRect(param);
            legacyLeftBottomRect = new LegacySimpleUIRect(param, new Objects.GLColor(1, 1, 1, 1));

            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size);
            uiLeftTopRect = new SimpleUIRect(param);
            legacyLeftTopRect = new LegacySimpleUIRect(param, new Objects.GLColor(1, 1, 1, 1));

            param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size);
            uiRightBottomRect = new SimpleUIRect(param);
            legacyRightBottomRect = new LegacySimpleUIRect(param, new Objects.GLColor(1, 1, 1, 1));

            param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size);
            uiRightTopRect = new SimpleUIRect(param);
            legacyRightTopRect = new LegacySimpleUIRect(param, new Objects.GLColor(1, 1, 1, 1));

            uiLeftBottomRect.Initialize();
            uiLeftTopRect.Initialize();
            uiRightBottomRect.Initialize();
            uiRightTopRect.Initialize();

            legacyLeftBottomRect.Initialize();
            legacyLeftTopRect.Initialize();
            legacyRightBottomRect.Initialize();
            legacyRightTopRect.Initialize();

            axisElement = new AxisElement();
            axisElement.Initialize();
            axisElement.BeforeRendering += axisElement_BeforeRendering;
            axisElement.AfterRendering += axisElement_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;
        }
Ejemplo n.º 4
0
        public SimpleUIPointSpriteStringElement(IUILayoutParam param,
                                                string content, vec3 position,
                                                GLColor color = null, int fontSize = 32, int maxRowWidth = 256, FontResource fontResource = null)
        {
            IUILayout layout = this;

            layout.Param = param;
            this.element = new PointSpriteStringElement(content, position, color, fontSize, maxRowWidth, fontResource);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="anchor">the edges of the viewport to which a SimpleUIRect is bound and determines how it is resized with its parent.
        /// <para>something like AnchorStyles.Left | AnchorStyles.Bottom.</para></param>
        /// <param name="margin">the space between viewport and SimpleRect.</param>
        /// <param name="size">Stores width when <see cref="OpenGLUIRect.Anchor"/>.Left & <see cref="OpenGLUIRect.Anchor"/>.Right is <see cref="OpenGLUIRect.Anchor"/>.None.
        /// <para> and height when <see cref="OpenGLUIRect.Anchor"/>.Top & <see cref="OpenGLUIRect.Anchor"/>.Bottom is <see cref="OpenGLUIRect.Anchor"/>.None.</para></param>
        /// <param name="zNear"></param>
        /// <param name="zFar"></param>
        /// <param name="rectColor">default color is red.</param>
        //public LegacySimpleUIRect(AnchorStyles anchor, Padding margin, System.Drawing.Size size, int zNear = -1000, int zFar = 1000, GLColor rectColor = null)
        public LegacySimpleUIRect(IUILayoutParam param, GLColor rectColor = null)
        {
            this.Param = param;

            if (rectColor == null)
            { this.RectColor = new GLColor(1, 0, 0, 1); }
            else
            { this.RectColor = rectColor; }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="anchor">the edges of the viewport to which a SimpleUIRect is bound and determines how it is resized with its parent.
        /// <para>something like AnchorStyles.Left | AnchorStyles.Bottom.</para></param>
        /// <param name="margin">the space between viewport and SimpleRect.</param>
        /// <param name="size">Stores width when <see cref="OpenGLUIRect.Anchor"/>.Left &amp; <see cref="OpenGLUIRect.Anchor"/>.Right is <see cref="OpenGLUIRect.Anchor"/>.None.
        /// <para> and height when <see cref="OpenGLUIRect.Anchor"/>.Top &amp; <see cref="OpenGLUIRect.Anchor"/>.Bottom is <see cref="OpenGLUIRect.Anchor"/>.None.</para></param>
        /// <param name="zNear"></param>
        /// <param name="zFar"></param>
        /// <param name="rectColor">default color is red.</param>
        public SimpleUIRect(IUILayoutParam param, GLColor rectColor = null)
        {
            IUILayout layout = this;
            layout.Param = param;

            if (rectColor == null)
            { this.rectColor = new vec3(0, 0, 1); }
            else
            { this.rectColor = new vec3(rectColor.R, rectColor.G, rectColor.B); }
        }
Ejemplo n.º 7
0
        public FormLegacyTexture3D()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new ScientificCamera(CameraTypes.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            Padding padding = new System.Windows.Forms.Padding(10, 10, 10, 10);
            Size size = new Size(100, 100);
            //Size size = new Size(5, 5);
            IUILayoutParam param;
            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            legacyUIRect = new LegacySimpleUIRect(param, new Objects.GLColor(1, 0, 0, 1));

            param = new IUILayoutParam(AnchorStyles.Bottom | AnchorStyles.Right, padding, size);
            modernUIRect = new SimpleUIRect(param, new GLColor(0, 1, 1, 1));

            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            leftUIAxis = new SimpleUIAxis(param, new GLColor(1, 1, 1, 1));

            param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size);
            rightUIAxis = new SimpleUIAxis(param, new GLColor(1, 1, 1, 1));

            legacyUIRect.Initialize();
            modernUIRect.Initialize();
            leftUIAxis.Initialize();
            rightUIAxis.Initialize();

            legacyUIRect.BeforeRendering += legacyUIRect_BeforeRendering;
            legacyUIRect.AfterRendering += legacyUIRect_AfterRendering;

            element = new DemoLegacyTexture3DCubeElement();
            element.Initialize();
            element.BeforeRendering += element_BeforeRendering;
            element.AfterRendering += element_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;

            UpdateInfo();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="anchor">the edges of the viewport to which a SimpleUIRect is bound and determines how it is resized with its parent.
        /// <para>something like AnchorStyles.Left | AnchorStyles.Bottom.</para></param>
        /// <param name="margin">the space between viewport and SimpleRect.</param>
        /// <param name="size">Stores width when <see cref="OpenGLUIRect.Anchor"/>.Left &amp; <see cref="OpenGLUIRect.Anchor"/>.Right is <see cref="OpenGLUIRect.Anchor"/>.None.
        /// <para> and height when <see cref="OpenGLUIRect.Anchor"/>.Top &amp; <see cref="OpenGLUIRect.Anchor"/>.Bottom is <see cref="OpenGLUIRect.Anchor"/>.None.</para></param>
        /// <param name="zNear"></param>
        /// <param name="zFar"></param>
        /// <param name="rectColor">default color is red.</param>
        public SimpleUIColorIndicatorBar(IUILayoutParam param, ColorPalette colorPalette, float min, float max, float step)
        {
            IUILayout layout = this;
            layout.Param = param;

            this.ColorPalette = colorPalette;

            this.Min = min;
            this.Max = max;
            this.Step = step;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="anchor">the edges of the viewport to which a SimpleUIRect is bound and determines how it is resized with its parent.
        /// <para>something like AnchorStyles.Left | AnchorStyles.Bottom.</para></param>
        /// <param name="margin">the space between viewport and SimpleRect.</param>
        /// <param name="size">Stores width when <see cref="OpenGLUIRect.Anchor"/>.Left & <see cref="OpenGLUIRect.Anchor"/>.Right is <see cref="OpenGLUIRect.Anchor"/>.None.
        /// <para> and height when <see cref="OpenGLUIRect.Anchor"/>.Top & <see cref="OpenGLUIRect.Anchor"/>.Bottom is <see cref="OpenGLUIRect.Anchor"/>.None.</para></param>
        /// <param name="zNear"></param>
        /// <param name="zFar"></param>
        /// <param name="rectColor">default color is red.</param>
        public SimpleUIAxis(IUILayoutParam param, GLColor rectColor = null,
            float radius = 0.3f, float axisLength = 10, int faceCount = 10)
        {
            // 把AxiesElement缩放到恰好放进此UI
            radius = radius / axisLength / 2;
            axisLength = 0.5f;
            this.axisElement = new AxisElement(radius, axisLength, faceCount);

            IUILayout layout = this;
            layout.Param = param;
        }
Ejemplo n.º 10
0
        public FormSimplePointSprite(float fontSize, bool foreshortening, FragShaderType type)
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new ScientificCamera(CameraTypes.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            Padding padding = new System.Windows.Forms.Padding(40, 40, 40, 40);
            Size size = new Size(100, 100);
            //Size size = new Size(5, 5);
            IUILayoutParam param;
            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            uiLeftBottomAxis = new SimpleUIAxis(param);
            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size);
            uiLeftTopAxis = new SimpleUIAxis(param);
            param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size);
            uiRightBottomAxis = new SimpleUIAxis(param);
            param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size);
            uiRightTopAxis = new SimpleUIAxis(param);

            uiLeftBottomAxis.Initialize();
            uiLeftTopAxis.Initialize();
            uiRightBottomAxis.Initialize();
            uiRightTopAxis.Initialize();

            pointSpriteElement = new DemoSimplePointSpriteElement(fontSize, foreshortening, type);
            pointSpriteElement.Initialize();
            pointSpriteElement.BeforeRendering += pointSpriteElement_BeforeRendering;
            pointSpriteElement.AfterRendering += pointSpriteElement_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;
        }
Ejemplo n.º 11
0
        public FormCubeMap()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new ScientificCamera(CameraTypes.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
                this.camera.UpVector = new vec3(-0.07f, 0.96f, 0.29f);
                this.camera.Position = new vec3(0.03f, 0.03f, 0.03f);
            }

            rotator = new SatelliteRotator(this.camera);
            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;

            element = new CubeMapExample();
            element.Initialize();

            //element.BeforeRendering += element_BeforeRendering;
            //element.AfterRendering += element_AfterRendering;

            IUILayoutParam param = new IUILayoutParam(
                AnchorStyles.Left | AnchorStyles.Bottom,
                new Padding(10, 10, 10, 10), new Size(50, 50));
            uiAxis = new SimpleUIAxis(param);
            uiAxis.Initialize();

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;
            this.Load += Form_Load;
        }
Ejemplo n.º 12
0
        public FormColorCodedPicking()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new ScientificCamera(CameraTypes.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            const int size = 3;
            this.camera.Position = new vec3(size * 3, size * 3, size * 3);

            rotator = new SatelliteRotator(this.camera);

            element = new DemoColorCodedPickingElement(size);
            element.Initialize();
            //element.BeforeRendering += element_BeforeRendering;
            //element.AfterRendering += element_AfterRendering;

            Padding uiPadding = new System.Windows.Forms.Padding(10, 10, 10, 10);
            Size uiSize = new System.Drawing.Size(50, 50);
            IUILayoutParam uiParam = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, uiPadding, uiSize);
            uiAxis = new SimpleUIAxis(uiParam);
            uiAxis.Initialize();

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;

            this.Load += FormColorCodedPicking_Load;
        }
Ejemplo n.º 13
0
        public FormSimpleUIColorIndicator()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new ScientificCamera(CameraTypes.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            ColorPalette colorPalette = ColorPaletteFactory.CreateRainbow();

            Padding padding = new System.Windows.Forms.Padding(40, 40, 40, 40);
            Size size = new Size(100, 30);
            IUILayoutParam param;
            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right, padding, size);
            this.colorIndicator = new SimpleUIColorIndicator(param, colorPalette, new GLColor(1, 1, 1, 1), -100, 100, 5);
            this.colorIndicator.Initialize();

            axisElement = new AxisElement();
            axisElement.Initialize();
            axisElement.BeforeRendering += axisElement_BeforeRendering;
            axisElement.AfterRendering += axisElement_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;
        }
        public FormWholeFontTextureElement()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new ScientificCamera(CameraTypes.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            rotator = new SatelliteRotator(this.camera);
            this.Load += FormWholeFontTextureElement_Load;

            element = new WholeFontTextureElement("FormWholeFontTextureElement.png", "FormWholeFontTextureElement.xml");
            element.Initialize();

            element.BeforeRendering += element_BeforeRendering;
            element.AfterRendering += element_AfterRendering;

            IUILayoutParam param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom,
                new Padding(10, 10, 10, 10), new Size(40, 40));
            uiAxis = new SimpleUIAxis(param);
            uiAxis.Initialize();

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 根据UI元素的布局设定,计算其应有的宽高及其在ortho()中应有的参数。
        /// </summary>
        /// <param name="uiElement"></param>
        /// <param name="viewportWidth"></param>
        /// <param name="viewportHeight"></param>
        /// <param name="args"></param>
        static void CalculateCoords(IUILayout uiElement, int viewportWidth, int viewportHeight, IUILayoutArgs args)
        {
            IUILayoutParam param = uiElement.Param;

            if ((param.Anchor & leftRightAnchor) == leftRightAnchor)
            {
                args.UIWidth = viewportWidth - param.Margin.Left - param.Margin.Right;
                if (args.UIWidth < 0)
                {
                    args.UIWidth = 0;
                }
            }
            else
            {
                args.UIWidth = param.Size.Width;
            }

            if ((param.Anchor & topBottomAnchor) == topBottomAnchor)
            {
                args.UIHeight = viewportHeight - param.Margin.Top - param.Margin.Bottom;
                if (args.UIHeight < 0)
                {
                    args.UIHeight = 0;
                }
            }
            else
            {
                args.UIHeight = param.Size.Height;
            }

            if ((param.Anchor & leftRightAnchor) == AnchorStyles.None)
            {
                args.left = -(args.UIWidth / 2
                              + (viewportWidth - args.UIWidth)
                              * ((double)param.Margin.Left / (double)(param.Margin.Left + param.Margin.Right)));
            }
            else if ((param.Anchor & leftRightAnchor) == AnchorStyles.Left)
            {
                args.left = -(args.UIWidth / 2 + param.Margin.Left);
            }
            else if ((param.Anchor & leftRightAnchor) == AnchorStyles.Right)
            {
                args.left = -(viewportWidth - args.UIWidth / 2 - param.Margin.Right);
            }
            else // if ((Anchor & leftRightAnchor) == leftRightAnchor)
            {
                args.left = -(args.UIWidth / 2 + param.Margin.Left);
            }

            if ((param.Anchor & topBottomAnchor) == AnchorStyles.None)
            {
                args.bottom = -viewportHeight / 2;
                args.bottom = -(args.UIHeight / 2
                                + (viewportHeight - args.UIHeight)
                                * ((double)param.Margin.Bottom / (double)(param.Margin.Bottom + param.Margin.Top)));
            }
            else if ((param.Anchor & topBottomAnchor) == AnchorStyles.Bottom)
            {
                args.bottom = -(args.UIHeight / 2 + param.Margin.Bottom);
            }
            else if ((param.Anchor & topBottomAnchor) == AnchorStyles.Top)
            {
                args.bottom = -(viewportHeight - args.UIHeight / 2 - param.Margin.Top);
            }
            else // if ((Anchor & topBottomAnchor) == topBottomAnchor)
            {
                args.bottom = -(args.UIHeight / 2 + param.Margin.Bottom);
            }
        }
Ejemplo n.º 16
0
        private void FormTransformFeedback_Load(object sender, EventArgs e)
        {
            IUILayoutParam param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom,
                new Padding(10, 10, 10, 10), new Size(50, 50));
            this.uiAxis = new SimpleUIAxis(param);

            //frmWhiteBoard = new FormWhiteBoard();
            //frmWhiteBoard.Show();

            //GL.Enable(GL.GL_DEBUG_OUTPUT);
            //GL.Enable(GL.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
            //GL.DebugMessageControl(
            //    Enumerations.DebugMessageControlSource.DONT_CARE,
            //    Enumerations.DebugMessageControlType.DONT_CARE,
            //    Enumerations.DebugMessageControlSeverity.DONT_CARE, 0, null, true);
            //GL.DebugMessageCallback(this.CallbackProc, this.Handle);

            GL.GenQueries(1, TimerQueryName);

            // begin
            GL.GenQueries(1, Query);

            InitProgram();

            InitBuffer();

            initVertexArray();

            initFeedback();
        }
Ejemplo n.º 17
0
        void ISupportInitialize.EndInit()
        {
            CreateRenderContext();

            this.camera = new ScientificCamera(CameraTypes.Perspecitive, this.Width, this.Height);

            this.rotator = new SatelliteRotator(this.camera);

            this.MouseDown += scientificVisual3DControl1_MouseDown;
            this.MouseMove += scientificVisual3DControl1_MouseMove;
            this.MouseUp += scientificVisual3DControl1_MouseUp;

            {
                IUILayoutParam param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom,
                    new Padding(10, 10, 10, 10), new Size(50, 50));
                uiAxis = new SimpleUIAxis(param);
                uiAxis.Initialize();
                this.ElementList.Add(uiAxis);
            }
            {
                IUILayoutParam param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
                    new Padding(100, 30, 40, 30), new Size(30, 30));
                ColorPalette colorPalette = ColorPaletteFactory.CreateRainbow();
                uiColorIndicator = new SimpleUIColorIndicator(param, colorPalette, new Objects.GLColor(1, 1, 1, 1), -100, 100, 5);
                uiColorIndicator.Initialize();
                this.ElementList.Add(uiColorIndicator);
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="anchor">the edges of the viewport to which a SimpleUIRect is bound and determines how it is resized with its parent.
 /// <para>something like AnchorStyles.Left | AnchorStyles.Bottom.</para></param>
 /// <param name="margin">the space between viewport and SimpleRect.</param>
 /// <param name="size">Stores width when <see cref="OpenGLUIRect.Anchor"/>.Left &amp; <see cref="OpenGLUIRect.Anchor"/>.Right is <see cref="OpenGLUIRect.Anchor"/>.None.
 /// <para> and height when <see cref="OpenGLUIRect.Anchor"/>.Top &amp; <see cref="OpenGLUIRect.Anchor"/>.Bottom is <see cref="OpenGLUIRect.Anchor"/>.None.</para></param>
 /// <param name="zNear"></param>
 /// <param name="zFar"></param>
 /// <param name="rectColor">default color is red.</param>
 public SimpleUICube(IUILayoutParam param)
 {
     IUILayout layout = this;
     layout.Param = param;
 }