Ray Tracing, Version 4.7
Day #12
|
Goal: Ray trace a scene where
|
Ray Tracing Tools:
Change class Light so that it has data members
GLdoubleVector spotDirection, dir;
GLdouble cutoffAngle;
GLdouble spotExponent;
GLdouble spotEffect;
GLdouble attenuationFactor;
GLdouble distance, kc, kl, kq;
bool isSpotlight;
bool isDirectional;
and change its constructor so that it initializes both the booleans to false, kc to 1.0, attenuationFactor to 1.0, and spotEffect to 1.0.
Scene:
Make change to readScene so that it parses
cutoffAngle
spotExponent
spotDirection
dir (for the directional light)
kc, kl, kq (attenuation coefficients)
Make change to shade so that, for each light source,
globalAmbient + attenuationFactor * spotEffect * (Diffuse + Specular + Ambient),
where everything except globalAmbient is calculated and added in for each light source.
Examples:
My example files are finally correct and are in /classes/cs3114/Advanced_Graphics/files. All examples use the wood texture and all have a cutoff angle of 35 degrees. The only thing that changes from example to example is the spotExponent.
spot_exp2.scn (uses spotExponent = 2.0)
spot_exp10.scn (uses spotExponent = 10)
spot_exp50.scn
spot_exp100.scn
spot_exp150.scn
spot_exp200.scn