Esempio n. 1
0
        void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e)
        {
            PrintCameraInfo();

            GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

            var arg = new RenderEventArgs(RenderModes.Render, this.camera);

            mat4 projectionMatrix = camera.GetProjectionMat4();
            mat4 viewMatrix = camera.GetViewMat4();
            mat4 modelMatrix = mat4.identity();

            if (this.newElement != null)
            {
                if (this.element != null)
                {
                    this.element.Dispose();
                }
                this.element = this.newElement;
                this.newElement = null;
            }
            ShaderDesignerRendererBase element = this.element;
            element.projectionMatrix = projectionMatrix;
            element.viewMatrix = viewMatrix;
            element.modelMatrix = modelMatrix;

            element.Render(arg);
            uiLeftBottomAxis.Render(arg);
        }
Esempio n. 2
0
        private void CreateElement()
        {
            IModel model = modelFactories[currentModelIndex].Create(this.radius);
            ShaderDesignerRendererBase element = rendererFactories[currentRendererIndex].GetRenderer(model);
            element.Initialize();
            this.newElement = element;

            StringBuilder builder = new StringBuilder();
            builder.Append(string.Format("{0}", model.GetType().Name));
            builder.Append(" - ");
            builder.Append(string.Format("{0}", element.GetType().Name));
            builder.Append(string.Format(" - radius: {0}", radius));
            this.Text = builder.ToString();
        }