31 lines
818 B
C++
31 lines
818 B
C++
#ifndef DENSITY_MAP_H
|
|
#define DENSITY_MAP_H
|
|
#include <core/resource.h>
|
|
#include <core/math/random_number_generator.h>
|
|
#include <modules/opensimplex/open_simplex_noise.h>
|
|
#include <modules/voxel/util/math/vector3i.h>
|
|
#include "world_height_map.h"
|
|
|
|
class DensityMap: public Resource {
|
|
GDCLASS(DensityMap, Resource);
|
|
public:
|
|
DensityMap();
|
|
~DensityMap();
|
|
protected:
|
|
Ref<WorldHeightMap> height_map;
|
|
Ref<RandomNumberGenerator> rnd;
|
|
Ref<OpenSimplexNoise> noise;
|
|
Ref<Curve> curve;
|
|
float max_height;
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
|
static void _bind_methods();
|
|
public:
|
|
void update_all();
|
|
float get_population_density(float x, float y);
|
|
private:
|
|
int seed;
|
|
};
|
|
#endif
|