remove light_delete, rename light_create to light, update help pages, tests, ... 53/12653/5
Antoine ELIAS [Tue, 24 Sep 2013 15:48:44 +0000 (17:48 +0200)]
Change-Id: I8d658531b4cb9c5f7f407446595c5e1ea27f157f

23 files changed:
scilab/modules/graphics/Makefile.am
scilab/modules/graphics/Makefile.in
scilab/modules/graphics/demos/lighting/color_light.dem.sce
scilab/modules/graphics/demos/lighting/dir_light.dem.sce
scilab/modules/graphics/demos/lighting/rot_light.dem.sce
scilab/modules/graphics/demos/lighting/simple_light.dem.sce
scilab/modules/graphics/graphics.vcxproj
scilab/modules/graphics/graphics.vcxproj.filters
scilab/modules/graphics/help/en_US/lighting/light.xml
scilab/modules/graphics/help/en_US/lighting/light_create.xml [deleted file]
scilab/modules/graphics/help/en_US/lighting/light_delete.xml [deleted file]
scilab/modules/graphics/help/en_US/lighting/light_properties.xml [new file with mode: 0644]
scilab/modules/graphics/help/en_US/lighting/lighting.xml
scilab/modules/graphics/includes/Light.h
scilab/modules/graphics/includes/gw_graphics.h
scilab/modules/graphics/sci_gateway/c/gw_graphics.c
scilab/modules/graphics/sci_gateway/c/sci_light.c [moved from scilab/modules/graphics/sci_gateway/c/sci_light_create.c with 88% similarity]
scilab/modules/graphics/sci_gateway/c/sci_light_delete.c [deleted file]
scilab/modules/graphics/sci_gateway/graphics_gateway.xml
scilab/modules/graphics/src/c/Light.c
scilab/modules/graphics/tests/unit_tests/light.dia.ref
scilab/modules/graphics/tests/unit_tests/light.tst
scilab/modules/io/macros/%_sodload.sci

index da4b92d..ba75354 100644 (file)
@@ -411,8 +411,8 @@ sci_gateway/c/sci_rubberbox.c \
 sci_gateway/c/sci_rotate_axes.c \
 sci_gateway/c/sci_is_handle_valid.c \
 sci_gateway/c/sci_Legend.c \
-sci_gateway/c/sci_light_create.c \
-sci_gateway/c/sci_light_delete.c
+sci_gateway/c/sci_light.c
+
 
 libscigraphics_la_CPPFLAGS = \
        -I$(srcdir)/includes/ \
index 58ebccb..750fc88 100644 (file)
@@ -555,9 +555,7 @@ am__objects_2 = libscigraphics_la-sci_swap_handles.lo \
        libscigraphics_la-sci_rubberbox.lo \
        libscigraphics_la-sci_rotate_axes.lo \
        libscigraphics_la-sci_is_handle_valid.lo \
-       libscigraphics_la-sci_Legend.lo \
-       libscigraphics_la-sci_light_create.lo \
-       libscigraphics_la-sci_light_delete.lo
+       libscigraphics_la-sci_Legend.lo libscigraphics_la-sci_light.lo
 am_libscigraphics_la_OBJECTS = $(am__objects_2)
 libscigraphics_la_OBJECTS = $(am_libscigraphics_la_OBJECTS)
 @GUI_TRUE@am_libscigraphics_la_rpath = -rpath $(pkglibdir)
@@ -1295,8 +1293,7 @@ sci_gateway/c/sci_rubberbox.c \
 sci_gateway/c/sci_rotate_axes.c \
 sci_gateway/c/sci_is_handle_valid.c \
 sci_gateway/c/sci_Legend.c \
-sci_gateway/c/sci_light_create.c \
-sci_gateway/c/sci_light_delete.c
+sci_gateway/c/sci_light.c
 
 libscigraphics_la_CPPFLAGS = \
        -I$(srcdir)/includes/ \
@@ -1899,8 +1896,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_glue.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_grayplot.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_is_handle_valid.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_light_create.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_light_delete.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_light.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_matplot.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_matplot1.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_la-sci_move.Plo@am__quote@
@@ -4661,19 +4657,12 @@ libscigraphics_la-sci_Legend.lo: sci_gateway/c/sci_Legend.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_la-sci_Legend.lo `test -f 'sci_gateway/c/sci_Legend.c' || echo '$(srcdir)/'`sci_gateway/c/sci_Legend.c
 
-libscigraphics_la-sci_light_create.lo: sci_gateway/c/sci_light_create.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_la-sci_light_create.lo -MD -MP -MF $(DEPDIR)/libscigraphics_la-sci_light_create.Tpo -c -o libscigraphics_la-sci_light_create.lo `test -f 'sci_gateway/c/sci_light_create.c' || echo '$(srcdir)/'`sci_gateway/c/sci_light_create.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libscigraphics_la-sci_light_create.Tpo $(DEPDIR)/libscigraphics_la-sci_light_create.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='sci_gateway/c/sci_light_create.c' object='libscigraphics_la-sci_light_create.lo' libtool=yes @AMDEPBACKSLASH@
+libscigraphics_la-sci_light.lo: sci_gateway/c/sci_light.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_la-sci_light.lo -MD -MP -MF $(DEPDIR)/libscigraphics_la-sci_light.Tpo -c -o libscigraphics_la-sci_light.lo `test -f 'sci_gateway/c/sci_light.c' || echo '$(srcdir)/'`sci_gateway/c/sci_light.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libscigraphics_la-sci_light.Tpo $(DEPDIR)/libscigraphics_la-sci_light.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='sci_gateway/c/sci_light.c' object='libscigraphics_la-sci_light.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_la-sci_light_create.lo `test -f 'sci_gateway/c/sci_light_create.c' || echo '$(srcdir)/'`sci_gateway/c/sci_light_create.c
-
-libscigraphics_la-sci_light_delete.lo: sci_gateway/c/sci_light_delete.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_la-sci_light_delete.lo -MD -MP -MF $(DEPDIR)/libscigraphics_la-sci_light_delete.Tpo -c -o libscigraphics_la-sci_light_delete.lo `test -f 'sci_gateway/c/sci_light_delete.c' || echo '$(srcdir)/'`sci_gateway/c/sci_light_delete.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libscigraphics_la-sci_light_delete.Tpo $(DEPDIR)/libscigraphics_la-sci_light_delete.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='sci_gateway/c/sci_light_delete.c' object='libscigraphics_la-sci_light_delete.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_la-sci_light_delete.lo `test -f 'sci_gateway/c/sci_light_delete.c' || echo '$(srcdir)/'`sci_gateway/c/sci_light_delete.c
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_la-sci_light.lo `test -f 'sci_gateway/c/sci_light.c' || echo '$(srcdir)/'`sci_gateway/c/sci_light.c
 
 mostlyclean-libtool:
        -rm -f *.lo
