Commit a1ce3752800273300fb84b0a77df748a4248beb4
1 parent
78dcb560
fixed minor lighting bugs
Showing
1 changed file
with
7 additions
and
5 deletions
Show diff stats
main.cu
... | ... | @@ -130,8 +130,8 @@ void glut_render(void) { |
130 | 130 | stim::vec3<float> focus = cam.getLookAt(); //get the camera focal point |
131 | 131 | stim::vec3<float> up = cam.getUp(); //get the camera "up" orientation |
132 | 132 | |
133 | - stim::vec3<float> v = focus - eye; | |
134 | - stim::vec3<float> v1 = v.cross(up); | |
133 | + stim::vec3<float> v = focus - eye; //calculate a vector from the camera to the center | |
134 | + stim::vec3<float> v1 = v.cross(up); | |
135 | 135 | stim::vec3<float> v2 = up.cross(v); |
136 | 136 | v1 = v1.norm(); |
137 | 137 | v2 = v2.norm(); |
... | ... | @@ -140,8 +140,10 @@ void glut_render(void) { |
140 | 140 | stim::vec3<float> s = bb.size(); |
141 | 141 | float r = s.len(); |
142 | 142 | |
143 | - stim::vec3<float> p1 = focus + l1*r/10; | |
144 | - stim::vec3<float> p2 = focus + l2*r/10; | |
143 | + //stim::vec3<float> p1 = focus + l1*r/5; | |
144 | + //stim::vec3<float> p2 = focus + l2*r/5; | |
145 | + stim::vec3<float> p1 = focus + cam.getUp() * 100000; | |
146 | + stim::vec3<float> p2 = cam.getPosition(); | |
145 | 147 | |
146 | 148 | // light |
147 | 149 | GLfloat global_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; |
... | ... | @@ -242,7 +244,7 @@ void glut_render(void) { |
242 | 244 | glPushMatrix(); |
243 | 245 | glTranslatef(p2[0], p2[1], p2[2]); |
244 | 246 | glColor3f(0.0, 0.0, 1.0); |
245 | - glutSolidSphere(10, 10, 10); | |
247 | + //glutSolidSphere(10, 10, 10); | |
246 | 248 | glPopMatrix(); |
247 | 249 | glColor3f(1, 1, 1); |
248 | 250 | ... | ... |