Ray Camera::GenerateRay(const Vec2f& uv, const Vec2f& auv, float time) { Ray ray = lens->GenerateRay(uv, auv, time); if(!xform->IsIdentity()) { Matrix4d m = xform->GetTransform(time); ray = Ray(m.TransformPoint(ray.E), m.TransformVector(ray.D).GetNormalized(), ray.time); } return ray; }
PhotonSample Light::SamplePhoton(const Vec3f& sceneCenter, float sceneRadius, const Vec2f& ss, const Vec2f& sa, float time) { PhotonSample ret; if(xform->IsIdentity()) { ret.le = source->SamplePhoton(sceneCenter,sceneRadius,ss,sa,time,&ret.P,&ret.wo,&ret.pdf); } else { Vec3f Cl = xform->GetInverseTransform(time).TransformPoint(sceneCenter); ret.le = source->SamplePhoton(Cl,sceneRadius,ss,sa,time,&ret.P,&ret.wo,&ret.pdf); Matrix4d m = xform->GetTransform(time); ret.P = m.TransformPoint(ret.P); ret.wo = m.TransformVector(ret.wo).GetNormalized(); } return ret; }
//! \brief Transform the sample void OmniVLightSample::Transform(const Matrix4d &m) { _position = m.TransformPoint(_position); }
//! \brief Transform the light sample void OrientdVLightSample::Transform(const Matrix4d &m) { _position = m.TransformPoint(_position); _normal = m.TransformVector(_normal); }