Issue 888: Fix for master branch: Correctly calculate the bucket center and radius.
The previous routine lead to offsets in the verts and thus to problems in the transition shaders.
This commit is contained in:
parent
4c975a0537
commit
3f996495c6
1 changed files with 8 additions and 5 deletions
|
@ -46,13 +46,16 @@ using std::string;
|
||||||
// tile and zero elevation
|
// tile and zero elevation
|
||||||
void TGGenOutput::calc_gbs( TGConstruct& c ) {
|
void TGGenOutput::calc_gbs( TGConstruct& c ) {
|
||||||
point_list wgs84_nodes = c.get_wgs84_nodes();
|
point_list wgs84_nodes = c.get_wgs84_nodes();
|
||||||
SGSphered d;
|
gbs_center = SGVec3d::fromGeod( c.get_bucket().get_center() );
|
||||||
|
|
||||||
|
double dist_squared, radius_squared = 0;
|
||||||
for ( int i = 0; i < wgs84_nodes.size(); ++i ) {
|
for ( int i = 0; i < wgs84_nodes.size(); ++i ) {
|
||||||
d.expandBy(wgs84_nodes[ i ].toSGVec3d());
|
dist_squared = distSqr(gbs_center, wgs84_nodes[i].toSGVec3d());
|
||||||
|
if ( dist_squared > radius_squared ) {
|
||||||
|
radius_squared = dist_squared;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
gbs_radius = sqrt(radius_squared);
|
||||||
gbs_center = d.getCenter();
|
|
||||||
gbs_radius = d.getRadius();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue