Linear features: Yellow hold lights are unidirectional to the right of the line direction.
Implement this by creating a directional normal for these types.
This commit is contained in:
parent
e8e1123db1
commit
ccfde6914a
2 changed files with 28 additions and 4 deletions
|
@ -759,6 +759,7 @@ int LinearFeature::Finish( bool closed, unsigned int idx )
|
|||
{
|
||||
prev_outer = Point3D(0.0f, 0.0f, 0.0f);
|
||||
cur_light_dist = 0.0f;
|
||||
bool directional_light = lights[i]->IsDirectional();
|
||||
|
||||
// which material for this light
|
||||
switch( lights[i]->type )
|
||||
|
@ -839,10 +840,28 @@ int LinearFeature::Finish( bool closed, unsigned int idx )
|
|||
|
||||
poly.add_node(0, tmp);
|
||||
|
||||
// calculate the normal
|
||||
Point3D vec = sgGeodToCart( tmp * SG_DEGREES_TO_RADIANS );
|
||||
double length = vec.distance3D( Point3D(0.0) );
|
||||
double length;
|
||||
Point3D vec;
|
||||
|
||||
if ( !directional_light )
|
||||
{
|
||||
// calculate the omnidirectional normal
|
||||
vec = sgGeodToCart( tmp * SG_DEGREES_TO_RADIANS );
|
||||
length = vec.distance3D( Point3D(0.0) );
|
||||
vec = vec / length;
|
||||
} else
|
||||
{
|
||||
// calculate the directional normal
|
||||
double heading_vec = heading + 90.0;
|
||||
if (heading_vec > 360.0) { heading_vec -= 360.0; }
|
||||
geo_direct_wgs_84( tmp.y(), tmp.x(), heading_vec, 10, &pt_y, &pt_x, &az2 );
|
||||
Point3D cart1 = sgGeodToCart( tmp * SG_DEGREES_TO_RADIANS );
|
||||
Point3D cart2 = sgGeodToCart( Point3D(pt_x, pt_y, 0.0) * SG_DEGREES_TO_RADIANS );
|
||||
|
||||
vec = cart2 - cart1;
|
||||
length = vec.distance3D( Point3D(0.0) );
|
||||
vec = vec / length;
|
||||
}
|
||||
|
||||
normals_poly.add_node(0, vec );
|
||||
|
||||
|
|
|
@ -57,6 +57,11 @@ public:
|
|||
unsigned int type;
|
||||
unsigned int start_idx;
|
||||
unsigned int end_idx;
|
||||
|
||||
bool IsDirectional()
|
||||
{
|
||||
return (type == 103 || type == 104) ? true : false;
|
||||
}
|
||||
};
|
||||
typedef std::vector <Lighting*> LightingList;
|
||||
|
||||
|
|
Loading…
Reference in a new issue