Beispiel #1
0
        public void RenderPick(Matrix4d viewproj, MObject Root)
        {
            GL.Viewport(0, 0, MScreen.Width, MScreen.Height);
            // Globals.Index = 0;
            if (pickmaterial == null)
            {
                Console.Error.WriteLine("PickMaterial is NULL");
                return;
            }
            Globals.ShaderOverride = pickmaterial.shader;
            pickmaterial.shader.Bind();
            GL.ClearColor(Color4.White);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            Globals.Index++;
            Root.Index = Index;

            Vector3  rgb       = IntToRgb(Index);
            int      ccc       = RGBtoInt(rgb);
            Matrix4d offsetmat = Matrix4d.CreateTranslation(-Globals.GlobalOffset);

            pickmaterial.shader.SetVec3("object_index", rgb);
            Root.Render(viewproj, offsetmat);

            Globals.ShaderOverride = null;
        }
 public void OnUpdate()
 {
     sceneManager.StartRender();
     if (curObject != null)
     {
         curObject.Render();
     }
 }