index 5abf6e1..0ba4be3 100644 (file)
@@ -16,7 +16,7 @@ function demo_color_light()
     my_handle.figure_name = my_plot_desc;
 
     my_handle.figure_name = my_plot_desc;
-    plot3d;l=light_create();s=gce();
+    plot3d;l=light();s=gce();
 
     s.color_material = "off";
     s.color_flag = 0;
index f10506d..8675cf3 100644 (file)
@@ -15,7 +15,7 @@ function demo_dir_light()
     my_handle.figure_name = my_plot_desc;
 
     my_handle.figure_name = my_plot_desc;
-    plot3d;l=light_create();s=gce();
+    plot3d;l=light();s=gce();
 
     l.light_type = "directional";
     l.light_direction = [1 0 1];
index f131022..79c36ce 100644 (file)
@@ -16,7 +16,7 @@ function demo_rot_light()
     my_handle.figure_name = my_plot_desc;
 
     my_handle.figure_name = my_plot_desc;
-    plot3d;l=light_create();s=gce();
+    plot3d;l=light();s=gce();
 
     for i=0:10000
         sleep(5);
index 6e2a5af..ec6fd67 100644 (file)
@@ -16,7 +16,7 @@ function demo_simple_light()
     my_handle.figure_name = my_plot_desc;
 
     my_handle.figure_name = my_plot_desc;
-    plot3d;l=light_create();s=gce();
+    plot3d;l=light();s=gce();
 
     l.ambient_color = [1 1 1];
     s.diffuse_color = [0 0 0.8];
@@ -28,7 +28,7 @@ function demo_simple_light()
     s.ambient_color = [0 0 0.35];
 
     // DEMO END
-       
+
 endfunction
 
 
index bd60fe3..47e2323 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -198,8 +198,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="sci_gateway\c\sci_light_create.c" />
-    <ClCompile Include="sci_gateway\c\sci_light_delete.c" />
+    <ClCompile Include="sci_gateway\c\sci_light.c" />
     <ClCompile Include="src\c\Axes.c" />
     <ClCompile Include="src\c\axesScale.c" />
     <ClCompile Include="src\c\BasicAlgos.c" />
index 5c4c955..5305e02 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
     <Filter Include="Source Files">
     <ClCompile Include="src\c\Light.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="sci_gateway\c\sci_light_create.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="sci_gateway\c\sci_light_delete.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="src\c\getHandleProperty\set_image_type_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="src\c\getHandleProperty\get_image_type_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="sci_gateway\c\sci_light.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="includes\Axes.h">
index f3e9d02..a8c8eeb 100644 (file)
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" scilab:needs-examples="no" xml:id="light">
     <refnamediv>
         <refname>light</refname>
-        <refpurpose>Light overview</refpurpose>
+        <refpurpose>creates a light object in the given axes</refpurpose>
     </refnamediv>
+    <refsynopsisdiv>
+        <title>Calling Sequence</title>
+        <synopsis>light()
+            light(&lt;LightProperty&gt;)
+            light(axes_handle, &lt;LightProperty&gt;)
+        </synopsis>
+    </refsynopsisdiv>
     <refsection>
-        <title>Description</title>
-        <para>
-            The light object contains the properties to change lighting appearance.
-            Lights aren't visible in the axes but they affect the surface appearance.
-        </para>
-        <para>
-            Lights can be created using <link linkend="light_create">light_create</link> function,
-            and deleted using <link linkend="light_delete">light_delete</link> function.
-        </para>
-        <scilab:image>
-            plot3d();
-            l = light_create();
-            s = gce();
-            s.diffuse_color = [0 0 0.8];
-            s.ambient_color = [0 0 1];
-        </scilab:image>
-    </refsection>
-    <refsection>
-        <title>Light properties list</title>
+        <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>visible: </term>
-                <listitem>
-                    <para>
-                        This field defines if the light is enabled <literal>"on"</literal>
-                        or disabled <literal>"off"</literal>.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>light_type: </term>
-                <listitem>
-                    <para>This field defines the type of light used. There are two
-                        types available:<literal>"directional"</literal> and <literal>"point"</literal>.
-                        Directional lights are positioned infinitely far from the surface
-                        thus emitting parallel rays.
-                        Point lights are defined as a point in space thus emitting rays in all
-                        directions.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>light_direction: </term>
-                <listitem>
-                    <para>This field defines the ray direction for directional light.
-                        The direction can be chaged using a 3 element vector <literal>"[x, y, z]"</literal>
-                        representing a vector starting from the origin.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>light_position: </term>
-                <listitem>
-                    <para>This field defines the light position for point light.
-                        The position can be changed using a 3 element vector <literal>"[x, y, z]"</literal>.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>ambient_color: </term>
+                <term>axes_handle</term>
                 <listitem>
