public void EstimateLodDensitySamplingPerformance() { var env = new TerrainLodEnvironment(); // At the moment of writing we averaged 3 densities per cell for 16x16x16, but lets assume its 1 (when alot of single material chunks exist) var numMeshes = 500; var numIts = 32; var extraSimulate = 10; // Do the test 'extraSimulate' times to make it more accurate, but this is again subtracted from total later estimateSamplingPerformance(extraSimulate, numIts, env, numMeshes); }
private static void estimateSamplingPerformance(int extraSimulate, int numIts, TerrainLodEnvironment env, int numMeshes) { var perf = PerformanceHelper.Measure(() => { for (int j = 0; j < extraSimulate; j++) { for (int x = 0; x < numIts; x++) { for (int y = 0; y < numIts; y++) { for (int z = 0; z < numIts; z++) { var value = env.densityFunction(new Vector3(x, y, z)); } } } } }); Console.WriteLine("Time for {0}x{0}x{0}: {1}", numIts, perf.Multiply(1f / extraSimulate).PrettyPrint()); Console.WriteLine("Time for 32*1024 with lod: " + perf.Multiply((float)numMeshes / extraSimulate).PrettyPrint()); }
public void TestLodEnvironment() { var env = new TerrainLodEnvironment(); env.LoadIntoEngine(EngineFactory.CreateEngine()); }