source: GTP/branches/IllumWPdeliver2008dec/IlluminationWP/demos/Standalone/PathMap [DirectX]/PointLight.hpp @ 3255

Revision 3255, 723 bytes checked in by szirmay, 15 years ago (diff)
Line 
1#pragma once
2#include "light.hpp"
3
4class PointLight :
5        public Light
6{
7public:
8        PointLight(){}
9        PointLight(const Vector& position, const Vector& radiance, const Vector& direction)
10                : Light(position, radiance)
11        {
12                this->direction = direction;
13        }
14        float getFormFactor(const Vector& lookpoint, const Vector& normal) const
15        {
16                Vector diff; diff.setDifference(lookpoint, position);
17                float dist2 = diff.norm2();
18                float dist2inv = 1.0f / dist2;
19                return - dist2inv * dist2inv * (diff * normal) * (diff * direction);
20        }
21        Vector getSample() const {return position;}
22        bool isPossiblyVisible(const Vector& point) const
23        {
24                Vector diff; diff.setDifference(point, position);
25                return diff * direction > 0;
26        }
27};
Note: See TracBrowser for help on using the repository browser.