// // texture_skylight.cc // // Skylight texture. // // Copyright (C) J. Belson 2003.09.27 // // $Id: texture_skylight.cc,v 1.1 2003/10/11 18:11:00 jon Exp $ // #include "texture_skylight.h" /** * Constructor. */ texture_skylight::texture_skylight(const textset_skylight& ts) : texture(ts) { sky = new skylight(3.0); sky->set_sun_direction(ts.sun_direction); sun_direction = ts.sun_direction; } /** * Destructor. */ texture_skylight::~texture_skylight() { delete sky; } /** * Calculate colour at specified point. * @param s Texture coordinate. * @param t Texture coordinate. * @param u Texture coordinate. * @return Colour at specified point. */ fcolour texture_skylight::colour(float s, float t, float u, vector3d*) { if (u < 0) { return fcolour(0.0, 0.0, 0.0); u = 0; } vector3d view_direction(s, u, t); view_direction.normalise(); return sky->get_colour(view_direction); }