Vector ShootRay (Reta R, double Relative) { PointList *P; Point *hit; Vector Target; Vector color; Vector Normal; Vector Zero (0,0,0); Reta S; if (Relative<reflection) return Zero; RaysShooted++; P=new PointList; scene->Intersect (R,P); hit=P->First (); if (hit!=NULL) { Target=R.O+R.R*hit->t; Normal=hit->owner->Normal (Target); color=lightlist->Shade (Target,Normal,scene); delete P; if (hit->owner->surface->GetKs()!=0.0) { S.O=Target+Normal*epsilon; S.R=R.R-Normal*(R.R*Normal)*2.0; return hit->owner->surface->Apply (color,ShootRay (S,Relative*hit->owner->surface->GetKs())); } else return hit->owner->surface->Apply (color,Zero); } else { delete P; return Zero; } }