-                    <para>This field defines the ambient color of the light.
-                        The color is defined by a 3 element vector <literal>"[red, green, blue]"</literal>
-                        with each element in the range [0, 1].
-                    </para>
+                    <para>The handle of the axes, if ommited is used the current axes.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>diffuse_color: </term>
+                <term>&lt;LightProperty&gt;</term>
                 <listitem>
-                    <para>This field defines the diffuse color of the light.
-                        The color is defined by a 3 element vector <literal>"[red, green, blue]"</literal>
-                        with each element in the range [0, 1].
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>specular_color: </term>
-                <listitem>
-                    <para>This field defines the specular color of the light.
-                        The color is defined by a 3 element vector <literal>"[red, green, blue]"</literal>
-                        with each element in the range [0, 1].
+                    <para>
+                        Optional argument specifying the light properties (see <link linkend="light">light</link>).
                     </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
     <refsection>
+        <title>Description</title>
+        <para>
+            The <literal>light</literal> function, creates a light object in the specified axes
+            and sets the properties specified with &lt;LightProperty&gt; optional arguments.
+        </para>
+    </refsection>
+    <refsection>
         <title>Examples</title>
-
+        <scilab:image>
+            plot3d();
+            l = light(visible="on", type="point", position=[0 0 1]);
+        </scilab:image>
         <programlisting role="example"><![CDATA[
-        // point light
-        plot3d;l=light_create();s=gce();
-        for i=0:1000
-            sleep(5);
-            x = 2*cos(i*%pi/180);
-            y = 2*sin(i*%pi/180);
-            z = 2;
-            l.light_position = [x y z];
-        end
-
-        // change light to directional mode
-        l.light_type = "directional";
-        l.light_direction = [1 0 1];
-        l.ambient_color = [0.1 0.1 0.1];
-        s.diffuse_color = [0.4 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 0.6];
-        sleep(5000);
-
-        l2 = light_create(ambient_color=[0 0 0], diffuse_color = [0.8 0.8 1], type="point", position=[0 3 4]);
-        sleep(5000);
-        light_delete(l);
-        l2.specular_color = [1 0.6 0];
-        ]]></programlisting>
+plot3d();
+l = light(visible="on", type="point", position=[0 0 1]);
+         ]]></programlisting>
     </refsection>
     <refsection role="see also">
         <title>See Also</title>
                 <link linkend="lighting">lighting</link>
             </member>
             <member>
-                <link linkend="light_create">light_create</link>
+                <link linkend="light_properties">light properties</link>
             </member>
             <member>
-                <link linkend="light_delete">light_delete</link>
+                <link linkend="delete">delete</link>
             </member>
         </simplelist>
     </refsection>
