Original Post
I don''t think I understand the opengl-light-model correctly.
[list]
[*] How can I set the radius of the light
[*] How can I set the stuph to light up
[/list]
I''ve got the basics working however, somehow I cant figure out the above. The normals get calculated like :
float Ax, Ay, Az;
float Bx, By, Bz;
float Cx, Cy, Cz;
float l;
for(long i=0;i<this->LevelWidth;i++)
for(long j=0;j<this->LevelHeight;j++)
{
Ax = x1;
Ay = y1;
Az = z1;
Bx = x2 - x1;
By = y2 - y1;
Bz = z2 - z1;
Cx=Ay*Bz - By*Az;
Cy=Az*Bx - Bz*Ax;
Cz=Ax*By - Bx*Ay;
l = (float)sqrt(Cx*Cx + Cy*Cy + Cz*Cz);
this->Normals[i+j*this->LevelWidth].x += Cx / l;
this->Normals[i+j*this->LevelWidth].y += Cy / l;
this->Normals[i+j*this->LevelWidth].z += Cy / l;
}
[/CODE]
Like a wiseman once said -- Help
-- Divide Overflow