| 48 | //////////////////////////////////////////////////////////////////////////////// |
| 49 | |
| 50 | Light_SampleRes Lights_sample(const Light* self, |
| 51 | const DifferentialGeometry& dg, /*! point to generate the sample for >*/ |
| 52 | const Vec2f s) /*! random numbers to generate the sample >*/ |
| 53 | { |
| 54 | TutorialLightType ty = self->type; |
| 55 | switch (ty) { |
| 56 | case LIGHT_AMBIENT : return AmbientLight_sample(self,dg,s); |
| 57 | case LIGHT_POINT : return PointLight_sample(self,dg,s); |
| 58 | case LIGHT_DIRECTIONAL: return DirectionalLight_sample(self,dg,s); |
| 59 | case LIGHT_SPOT : return SpotLight_sample(self,dg,s); |
| 60 | case LIGHT_QUAD : return QuadLight_sample(self,dg,s); |
| 61 | default: { |
| 62 | Light_SampleRes res; |
| 63 | res.weight = Vec3fa(0,0,0); |
| 64 | res.dir = Vec3fa(0,0,0); |
| 65 | res.dist = 0; |
| 66 | res.pdf = inf; |
| 67 | return res; |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | Light_EvalRes Lights_eval(const Light* self, |
| 73 | const DifferentialGeometry& dg, |
no test coverage detected