Fix for helipad texturing
Fix for helipad base and clearing when we have borders Remove extra debug statements
This commit is contained in:
parent
fae73f38b5
commit
780e836e8b
3 changed files with 26 additions and 28 deletions
|
@ -40,14 +40,14 @@ Helipad::Helipad(char* definition)
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Read helipad: (" << heli.lon << "," << heli.lat << ") heading: " << heli.heading << " length: " << heli.length << " width: " << heli.width );
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Read helipad: (" << heli.lon << "," << heli.lat << ") heading: " << heli.heading << " length: " << heli.length << " width: " << heli.width );
|
||||||
}
|
}
|
||||||
|
|
||||||
tglightcontour_list Helipad::gen_helipad_lights(double maxsize){
|
tglightcontour_list Helipad::gen_helipad_lights(double maxsize) {
|
||||||
tglightcontour_list result;
|
tglightcontour_list result;
|
||||||
|
|
||||||
// Vector calculation
|
// Vector calculation
|
||||||
SGVec3d vec = normalize(SGVec3d::fromGeod(GetLoc()));
|
SGVec3d vec = normalize(SGVec3d::fromGeod(GetLoc()));
|
||||||
|
|
||||||
// Create yellow edge lights, 5m spacing
|
// Create yellow edge lights, 5m spacing
|
||||||
tgContour area = gen_runway_area_w_extend(0.0, 0.0, 0.0, 0.0, 0.0);
|
tgContour area = gen_helipad_area_w_extend(0.0, 0.0);
|
||||||
tgLightContour yellow;
|
tgLightContour yellow;
|
||||||
|
|
||||||
yellow.SetType( "RWY_YELLOW_LIGHTS" );
|
yellow.SetType( "RWY_YELLOW_LIGHTS" );
|
||||||
|
@ -88,7 +88,6 @@ tgPolygon Helipad::WriteGeom( const tgContour& area, string material,
|
||||||
// Create the final output and push on to the runway super_polygon
|
// Create the final output and push on to the runway super_polygon
|
||||||
// list
|
// list
|
||||||
split.SetMaterial( material );
|
split.SetMaterial( material );
|
||||||
rwy_polys.push_back( split );
|
|
||||||
|
|
||||||
tgContour::AddToAccumulator( area );
|
tgContour::AddToAccumulator( area );
|
||||||
|
|
||||||
|
@ -126,15 +125,16 @@ void Helipad::BuildBtg( tgpolygon_list& rwy_polys,
|
||||||
|
|
||||||
// write out
|
// write out
|
||||||
tgPolygon result = WriteGeom( helipad, material + "heli", rwy_polys, slivers);
|
tgPolygon result = WriteGeom( helipad, material + "heli", rwy_polys, slivers);
|
||||||
|
result.SetMaterial( material + "heli" );
|
||||||
result.SetTexParams( helipad.GetNode(0), maxsize, maxsize, heli.heading );
|
result.SetTexParams( helipad.GetNode(0), maxsize, maxsize, heli.heading );
|
||||||
result.SetTexLimits( 1,1,0,0 );
|
result.SetTexLimits( 0,0,1,1 );
|
||||||
result.SetTexMethod( TG_TEX_BY_TPS_CLIPUV, 0.0, 0.0, 1.0, 1.0 );
|
result.SetTexMethod( TG_TEX_BY_TPS_CLIPUV, -1.0, -1.0, 1.0, 1.0 );
|
||||||
|
|
||||||
rwy_polys.push_back( result );
|
rwy_polys.push_back( result );
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
double heading = 0, areahight = 0;
|
double heading = 0, areahight = 0;
|
||||||
tgContour heli_area = gen_runway_area_w_extend(0.0, 0.0, 0.0, 0.0, 0.0);
|
tgContour heli_area = gen_helipad_area_w_extend(0.0, 0.0);
|
||||||
heli_area = tgContour::Snap( heli_area, gSnap );
|
heli_area = tgContour::Snap( heli_area, gSnap );
|
||||||
|
|
||||||
tgcontour_list area_contours;
|
tgcontour_list area_contours;
|
||||||
|
@ -192,7 +192,7 @@ void Helipad::BuildBtg( tgpolygon_list& rwy_polys,
|
||||||
shoulder_width = heli.width;
|
shoulder_width = heli.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
tgContour shoulder = gen_runway_area_w_extend(0.0, areahight, 0.0, 0.0, areahight);
|
tgContour shoulder = gen_helipad_area_w_extend(areahight, areahight);
|
||||||
shoulder = tgContour::Snap( shoulder, gSnap );
|
shoulder = tgContour::Snap( shoulder, gSnap );
|
||||||
|
|
||||||
for (i = 0; i < 4; ++i) {
|
for (i = 0; i < 4; ++i) {
|
||||||
|
@ -232,12 +232,24 @@ void Helipad::BuildBtg( tgpolygon_list& rwy_polys,
|
||||||
BuildBtg( rwy_polys, rwy_lights, slivers );
|
BuildBtg( rwy_polys, rwy_lights, slivers );
|
||||||
|
|
||||||
// generate area around helipad
|
// generate area around helipad
|
||||||
|
double length, width;
|
||||||
tgContour base, safe_base;
|
tgContour base, safe_base;
|
||||||
base = gen_runway_area_w_extend( 0.0, heli.length * 0.25 , 0.0, 0.0, heli.width * 0.25 );
|
|
||||||
|
length = heli.length;
|
||||||
|
width = heli.width;
|
||||||
|
if ( (heli.shoulder == 1) || (heli.shoulder == 2 ) ) {
|
||||||
|
length += 12.0;
|
||||||
|
width += 12.0;
|
||||||
|
} else {
|
||||||
|
length += 2.0;
|
||||||
|
width += 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
base = gen_helipad_area_w_extend(length * 0.25 , width * 0.25 );
|
||||||
base = tgContour::Snap( base, gSnap );
|
base = tgContour::Snap( base, gSnap );
|
||||||
|
|
||||||
// also clear a safe area around the pad
|
// also clear a safe area around the pad
|
||||||
safe_base = gen_runway_area_w_extend( 0.0, heli.length * 0.5, 0.0, 0.0, heli.width * 0.5 );
|
safe_base = gen_helipad_area_w_extend( length * 0.5, width * 0.5 );
|
||||||
safe_base = tgContour::Snap( safe_base, gSnap );
|
safe_base = tgContour::Snap( safe_base, gSnap );
|
||||||
|
|
||||||
// add this to the airport clearing
|
// add this to the airport clearing
|
||||||
|
@ -252,7 +264,6 @@ void Helipad::BuildShoulder( tgpolygon_list& rwy_polys,
|
||||||
tgPolygon& apt_base,
|
tgPolygon& apt_base,
|
||||||
tgPolygon& apt_clearing )
|
tgPolygon& apt_clearing )
|
||||||
{
|
{
|
||||||
tgPolygon base, safe_base;
|
|
||||||
tgPolygon shoulder;
|
tgPolygon shoulder;
|
||||||
|
|
||||||
for (unsigned int i=0; i<shoulder_polys.size(); i++) {
|
for (unsigned int i=0; i<shoulder_polys.size(); i++) {
|
||||||
|
@ -270,17 +281,9 @@ void Helipad::BuildShoulder( tgpolygon_list& rwy_polys,
|
||||||
rwy_polys.push_back( shoulder_polys[i] );
|
rwy_polys.push_back( shoulder_polys[i] );
|
||||||
|
|
||||||
tgPolygon::AddToAccumulator( shoulder );
|
tgPolygon::AddToAccumulator( shoulder );
|
||||||
|
|
||||||
// also clear a safe area around the runway
|
|
||||||
base = tgPolygon::Expand( shoulder, 20.0);
|
|
||||||
safe_base = tgPolygon::Expand( shoulder, 50.0);
|
|
||||||
|
|
||||||
// add this to the airport clearing
|
|
||||||
apt_clearing = tgPolygon::Union( safe_base, apt_clearing );
|
|
||||||
|
|
||||||
// and add the clearing to the base
|
|
||||||
apt_base = tgPolygon::Union( base, apt_base );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// base and clearing calculated when generating the shoulders
|
||||||
}
|
}
|
||||||
|
|
||||||
void Helipad::BuildShoulder( tgpolygon_list& rwy_polys,
|
void Helipad::BuildShoulder( tgpolygon_list& rwy_polys,
|
||||||
|
|
|
@ -74,9 +74,9 @@ private:
|
||||||
|
|
||||||
// generate an area for a runway with expansion specified in meters
|
// generate an area for a runway with expansion specified in meters
|
||||||
// (return result points in degrees)
|
// (return result points in degrees)
|
||||||
tgContour gen_runway_area_w_extend( double alt_m, double length_extend, double displ1, double displ2, double width_extend )
|
tgContour gen_helipad_area_w_extend( double length_extend, double width_extend )
|
||||||
{
|
{
|
||||||
return ( gen_wgs84_area( GetLoc(), heli.length + 2.0*length_extend, displ1, displ2, heli.width + 2.0*width_extend, heli.heading, false) );
|
return ( gen_wgs84_area( GetLoc(), heli.length + 2.0*length_extend, 0.0, 0.0, heli.width + 2.0*width_extend, heli.heading, false) );
|
||||||
}
|
}
|
||||||
|
|
||||||
tglightcontour_list gen_helipad_lights(double maxsize);
|
tglightcontour_list gen_helipad_lights(double maxsize);
|
||||||
|
|
|
@ -1740,9 +1740,7 @@ tgPolygon tgContour::DiffWithAccumulator( const tgContour& subject )
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
result = tgPolygon::FromClipper( clipper_result );
|
result = tgPolygon::FromClipper( clipper_result );
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Diff contour With Accumulator got " << num_hits << " hits - result has " << result.Contours() << " contours ");
|
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Diff contour With Accumulator - no hits, return original" );
|
|
||||||
result.AddContour( subject );
|
result.AddContour( subject );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2128,10 +2126,7 @@ tgPolygon tgPolygon::DiffWithAccumulator( const tgPolygon& subject )
|
||||||
// Make sure we keep texturing info
|
// Make sure we keep texturing info
|
||||||
result.SetMaterial( subject.GetMaterial() );
|
result.SetMaterial( subject.GetMaterial() );
|
||||||
result.SetTexParams( subject.GetTexParams() );
|
result.SetTexParams( subject.GetTexParams() );
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Diff polygon With Accumulator got " << num_hits << " hits - result has " << result.Contours() << " contours - copied material name " << result.GetMaterial() );
|
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Diff polygon With Accumulator no hits - return original" );
|
|
||||||
result = subject;
|
result = subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2317,7 +2312,7 @@ void tgPolygon::Texture( void )
|
||||||
double x, y;
|
double x, y;
|
||||||
double tx, ty;
|
double tx, ty;
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Texture Poly with material " << material << " method " << tp.method );
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Texture Poly with material " << material << " method " << tp.method << " tpref " << tp.ref << " heading " << tp.heading );
|
||||||
|
|
||||||
switch( tp.method ) {
|
switch( tp.method ) {
|
||||||
case TG_TEX_BY_GEODE:
|
case TG_TEX_BY_GEODE:
|
||||||
|
|
Loading…
Reference in a new issue