| VRS - The Virtual Rendering System |
| version 3.3 |
#include <vrs/opengl/lightingcalculator.h>

Static Public Member Functions | |
| static void | calculateLightingColors (SO< PolygonSet > poly, SO< ShapeMaterialGL > material, SO< Iterator< SO< Light > > > lights, const Matrix &matrix=Matrix(), SO< Iterator< Matrix > > lightTransforms=0) |
| static void | calculateLightingColors (SO< MappedVertexAttributeShapeGL > shape, SO< ShapeMaterialGL > material, SO< Iterator< SO< Light > > > lights, const Matrix &matrix=Matrix(), SO< Iterator< Matrix > > lightTransforms=0) |
| static void | calculateLightingColors (SO< PolygonSet > poly, Color defaultColor, const Vector &lightDirection, double minIntensity=0.4, double maxIntensity=1.4, const Matrix &matrix=Matrix()) |
| static void | calculateTrilightColors (SO< PolygonSet > poly, const Color &defaultVertexColor, const Vector &lightDirection, const Color &lightColor0, const Color &lightColor1, const Color &lightColor2, const Matrix &polyTransformMatrix=Matrix()) |
| static void | calculateLightingColors (SO< MappedVertexAttributeShapeGL > shape, Color defaultColor, const Vector &lightDirection, double minIntensity=0.4, double maxIntensity=1.4, const Matrix &matrix=Matrix()) |
| static Color | calculateLighting (SO< ShapeMaterialGL > mat, SO< Iterator< SO< Light > > > lights, const Vector &vertex, const Vector &normal, const Color &vertexColor) |
| static Color | calculateLighting (SO< ShapeMaterialGL > mat, SO< Iterator< SO< Light > > > lights, SO< Iterator< Matrix > > lightTransforms, const Vector &vertex, const Vector &normal, const Color &vertexColor) |
| Same as other calculateLighting(), but additionally takes a transformation for each light. | |
| static Color | calculateLighting (const Vector &lightDirection, double minIntensity, double maxIntensity, const Vector &vertex, const Vector &normal, const Color &vertexColor) |
| static Color | calculateTrilight (const Vector &vertexNormal, const Color &vertexColor, const Vector &lightDirection, const Color &lightColor0, const Color &lightColor1, const Color &lightColor2) |
| static void VRS::LightingCalculator::calculateLightingColors | ( | SO< PolygonSet > | poly, | |
| SO< ShapeMaterialGL > | material, | |||
| SO< Iterator< SO< Light > > > | lights, | |||
| const Matrix & | matrix = Matrix(), |
|||
| SO< Iterator< Matrix > > | lightTransforms = 0 | |||
| ) | [static] |
For statically enlightened scenes, this method calculates color values according to the given vertex colors (either given by the material or by a color iterator of poly), the material properties and given light sources. The calculation is based on the phong model. The calculated colors are inserted into 'poly' as new color iterator, i.e., either a given color iterator is replaced or a new one is set. The resulting PolygonSet can (and should) be rendered without lighting. Using pre-calculated lighting for static scenes can increase the rendering speed. Note:
| static void VRS::LightingCalculator::calculateLightingColors | ( | SO< MappedVertexAttributeShapeGL > | shape, | |
| SO< ShapeMaterialGL > | material, | |||
| SO< Iterator< SO< Light > > > | lights, | |||
| const Matrix & | matrix = Matrix(), |
|||
| SO< Iterator< Matrix > > | lightTransforms = 0 | |||
| ) | [static] |
Does the same as the method above for a MappedVertexAttributeShapeGL instead of a PolygonSet.
| static void VRS::LightingCalculator::calculateLightingColors | ( | SO< PolygonSet > | poly, | |
| Color | defaultColor, | |||
| const Vector & | lightDirection, | |||
| double | minIntensity = 0.4, |
|||
| double | maxIntensity = 1.4, |
|||
| const Matrix & | matrix = Matrix() | |||
| ) | [static] |
Similar to the methods above. Instead of OpenGL lighting, this function uses a different lighting formula, that separates backfaces better than Phong lighting. Note, that this formula is far from being realistic.
| static void VRS::LightingCalculator::calculateTrilightColors | ( | SO< PolygonSet > | poly, | |
| const Color & | defaultVertexColor, | |||
| const Vector & | lightDirection, | |||
| const Color & | lightColor0, | |||
| const Color & | lightColor1, | |||
| const Color & | lightColor2, | |||
| const Matrix & | polyTransformMatrix = Matrix() | |||
| ) | [static] |
This method calculates the "trilight" lighting for the given polygonset: http://home.comcast.net/~tom_forsyth/papers/trilight/trilight.html
| static void VRS::LightingCalculator::calculateLightingColors | ( | SO< MappedVertexAttributeShapeGL > | shape, | |
| Color | defaultColor, | |||
| const Vector & | lightDirection, | |||
| double | minIntensity = 0.4, |
|||
| double | maxIntensity = 1.4, |
|||
| const Matrix & | matrix = Matrix() | |||
| ) | [static] |
Does the same as the method above for a MappedVertexAttributeShapeGL instead of a PolygonSet.
| static Color VRS::LightingCalculator::calculateLighting | ( | SO< ShapeMaterialGL > | mat, | |
| SO< Iterator< SO< Light > > > | lights, | |||
| const Vector & | vertex, | |||
| const Vector & | normal, | |||
| const Color & | vertexColor | |||
| ) | [static] |
Calculates the lighting for a single vertex with given normal, color, material, and light sources.
| static Color VRS::LightingCalculator::calculateLighting | ( | SO< ShapeMaterialGL > | mat, | |
| SO< Iterator< SO< Light > > > | lights, | |||
| SO< Iterator< Matrix > > | lightTransforms, | |||
| const Vector & | vertex, | |||
| const Vector & | normal, | |||
| const Color & | vertexColor | |||
| ) | [static] |
Same as other calculateLighting(), but additionally takes a transformation for each light.
| static Color VRS::LightingCalculator::calculateLighting | ( | const Vector & | lightDirection, | |
| double | minIntensity, | |||
| double | maxIntensity, | |||
| const Vector & | vertex, | |||
| const Vector & | normal, | |||
| const Color & | vertexColor | |||
| ) | [static] |
Calculates the fake lighting for a single vertex with given normal, color, and light properties.
| static Color VRS::LightingCalculator::calculateTrilight | ( | const Vector & | vertexNormal, | |
| const Color & | vertexColor, | |||
| const Vector & | lightDirection, | |||
| const Color & | lightColor0, | |||
| const Color & | lightColor1, | |||
| const Color & | lightColor2 | |||
| ) | [static] |
Calculates the trilight equation: http://home.comcast.net/~tom_forsyth/papers/trilight/trilight.html res = colour0 * clamp(N.L) + colour1 * (1-abs(N.L)) + colour2 * clamp(-N.L) "vertexNormal" and "lightDIrection" should be normalized!