00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef VRS_OPENGL_LIGHTINGCALCULATOR_H
00043 #define VRS_OPENGL_LIGHTINGCALCULATOR_H
00044
00045 #include <vrs/sharedobj.h>
00046 #include <vrs/color.h>
00047 #include <vrs/vector.h>
00048 #include <vrs/matrix.h>
00049
00050 namespace VRS {
00051
00052 class Light;
00053 class MappedVertexAttributeShapeGL;
00054 class ShapeMaterialGL;
00055 class PolygonSet;
00056 template<typename T> class Iterator;
00057
00058 class VRS_CORE_API LightingCalculator : public SharedObj {
00059 public:
00060
00061 static void calculateLightingColors(SO<PolygonSet> poly,
00062 SO<ShapeMaterialGL> material,
00063 SO<Iterator<SO<Light> > > lights,
00064 const Matrix& matrix = Matrix(),
00065 SO<Iterator<Matrix> > lightTransforms = 0);
00080 static void calculateLightingColors(SO<MappedVertexAttributeShapeGL> shape,
00081 SO<ShapeMaterialGL> material,
00082 SO<Iterator<SO<Light> > > lights,
00083 const Matrix& matrix = Matrix(),
00084 SO<Iterator<Matrix> > lightTransforms = 0);
00088 static void calculateLightingColors(SO<PolygonSet> poly,
00089 Color defaultColor,
00090 const Vector& lightDirection,
00091 double minIntensity = 0.4,
00092 double maxIntensity = 1.4,
00093 const Matrix& matrix = Matrix());
00098 static void calculateTrilightColors(
00099 SO<PolygonSet> poly,
00100 const Color& defaultVertexColor,
00101 const Vector& lightDirection,
00102 const Color& lightColor0,
00103 const Color& lightColor1,
00104 const Color& lightColor2,
00105 const Matrix& polyTransformMatrix = Matrix()
00106 );
00111 static void calculateLightingColors(SO<MappedVertexAttributeShapeGL> shape,
00112 Color defaultColor,
00113 const Vector& lightDirection,
00114 double minIntensity = 0.4,
00115 double maxIntensity = 1.4,
00116 const Matrix& matrix = Matrix());
00119 static Color calculateLighting(SO<ShapeMaterialGL> mat, SO<Iterator<SO<Light> > > lights,
00120 const Vector& vertex, const Vector& normal, const Color& vertexColor);
00123 static Color calculateLighting(SO<ShapeMaterialGL> mat,
00124 SO<Iterator<SO<Light> > > lights,
00125 SO<Iterator<Matrix> > lightTransforms,
00126 const Vector& vertex,
00127 const Vector& normal,
00128 const Color& vertexColor);
00130
00131 static Color calculateLighting(const Vector& lightDirection,
00132 double minIntensity, double maxIntensity,
00133 const Vector& vertex, const Vector& normal, const Color& vertexColor);
00136 static Color calculateTrilight(
00137 const Vector& vertexNormal,
00138 const Color& vertexColor,
00139 const Vector& lightDirection,
00140 const Color& lightColor0,
00141 const Color& lightColor1,
00142 const Color& lightColor2
00143 );
00150 private:
00151 static SO<Iterator<Color> > calculateLightingColors(
00152 SO<Iterator<Vector> > vertices,
00153 SO<Iterator<Vector> > normals,
00154 SO<Iterator<Color> > colors,
00155 SO<ShapeMaterialGL> material,
00156 SO<Iterator<SO<Light> > > lights,
00157 const Matrix& matrix,
00158 SO<Iterator<Matrix> > lightTransforms
00159 );
00160
00161 static SO<Iterator<Color> > calculateLightingColors(
00162 SO<Iterator<Vector> > vertices,
00163 SO<Iterator<Vector> > normals,
00164 SO<Iterator<Color> > colors,
00165 Color defaultColor,
00166 const Vector& lightDirection,
00167 double minIntensity,
00168 double maxIntensity,
00169 const Matrix& matrix
00170 );
00171
00172 static SO<Iterator<Color> > calculateTrilightColors(
00173 SO<Iterator<Vector> > vertices,
00174 SO<Iterator<Vector> > normals,
00175 SO<Iterator<Color> > colors,
00176 const Color& defaultVertexColor,
00177 const Vector& lightDirection,
00178 const Color& lightColor0,
00179 const Color& lightColor1,
00180 const Color& lightColor2,
00181 const Matrix& transformMatrix
00182 );
00183 };
00184
00185 #endif // VRS_OPENGL_LIGHTINGCALCULATOR_H
00186
00187 }