Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor|Renderer|LightGrid: Reimplemented LightGrid
Separated IPointLightSource from ILightSource so that the latter can be used as the base for non-point light sources. LightGrid::IBlockLightSource (based on ILightSource) is the (abstract) base for illumination sources. SectorCluster is one such source. LightGrid light source grid CoverageData is now managed internally. LightGrid (re)initialization was revised to separate light source coverage determination from logical grid initialization. New sources can now be created dynamically without needing to rebuild the logical grid. LightGrid no longer observes Sector light color/intensity changes. Instead, IBlockLightSources are obliged to notify the LightGrid when their lighting properties change for scheduling of block updates. Revised LightGrid internal representation to clean up the "null block" optimization. Separated the light grid debug visual into rend_main.cpp for now. The map renderer now obtains the effective lighting properties from SectorCluster directly (using the same method as IBlockLightSource). Experimenting with sector light color & intensity as Vector4f.
- Loading branch information
1 parent
357d170
commit 7b82ef6
Showing
24 changed files
with
1,207 additions
and
1,087 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** @file ilightsource.h Interface for a light source. | ||
/** @file ilightsource.h Interface for a point light source. | ||
* | ||
* @authors Copyright (c) 2013 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
|
@@ -34,8 +34,6 @@ | |
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. | ||
|
@@ -52,17 +50,6 @@ class 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 | ||
|
@@ -73,10 +60,36 @@ class ILightSource | |
/** | ||
* Returns the intensity of the light. | ||
* | ||
* @param viewPoint World point from where the light is being observed. | ||
* Intensity may vary based on direction. | ||
* @param viewPoint World point from where the light is being observed if | ||
* the intensity may vary depending on the relative direction | ||
* and/or position of the viewer. | ||
*/ | ||
virtual de::dfloat lightSourceIntensity(de::Vector3d const &viewPoint) const = 0; | ||
}; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
danij-deng
Author
Collaborator
|
||
|
||
/** | ||
* Interface for a point light source. | ||
* | ||
* @ingroup render | ||
*/ | ||
class IPointLightSource : public ILightSource | ||
{ | ||
public: | ||
typedef de::Vector3d Origin; | ||
|
||
public: | ||
virtual ~IPointLightSource() {} | ||
|
||
/** | ||
* 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; | ||
}; | ||
|
||
#endif // DENG_CLIENT_ILIGHTSOURCE_H |
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
Oops, something went wrong.
I just realized this interface is missing a lightDirection() method. While some light can be directionless (direction = 0,0,0), in most cases we'll need a direction for lighting objects, etc.