File: Light

package info (click to toggle)
dxsamples 4.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 26,348 kB
  • ctags: 1,513
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,101
file content (42 lines) | stat: -rw-r--r-- 1,160 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

   // Import the data
electrondensity = Import("watermolecule");
   // Partition the data
electrondensity = Partition(electrondensity);
   // Create an isosurface at a value of 0.3
isosurface = Isosurface(electrondensity,0.3);
   // Create a camera for the data
camera = AutoCamera(isosurface);

   // Create a macro. The macro takes as input a light, and collects the
   // light with the isosurface.  The collection is displayed using the
   // camera
macro makepicture(light)
{
  collected = Collect(isosurface, distantlight);
  Display(collected,camera);
}


    // Create a light in the direction [1 1 1]
lightdirection = [1 1 1];
    // Give it the color white
lightcolor = [1 1 1];
    // Make the light
distantlight = Light(lightdirection, lightcolor);
    // Call the macro
makepicture(distantlight);

    // Change the color to green
lightcolor = [0 1 0];
distantlight = Light(lightdirection, lightcolor);
makepicture(distantlight);

    // Change the direction to straight out in the z direction
lightdirection = [0 0 1];
    // The color is red 
lightcolor = [1 0 0];
distantlight = Light(lightdirection, lightcolor);
makepicture(distantlight);