<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) Pedro SOUZA
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<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>creates a light object in the given axes</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>l=light()
            l=light(&lt;LightProperty&gt;)
            l=light(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 omitted is used the current axes.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>&lt;LightProperty&gt;</term>
                <listitem>
                    <para>
                        Optional argument specifying the light properties. The optional arguments are set using
                        syntax: <literal>"light(propname1=propvalue1, propname2=propvalue2, ..., propnameN=propvalueN)"</literal>.
                    </para>
                    <para>Following there is the list of optional arguments:</para>
                    <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>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.
                                </para>
                                <para>
                                    Point lights are defined as a point in space thus emitting rays in all
                                    directions.
                                    The default value is <literal>"point"</literal>.
                                </para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term>direction: </term>
                            <listitem>
                                <para>This field defines the ray direction for directional light.
                                    The direction can be changed using a 3 element vector <literal>"[x, y, z]"</literal>
                                    representing a vector starting from the origin.
                                </para>
                                <para>
                                    The default value is <literal>"[0 0 1]"</literal>.
                                </para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term>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>
                                <para>
                                    The default value is <literal>"[0 0 1]"</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>
                                <para>
                                    The default value is <literal>"[0.1 0.1 0.1]"</literal>.
                                </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>
                                <para>
                                    The default value is <literal>"[1 1 1]"</literal>.
                                </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>
                                <para>
                                    The default value is <literal>"[1 1 1]"</literal>.
                                </para>
                            </listitem>
                        </varlistentry>
                    </variablelist>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            The <literal>light</literal> function, creates a light entity (see <link linkend="light">light_property</link> for the light entity properties) in the specified axes
            and sets the properties specified with &lt;LightProperty&gt; optional arguments.
        </para>
        <para>
            For a more detailed explanation about how lighting affects the surface
            appearance see <link linkend="lighting">lighting</link>.
        </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[
plot3d();
l = light(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_properties">light properties</link>
            </member>
            <member>
                <link linkend="surface_properties">surface properties</link>
            </member>
            <member>
                <link linkend="delete">delete</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
