Updated world module (now voronoi roads work

This commit is contained in:
Segey Lapin
2021-10-13 16:33:36 +03:00
parent d0b1daa6e9
commit e35d566eb8
14 changed files with 1533 additions and 246 deletions

View File

@@ -0,0 +1,29 @@
#ifndef WORLD_HEIGHT_MAP_H
#define WORLD_HEIGHT_MAP_H
#include <core/resource.h>
#include <core/math/random_number_generator.h>
#include <core/math/rect2.h>
#include <modules/opensimplex/open_simplex_noise.h>
#include <scene/main/node.h>
class WorldHeightMap: public Resource {
GDCLASS(WorldHeightMap, Resource);
public:
WorldHeightMap();
~WorldHeightMap();
protected:
Ref<OpenSimplexNoise> noise;
Ref<Curve> curve;
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_surface_height(float x, float y);
float get_base_height(float x, float y);
float get_base_steepness(float x, float y);
void draw_height_map(Node *draw, const Rect2 &draw_rect, const Rect2 &world_rect);
private:
int seed;
};
#endif