added light demos 04/12604/2
Pedro Arthur [Thu, 19 Sep 2013 19:21:32 +0000 (16:21 -0300)]
Change-Id: I67f561f185725488d70ef746f330a2ecd0e0841a

scilab/modules/graphics/demos/graphics.dem.gateway.sce
scilab/modules/graphics/demos/lighting/color_light.dem.sce [new file with mode: 0644]
scilab/modules/graphics/demos/lighting/dir_light.dem.sce [new file with mode: 0644]
scilab/modules/graphics/demos/lighting/lighting.dem.gateway.sce [new file with mode: 0644]
scilab/modules/graphics/demos/lighting/rot_light.dem.sce [new file with mode: 0644]
scilab/modules/graphics/demos/lighting/simple_light.dem.sce [new file with mode: 0644]
scilab/modules/helptools/images/light_1.png
scilab/modules/helptools/images/light_create_1.png
scilab/modules/helptools/images/lighting_1.png
scilab/modules/helptools/images/lighting_2.png

index 04ba333..31a8c84 100644 (file)
@@ -21,6 +21,7 @@ function subdemolist = demo_gateway()
     _("bar histogram")               ,"bar/bar.dem.sce"; ..
     _("Datatips")                    ,"datatips/datatips.dem.gateway.sce"                   ; ..
     _("LaTeX/MathML")                ,"textrendering/textrendering.dem.gateway.sce"         ; ..
+       _("Lighting")                    ,"lighting/lighting.dem.gateway.sce"                   ; ..
     _("Misc")                        ,"misc/misc.dem.sce"                                   ; ..
     _("Colormap")                    ,"colormap/colormap.dem.sce"];
 
