Now generating roads on terrain. Still some trouble left.
This commit is contained in:
@@ -303,7 +303,7 @@ Vector2 RoadGrid::get_influence(int x, int y) const
|
||||
Vector2 seg[] = {a, b};
|
||||
Vector2 pt = Geometry::get_closest_point_to_segment_2d(p, seg);
|
||||
float d = pt.distance_squared_to(p);
|
||||
if (d < he->depth * he->depth) {
|
||||
if (d < MAX(96.0f * 96.0f, he->depth * he->depth) + 96.0f * 96.0f) {
|
||||
Vector2 ret;
|
||||
ret.x = 1.0f;
|
||||
assert(diagram_vertex_heights.size() > he->a);
|
||||
@@ -315,7 +315,7 @@ Vector2 RoadGrid::get_influence(int x, int y) const
|
||||
float m1 = pt.distance_to(a) / l;
|
||||
float m2 = CLAMP(1.0f - m1, 0.0f, 1.0f);
|
||||
float h = h1 * (1.0f - m1) + h2 * (1.0f - m2);
|
||||
ret.y = h;
|
||||
ret.y = h - 0.5f;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user