1
0
Fork 0

Added per linear feature width capability, so double lines are twice as wide, etc...

This commit is contained in:
PSadrozinski 2011-09-28 20:25:00 -04:00 committed by Christian Schmitt
parent 6dcf165438
commit ecbfc64b14
5 changed files with 102 additions and 68 deletions

View file

@ -244,6 +244,10 @@ static TGPolygon linear_feature_tex_coords( const TGPolygon& in_poly, const TGTe
tmp = x / width; tmp = x / width;
tx = tmp * (maxu - minu) + minu; tx = tmp * (maxu - minu) + minu;
if ( tx < -1.0 ) { tx = -1.0; }
if ( tx > 1.0 ) { tx = 1.0; }
SG_LOG(SG_GENERAL, SG_DEBUG, " (" << tx << ")"); SG_LOG(SG_GENERAL, SG_DEBUG, " (" << tx << ")");
/* /*

View file

@ -65,7 +65,7 @@ void ClosedPoly::AddNode( BezNode* node )
} }
SG_LOG(SG_GENERAL, SG_DEBUG, " Adding node (" << node->GetLoc().x() << "," << node->GetLoc().y() << ") to current linear feature " << cur_marking); SG_LOG(SG_GENERAL, SG_DEBUG, " Adding node (" << node->GetLoc().x() << "," << node->GetLoc().y() << ") to current linear feature " << cur_marking);
cur_marking = new LinearFeature(marking_desc, 1.5f, 0.6f ); cur_marking = new LinearFeature(marking_desc, 1.0f );
} }
cur_marking->AddNode( node ); cur_marking->AddNode( node );
} }
@ -622,12 +622,12 @@ int ClosedPoly::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list
sp.erase(); sp.erase();
sp.set_poly( split ); sp.set_poly( split );
sp.set_material( material ); sp.set_material( material );
sp.set_flag("taxi"); //sp.set_flag("taxi");
rwy_polys->push_back( sp ); rwy_polys->push_back( sp );
SG_LOG(SG_GENERAL, SG_DEBUG, "clipped = " << clipped.contours()); SG_LOG(SG_GENERAL, SG_DEBUG, "clipped = " << clipped.contours());
*accum = tgPolygonUnion( pre_tess, *accum ); *accum = tgPolygonUnion( pre_tess, *accum );
tp = TGTexParams( pre_tess.get_pt(0,0), 20.0 /* TODO poly width */, 20.0 /* TODO poly length */, texture_heading ); tp = TGTexParams( pre_tess.get_pt(0,0), 1.0 /* TODO poly width */, 1.0 /* TODO poly length */, texture_heading );
texparams->push_back( tp ); texparams->push_back( tp );
ExpandContour( hull, base, 20.0 ); ExpandContour( hull, base, 20.0 );

View file

