Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renderer: Added an interface for point light sources
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** @file ilightsource.h Interface for a light source. | ||
* | ||
* @authors Copyright (c) 2013 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef DENG_CLIENT_ILIGHTSOURCE_H | ||
#define DENG_CLIENT_ILIGHTSOURCE_H | ||
|
||
#include <de/libdeng2.h> | ||
#include <de/Vector> | ||
|
||
/** | ||
* Interface for a light source. | ||
* | ||
* All sources of light should implement this interface. Through it, various | ||
* parts of the rendering subsystem can know where and what kind of light this | ||
* is. | ||
* | ||
* @ingroup render | ||
*/ | ||
class ILightSource | ||
{ | ||
public: | ||
typedef de::Vector3d Origin; | ||
|
||
/** | ||
* Unique identifier of the source. This can be used to uniquely identify a | ||
* source of light across multiple frames. | ||
*/ | ||
typedef de::duint32 LightId; | ||
|
||
/** | ||
* RGB color of the emitted light. | ||
*/ | ||
typedef de::Vector3f Color; | ||
|
||
public: | ||
virtual ~ILightSource() {} | ||
|
||
virtual LightId lightSourceId() const = 0; | ||
|
||
/** | ||
* Returns the position of the light source, in map units. | ||
*/ | ||
virtual Origin lightSourceOrigin() const = 0; | ||
|
||
/** | ||
* Returns the radius of the emitter itself, in map units. A radius of | ||
* zero would mean that the light emitter is an infinitely small point. | ||
*/ | ||
virtual de::dfloat lightSourceRadius() const = 0; | ||
|
||
/** | ||
* Returns the color of the emitted light. The intensity of the light must | ||
* not be factored into the color values, but is instead returned separately | ||
* by lightSourceIntensity(). | ||
*/ | ||
virtual Color lightSourceColor() const = 0; | ||
|
||
/** | ||
* Returns the intensity of the light. | ||
* | ||
* @param viewPoint World point from where the light is being observed. | ||
* Intensity may vary based on direction. | ||
*/ | ||
virtual de::dfloat lightSourceIntensity(de::Vector3d const &viewPoint) const = 0; | ||
}; | ||
|
||
#endif // DENG_CLIENT_ILIGHTSOURCE_H |