diff --git a/scilab/modules/graphics/help/en_US/lighting/light_create.xml b/scilab/modules/graphics/help/en_US/lighting/light_create.xml
deleted file mode 100644 (file)
index edd3da8..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) Pedro SOUZA
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" scilab:needs-examples="no" xml:id="light_create">
-    <refnamediv>
-        <refname>light_create</refname>
-        <refpurpose>creates a light object in the given axes</refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>Calling Sequence</title>
-        <synopsis>light_create()
-        light_create(&lt;LightProperty&gt;)
-        light_create(axes_handle, &lt;LightProperty&gt;)
-        </synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>Arguments</title>
-        <variablelist>
-            <varlistentry>
-                <term>axes_handle</term>
-                <listitem>
-                    <para>The handle of the axes, if ommited is used the current axes.</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>&lt;LightProperty&gt;</term>
-                <listitem>
-                    <para>
-                        Optional argument specifying the light properties (see <link linkend="light">light</link>).
-                    </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>Description</title>
-        <para>
-            The <literal>light_create</literal> function, creates a light object in the specified axes
-            and sets the properties specified with &lt;LightProperty&gt; optional arguments.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Examples</title>
-        <scilab:image>
-plot3d();
-l = light_create(visible="on", type="point", position=[0 0 1]);
-        </scilab:image>
-        <programlisting role="example"><![CDATA[
-plot3d();
-l = light_create(visible="on", type="point", position=[0 0 1]);
-         ]]></programlisting>
-    </refsection>
-    <refsection role="see also">
-        <title>See Also</title>
-        <simplelist type="inline">
-            <member>
-                <link linkend="lighting">lighting</link>
-            </member>
-            <member>
-                <link linkend="light">light</link>
-            </member>
-            <member>
-                <link linkend="light_delete">light_delete</link>
-            </member>
-        </simplelist>
-    </refsection>
-</refentry>
diff --git a/scilab/modules/graphics/help/en_US/lighting/light_delete.xml b/scilab/modules/graphics/help/en_US/lighting/light_delete.xml
deleted file mode 100644 (file)
index c66d31b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) Pedro SOUZA
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" scilab:needs-examples="no" xml:id="light_delete">
-    <refnamediv>
-        <refname>light_delete</refname>
-        <refpurpose>deletes the given light</refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>Calling Sequence</title>
-        <synopsis>light_delete(light_handle) 
-        </synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>Arguments</title>
-        <variablelist>
-            <varlistentry>
-                <term>light_handle</term>
-                <listitem>
-                    <para>The handle of the light</para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>Description</title>
-        <para>
-            The <literal>light_delete</literal> function, removes the light from its parent axes
-            and deletes the light object.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Examples</title>
-        <programlisting role="example"><![CDATA[
-plot3d();
-l = light_create();
-light_delete(l);
-         ]]></programlisting>
-    </refsection>
-        <refsection role="see also">
-        <title>See Also</title>
-        <simplelist type="inline">
-            <member>
-                <link linkend="light_create">light_create</link>
-            </member>
-            <member>
-                <link linkend="light">light</link>
-            </member>
-        </simplelist>
-    </refsection>
-</refentry>
diff --git a/scilab/modules/graphics/help/en_US/lighting/light_properties.xml b/scilab/modules/graphics/help/en_US/lighting/light_properties.xml
new file mode 100644 (file)
index 0000000..3790027
--- /dev/null
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Pedro SOUZA
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" scilab:needs-examples="no" xml:id="light_properties">
+    <refnamediv>
+        <refname>light_properties</refname>
+        <refpurpose>Light overview</refpurpose>
+    </refnamediv>
+    <refsection>
+        <title>Description</title>
+        <para>
+            The light object contains the properties to change lighting appearance.
+            Lights aren't visible in the axes but they affect the surface appearance.
+        </para>
+        <para>
+            Lights can be created using <link linkend="light">light</link> function,
+            and deleted using <link linkend="delete">delete</link> function.
+        </para>
+        <scilab:image>
+            plot3d();
+            l = light();
+            s = gce();
+            s.diffuse_color = [0 0 0.8];
+            s.ambient_color = [0 0 1];
+        </scilab:image>
+    </refsection>
+    <refsection>
+        <title>Light properties list</title>
+        <variablelist>
+            <varlistentry>
+                <term>visible: </term>
+                <listitem>
+                    <para>
+                        This field defines if the light is enabled <literal>"on"</literal>
+                        or disabled <literal>"off"</literal>.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>light_type: </term>
+                <listitem>
+                    <para>This field defines the type of light used. There are two
+                        types available:<literal>"directional"</literal> and <literal>"point"</literal>.
+                        Directional lights are positioned infinitely far from the surface
+                        thus emitting parallel rays.
+                        Point lights are defined as a point in space thus emitting rays in all
+                        directions.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>light_direction: </term>
+                <listitem>
+                    <para>This field defines the ray direction for directional light.
+                        The direction can be chaged using a 3 element vector <literal>"[x, y, z]"</literal>
+                        representing a vector starting from the origin.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>light_position: </term>
+                <listitem>
+                    <para>This field defines the light position for point light.
+                        The position can be changed using a 3 element vector <literal>"[x, y, z]"</literal>.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>ambient_color: </term>
+                <listitem>
+                    <para>This field defines the ambient color of the light.
+                        The color is defined by a 3 element vector <literal>"[red, green, blue]"</literal>
+                        with each element in the range [0, 1].
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>diffuse_color: </term>
+                <listitem>
+                    <para>This field defines the diffuse color of the light.
+                        The color is defined by a 3 element vector <literal>"[red, green, blue]"</literal>
+                        with each element in the range [0, 1].
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>specular_color: </term>
+                <listitem>
+                    <para>This field defines the specular color of the light.
+                        The color is defined by a 3 element vector <literal>"[red, green, blue]"</literal>
+                        with each element in the range [0, 1].
+                    </para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        
+        <programlisting role="example"><![CDATA[
+        // point light
+        plot3d;l=light();s=gce();
+        for i=0:1000
+            sleep(5);
+            x = 2*cos(i*%pi/180);
+            y = 2*sin(i*%pi/180);
+            z = 2;
+            l.light_position = [x y z];
+        end
+
+        // change light to directional mode
+        l.light_type = "directional";
+        l.light_direction = [1 0 1];
+        l.ambient_color = [0.1 0.1 0.1];
+        s.diffuse_color = [0.4 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 0.6];
+        sleep(5000);
+
+        l2 = light(ambient_color=[0 0 0], diffuse_color = [0.8 0.8 1], type="point", position=[0 3 4]);
+        sleep(5000);
+        delete(l);
+        l2.specular_color = [1 0.6 0];
+        ]]></programlisting>
+    </refsection>
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="lighting">lighting</link>
+            </member>
+            <member>
+                <link linkend="light">light</link>
+            </member>
+            <member>
+                <link linkend="delete">delete</link>
+            </member>
+        </simplelist>
+    </refsection>
+</refentry>
index dca889a..533927b 100644 (file)
@@ -25,8 +25,8 @@
         </para>
         <para>
             A light is represented mainly by its colors: ambient, diffuse and specular. It can
-            be created using <link linkend="light_create">light_create</link> function,
-            and deleted using <link linkend="light_delete">light_delete</link> function.
+            be created using <link linkend="light">light</link> function,
+            and deleted using <link linkend="delete">delete</link> function.
         </para>
         <para>
             The surface material properties is represented also by its colors
                 Specular color defines the specular highlight color.
             </para>
         </listitem>
-
+        
         <para>
             Following one can compare the surface with and without lighting:
         </para>
         <para>
             <scilab:image>
                 plot3d();
-                light = light_create();
+                light = light();
             </scilab:image>
         </para>
         <para>
@@ -69,7 +69,7 @@
                 plot3d();
             </scilab:image>
         </para>
-
+        
     </refsection>
     <refsection>
         <title>Lighting properties list</title>
@@ -199,7 +199,7 @@ s=gce();
 s.color_flag=0;
 s.thickness=0;
 s.hiddencolor = -1;
-light = light_create();
+light = light();
 //change diffuse color to orange
 s.diffuse_color = [1, 0.6, 0];
 s.color_material="off";