@ -356,6 +356,7 @@ int LinearFeature::Finish()
double dist; double dist;
double az2; double az2;
double last_end_v; double last_end_v;
double width;
int i, j; int i, j;
string material; string material;
int mat_idx = 0; int mat_idx = 0;
@ -379,45 +380,121 @@ int LinearFeature::Finish()
break; break;
case LF_SOLID_YELLOW: case LF_SOLID_YELLOW:
//material = "lf_sng_solid_yellow"; material = "lf_sng_solid_yellow";
//break; width = 0.25f;
break;
case LF_BROKEN_YELLOW: case LF_BROKEN_YELLOW:
material = "lf_sng_broken_yellow";
width = 0.25f;
break;
case LF_SOLID_DBL_YELLOW: case LF_SOLID_DBL_YELLOW:
material = "lf_dbl_solid_yellow";
width = 0.5f;
break;
case LF_RUNWAY_HOLD: case LF_RUNWAY_HOLD:
material = "lf_runway_hold";
width = 1.0f;
break;
case LF_OTHER_HOLD: case LF_OTHER_HOLD:
material = "lf_other_hold";
width = 0.5f;
break;
case LF_ILS_HOLD: case LF_ILS_HOLD:
material = "lf_ils_hold";
width = 1.0f;
break;
case LF_SAFETYZONE_CENTERLINE: case LF_SAFETYZONE_CENTERLINE:
material = "lf_safetyzone_centerline";
width = 0.75f;
break;
case LF_SINGLE_LANE_QUEUE: case LF_SINGLE_LANE_QUEUE:
material = "lf_sng_lane_queue";
width = 0.25f;
break;
case LF_DOUBLE_LANE_QUEUE: case LF_DOUBLE_LANE_QUEUE:
material = "lf_dbl_lane_queue";
width = 0.5f;
break;
case LF_B_SOLID_YELLOW: case LF_B_SOLID_YELLOW:
material = "lf_dbl_solid_yellow";
width = 0.25f;
break;
case LF_B_BROKEN_YELLOW: case LF_B_BROKEN_YELLOW:
material = "lf_sng_broken_yellow_border";
width = 0.25f;
break;
case LF_B_SOLID_DBL_YELLOW: case LF_B_SOLID_DBL_YELLOW:
material = "lf_dbl_solid_yellow_border";
width = 0.5f;
break;
case LF_B_RUNWAY_HOLD: case LF_B_RUNWAY_HOLD:
material = "lf_runway_hold_border";
width = 1.0f;
break;
case LF_B_OTHER_HOLD: case LF_B_OTHER_HOLD:
material = "lf_other_hold_border";
width = 0.5f;
break;
case LF_B_ILS_HOLD: case LF_B_ILS_HOLD:
material = "lf_ils_hold_border";
width = 1.0f;
break;
case LF_B_SAFETYZONE_CENTERLINE: case LF_B_SAFETYZONE_CENTERLINE:
material = "lf_safetyzone_centerline_border";
width = 0.75f;
break;
case LF_B_SINGLE_LANE_QUEUE: case LF_B_SINGLE_LANE_QUEUE:
material = "lf_sng_lane_queue_border";
width = 0.25f;
break;
case LF_B_DOUBLE_LANE_QUEUE: case LF_B_DOUBLE_LANE_QUEUE:
material = "lf_dbl_lane_queue_border";
width = 0.5f;
break;
case LF_SOLID_WHITE: case LF_SOLID_WHITE:
case LF_CHECKERBOARD_WHITE: material = "lf_sng_solid_white";
case LF_BROKEN_WHITE: width = 0.25f;
break;
case LF_BIDIR_GREEN: case LF_CHECKERBOARD_WHITE:
case LF_OMNIDIR_BLUE: material = "lf_checkerboard_white";
case LF_UNIDIR_CLOSE_AMBER: width = 0.5f;
case LF_UNIDIR_CLOSE_AMBER_PULSE: break;
case LF_BIDIR_GREEN_AMBER:
case LF_OMNIDIR_RED: case LF_BROKEN_WHITE:
//material = "gloff_lf_b_solid_yellow"; material = "lf_broken_white";
// material = "pa_lftest"; width = 0.25f;
// material = "pa_tstlin"; break;
case 101:
case 102:
case 103:
case 104:
case 105:
case 106:
// don't generate lights yet...
break; break;
default: default:
SG_LOG(SG_GENERAL, SG_DEBUG, "ClosedPoly::BuildBtg: unknown material " << marks[i]->type ); SG_LOG(SG_GENERAL, SG_ALERT, "ClosedPoly::BuildBtg: unknown material " << marks[i]->type );
exit(1); exit(1);
} }
@ -425,51 +502,6 @@ int LinearFeature::Finish()
for (j = marks[i]->start_idx; j <= marks[i]->end_idx; j++) for (j = marks[i]->start_idx; j <= marks[i]->end_idx; j++)
{ {
SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::Finish: calculating offsets for mark " << i << " whose start idx is " << marks[i]->start_idx << " and end idx is " << marks[i]->end_idx << " cur idx is " << j ); SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::Finish: calculating offsets for mark " << i << " whose start idx is " << marks[i]->start_idx << " and end idx is " << marks[i]->end_idx << " cur idx is " << j );
switch (mat_idx%10)
{
case 0:
material = "pa_tstlin0";
break;
case 1:
material = "pa_tstlin1";
break;
case 2:
material = "pa_tstlin2";
break;
case 3:
material = "pa_tstlin3";
break;
case 4:
material = "pa_tstlin4";
break;
case 5:
material = "pa_tstlin5";
break;
case 6:
material = "pa_tstlin6";
break;
case 7:
material = "pa_tstlin7";
break;
case 8:
material = "pa_tstlin8";
break;
case 9:
material = "pa_tstlin9";
break;
}
mat_idx++;
// for each point on the PointsList, generate a quad from // for each point on the PointsList, generate a quad from
// start to next, offset by 2 distnaces from the edge // start to next, offset by 2 distnaces from the edge

View file

@ -57,7 +57,7 @@ typedef std::vector <Marking*> MarkingList;
class LinearFeature class LinearFeature
{ {
public: public:
LinearFeature( char* desc, double o, double w ) LinearFeature( char* desc, double o )
{ {
if ( desc ) if ( desc )
{ {
@ -68,14 +68,12 @@ public:
description = "none"; description = "none";
} }
offset = o; offset = o;
width = w;
} }
LinearFeature( string desc, double o, double w ) LinearFeature( string desc, double o )
{ {
description = desc; description = desc;
offset = o; offset = o;
width = w;
} }
inline string GetDescription() { return description; } inline string GetDescription() { return description; }

View file

@ -162,11 +162,11 @@ LinearFeature* Parser::ParseFeature( char* line )
if (strlen( line )) if (strlen( line ))
{ {
feature = new LinearFeature(line, 0.0f, 1.0f); feature = new LinearFeature(line, 0.0f);
} }
else else
{ {
feature = new LinearFeature(NULL, 0.0f, 1.0f); feature = new LinearFeature(NULL, 0.0f);
} }
SG_LOG(SG_GENERAL, SG_ALERT, "Creating Linear Feature with desription \"" << line << "\""); SG_LOG(SG_GENERAL, SG_ALERT, "Creating Linear Feature with desription \"" << line << "\"");