Updated world module (now voronoi roads work
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
#include "road_map.h"
|
||||
|
||||
#define ROAD_MAP_TESTS
|
||||
|
||||
#define MIN_X -10000
|
||||
#define MAX_X 10000
|
||||
#define MIN_Z -10000
|
||||
#define MAX_Z 10000
|
||||
#define MIN_Y -1000
|
||||
#define MAX_Y 1000
|
||||
#define MIN_X (-10000)
|
||||
#define MAX_X (10000)
|
||||
#define MIN_Z (-10000)
|
||||
#define MAX_Z (10000)
|
||||
#define MIN_Y (-100)
|
||||
#define MAX_Y (300)
|
||||
#define HIGHWAY_LENGTH_MIN 100
|
||||
#define HIGHWAY_LENGTH_MAX 300
|
||||
|
||||
static RoadMap *g_road_map_data = NULL;
|
||||
RoadMap *RoadMap::get_singleton()
|
||||
@@ -25,9 +25,40 @@ void RoadMap::destroy_singleton()
|
||||
}
|
||||
RoadMap::RoadMap()
|
||||
{
|
||||
noise.instance();
|
||||
rnd.instance();
|
||||
}
|
||||
|
||||
RoadMap::~RoadMap()
|
||||
{
|
||||
}
|
||||
|
||||
class PrimaryNetwork {
|
||||
Vector<Vector3> points;
|
||||
friend class RoadMap;
|
||||
void start();
|
||||
};
|
||||
|
||||
void PrimaryNetwork::start()
|
||||
{
|
||||
#if 0
|
||||
Vector3 start_pos, start_dir;
|
||||
float l, a;
|
||||
Transform xform;
|
||||
|
||||
start_pos.x = MIN_X + ((float)(MAX_X - MIN_X)) * rnd.randf();
|
||||
start_pos.y = MIN_Y + ((float)(MAX_X - MIN_Y)) * rnd.randf();
|
||||
start_pos.z = MIN_Z + ((float)(MAX_X - MIN_Z)) * rnd.randf();
|
||||
l = HIGHWAY_LENGTH_MIN + ((float)(HIGHWAY_LENGTH_MAX - HIGHWAY_LENGTH_MIN)) * rnd.randf();
|
||||
start_dir = Vector3(l, 0.0f, 0.0f);
|
||||
start_pos.y = CLAMP(start_pos.y, 1.0f, MAX_Y);
|
||||
xform = Transform();
|
||||
#endif
|
||||
}
|
||||
|
||||
void RoadMap::gen_primary_network()
|
||||
{
|
||||
PrimaryNetwork p;
|
||||
p.start();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user