@@ -212,7 +212,7 @@ s.ambient_color = [1, 0.6, 0];
         <programlisting role="example"><![CDATA[
 plot3d();
 s=gce();
-light = light_create();
+light = light();
 s.color_flag=0;
 s.thickness=0;
 light.light_type = "directional";
@@ -229,10 +229,10 @@ light.specular_color = [0.5 0.3 0.7];
                 <link linkend="light">light</link>
             </member>
             <member>
-                <link linkend="light_create">light_create</link>
+                <link linkend="light_properties">light properties</link>
             </member>
             <member>
-                <link linkend="light_delete">light_delete</link>
+                <link linkend="delete">delete</link>
             </member>
         </simplelist>
     </refsection>
index 19de369..3e87ec9 100644 (file)
@@ -11,5 +11,3 @@
  */\r
 \r
 BOOL createLight(char* fname, long long axes_handle, int type, BOOL visible, double * position, double * direction, double * ambient_color, double * diffuse_color, double * specular_color, long long * pLightHandle);\r
-\r
-BOOL deleteLight(long long light_handle);
\ No newline at end of file
index 21fc0b3..678d76b 100644 (file)
@@ -95,8 +95,7 @@ GRAPHICS_IMPEXP int sci_demo(char *fname, int fname_len);
 GRAPHICS_IMPEXP int sci_delete(char *fname, unsigned long fname_len);
 GRAPHICS_IMPEXP int sci_copy(char *fname, unsigned long fname_len);
 GRAPHICS_IMPEXP int sci_contour2di(char *fname, unsigned long fname_len);
-GRAPHICS_IMPEXP int sci_light_create(char *fname, unsigned long fname_len);
-GRAPHICS_IMPEXP int sci_light_delete(char *fname, unsigned long fname_len);
+GRAPHICS_IMPEXP int sci_light(char *fname, unsigned long fname_len);
 
 /*--------------------------------------------------------------------------*/
 #endif /* __INTGRAPHICS__ */
index d399c13..0b4f42b 100644 (file)
@@ -98,8 +98,7 @@ static gw_generic_table Tab[] =
     {sci_rotate_axes, "rotate_axes"},
     {sci_is_handle_valid, "is_handle_valid"},
     {sci_Legend, "captions"},
-    {sci_light_create, "light_create"},
-    {sci_light_delete, "light_delete"}
+    {sci_light, "light"}
 };
 
 /*--------------------------------------------------------------------------*/
@@ -20,7 +20,7 @@
 
 
 
-int sci_light_create(char *fname, unsigned long fname_len)
+int sci_light(char *fname, unsigned long fname_len)
 {
     int type = -1;
     BOOL visible = 1;
@@ -67,16 +67,21 @@ int sci_light_create(char *fname, unsigned long fname_len)
             return 0;
         }
 
-        if (isHandleType(pvApiCtx, piAddr) == FALSE || isScalar(pvApiCtx, piAddr) == FALSE)
+        if (isHandleType(pvApiCtx, piAddr))
         {
-            Scierror(999, _("%s: Wrong type for input argument #%d: A graphic handle expected.\n"), fname, 1);
-            return 0;
-        }
-
-        if (getScalarHandle(pvApiCtx, piAddr, &axesHandle))
-        {
-            Scierror(999, _("%s: Wrong type for input argument #%d: A graphic handle expected.\n"), fname, 1);
-            return 0;
+            if (isScalar(pvApiCtx, piAddr))
+            {
+                if (getScalarHandle(pvApiCtx, piAddr, &axesHandle))
+                {
+                    Scierror(999, _("%s: Wrong type for input argument #%d: A graphic handle expected.\n"), fname, 1);
+                    return 0;
+                }
+            }
+            else
+            {
+                Scierror(999, _("%s: Wrong type for input argument #%d: A graphic handle expected.\n"), fname, 1);
+                return 0;
+            }
         }
 
         if (getOptionals(pvApiCtx, fname, opts) == 0)
diff --git a/scilab/modules/graphics/sci_gateway/c/sci_light_delete.c b/scilab/modules/graphics/sci_gateway/c/sci_light_delete.c
deleted file mode 100644 (file)
index 0b8a82c..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2013 - Pedro SOUZA
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-#include "gw_graphics.h"
-#include "api_scilab.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "HandleManagement.h"
-#include "Light.h"
-
-
-int sci_light_delete(char *fname, unsigned long fname_len)
-{
-    SciErr sciErr;
-    int* piAddr        = NULL;
-    int nbRow, nbCol;
-    long long lightHandle = 0;
-    BOOL result;
-
-    CheckInputArgument(pvApiCtx, 1, 1);
-
-    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
-    if (sciErr.iErr)
-    {
-        Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
-        return 0;
-    }
-
-    if (getScalarHandle(pvApiCtx, piAddr, &lightHandle))
-    {
-        Scierror(999, _("%s: Wrong type for argument %d: A graphic handle expected.\n"), fname, 1);
-        return 0;
-    }
-
-    deleteLight(lightHandle);
-
-    AssignOutputVariable(pvApiCtx, 1) = 0;
-    ReturnArguments(pvApiCtx);
-}
index 9092e8e..bd45296 100644 (file)
@@ -87,6 +87,5 @@
     <PRIMITIVE gatewayId="7" primitiveId="69" primitiveName="rotate_axes"/>
     <PRIMITIVE gatewayId="7" primitiveId="70" primitiveName="is_handle_valid"/>
     <PRIMITIVE gatewayId="7" primitiveId="71" primitiveName="captions"/>
-       <PRIMITIVE gatewayId="7" primitiveId="72" primitiveName="light_create"/>
-    <PRIMITIVE gatewayId="7" primitiveId="73" primitiveName="light_delete"/>
+       <PRIMITIVE gatewayId="7" primitiveId="72" primitiveName="light"/>
 </GATEWAY>
index 32e59be..b235e76 100644 (file)
@@ -120,28 +120,3 @@ BOOL createLight(char* fname, long long axes_handle, int type, BOOL visible, dou
 \r
     return TRUE;\r
 }\r
-\r
-\r
-BOOL deleteLight(long long light_handle)\r
-{\r
-    int iType;\r
-    int *piType = &iType;\r
-    const char * uid = NULL;\r
-\r
-    uid = getObjectFromHandle(light_handle);\r
-    if (uid == NULL)\r
-    {\r
-        return FALSE;\r
-    }\r
-\r
-    getGraphicObjectProperty(uid, __GO_TYPE__, jni_int, (void **)&piType);\r
-\r
-    if (iType != __GO_LIGHT__)\r
-    {\r
-        return FALSE;\r
-    }\r
-\r
-    deleteGraphicObject((char*)uid);\r
-\r
-    return TRUE;\r
-}\r
index ef74722..224f52d 100644 (file)
 // Check each default property\r
 figure();\r
 a=gca();\r
-light = light_create();\r
-assert_checkequal(light.type, "Light");\r
-assert_checkequal(light.parent.type, "Axes");\r
-assert_checkequal(light.children, []);\r
-assert_checkequal(light.visible, "on");\r
-assert_checkequal(light.light_type, "point");\r
+l = light();\r
+assert_checkequal(l.type, "Light");\r
+assert_checkequal(l.parent.type, "Axes");\r
+assert_checkequal(l.children, []);\r
+assert_checkequal(l.visible, "on");\r
+assert_checkequal(l.light_type, "point");\r
 clf();\r
 subplot(2, 1, 1);\r
 a1=gca();\r
 subplot(2, 1, 2);\r
 a2=gca();\r
-light = light_create(a1);\r
-assert_checkequal(light.type, "Light");\r
-assert_checkequal(light.parent.type, "Axes");\r
-assert_checkequal(light.parent.UID, a1.UID);\r
-assert_checkequal(light.children, []);\r
-assert_checkequal(light.visible, "on");\r
-assert_checkequal(light.light_type, "point");\r
+l = light(a1);\r
+assert_checkequal(l.type, "Light");\r
+assert_checkequal(l.parent.type, "Axes");\r
+assert_checkequal(l.parent.UID, a1.UID);\r
+assert_checkequal(l.children, []);\r
+assert_checkequal(l.visible, "on");\r
+assert_checkequal(l.light_type, "point");\r
 clf();\r
 a=gca();\r
-light = light_create(a, visible="off", type="directional", position=[5 4 3], direction=[2 1 0], ambient_color=[0.3 0.3 0.3], diffuse_color=[0.2 0.2 0.2], specular_color=[0.1 0.1 0.1]);\r
-assert_checkequal(light.type, "Light");\r
-assert_checkequal(light.parent.type, "Axes");\r
-assert_checkequal(light.children, []);\r
-assert_checkequal(light.visible, "off");\r
-assert_checkequal(light.light_type, "directional");\r
-assert_checktrue(light.light_position - [5 4 3] < 1d-7);\r
-assert_checktrue(light.light_direction - [2 1 0] < 1d-7);\r
-assert_checktrue(light.ambient_color - [0.3 0.3 0.3] < 1d-7);\r
-assert_checktrue(light.diffuse_color - [0.2 0.2 0.2] < 1d-7);\r
-assert_checktrue(light.specular_color - [0.1 0.1 0.1] < 1d-7);\r
+l = light(a, visible="off", type="directional", position=[5 4 3], direction=[2 1 0], ambient_color=[0.3 0.3 0.3], diffuse_color=[0.2 0.2 0.2], specular_color=[0.1 0.1 0.1]);\r
+assert_checkequal(l.type, "Light");\r
+assert_checkequal(l.parent.type, "Axes");\r
+assert_checkequal(l.children, []);\r
+assert_checkequal(l.visible, "off");\r
+assert_checkequal(l.light_type, "directional");\r
+assert_checktrue(l.light_position - [5 4 3] < 1d-7);\r
+assert_checktrue(l.light_direction - [2 1 0] < 1d-7);\r
+assert_checktrue(l.ambient_color - [0.3 0.3 0.3] < 1d-7);\r
+assert_checktrue(l.diffuse_color - [0.2 0.2 0.2] < 1d-7);\r
+assert_checktrue(l.specular_color - [0.1 0.1 0.1] < 1d-7);\r
 // check valid parameter type\r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = ''asd''", "errcatch");\r
+ierr = execstr("l.ambient_color = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = ''asd''", "errcatch");\r
+ierr = execstr("l.diffuse_color = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = ''asd''", "errcatch");\r
+ierr = execstr("l.specular_color = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "light_position");\r
-ierr = execstr("light.light_position = ''asd''", "errcatch");\r
+ierr = execstr("l.light_position = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "light_direction");\r
-ierr = execstr("light.light_direction = ''asd''", "errcatch");\r
+ierr = execstr("l.light_direction = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong type for ''%s'' property: String expected.\n"),  "light_type");\r
-ierr = execstr("light.light_type = 0", "errcatch");\r
+ierr = execstr("l.light_type = 0", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 // check parameter  vector size\r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "ambient_color", 3);\r
-ierr = execstr("light.ambient_color = [1 1]", "errcatch");\r
+ierr = execstr("l.ambient_color = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "diffuse_color", 3);\r
-ierr = execstr("light.diffuse_color = [1 1]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "specular_color", 3);\r
-ierr = execstr("light.specular_color = [1 1]", "errcatch");\r
+ierr = execstr("l.specular_color = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "light_position", 3);\r
-ierr = execstr("light.light_position = [1 1]", "errcatch");\r
+ierr = execstr("l.light_position = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "light_direction", 3);\r
-ierr = execstr("light.light_direction = [1 1]", "errcatch");\r
+ierr = execstr("l.light_direction = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 // check parameter bounds\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [-1 0 0]", "errcatch");\r
+ierr = execstr("l.ambient_color = [-1 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [0 -1 0]", "errcatch");\r
+ierr = execstr("l.ambient_color = [0 -1 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [0 0 -1]", "errcatch");\r
+ierr = execstr("l.ambient_color = [0 0 -1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [1.5 0 0]", "errcatch");\r
+ierr = execstr("l.ambient_color = [1.5 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [0 1.5 0]", "errcatch");\r
+ierr = execstr("l.ambient_color = [0 1.5 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [0 0 1.5]", "errcatch");\r
+ierr = execstr("l.ambient_color = [0 0 1.5]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 ////////\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [-1 0 0]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [-1 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [0 -1 0]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [0 -1 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [0 0 -1]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [0 0 -1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [1.5 0 0]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [1.5 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [0 1.5 0]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [0 1.5 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [0 0 1.5]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [0 0 1.5]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 /////////////\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [-1 0 0]", "errcatch");\r
+ierr = execstr("l.specular_color = [-1 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [0 -1 0]", "errcatch");\r
+ierr = execstr("l.specular_color = [0 -1 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [0 0 -1]", "errcatch");\r
+ierr = execstr("l.specular_color = [0 0 -1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [1.5 0 0]", "errcatch");\r
+ierr = execstr("l.specular_color = [1.5 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [0 1.5 0]", "errcatch");\r
+ierr = execstr("l.specular_color = [0 1.5 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [0 0 1.5]", "errcatch");\r
+ierr = execstr("l.specular_color = [0 0 1.5]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 // check light_type input\r
 errmsg=msprintf(_("Wrong value for ''%s'' property: ''directional'' or ''point'' expected.\n"), "light_type");\r
-ierr = execstr("light.light_type = ''pointt''", "errcatch");\r
+ierr = execstr("l.light_type = ''pointt''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 errmsg=msprintf(_("Wrong value for ''%s'' property: ''directional'' or ''point'' expected.\n"), "light_type");\r
-ierr = execstr("light.light_type = ''ddirectional''", "errcatch");\r
+ierr = execstr("l.light_type = ''ddirectional''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
-light_delete(light);\r
+delete(l);\r
 assert_checkequal(a.children, []);\r
 close();\r
index f77e1de..2d69d33 100644 (file)
 // Check each default property\r
 figure();\r
 a=gca();\r
-light = light_create();\r
+l = light();\r
 \r
-assert_checkequal(light.type, "Light");\r
-assert_checkequal(light.parent.type, "Axes");\r
-assert_checkequal(light.children, []);\r
-assert_checkequal(light.visible, "on");\r
-assert_checkequal(light.light_type, "point");\r
+assert_checkequal(l.type, "Light");\r
+assert_checkequal(l.parent.type, "Axes");\r
+assert_checkequal(l.children, []);\r
+assert_checkequal(l.visible, "on");\r
+assert_checkequal(l.light_type, "point");\r
 \r
 \r
 \r
@@ -27,158 +27,158 @@ subplot(2, 1, 1);
 a1=gca();\r
 subplot(2, 1, 2);\r
 a2=gca();\r
-light = light_create(a1);\r
+l = light(a1);\r
 \r
-assert_checkequal(light.type, "Light");\r
-assert_checkequal(light.parent.type, "Axes");\r
-assert_checkequal(light.parent.UID, a1.UID);\r
-assert_checkequal(light.children, []);\r
-assert_checkequal(light.visible, "on");\r
-assert_checkequal(light.light_type, "point");\r
+assert_checkequal(l.type, "Light");\r
+assert_checkequal(l.parent.type, "Axes");\r
+assert_checkequal(l.parent.UID, a1.UID);\r
+assert_checkequal(l.children, []);\r
+assert_checkequal(l.visible, "on");\r
+assert_checkequal(l.light_type, "point");\r
 \r
 clf();\r
 a=gca();\r
-light = light_create(a, visible="off", type="directional", position=[5 4 3], direction=[2 1 0], ambient_color=[0.3 0.3 0.3], diffuse_color=[0.2 0.2 0.2], specular_color=[0.1 0.1 0.1]);\r
+l = light(a, visible="off", type="directional", position=[5 4 3], direction=[2 1 0], ambient_color=[0.3 0.3 0.3], diffuse_color=[0.2 0.2 0.2], specular_color=[0.1 0.1 0.1]);\r
 \r
-assert_checkequal(light.type, "Light");\r
-assert_checkequal(light.parent.type, "Axes");\r
-assert_checkequal(light.children, []);\r
-assert_checkequal(light.visible, "off");\r
-assert_checkequal(light.light_type, "directional");\r
-assert_checktrue(light.light_position - [5 4 3] < 1d-7);\r
-assert_checktrue(light.light_direction - [2 1 0] < 1d-7);\r
-assert_checktrue(light.ambient_color - [0.3 0.3 0.3] < 1d-7);\r
-assert_checktrue(light.diffuse_color - [0.2 0.2 0.2] < 1d-7);\r
-assert_checktrue(light.specular_color - [0.1 0.1 0.1] < 1d-7);\r
+assert_checkequal(l.type, "Light");\r
+assert_checkequal(l.parent.type, "Axes");\r
+assert_checkequal(l.children, []);\r
+assert_checkequal(l.visible, "off");\r
+assert_checkequal(l.light_type, "directional");\r
+assert_checktrue(l.light_position - [5 4 3] < 1d-7);\r
+assert_checktrue(l.light_direction - [2 1 0] < 1d-7);\r
+assert_checktrue(l.ambient_color - [0.3 0.3 0.3] < 1d-7);\r
+assert_checktrue(l.diffuse_color - [0.2 0.2 0.2] < 1d-7);\r
+assert_checktrue(l.specular_color - [0.1 0.1 0.1] < 1d-7);\r
 \r
 \r
 \r
 \r
 // check valid parameter type\r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = ''asd''", "errcatch");\r
+ierr = execstr("l.ambient_color = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 \r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = ''asd''", "errcatch");\r
+ierr = execstr("l.diffuse_color = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 \r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = ''asd''", "errcatch");\r
+ierr = execstr("l.specular_color = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 \r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "light_position");\r
-ierr = execstr("light.light_position = ''asd''", "errcatch");\r
+ierr = execstr("l.light_position = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 \r
 errmsg=msprintf(_("Wrong type for ''%s'' property: Real matrix expected.\n"), "light_direction");\r
-ierr = execstr("light.light_direction = ''asd''", "errcatch");\r
+ierr = execstr("l.light_direction = ''asd''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong type for ''%s'' property: String expected.\n"),  "light_type");\r
-ierr = execstr("light.light_type = 0", "errcatch");\r
+ierr = execstr("l.light_type = 0", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 \r
 // check parameter  vector size\r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "ambient_color", 3);\r
-ierr = execstr("light.ambient_color = [1 1]", "errcatch");\r
+ierr = execstr("l.ambient_color = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "diffuse_color", 3);\r
-ierr = execstr("light.diffuse_color = [1 1]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "specular_color", 3);\r
-ierr = execstr("light.specular_color = [1 1]", "errcatch");\r
+ierr = execstr("l.specular_color = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "light_position", 3);\r
-ierr = execstr("light.light_position = [1 1]", "errcatch");\r
+ierr = execstr("l.light_position = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong size for ''%s'' property: %d elements expected.\n"), "light_direction", 3);\r
-ierr = execstr("light.light_direction = [1 1]", "errcatch");\r
+ierr = execstr("l.light_direction = [1 1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 // check parameter bounds\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [-1 0 0]", "errcatch");\r
+ierr = execstr("l.ambient_color = [-1 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [0 -1 0]", "errcatch");\r
+ierr = execstr("l.ambient_color = [0 -1 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [0 0 -1]", "errcatch");\r
+ierr = execstr("l.ambient_color = [0 0 -1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [1.5 0 0]", "errcatch");\r
+ierr = execstr("l.ambient_color = [1.5 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [0 1.5 0]", "errcatch");\r
+ierr = execstr("l.ambient_color = [0 1.5 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "ambient_color");\r
-ierr = execstr("light.ambient_color = [0 0 1.5]", "errcatch");\r
+ierr = execstr("l.ambient_color = [0 0 1.5]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 ////////\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [-1 0 0]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [-1 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [0 -1 0]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [0 -1 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [0 0 -1]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [0 0 -1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [1.5 0 0]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [1.5 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [0 1.5 0]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [0 1.5 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "diffuse_color");\r
-ierr = execstr("light.diffuse_color = [0 0 1.5]", "errcatch");\r
+ierr = execstr("l.diffuse_color = [0 0 1.5]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 /////////////\r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [-1 0 0]", "errcatch");\r
+ierr = execstr("l.specular_color = [-1 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [0 -1 0]", "errcatch");\r
+ierr = execstr("l.specular_color = [0 -1 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [0 0 -1]", "errcatch");\r
+ierr = execstr("l.specular_color = [0 0 -1]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [1.5 0 0]", "errcatch");\r
+ierr = execstr("l.specular_color = [1.5 0 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [0 1.5 0]", "errcatch");\r
+ierr = execstr("l.specular_color = [0 1.5 0]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 errmsg=msprintf(_("Wrong values for ''%s'' property: values between [0, 1] expected.\n"), "specular_color");\r
-ierr = execstr("light.specular_color = [0 0 1.5]", "errcatch");\r
+ierr = execstr("l.specular_color = [0 0 1.5]", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 \r
@@ -186,16 +186,16 @@ assert_checkequal(lasterror(), errmsg);
 \r
 // check light_type input\r
 errmsg=msprintf(_("Wrong value for ''%s'' property: ''directional'' or ''point'' expected.\n"), "light_type");\r
-ierr = execstr("light.light_type = ''pointt''", "errcatch");\r
+ierr = execstr("l.light_type = ''pointt''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 \r
 errmsg=msprintf(_("Wrong value for ''%s'' property: ''directional'' or ''point'' expected.\n"), "light_type");\r
-ierr = execstr("light.light_type = ''ddirectional''", "errcatch");\r
+ierr = execstr("l.light_type = ''ddirectional''", "errcatch");\r
 assert_checkequal(lasterror(), errmsg);\r
 \r
 \r
 \r
-light_delete(light);\r
+delete(l);\r
 assert_checkequal(a.children, []);\r
 close();\r
index 920b5e0..273c1df 100644 (file)
@@ -777,7 +777,7 @@ function %_sodload(%__filename__, varargin)
         fields = fieldnames(lightProperties);
         fields(1) = [];
 
-        h = light_create();
+        h = light();
         fields(fields=="children") = [];
 
         for i = 1:size(fields, "*")