public override void Render(MasterRenderer renderer)
        {
            RenderableChunks = 0;
            CulledChunks     = 0;
            int unfinished = 0;

            foreach (Chunk chunk in Chunks.Values)
            {
                if (chunk.State != ChunkState.Renderable)
                {
                    unfinished++;
                }

                if ((chunk.State == ChunkState.Renderable || chunk.State > ChunkState.Unshaped) && !chunk.IsEmpty &&
                    CullingFrustum.Intersects(chunk.BoundingBox))
                {
                    RenderableChunks++;
                    chunk.Culled = false;
                }
                else
                {
                    CulledChunks++;
                    chunk.Culled = true;
                }

                chunkRenderer.Batch(chunk);
            }

            UnfinishedChunks = unfinished;
        }
Beispiel #2
0
        private bool IsCulled(IBoundingBox bb, Matrix4x4 modelMatrix)
        {
            var culled = !CullingFrustum.Contains(bb, modelMatrix);

            return(culled);
        }
Beispiel #3
0
        public void Prepare()
        {
            var vp = ViewMatrix.PostMultiply(ProjectionMatrix);

            CullingFrustum.SetViewProjectionMatrix(vp);
        }