72 for(i=0;i<4;i++) v.
v[i]=p[3+i].
f;
113 assert(
a == 180 || (
a>=0 &&
a<=90));
150 tgl_warning(
"glopLightModel: illegal pname: 0x%x\n", pname);
157static inline float clampf(
float a,
float min,
float max)
159 if (
a<min)
return min;
160 else if (
a>max)
return max;
187 float dist,
tmp,att,dot,dot_spot,dot_spec;
220 dist=sqrt(d.X*d.X+d.Y*d.Y+d.Z*d.Z);
230 dot=d.X*n.X+d.Y*n.Y+d.Z*n.Z;
231 if (twoside && dot < 0) dot = -dot;
243 if (twoside && dot_spot < 0) dot_spot = -dot_spot;
244 if (dot_spot < l->cos_spot_cutoff) {
271 dot_spec=n.X*s.X+n.Y*s.Y+n.Z*s.Z;
272 if (twoside && dot_spec < 0) dot_spec = -dot_spec;
276 tmp=sqrt(s.X*s.X+s.Y*s.Y+s.Z*s.Z);
278 dot_spec=dot_spec /
tmp;
287 dot_spec = specbuf->
buf[idx];
299 v->
color.
v[0]=clampf(R,0,1);
300 v->
color.
v[1]=clampf(G,0,1);
301 v->
color.
v[2]=clampf(B,0,1);
@ GL_CONSTANT_ATTENUATION
@ GL_LIGHT_MODEL_TWO_SIDE
@ GL_LIGHT_MODEL_LOCAL_VIEWER
@ GL_QUADRATIC_ATTENUATION
void gl_enable_disable_light(GLContext *c, int light, int v)
void gl_shade_vertex(GLContext *c, GLVertex *v)
void glopMaterial(GLContext *c, GLParam *p)
void glopLight(GLContext *c, GLParam *p)
void glopLightModel(GLContext *c, GLParam *p)
void glopColorMaterial(GLContext *c, GLParam *p)
void tgl_warning(const char *format,...)
GLSpecBuf * specbuf_get_buffer(GLContext *c, const int shininess_i, const float shininess)
#define SPECULAR_BUFFER_RESOLUTION
#define SPECULAR_BUFFER_SIZE
int current_color_material_mode
int current_color_material_type
GLLight lights[MAX_LIGHTS]
float buf[SPECULAR_BUFFER_SIZE+1]
void gl_M4_MulV4(V4 *a, M4 *b, V4 *c)