- sgSetVec4( l->sun_vec().data(), l->get_sunpos().x(),
- l->get_sunpos().y(), l->get_sunpos().z(), 0.0 );
- sgNormalizeVec4( l->sun_vec().data() );
- sgCopyVec4( l->sun_vec_inv().data(), l->sun_vec().data() );
- sgNegateVec4( l->sun_vec_inv().data() );
-
- // make sure these are directional light sources only
- l->sun_vec()[3] = l->sun_vec_inv()[3] = 0.0;
- // cout << " l->sun_vec = " << l->sun_vec[0] << "," << l->sun_vec[1]
- // << ","<< l->sun_vec[2] << endl;
+ l->sun_vec() = SGVec4f(toVec3f(normalize(l->get_sunpos())), 0);
+ l->sun_vec_inv() = - l->sun_vec();