102 GLfloat rscale, gscale, bscale, ascale;
111 rscale =
ctx->Visual->RedScale;
112 gscale =
ctx->Visual->GreenScale;
113 bscale =
ctx->Visual->BlueScale;
114 ascale =
ctx->Visual->AlphaScale;
116 mat = &
ctx->Light.Material[side];
119 baseR =
mat->Emission[0] +
ctx->Light.Model.Ambient[0] *
mat->Ambient[0];
120 baseG =
mat->Emission[1] +
ctx->Light.Model.Ambient[1] *
mat->Ambient[1];
121 baseB =
mat->Emission[2] +
ctx->Light.Model.Ambient[2] *
mat->Ambient[2];
149 GLfloat ambientR, ambientG, ambientB;
155 if (
light->Position[3]==0.0) {
157 VPx =
light->VP_inf_norm[0];
158 VPy =
light->VP_inf_norm[1];
159 VPz =
light->VP_inf_norm[2];
175 attenuation = 1.0F / (
light->ConstantAttenuation
176 +
d * (
light->LinearAttenuation
177 +
d *
light->QuadraticAttenuation));
181 if (
light->SpotCutoff==180.0F) {
186 GLfloat PVx, PVy, PVz, PV_dot_dir;
190 PV_dot_dir = PVx*
light->NormDirection[0]
191 + PVy*
light->NormDirection[1]
192 + PVz*
light->NormDirection[2];
193 if (PV_dot_dir<=0.0F || PV_dot_dir<light->CosCutoff) {
200 spot =
light->SpotExpTable[
k][0]
205 ambientR =
mat->Ambient[0] *
light->Ambient[0];
206 ambientG =
mat->Ambient[1] *
light->Ambient[1];
207 ambientB =
mat->Ambient[2] *
light->Ambient[2];
210 n_dot_VP =
nx * VPx +
ny * VPy +
nz * VPz;
213 if (n_dot_VP<=0.0F) {
216 sumR +=
t * ambientR;
217 sumG +=
t * ambientG;
218 sumB +=
t * ambientB;
222 GLfloat diffuseR, diffuseG, diffuseB;
223 GLfloat specularR, specularG, specularB;
227 diffuseR = n_dot_VP *
mat->Diffuse[0] *
light->Diffuse[0];
228 diffuseG = n_dot_VP *
mat->Diffuse[1] *
light->Diffuse[1];
229 diffuseB = n_dot_VP *
mat->Diffuse[2] *
light->Diffuse[2];
232 if (
ctx->Light.Model.LocalViewer) {
237 vlen =
GL_SQRT( vx*vx + vy*vy + vz*vz );
257 n_dot_h =
nx*h_x +
ny*h_y +
nz*h_z;
267 n_dot_h = n_dot_h /
GL_SQRT( h_x*h_x + h_y*h_y + h_z*h_z );
270 spec_coef =
pow( n_dot_h,
mat->Shininess );
275 if (
mat->ShineTable[
k] < 0.0F)
277 spec_coef =
mat->ShineTable[
k];
279 if (spec_coef<1.0e-10) {
285 specularR = spec_coef *
mat->Specular[0]*
light->Specular[0];
286 specularG = spec_coef *
mat->Specular[1]*
light->Specular[1];
287 specularB = spec_coef *
mat->Specular[2]*
light->Specular[2];
291 t = attenuation * spot;
292 sumR +=
t * (ambientR + diffuseR + specularR);
293 sumG +=
t * (ambientG + diffuseG + specularG);
294 sumB +=
t * (ambientB + diffuseB + specularB);
320 GLfloat rscale, gscale, bscale, ascale;
322 GLfloat *baseColor =
ctx->Light.BaseColor[side];
327 rscale =
ctx->Visual->RedScale;
328 gscale =
ctx->Visual->GreenScale;
329 bscale =
ctx->Visual->BlueScale;
330 ascale =
ctx->Visual->AlphaScale;
333 sumA = (
GLint) (baseColor[3] * ascale);
372 n_dot_VP =
nx *
light->VP_inf_norm[0]
382 sumR += n_dot_VP * lightMatDiffuse[0];
383 sumG += n_dot_VP * lightMatDiffuse[1];
384 sumB += n_dot_VP * lightMatDiffuse[2];
388 n_dot_h =
nx *
light->h_inf_norm[0]
395 ctx->Light.Material[side].Shininess );
396 if (spec_coef>1.0e-10F) {
397 sumR += spec_coef *
light->MatSpecular[side][0];
398 sumG += spec_coef *
light->MatSpecular[side][1];
399 sumB += spec_coef *
light->MatSpecular[side][2];
407 if (
m->ShineTable[
k] < 0.0F)
408 m->ShineTable[
k] =
gl_pow( n_dot_h,
m->Shininess );
409 spec_coef =
m->ShineTable[
k];
410 sumR += spec_coef *
light->MatSpecular[side][0];
411 sumG += spec_coef *
light->MatSpecular[side][1];
412 sumB += spec_coef *
light->MatSpecular[side][2];
478 if (
light->Position[3]==0.0) {
481 lx =
light->VP_inf_norm[0];
482 ly =
light->VP_inf_norm[1];
483 lz =
light->VP_inf_norm[2];
499 attenuation = 1.0F / (
light->ConstantAttenuation
500 +
d * (
light->LinearAttenuation
501 +
d *
light->QuadraticAttenuation));
504 l_dot_norm = lx*
nx + ly*
ny + lz*
nz;
506 if (l_dot_norm>0.0F) {
510 if (
light->SpotCutoff==180.0F) {
512 spot_times_atten = attenuation;
522 spot_times_atten = 0.0F;
529 spot_times_atten = spot * attenuation;
534 diffuse += l_dot_norm *
light->dli * spot_times_atten;
538 GLfloat h_x, h_y, h_z, n_dot_h, spec_coef;
541 if (
ctx->Light.Model.LocalViewer) {
546 vlen =
GL_SQRT( vx*vx + vy*vy + vz*vz );
563 n_dot_h = h_x*
nx + h_y*
ny + h_z*
nz;
565 if (n_dot_h <= 0.0F) {
570 n_dot_h = n_dot_h /
GL_SQRT(h_x*h_x + h_y*h_y + h_z*h_z);
572 spec_coef =
pow( n_dot_h,
mat->Shininess );
576 if (
mat->ShineTable[
k] < 0.0F)
578 spec_coef =
mat->ShineTable[
k];
593 d_a =
mat->DiffuseIndex -
mat->AmbientIndex;
594 s_a =
mat->SpecularIndex -
mat->AmbientIndex;
static CHAR baseA[MAX_PATH]
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
double pow(double x, double y)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLfloat GLfloat GLfloat GLfloat nx
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum light
void gl_color_shade_vertices(GLcontext *ctx, GLuint side, GLuint n, GLfloat vertex[][4], GLfloat normal[][3], GLubyte color[][4])
void gl_color_shade_vertices_fast(GLcontext *ctx, GLuint side, GLuint n, GLfloat normal[][3], GLubyte color[][4])
void gl_index_shade_vertices(GLcontext *ctx, GLuint side, GLuint n, GLfloat vertex[][4], GLfloat normal[][3], GLuint indexResult[])
static GLfloat gl_pow(GLfloat x, GLfloat y)
#define CLAMP(f, min, max)