Source: raytracer/lightray.h


Annotated List
Files
Globals
Hierarchy
Index
/* *************************************************************************
                          lightray.h  -  description
                             -------------------
    begin                : Wed Oct 16 2002    
    copyright            : (C) 2002 by Micha Riser
    email                : mriser@gmx.net
 ************************************************************************* */

/* *************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ************************************************************************* */

#ifndef LIGHTRAY_H
#define LIGHTRAY_H

#include "ray.h"
#include "colour.h"
//#include "lightcache.h"
#include "insidelist.h"

class Scene;

/**Ray emitted by light source. Used for shadow tests.
  *@author Micha Riser
  */
class LightRay: public Ray {

public: // Constructor and destructor
    LightRay(const Vector3& start, const Vector3& end, Scene* s,
      const Colour3 lightcolour, const InsideList* l):
      Ray(start, Vector3::sub(end,start)), myscene(s), colour(lightcolour), length(direction.length()) {

        direction.scale(1/length);
        if (l) inside = InsideList(*l); else l=0;

    }

    ~LightRay() {}

public: // Public methods
    /**Shoots the ray.
      *@param blockingerror Returns error that originates if the light would
      *be blocked/not blocked.
      *@returns Light colour that arrives at end point.
      */
    Colour3 shoot(CLR& blockingerror);

private: // Private attributes
    Scene* myscene;
    Colour3 colour;
    InsideList inside;
    DBL length;

};

#endif

Generated by: micha@laptop on Thu Oct 24 20:25:24 2002, using kdoc 2.0a53.