00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "stdafx.h"
00027 #include "intersection.h"
00028 #include "shape.h"
00029 #include "primitive.h"
00030 #include "light.h"
00031
00032
00033 BSDF *Intersection::GetBSDF(const RayDifferential &ray,
00034 MemoryArena &arena) const {
00035 PBRT_STARTED_BSDF_SHADING(const_cast<RayDifferential *>(&ray));
00036 dg.ComputeDifferentials(ray);
00037 BSDF *bsdf = primitive->GetBSDF(dg, ObjectToWorld, arena);
00038 PBRT_FINISHED_BSDF_SHADING(const_cast<RayDifferential *>(&ray), bsdf);
00039 return bsdf;
00040 }
00041
00042
00043 BSSRDF *Intersection::GetBSSRDF(const RayDifferential &ray,
00044 MemoryArena &arena) const {
00045 PBRT_STARTED_BSSRDF_SHADING(const_cast<RayDifferential *>(&ray));
00046 dg.ComputeDifferentials(ray);
00047 BSSRDF *bssrdf = primitive->GetBSSRDF(dg, ObjectToWorld, arena);
00048 PBRT_FINISHED_BSSRDF_SHADING(const_cast<RayDifferential *>(&ray), bssrdf);
00049 return bssrdf;
00050 }
00051
00052
00053 Spectrum Intersection::Le(const Vector &w) const {
00054 const AreaLight *area = primitive->GetAreaLight();
00055 return area ? area->L(dg.p, dg.nn, w) : Spectrum(0.);
00056 }
00057
00058