12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /*
- Copyright (C) 2015 Jochem Raat
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #pragma once
- #include <random>
- #include <fractalNoise.h>
- // This class takes a height map of an island and its width and height
- // and generates a heat map represented as a array of doubles, where
- // higher numbers represent higher temperatures.
- class HeatMapGenerator {
- public:
- // The constructor takes a random generator to pass to the
- // PerlinNoiseGenerator.
- HeatMapGenerator(std::mt19937 *mt) : fractalNoiseGenerator(mt) { }
- // Generate a heat map for the given height map, this is done by
- // combining the height map with a random perlin noise map.
- double *generateHeatMap(double *heightmap,
- unsigned width,
- unsigned height);
- private:
- // Used to generate the perlin noise maps
- FractalNoiseGenerator fractalNoiseGenerator;
- // Used to generate the heat at a point from the height and
- // noise.
- double generateHeatPoint(double height, double noise);
- };
|