diff --git a/scilab/modules/graphics/demos/lighting/color_light.dem.sce b/scilab/modules/graphics/demos/lighting/color_light.dem.sce
new file mode 100644 (file)
index 0000000..5abf6e1
--- /dev/null
@@ -0,0 +1,57 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Pedro SOUZA
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+
+function demo_color_light()
+
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
+    demo_viewCode("color_light.dem.sce");
+
+    // DEMO START
+
+    my_plot_desc          = "Color light";
+    my_handle.figure_name = my_plot_desc;
+
+    my_handle.figure_name = my_plot_desc;
+    plot3d;l=light_create();s=gce();
+
+    s.color_material = "off";
+    s.color_flag = 0;
+    s.thickness = 0;
+    s.hiddencolor = -1;
+    s.ambient_color = [1 1 1];
+    s.diffuse_color = [1 1 1];
+    s.specular_color = [1 1 1];
+
+    diff0 = rand(1, 3);
+    diff1 = rand(1, 3);
+    spec0 = rand(1, 3);
+    spec1 = rand(1, 3);
+
+    num = 10;
+    for j=1: num
+        n = 700;
+        for i=1:n
+            t = i / n;
+            cdiff = diff0 * (1 - t) + diff1 * t;
+            cspec = spec0 * (1 - t) + spec1 * t;
+            l.ambient_color = 0.2 * cdiff;
+            l.diffuse_color = 0.8 * cdiff;
+            l.specular_color = cspec;
+            sleep(3);
+        end
+        diff0 = diff1;
+        spec0 = spec1;
+        diff1 = rand(1, 3);
+        spec1 = rand(1, 3);
+    end
+    // DEMO END
+
+endfunction
+
+
+demo_color_light();
+clear demo_color_light;
\ No newline at end of file
diff --git a/scilab/modules/graphics/demos/lighting/dir_light.dem.sce b/scilab/modules/graphics/demos/lighting/dir_light.dem.sce
new file mode 100644 (file)
index 0000000..f10506d
--- /dev/null
@@ -0,0 +1,37 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Pedro SOUZA
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+
+function demo_dir_light()
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
+    demo_viewCode("dir_light.dem.sce");
+
+    // DEMO START
+
+    my_plot_desc          = "Directional light";
+    my_handle.figure_name = my_plot_desc;
+
+    my_handle.figure_name = my_plot_desc;
+    plot3d;l=light_create();s=gce();
+
+    l.light_type = "directional";
+    l.light_direction = [1 0 1];
+    l.ambient_color = [0.1 0.1 0.1];
+    s.diffuse_color = [0.5 0.4 0.4];
+    s.color_material = "off";
+    s.color_flag = 0;
+    s.thickness = 0;
+    s.hiddencolor = -1;
+    s.specular_color = [0.6 0.6 1];
+
+    // DEMO END
+endfunction
+
+
+demo_dir_light();
+clear demo_dir_light;
+
+
diff --git a/scilab/modules/graphics/demos/lighting/lighting.dem.gateway.sce b/scilab/modules/graphics/demos/lighting/lighting.dem.gateway.sce
new file mode 100644 (file)
index 0000000..56cf4c1
--- /dev/null
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Pedro SOUZA
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+demopath = get_absolute_file_path("lighting.dem.gateway.sce");
+
+subdemolist = [                                   ..
+"Simple light"      , "simple_light.dem.sce"    ; ..
+"Rotating light"    , "rot_light.dem.sce"       ; ..
+"Colored light"     , "color_light.dem.sce"     ; ..
+"Directional light" , "dir_light.dem.sce"       ];
+
+subdemolist(:,2) = demopath + subdemolist(:,2);
+clear demopath;
\ No newline at end of file
diff --git a/scilab/modules/graphics/demos/lighting/rot_light.dem.sce b/scilab/modules/graphics/demos/lighting/rot_light.dem.sce
new file mode 100644 (file)
index 0000000..f131022
--- /dev/null
@@ -0,0 +1,36 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Pedro SOUZA
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+
+function demo_rot_light()
+
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
+    demo_viewCode("rot_light.dem.sce");
+
+    // DEMO START
+
+    my_plot_desc          = "Rotating light";
+    my_handle.figure_name = my_plot_desc;
+
+    my_handle.figure_name = my_plot_desc;
+    plot3d;l=light_create();s=gce();
+
+    for i=0:10000
+        sleep(5);
+        x = 2*cos(i*%pi/180);
+        y = 2*sin(i*%pi/180);
+        z = 2;
+        l.light_position = [x y z];
+    end
+
+    // DEMO END
+
+endfunction
+
+
+demo_rot_light();
+clear demo_rot_light;
+
diff --git a/scilab/modules/graphics/demos/lighting/simple_light.dem.sce b/scilab/modules/graphics/demos/lighting/simple_light.dem.sce
new file mode 100644 (file)
index 0000000..6e2a5af
--- /dev/null
@@ -0,0 +1,36 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Pedro SOUZA
+//
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+
+function demo_simple_light()
+
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
+    demo_viewCode("simple_light.dem.sce");
+
+    // DEMO START
+
+    my_plot_desc          = "Simple light";
+    my_handle.figure_name = my_plot_desc;
+
+    my_handle.figure_name = my_plot_desc;
+    plot3d;l=light_create();s=gce();
+
+    l.ambient_color = [1 1 1];
+    s.diffuse_color = [0 0 0.8];
+    s.color_material = "off";
+    s.color_flag = 0;
+    s.thickness = 0;
+    s.hiddencolor = -1;
+    s.specular_color = [0.1 0.1 0.3];
+    s.ambient_color = [0 0 0.35];
+
+    // DEMO END
+       
+endfunction
+
+
+demo_simple_light();
+clear demo_simple_light;
\ No newline at end of file
index 6323753..7e5b3d0 100644 (file)
Binary files a/scilab/modules/helptools/images/light_1.png and b/scilab/modules/helptools/images/light_1.png differ
index 6323753..7e5b3d0 100644 (file)
Binary files a/scilab/modules/helptools/images/light_create_1.png and b/scilab/modules/helptools/images/light_create_1.png differ
index 6323753..7e5b3d0 100644 (file)
Binary files a/scilab/modules/helptools/images/lighting_1.png and b/scilab/modules/helptools/images/lighting_1.png differ
index 26b388a..6a7d3b8 100644 (file)
Binary files a/scilab/modules/helptools/images/lighting_2.png and b/scilab/modules/helptools/images/lighting_2.png differ