// -*- C++ -*-
#ifndef RIRAYSHADER_H
#define RIRAYSHADER_H
/* Copyright 1996 
 * Thu Aug 14 09:43:27 1997  Brian Smits  (bes@phoenix.cs.utah.edu)
 * 
 * RiRayShader.H
 * 
 *	
 * 
 * $Id: RiRayShader.H,v 1.8 1999/10/01 18:26:30 bes Exp $ 
 * 
 */
#ifndef RICOMMON_H
#include <RiCommon.H>
#endif

#ifndef RIRAYOBJECT_H
#include <RiRayObject.H>
#endif

#ifndef RIRAY3_H
#include <RiRay3.H>
#endif

#ifndef RISPECTRUM_H
#include <RiSpectrum.H>
#endif

#ifndef RIVECTOR3_H
#include <RiVector3.H>
#endif

#ifndef RIBACKGROUND_H
#include <RiBackground.H>
#endif

#ifndef RISAMPLEPATTERN_H
#include <RiSamplePattern.H>
#endif

#ifndef RIRAYSHADESTRATEGY_H
#include <RiRayShadeStrategy.H>
#endif

/***************************************************************
CLASS
    RiRayShader
     <one line summary> 

DESCRIPTION
     <Detailed description with any warnings>

****************************************************************/

class RiRayShader {
  public:
				// GROUP: Constructors and assignment
    RiRayShader(RiRayObject *env = NULL, RiBackground *bg = NULL, int maxDepth = NULL);
				// GROUP: Members
				//// Should have NO side effects.
				// [in] corl  Count only reflected light.  Needed if the
				// previous shader did anything special to sample lights
    virtual  RiSpectrum Shade(RiRay3 &ray, RiRayHit &hit, Ri2DSamplePatternIterator &samps,
			      RiMedia *media, bool corl = false, int treeDepth = 0);
				////
    RiRayObject		*GetEnvironment() const;
				////
    void 		 SetEnvironment(RiRayObject *obj);
				////
    RiBackground	*GetBackground() const;
				////
    void 		 SetBackground(RiBackground *bg);
				////
    void		 SetMaxRayDepth(int rayDepth);
				////
    void		 SetEmission(RiRayShadeStrategy *emit);
				////
    void		 SetDirectLighting(RiRayShadeStrategy *direct);
				////
    void		 SetTermination(RiRayShadeStrategy *terminate);
				////
    void		 SetSecondary(RiRayShadeStrategy *second);
				////
    void		 SetSpecular(RiRayShadeStrategy *spec);
 				//// Return the shader to be used for shading secondary rays
				// default implementation is to return itself
    virtual RiRayShader *GetRayShader();
  private:
				//// Environment for secondary rays
    RiRayObject *env;
				//// simple cut off criterion
    int		 maxRayDepth;
				////
    RiBackground *background;
				////
    RiRayShadeStrategy  *emit, *direct, *terminate, *secondary, *specular;
};

#endif /*RiRayShader_H */

