4 void SetUpLight(Light* whichsource, int whichlight){
5 static float qattenuation[]={0.0002f};
6 static float cattenuation[]={1.5f};
7 static float lattenuation[]={0.5f};
8 static float zattenuation[]={0.0f};
13 GLfloat LightAmbient[]= { whichsource->ambient[0], whichsource->ambient[1], whichsource->ambient[2], 1.0f};
14 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
15 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 0.0f };
17 //glLightfv(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, qattenuation);
18 glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
19 glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
20 glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
25 GLfloat LightAmbient[]= { 0, 0, 0, 1.0f};
26 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
27 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
29 glLightfv(GL_LIGHT1, GL_QUADRATIC_ATTENUATION, qattenuation);
30 glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);
31 glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
32 glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
37 GLfloat LightAmbient[]= { 0, 0, 0, 1.0f};
38 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
39 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
41 glLightfv(GL_LIGHT2, GL_QUADRATIC_ATTENUATION, qattenuation);
42 glLightfv(GL_LIGHT2, GL_POSITION, LightPosition);
43 glLightfv(GL_LIGHT2, GL_AMBIENT, LightAmbient);
44 glLightfv(GL_LIGHT2, GL_DIFFUSE, LightDiffuse);
49 GLfloat LightAmbient[]= { 0, 0, 0, 1.0f};
50 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
51 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
53 glLightfv(GL_LIGHT3, GL_QUADRATIC_ATTENUATION, qattenuation);
54 glLightfv(GL_LIGHT3, GL_POSITION, LightPosition);
55 glLightfv(GL_LIGHT3, GL_AMBIENT, LightAmbient);
56 glLightfv(GL_LIGHT3, GL_DIFFUSE, LightDiffuse);
61 GLfloat LightAmbient[]= { 0, 0, 0, 1.0f};
62 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
63 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
65 glLightfv(GL_LIGHT4, GL_QUADRATIC_ATTENUATION, qattenuation);
66 glLightfv(GL_LIGHT4, GL_POSITION, LightPosition);
67 glLightfv(GL_LIGHT4, GL_AMBIENT, LightAmbient);
68 glLightfv(GL_LIGHT4, GL_DIFFUSE, LightDiffuse);
73 GLfloat LightAmbient[]= { 0, 0, 0, 1.0f};
74 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
75 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
77 glLightfv(GL_LIGHT5, GL_QUADRATIC_ATTENUATION, qattenuation);
78 glLightfv(GL_LIGHT5, GL_POSITION, LightPosition);
79 glLightfv(GL_LIGHT5, GL_AMBIENT, LightAmbient);
80 glLightfv(GL_LIGHT5, GL_DIFFUSE, LightDiffuse);
85 GLfloat LightAmbient[]= { 0, 0, 0, 1.0f};
86 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
87 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
89 glLightfv(GL_LIGHT6, GL_QUADRATIC_ATTENUATION, qattenuation);
90 glLightfv(GL_LIGHT6, GL_POSITION, LightPosition);
91 glLightfv(GL_LIGHT6, GL_AMBIENT, LightAmbient);
92 glLightfv(GL_LIGHT6, GL_DIFFUSE, LightDiffuse);
97 GLfloat LightAmbient[]= { 0, 0, 0, 1.0f};
98 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
99 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
101 glLightfv(GL_LIGHT7, GL_QUADRATIC_ATTENUATION, qattenuation);
102 glLightfv(GL_LIGHT7, GL_POSITION, LightPosition);
103 glLightfv(GL_LIGHT7, GL_AMBIENT, LightAmbient);
104 glLightfv(GL_LIGHT7, GL_DIFFUSE, LightDiffuse);
109 void SetUpMainLight(Light* whichsource, int whichlight, float ambientr, float ambientg, float ambientb){
110 static float qattenuation[]={0.0f};
115 GLfloat LightAmbient[]= { ambientr, ambientg, ambientb, 1.0f};
116 GLfloat LightDiffuse[]= { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
117 GLfloat LightPosition[]= { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
119 glLightfv(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, qattenuation);
120 glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
121 glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
122 glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);