Skip to content

Commit

Permalink
Renderer: Added an interface for point light sources
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Nov 15, 2013
1 parent 6964e8a commit b1a0552
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions doomsday/client/client.pro
Expand Up @@ -301,6 +301,7 @@ DENG_HEADERS += \
include/render/fx/postprocessing.h \
include/render/fx/vignette.h \
include/render/huecirclevisual.h \
include/render/ilightsource.h \
include/render/lightdecoration.h \
include/render/lightgrid.h \
include/render/lumobj.h \
Expand Down
82 changes: 82 additions & 0 deletions doomsday/client/include/render/ilightsource.h
@@ -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

0 comments on commit b1a0552

Please sign in to comment.