- // calculate the angle between v->surface_to_sun and
- // v->surface_east. We do this so we can sort out the acos()
- // ambiguity. I wish I could think of a more efficient way ... :-(
- east_dot = MAT3_DOT_PRODUCT( surface_to_sun, v->get_surface_east() );
- // printf(" East dot product = %.2f\n", east_dot);
+ sgmap_vec_onto_cur_surface_plane( v->get_world_up(), v->get_view_pos(),
+ to_sun, surface_to_sun );
+ sgNormalizeVec3(surface_to_sun);
+ // cout << "(sg) Surface direction to sun is "
+ // << surface_to_sun[0] << ","
+ // << surface_to_sun[1] << ","
+ // << surface_to_sun[2] << endl;
+ // cout << "Should be close to zero = "
+ // << sgScalarProductVec3(nup, surface_to_sun) << endl;
+
+ // calculate the angle between surface_to_sun and
+ // v->get_surface_east(). We do this so we can sort out the
+ // acos() ambiguity. I wish I could think of a more efficient
+ // way. :-(
+ east_dot = sgScalarProductVec3( surface_to_sun, v->get_surface_east() );
+ // cout << " East dot product = " << east_dot << endl;