public override void RenderMaterial(GL_ControlBase control, Pass pass, GenericPickableMesh mesh,
                                     GL_EditorFramework.GL_Core.ShaderProgram shader, Vector4 highlight_color)
 {
     foreach (var group in mesh.Mesh.PolygonGroups)
     {
         Render.RenderMaterials(Render.ActiveShader, mesh.Mesh, group, group.Material, highlight_color);
     }
 }
 public override void ReloadUniforms(GL_ControlBase control, GL_EditorFramework.GL_Core.ShaderProgram shader)
 {
     foreach (var model in Render.Scene.Models)
     {
         int i = 0;
         foreach (var bone in model.Skeleton.Bones)
         {
             Matrix4 transform = bone.Inverse * bone.Transform;
             GL.UniformMatrix4(GL.GetUniformLocation(shader.programs[control], String.Format("bones[{0}]", i++)), false, ref transform);
         }
     }
 }
        private void SetupPickingShader(GL_ControlModern control)
        {
            //solid shader
            var solidColorFrag = new GL_EditorFramework.GL_Core.FragmentShader(
                @"#version 330
                        uniform vec4 color;
                        void main(){
                            gl_FragColor = color;
                        }");
            var solidColorVert = new GL_EditorFramework.GL_Core.VertexShader(
                VertexShaderPicking);

            pickingShader = new GL_EditorFramework.GL_Core.ShaderProgram(
                solidColorFrag, solidColorVert, control);
        }
        /*   public override void UpdateMeshMatrix(GL_ControlModern control,
         *         EditorSceneBase editorScene, Matrix4 modelMatrix, GenericPickableMesh mesh)
         * {
         *     control.ResetModelMatrix();
         *
         *     if (mesh.IsSelected())
         *         Console.WriteLine($"meshpos {mesh.GlobalPosition}");
         *
         *     var matrix = mesh.GetMatrix(editorScene);
         *     Render.ShaderProgram.SetMatrix4x4("mtxMdl", ref matrix);
         *     control.CurrentShader.SetMatrix4x4("mtxMdl", ref matrix);
         * }*/

        public override void OnRender(GL_ControlModern control, GL_EditorFramework.GL_Core.ShaderProgram shaderProgram, EditorSceneBase editorScene, Pass pass, Vector4 highlightColor)
        {
            if (pass != Pass.PICKING)
            {
                control.CurrentShader = null;
                Render.OnRender(new Camera()
                {
                    ModelMatrix      = control.ModelMatrix,
                    ViewMatrix       = control.CameraMatrix,
                    ProjectionMatrix = control.ProjectionMatrix
                }, highlightColor);
            }
            else
            {
                base.OnRender(control, shaderProgram, editorScene, pass, highlightColor);
            }
        }