Radegast.Rendering.SceneWindow.RenderObjects C# (CSharp) Method

RenderObjects() private method

private RenderObjects ( RenderPass pass ) : void
pass RenderPass
return void
        private void RenderObjects(RenderPass pass)
        {
            if (!RenderSettings.PrimitiveRenderingEnabled) return;

            GL.EnableClientState(ArrayCap.VertexArray);
            GL.EnableClientState(ArrayCap.TextureCoordArray);
            GL.EnableClientState(ArrayCap.NormalArray);

            Vector3 myPos = Vector3.Zero;
            if (myself != null)
            {
                myPos = myself.RenderPosition;
            }
            else
            {
                myPos = Client.Self.SimPosition;
            }

            if (pass == RenderPass.Invisible)
            {
                GL.Disable(EnableCap.Texture2D);
                GL.StencilFunc(StencilFunction.Always, 1, 1);
                GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Replace);
                GL.ColorMask(false, false, false, false);
                GL.StencilMask(0);
            }

            int nrPrims = SortedObjects.Count;
            for (int i = 0; i < nrPrims; i++)
            {
                //RenderBoundingBox(SortedPrims[i]);

                // When rendering alpha faces, draw from back towards the camers
                // otherwise from those closest to camera, to the farthest
                int ix = pass == RenderPass.Alpha ? nrPrims - i - 1 : i;
                SceneObject obj = SortedObjects[ix];

                if (obj is RenderPrimitive)
                {
                    // Don't render objects that are outside the draw distane
                    if (FindClosestDistanceSquared(myPos, obj) > drawDistanceSquared) continue;
                    if (pass == RenderPass.Simple || pass == RenderPass.Alpha)
                    {
                        obj.StartQuery(pass);
                        obj.Render(pass, ix, this, lastFrameTime);
                        obj.EndQuery(pass);
                    }
                    else
                    {
                        obj.Render(pass, ix, this, lastFrameTime);
                    }
                }
            }

            if (pass == RenderPass.Invisible)
            {
                GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Keep);
                GL.ColorMask(true, true, true, true);
                GL.StencilFunc(StencilFunction.Notequal, 1, 1);
                GL.StencilMask(uint.MaxValue);
            }

            GL.Disable(EnableCap.Texture2D);
            GL.DisableClientState(ArrayCap.VertexArray);
            GL.DisableClientState(ArrayCap.TextureCoordArray);
            GL.DisableClientState(ArrayCap.NormalArray);
        }
SceneWindow