… | |
… | |
309 | { |
309 | { |
310 | using namespace shader::compile; |
310 | using namespace shader::compile; |
311 | |
311 | |
312 | lightvec = xyz (lightpos - model_view_matrix * vin.vertex); |
312 | lightvec = xyz (lightpos - model_view_matrix * vin.vertex); |
313 | camdist = max (1 - length (lightvec) / radius, 0); |
313 | camdist = max (1 - length (lightvec) / radius, 0); |
314 | } |
|
|
315 | |
314 | |
316 | shader::temp_3f linear_light::operator ()() |
315 | fsh (); |
|
|
316 | } |
|
|
317 | |
|
|
318 | void linear_light::fsh () |
317 | { |
319 | { |
318 | using namespace shader::compile; |
320 | using namespace shader::compile; |
319 | |
321 | |
320 | temp_3f res; |
322 | sh_lightvec = lightvec; |
321 | res = float3 (c.r / 255.F, c.g / 255.F, c.b / 255.F) * (min (intensity * camdist * 0.6F + 0.9F, 1.F)); |
323 | sh_colour = float3 (c.r / 255.F, c.g / 255.F, c.b / 255.F) * (min (intensity * camdist * 0.6F + 0.9F, 1.F)); |
322 | |
|
|
323 | return res; |
|
|
324 | } |
324 | } |
325 | |
325 | |
326 | |
326 | |