Last change
on this file since 438 was
65,
checked in by Maciej Komosinski, 14 years ago
|
added sources of the 3D client for the Framsticks server
|
File size:
614 bytes
|
Line | |
---|
1 | #ifndef __LIGHTS
|
---|
2 | #define __LIGHTS
|
---|
3 |
|
---|
4 | interface Light {
|
---|
5 | float3 illuminate(float3 p, out float3 L);
|
---|
6 | };
|
---|
7 |
|
---|
8 | struct PointLight : Light {
|
---|
9 | float3 Plight, Clight;
|
---|
10 | float3 illuminate(float3 P, out float3 L) {
|
---|
11 | L = normalize(Plight - P);
|
---|
12 | return Clight;
|
---|
13 | }
|
---|
14 | };
|
---|
15 |
|
---|
16 | struct SpotLight : Light {
|
---|
17 | float3 Plight, Clight, target;
|
---|
18 | float3 illuminate(float3 P, out float3 L) {
|
---|
19 | L = normalize(Plight - P);
|
---|
20 | float3 shine = normalize(Plight - target);
|
---|
21 | float costheta = dot(L, shine);
|
---|
22 | return Clight * smoothstep(0.98, 1., costheta);
|
---|
23 | }
|
---|
24 | };
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.