1
0
Fork 0

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:
Christian Schmitt 2012-09-30 22:37:04 +02:00
parent 4c975a0537
commit 3f996495c6

View file

@ -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() );
for ( int i = 0; i < wgs84_nodes.size(); ++i ) {
d.expandBy(wgs84_nodes[ i ].toSGVec3d());
}
gbs_center = d.getCenter(); double dist_squared, radius_squared = 0;
gbs_radius = d.getRadius(); for ( int i = 0; i < wgs84_nodes.size(); ++i ) {
dist_squared = distSqr(gbs_center, wgs84_nodes[i].toSGVec3d());
if ( dist_squared > radius_squared ) {
radius_squared = dist_squared;
}
}
gbs_radius = sqrt(radius_squared);
} }