
#include "Tscene.h"


void Tscene::light_init(float hour)
{
    pnlSky.setHour(hour);
    skyEarth.setHour(hour);

    float ambient;
    OVec3_f direction, color;
    // recuperation données soleil
    ambient = skyEarth.sun.getAmbient();
    direction = skyEarth.sun.getDir();
    color = skyEarth.sun.getColor();
    // correction de la luminosité dûe à la couche nuageuse
    //ambient -= skyEarth.clouds.getNeg_ambient();

    dshDir.enable();
        dshDir.setAmbient( ambient );
        dshDir.setColor( color );
        dshDir.setDirection( direction );
    dshDir.disable();

    lake3d_low.setLight(ambient, direction, color);
    lake3d_med.setLight(ambient, direction, color);
    //lake3d_hig.setLight(ambient, direction, color);
    //
    sea3d_low.setLight(ambient, direction, color);
    //sea3d_med.setLight(ambient, direction, color);

    // ---

    shLight.enable();
        shLight.setAmbient(0, ambient );
        shLight.setColor(0, color );
        shLight.setDirection(0, direction );
    shLight.disable();

    shLight_pbr.enable();
        shLight_pbr.setLight( ambient, direction, color );
    shLight_pbr.disable();

    //ECO_error_set("ambient : %f", ambient );
    //ECO_error_set("color : %f %f %f", color.r, color.g, color.b);
    //ECO_error_set("dir : %f %f %f", direction.z, direction.y, direction.z);
}
