Refactored optimized

This commit is contained in:
Segey Lapin
2021-10-15 16:18:30 +03:00
parent 8c4432031e
commit ea4c8a5731
2 changed files with 33 additions and 29 deletions

View File

@@ -12,7 +12,7 @@ class Roads: public MeshInstance {
protected:
Mutex mutex;
Ref<Curve> curve;
Ref<OpenSimplexNoise> noise;
Ref<FastNoiseLite> noise;
Ref<Material> mat;
Ref<PackedScene> road_data;
HashMap<String, Array> mesh_data;
@@ -37,6 +37,7 @@ protected:
struct thread_data thread;
static void generate_threaded(void *p_userdata);
StaticBody *body;
Transform cam_xform;
#if 0
struct edge_data {
int a;
@@ -65,7 +66,6 @@ protected:
void extrude_direct(Array &out, const Array &arrays, const struct edge_data *data) const;
void extrude_vshape(Array &out, const Array &arrays, const struct vshape *data) const;
#endif
int find_edge(int a, int b);
void _notification(int p_what);
int counter;
friend class RoadsData;
@@ -94,7 +94,9 @@ protected:
RoadGrid *rg;
static void _bind_methods();
Ref<Curve> curve;
Ref<OpenSimplexNoise> noise;
Ref<FastNoiseLite> noise;
Mutex sdf_mutex;
HashMap<int, float> sdf_data;
public:
RoadsData();
~RoadsData();
@@ -102,7 +104,7 @@ public:
static void create_singleton();
static void destroy_singleton();
RoadGrid *get_road_grid() const;
void set_noise(Ref<OpenSimplexNoise> noise);
void set_noise(Ref<FastNoiseLite> noise);
void set_curve(Ref<Curve> curve);
float get_sdf(int x, int y, int z);
};