Separated setup code

This commit is contained in:
Segey Lapin
2021-10-24 02:20:15 +03:00
parent eef15ea522
commit 8a5e9e0186
4 changed files with 80 additions and 40 deletions

View File

@@ -6,7 +6,7 @@
#include <scene/resources/concave_polygon_shape.h>
class StaticBody;
struct RoadGrid::vshape;
struct vshape;
struct RoadMeshData {
PoolVector<Vector3> points;
@@ -14,7 +14,7 @@ struct RoadMeshData {
float width2;
int flags;
float sidewalk_width;
struct RoadGrid::vshape *vshape;
struct vshape *vshape;
};
class Roads: public MeshInstance {
@@ -32,6 +32,7 @@ protected:
void _get_property_list(List<PropertyInfo> *p_list) const;
static void _bind_methods();
void update_all();
float sidewalk_width;
struct thread_data {
Thread thread;
Ref<Material> mat;
@@ -78,15 +79,20 @@ public:
PoolVector<String> build_item_list(float width, int flags, float sidewalk_width) const;
Ref<Curve3D> build_curve(Vector3 p1, Vector3 p2, Vector3 p3, float total_width) const;
// Array curve_mesh(PoolVector<Vector3> points, float width1, float width2, int flags, float sidewalk_width);
Array curve_mesh(const PoolVector<Vector3> &points, Ref<Curve3D> curve3, float width1, float width2, int flags, float sidewalk_width);
Array curve_mesh(const PoolVector<Vector3> &points, Ref<Curve3D> curve3, float total_width1, float total_width2,
const PoolVector<String> &parts_list1,
const PoolVector<String> &parts_list2,
int flags, float sidewalk_width);
int make_vmesh(Node *root, Ref<Material> mat, Ref<ArrayMesh> mesh, MeshInstance *xmi, RoadMeshData *data);
void process_vshapes();
void create_data(struct RoadGrid::vshape *v,
void create_vshape_data(struct vshape *v, int flags, float sidewalk_width);
void create_data(struct vshape *v,
struct RoadMeshData *data,
int flags, float sidewalk_width);
void add_scene_element(Node *root, Node *xnode, const Vector3 &p2, Ref<ConcavePolygonShape> shape);
inline float get_total_width(float width, int flags, float sidewalk_width);
inline Ref<Curve3D> get_curve(const PoolVector<Vector3> &points, float width, int flags, float sidewalk_width);
void build_vshape_data();
};
class RoadsData: public Object {