override public void GenerateHeightField(int currentFrame, ExtendedHeightField extendedHeightField) { Profiler.BeginSample("Clear Height Field"); extendedHeightField.Clear(); Profiler.EndSample(); Profiler.BeginSample("Set Point Map"); waveParticles.setPointMap(currentFrame, ref pointMap); Profiler.EndSample(); Profiler.BeginSample("Convolve Wave Particles"); for (int row = 0; row < heightFieldInfo.VertRes; row++) { for (int col = 0; col < heightFieldInfo.HoriRes; col++) { int index = row * heightFieldInfo.HoriRes + col; for (int y = 0; y < kernelHeight; y++) { for (int x = 0; x < kernelWidth; x++) { int y_index = (y - (kernelHeight / 2)) + row; int x_index = (x - (kernelWidth / 2)) + col; if (y_index > 0 && y_index < heightFieldInfo.VertRes && x_index > 0 && x_index < heightFieldInfo.HoriRes) { int fresh_index = (y_index * heightFieldInfo.HoriRes) + (x_index); extendedHeightField.heightMap[index] += (Color)(pointMap.heightMap[fresh_index] * kernel[(y * kernelWidth) + x]); } } } } } extendedHeightField.ApplyCPUHeightMap(); Profiler.EndSample(); }
override public void GenerateHeightField(int currentFrame, ExtendedHeightField extendedHeightField) { Profiler.BeginSample("Clear Height Field"); extendedHeightField.Clear(); Profiler.EndSample(); Profiler.BeginSample("Set Point Map"); waveParticles.setPointMap(currentFrame, ref pointMap); Profiler.EndSample(); Profiler.BeginSample("Convolve Wave Particles"); convolveWaveParticles(); extendedHeightField.UpdateTexture(convolvedTexture); Profiler.EndSample(); }