Ejemplo n.º 1
0
        //  Create vertex buffers and index buffers and fill them with voxel render cells
        //  IMPORTANT: Don't call from background thread or from LoadContent. Only from Draw call
        public static void PrepareRenderCellCache()
        {
            MyMwcLog.WriteLine("MyVoxelMaps.PrepareRenderCellCache - START");
            MyMwcLog.IncreaseIndent();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("BoundingSphere");

            BoundingSphere sphere = new BoundingSphere(MyCamera.BoundingSphere.Center, MyCamera.BoundingSphere.Radius * 1.2f);

            MyPerformanceTimer.PrepareRenderCellCache.Start();

            for (int voxelMapIterator = 0; voxelMapIterator < m_voxelMaps.Count; voxelMapIterator++)
            {
                //  Because this LoadInDraw will stop normal update calls, we might not be able to send keep alive
                //  messages to server for some time. This will help it - it will make networking be up-to-date.
                //MyClientServer.Update();

                MyVoxelMap voxelMap = m_voxelMaps[voxelMapIterator];

                //  Only voxel maps near bounding sphere
                if (voxelMap.IsSphereIntersectingBoundingSphereOfThisVoxelMap(ref sphere))
                {
                    voxelMap.PrepareRenderCellCache();
                }
            }

            MyPerformanceTimer.PrepareRenderCellCache.End();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyVoxelMaps.PrepareRenderCellCache - END");
        }
Ejemplo n.º 2
0
        //  Create vertex buffers and index buffers and fill them with voxel render cells
        //  IMPORTANT: Don't call from background thread or from LoadContent. Only from Draw call
        public void PrepareRenderCellCache()
        {
            MySandboxGame.Log.WriteLine("MyVoxelMaps.PrepareRenderCellCache - START");
            MySandboxGame.Log.IncreaseIndent();

            Profiler.Begin("MyVoxelMaps.PrepareRenderCellCache");

            for (int voxelMapIterator = 0; voxelMapIterator < m_voxelMaps.Count; voxelMapIterator++)
            {
                MyVoxelMap voxelMap = m_voxelMaps[voxelMapIterator];
                voxelMap.PrepareRenderCellCache();
            }

            Profiler.End();

            MySandboxGame.Log.DecreaseIndent();
            MySandboxGame.Log.WriteLine("MyVoxelMaps.PrepareRenderCellCache - END");
        }