Light is now a graphic object 19/12319/2
Pedro Arthur [Mon, 19 Aug 2013 20:37:33 +0000 (17:37 -0300)]
Change-Id: I54bf6f2fc5914901d4e6fd288a4ad6f7bcd4d427

27 files changed:
scilab/modules/graphic_objects/includes/graphicObjectProperties.h
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/axes/Axes.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicModel/GraphicModel.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObject.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObjectProperties.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/lighting/Light.java
scilab/modules/graphic_objects/src/scripts/propertiesMap.properties
scilab/modules/graphics/Makefile.am
scilab/modules/graphics/Makefile.in
scilab/modules/graphics/graphics.vcxproj
scilab/modules/graphics/graphics.vcxproj.filters
scilab/modules/graphics/includes/Light.h [new file with mode: 0644]
scilab/modules/graphics/includes/gw_graphics.h
scilab/modules/graphics/macros/%h_p.sci
scilab/modules/graphics/sci_gateway/c/gw_graphics.c
scilab/modules/graphics/sci_gateway/c/sci_light_create.c [new file with mode: 0644]
scilab/modules/graphics/sci_gateway/c/sci_light_delete.c [new file with mode: 0644]
scilab/modules/graphics/sci_gateway/graphics_gateway.xml
scilab/modules/graphics/src/c/Light.c [new file with mode: 0644]
scilab/modules/graphics/src/c/getHandleProperty/GetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/SetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/getHandleProperty.h
scilab/modules/graphics/src/c/getHandleProperty/get_type_property.c
scilab/modules/graphics/src/c/getHandleProperty/setHandleProperty.h
scilab/modules/graphics/src/c/getHandleProperty/set_light_type_property.c
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/util/LightingUtils.java

index 68f5e3f..3ca8648 100644 (file)
 #define __GO_COLORMATERIAL__               297
 #define __GO_MATERIAL_SHININESS__          301
 
-#define __GO_LIGHTING__                    302
+#define __GO_LIGHT__                       302
 #define __GO_LIGHT_TYPE__                  303
 #define __GO_LIGHT_DIRECTION__             304
 #define __GO_LIGHT_POSITION__              305
index 9ff3d76..316c039 100644 (file)
@@ -143,9 +143,6 @@ public class Axes extends GraphicObject {
     /** Default ClippableProperty */
     private ClippableProperty clipProperty;
 
-    /** light properties */
-    private Light light;
-
 
     /** Constructor */
     public Axes() {
@@ -167,7 +164,6 @@ public class Axes extends GraphicObject {
         mark = new Mark();
         arcDrawingMethod = ArcDrawingMethod.LINES;
         clipProperty = new ClippableProperty();
-        light = new Light();
     }
 
     public Axes clone() {
@@ -200,7 +196,6 @@ public class Axes extends GraphicObject {
         copy.line = new Line(this.line);
         copy.mark = new Mark(this.mark);
         copy.clipProperty = new ClippableProperty(this.clipProperty);
-        copy.light = new Light(this.light);
         copy.setValid(true);
 
         return copy;
@@ -372,20 +367,6 @@ public class Axes extends GraphicObject {
                 return ClippablePropertyType.CLIPBOXSET;
             case __GO_ARC_DRAWING_METHOD__ :
                 return ArcProperty.ARCDRAWINGMETHOD;
-            case __GO_AMBIENTCOLOR__ :
-                return ColorTriplet.ColorTripletProperty.AMBIENTCOLOR;
-            case __GO_DIFFUSECOLOR__ :
-                return ColorTriplet.ColorTripletProperty.DIFFUSECOLOR;
-            case __GO_SPECULARCOLOR__ :
-                return ColorTriplet.ColorTripletProperty.SPECULARCOLOR;
-            case __GO_LIGHTING__ :
-                return LightProperty.ENABLED;
-            case __GO_LIGHT_TYPE__ :
-                return LightProperty.TYPE;
-            case __GO_LIGHT_POSITION__ :
-                return LightProperty.POSITION;
-            case __GO_LIGHT_DIRECTION__ :
-                return LightProperty.DIRECTION;
             default :
                 return super.getPropertyFromName(propertyName);
         }
@@ -575,28 +556,6 @@ public class Axes extends GraphicObject {
             }
         } else if (property == ArcProperty.ARCDRAWINGMETHOD) {
             return getArcDrawingMethod();
-        } else if (property instanceof ColorTriplet.ColorTripletProperty) {
-            ColorTriplet.ColorTripletProperty cp = (ColorTriplet.ColorTripletProperty)property;
-            switch (cp) {
-                case AMBIENTCOLOR:
-                    return getLightAmbientColor();
-                case DIFFUSECOLOR:
-                    return getLightDiffuseColor();
-                case SPECULARCOLOR:
-                    return getLightSpecularColor();
-            }
-        } else if (property instanceof LightProperty) {
-            LightProperty lp = (LightProperty)property;
-            switch (lp) {
-                case ENABLED:
-                    return isLightEnable();
-                case TYPE:
-                    return getLightType();
-                case POSITION:
-                    return getLightPosition();
-                case DIRECTION:
-                    return getLightDirection();
-            }
         }
 
         return super.getProperty(property);
@@ -781,28 +740,6 @@ public class Axes extends GraphicObject {
             }
         } else if (property == ArcProperty.ARCDRAWINGMETHOD) {
             return setArcDrawingMethod((Integer) value);
-        } else if (property instanceof ColorTriplet.ColorTripletProperty) {
-            ColorTriplet.ColorTripletProperty cp = (ColorTriplet.ColorTripletProperty)property;
-            switch (cp) {
-                case AMBIENTCOLOR:
-                    return setLightAmbientColor((Double[])value);
-                case DIFFUSECOLOR:
-                    return setLightDiffuseColor((Double[])value);
-                case SPECULARCOLOR:
-                    return setLightSpecularColor((Double[])value);
-            }
-        } else if (property instanceof LightProperty) {
-            LightProperty lp = (LightProperty)property;
-            switch (lp) {
-                case ENABLED:
-                    return setLightEnable((Boolean) value);
-                case TYPE:
-                    return setLightType((Integer)value);
-                case POSITION:
-                    return setLightPosition((Double[])value);
-                case DIRECTION:
-                    return setLightDirection((Double[])value);
-            }
         }
 
         return super.setProperty(property, value);
@@ -2368,123 +2305,6 @@ public class Axes extends GraphicObject {
         return UpdateStatus.NoChange;
     }
 
-    /**
-     * @return the ambient color of the light.
-     */
-    public Double[] getLightAmbientColor() {
-        return light.getAmbientColor();
-    }
-
-    /**
-     * @param color the new ambient color of the light.
-     */
-    public UpdateStatus setLightAmbientColor(Double[] color) {
-        return light.setAmbientColor(color);
-    }
-
-    /**
-     * @return the light's difuse color.
-     */
-    public Double[] getLightDiffuseColor() {
-        return light.getDiffuseColor();
-    }
-
-    /**
-     * @param color the new diffuse color of the light.
-     */
-    public UpdateStatus setLightDiffuseColor(Double[] color) {
-        return light.setDiffuseColor(color);
-    }
-
-    /**
-     * @return the specular color of the light.
-     */
-    public Double[] getLightSpecularColor() {
-        return light.getSpecularColor();
-    }
-
-    /**
-     * @param color the new specular color of the light.
-     */
-    public UpdateStatus setLightSpecularColor(Double[] color) {
-        return light.setSpecularColor(color);
-    }
-
-    /**
-     * @return true if lighting is enabled.
-     */
-    public Boolean isLightEnable() {
-        return light.isEnable();
-    }
-
-    /**
-     * @param status lighting status (on/off).
-     */
-    public UpdateStatus setLightEnable(Boolean status) {
-        return light.setEnable(status);
-    }
-
-    /**
-     * @return the type of the light.
-     */
-    public Integer getLightType() {
-        return light.getTypeAsInteger();
-    }
-
-    /**
-     * @param the new type of the light.
-     */
-    public UpdateStatus setLightType(Integer type) {
-        return light.setTypeAsInteger(type);
-    }
-
-    /**
-     * @return the position of the light.
-     */
-    public Double[] getLightPosition() {
-        return light.getPosition();
-    }
-
-    /**
-     * @param the new position of the light.
-     */
-    public UpdateStatus setLightPosition(Double[] pos) {
-        return light.setPosition(pos);
-    }
-
-    /**
-     * @return the direction of the light.
-     */
-    public Double[] getLightDirection() {
-        return light.getDirection();
-    }
-
-    /**
-     * @param the new direction of the light.
-     */
-    public UpdateStatus setLightDirection(Double[] dir) {
-        return light.setDirection(dir);
-    }
-
-    /**
-     * @return the light.
-     */
-    public Light getLight() {
-        return light;
-    }
-
-    /**
-     * @param the new light.
-     */
-    public void setLight(Light light) {
-        if (light != null) {
-            this.light = light;
-        }
-    }
-
-    /**
-     * @return Type as String
-     */
     public Integer getType() {
         return GraphicObjectProperties.__GO_AXES__;
     }
index ddf8f87..361bdc4 100644 (file)
@@ -34,6 +34,7 @@ import org.scilab.modules.graphic_objects.polyline.Polyline;
 import org.scilab.modules.graphic_objects.rectangle.Rectangle;
 import org.scilab.modules.graphic_objects.surface.Fac3d;
 import org.scilab.modules.graphic_objects.surface.Plot3d;
+import org.scilab.modules.graphic_objects.lighting.Light;
 import org.scilab.modules.graphic_objects.textObject.Text;
 import org.scilab.modules.graphic_objects.uibar.progressionbar.Progressionbar;
 import org.scilab.modules.graphic_objects.uibar.waitbar.Waitbar;
@@ -309,6 +310,9 @@ public final class GraphicModel {
             case WAITBAR:
                 createdObject = new Waitbar();
                 break;
+            case LIGHT:
+                createdObject = new Light();
+                break;
             case UNKNOWNOBJECT:
                 createdObject = null;
                 break;
index acc38b4..9a5eae6 100644 (file)
@@ -45,7 +45,7 @@ public abstract class GraphicObject implements Cloneable {
     public enum Type { ARC, AXES, AXESMODEL, AXIS, CHAMP, COMPOUND, FAC3D, FEC, FIGURE, FIGUREMODEL, GRAYPLOT,
                        LABEL, LEGEND, MATPLOT, PLOT3D, POLYLINE, RECTANGLE, SEGS, TEXT, CHECKBOX, EDIT, FRAME,
                        IMAGE, LISTBOX, POPUPMENU, PUSHBUTTON, RADIOBUTTON, CONSOLE, JAVACONSOLE, SLIDER, TABLE, UITEXT, UIMENU, UIMENUMODEL,
-                       PROGRESSIONBAR, WAITBAR, UICONTEXTMENU, UNKNOWNOBJECT
+                       PROGRESSIONBAR, WAITBAR, UICONTEXTMENU, LIGHT, UNKNOWNOBJECT
                      };
 
     /** GraphicObject properties */
@@ -218,6 +218,8 @@ public abstract class GraphicObject implements Cloneable {
                 return Type.PROGRESSIONBAR;
             case __GO_WAITBAR__ :
                 return Type.WAITBAR;
+            case __GO_LIGHT__ :
+                return Type.LIGHT;
             default :
                 return Type.UNKNOWNOBJECT;
         }
index 38740fc..adfd52b 100644 (file)
@@ -363,7 +363,7 @@ public class GraphicObjectProperties {
     public static final int __GO_COLORMATERIAL__ =          297;
     public static final int __GO_MATERIAL_SHININESS__ =     301;
 
-    public static final int __GO_LIGHTING__ =               302;
+    public static final int __GO_LIGHT__ =                  302;
     public static final int __GO_LIGHT_TYPE__ =             303;
     public static final int __GO_LIGHT_DIRECTION__ =        304;
     public static final int __GO_LIGHT_POSITION__ =         305;
index e506baf..149d17b 100644 (file)
 
 package org.scilab.modules.graphic_objects.lighting;
 
-import org.scilab.modules.graphic_objects.graphicObject.GraphicObject.UpdateStatus;
+import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
+import org.scilab.modules.graphic_objects.graphicObject.Visitor;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.*;
 
 /**
  * Light class
  * @author Pedro SOUZA
  */
-public class Light extends ColorTriplet {
+public class Light extends GraphicObject {
 
-    public enum LightProperty {ENABLED, POSITION, DIRECTION, TYPE};
+    public enum LightProperty {POSITION, DIRECTION, TYPE};
     
     public enum LightType {DIRECTIONAL, POINT};
 
-    /** enables lighting */
-    boolean enabled;
-
     /** light position */
     Double[] position;
 
@@ -35,42 +34,37 @@ public class Light extends ColorTriplet {
 
     /** light type */
     LightType type;
+    
+    /** the light color */
+    ColorTriplet lightColor;
 
     public Light() {
         super();
-        enabled = false;
-        ambient[0] = ambient[1] = ambient[2] = 1.0;
-        diffuse[0] = diffuse[1] = diffuse[2] = 1.0;
-        specular[0] = specular[1] = specular[2] = 1.0;
+        lightColor = new ColorTriplet();
 
         position = new Double[] {0.0, 0.0, 1.0};
         direction = new Double[] {0.0, 0.0, 1.0};
         type = LightType.POINT;
+        
+        Double[] white = new Double[] {1.0, 1.0, 1.0};
+        setAmbientColor(white);
+        setDiffuseColor(white);
+        setSpecularColor(white);
     }
 
     /** copy contructor */
     public Light(Light other) {
-        super((ColorTriplet)other);
+        super();
         position = new Double[3];
         direction = new Double[3];
-        enabled = other.enabled;
         type = other.type;
+        lightColor = new ColorTriplet(other.lightColor);
         setPosition(other.position);
         setDirection(other.direction);
     }
-
-    /** enables/disables lighting */
-    public UpdateStatus setEnable(Boolean status) {
-        if (enabled != status) {
-            enabled = status;
-            return UpdateStatus.Success;
-        }
-        return UpdateStatus.NoChange;
-    }
-
-    /** returns lighting status */
-    public Boolean isEnable() {
-        return enabled;
+    
+    @Override
+    public void accept(Visitor visitor) {
     }
 
     /** returns the light's position */
@@ -112,7 +106,7 @@ public class Light extends ColorTriplet {
     }
 
     /** Sets the light's type from an integer */
-    public UpdateStatus setTypeAsInteger(Integer i) {
+    public UpdateStatus setLightTypeAsInteger(Integer i) {
         if (i >= 0 && i < LightType.values().length) {
             if (this.type != LightType.values()[i]) {
                 this.type = LightType.values()[i];
@@ -124,12 +118,12 @@ public class Light extends ColorTriplet {
     }
 
     /** Get the light's type as integer */
-    public Integer getTypeAsInteger() {
+    public Integer getLightTypeAsInteger() {
         return type.ordinal();
     }
 
     /** Sets the light's type */
-    public UpdateStatus setType(LightType type) {
+    public UpdateStatus setLightType(LightType type) {
         if (this.type != type) {
             this.type = type;
             return UpdateStatus.Success;
@@ -138,8 +132,127 @@ public class Light extends ColorTriplet {
     }
 
     /** Get the light's type */
-    public LightType getType() {
+    public LightType getLightType() {
         return type;
     }
+    
+    /**
+     * Returns the enum associated to a property name
+     * @param propertyName the property name
+     * @return the property enum
+     */
+    public Object getPropertyFromName(int propertyName) {
+        switch (propertyName) {
+            case __GO_AMBIENTCOLOR__ :
+                return ColorTriplet.ColorTripletProperty.AMBIENTCOLOR;
+            case __GO_DIFFUSECOLOR__ :
+                return ColorTriplet.ColorTripletProperty.DIFFUSECOLOR;
+            case __GO_SPECULARCOLOR__ :
+                return ColorTriplet.ColorTripletProperty.SPECULARCOLOR;
+            case __GO_LIGHT_TYPE__ :
+                return LightProperty.TYPE;
+            case __GO_LIGHT_POSITION__ :
+                return LightProperty.POSITION;
+            case __GO_LIGHT_DIRECTION__ :
+                return LightProperty.DIRECTION;
+            default :
+                return super.getPropertyFromName(propertyName);
+        }
+    }
+    /**
+     * Fast property get method
+     * @param property the property to get
+     * @return the property value
+     */
+    public Object getProperty(Object property) {
+       if (property instanceof ColorTriplet.ColorTripletProperty) {
+            ColorTriplet.ColorTripletProperty cp = (ColorTriplet.ColorTripletProperty)property;
+            switch (cp) {
+                case AMBIENTCOLOR:
+                    return getAmbientColor();
+                case DIFFUSECOLOR:
+                    return getDiffuseColor();
+                case SPECULARCOLOR:
+                    return getSpecularColor();
+            }
+        } else if (property instanceof LightProperty) {
+            LightProperty lp = (LightProperty)property;
+            switch (lp) {
+                case TYPE:
+                    return getLightTypeAsInteger();
+                case POSITION:
+                    return getPosition();
+                case DIRECTION:
+                    return getDirection();
+            }
+        }
+
+        return super.getProperty(property);
+    }
 
+    /**
+     * Fast property set method
+     * @param property the property to set
+     * @param value the property value
+     * @return true if the property has been set, false otherwise
+     */
+    public UpdateStatus setProperty(Object property, Object value) {
+        if (property instanceof ColorTriplet.ColorTripletProperty) {
+            ColorTriplet.ColorTripletProperty cp = (ColorTriplet.ColorTripletProperty)property;
+            switch (cp) {
+                case AMBIENTCOLOR:
+                    return setAmbientColor((Double[])value);
+                case DIFFUSECOLOR:
+                    return setDiffuseColor((Double[])value);
+                case SPECULARCOLOR:
+                    return setSpecularColor((Double[])value);
+            }
+        } else if (property instanceof LightProperty) {
+            LightProperty lp = (LightProperty)property;
+            switch (lp) {
+                case TYPE:
+                    return setLightTypeAsInteger((Integer)value);
+                case POSITION:
+                    return setPosition((Double[])value);
+                case DIRECTION:
+                    return setDirection((Double[])value);
+            }
+        }
+
+        return super.setProperty(property, value);
+    }
+
+    /** returns the ambient color of the light*/
+    public Double[] getAmbientColor() {
+        return lightColor.getAmbientColor();
+    }
+
+    /** Sets the ambient color */
+    public UpdateStatus setAmbientColor(Double[] color) {
+        return lightColor.setAmbientColor(color);
+    }
+
+    /** returns the dffuse color of the light*/
+    public Double[] getDiffuseColor() {
+        return lightColor.getDiffuseColor();
+    }
+
+    /** Sets the diffuse color of the light*/
+    public UpdateStatus setDiffuseColor(Double[] color) {
+        return lightColor.setDiffuseColor(color);
+    }
+
+    /** returns the specular color of the light*/
+    public Double[] getSpecularColor() {
+        return lightColor.getSpecularColor();
+    }
+
+    /** Sets the specular color of the light*/
+    public UpdateStatus setSpecularColor(Double[] color) {
+        return lightColor.setSpecularColor(color);
+    }
+
+    public Integer getType() {
+        return __GO_LIGHT__;
+    }
 }
index 79d1fb5..5d66793 100644 (file)
 @DECLARE@ __GO_COLORMATERIAL__ @EQUAL@          297 @END@
 @DECLARE@ __GO_MATERIAL_SHININESS__ @EQUAL@     301 @END@
 
-@DECLARE@ __GO_LIGHTING__ @EQUAL@               302 @END@
+@DECLARE@ __GO_LIGHT__ @EQUAL@                  302 @END@
 @DECLARE@ __GO_LIGHT_TYPE__ @EQUAL@             303 @END@
 @DECLARE@ __GO_LIGHT_DIRECTION__ @EQUAL@        304 @END@
 @DECLARE@ __GO_LIGHT_POSITION__ @EQUAL@         305 @END@
index 3551f30..a071704 100644 (file)
@@ -333,7 +333,6 @@ src/c/getHandleProperty/get_diffuse_color_property.c \
 src/c/getHandleProperty/get_specular_color_property.c \
 src/c/getHandleProperty/get_color_material_property.c \
 src/c/getHandleProperty/get_material_shininess_property.c \
-src/c/getHandleProperty/get_lighting_property.c \
 src/c/getHandleProperty/get_light_type_property.c \
 src/c/getHandleProperty/get_light_direction_property.c \
 src/c/getHandleProperty/get_light_position_property.c \
@@ -342,10 +341,10 @@ src/c/getHandleProperty/set_diffuse_color_property.c \
 src/c/getHandleProperty/set_specular_color_property.c \
 src/c/getHandleProperty/set_color_material_property.c \
 src/c/getHandleProperty/set_material_shininess_property.c \
-src/c/getHandleProperty/set_lighting_property.c \
 src/c/getHandleProperty/set_light_type_property.c \
 src/c/getHandleProperty/set_light_direction_property.c \
-src/c/getHandleProperty/set_light_position_property.c
+src/c/getHandleProperty/set_light_position_property.c \
+src/c/Light.c
 
 
 GATEWAY_C_SOURCES = sci_gateway/c/sci_swap_handles.c \
@@ -409,7 +408,9 @@ sci_gateway/c/sci_fec.c \
 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_Legend.c \
+sci_gateway/c/sci_light_create.c \
+sci_gateway/c/sci_light_delete.c
 
 libscigraphics_la_CPPFLAGS = \
        -I$(srcdir)/includes/ \
index 5c1d03c..7d7e14e 100644 (file)
@@ -451,7 +451,6 @@ am__objects_1 = libscigraphics_algo_la-GetCommandArg.lo \
        libscigraphics_algo_la-get_specular_color_property.lo \
        libscigraphics_algo_la-get_color_material_property.lo \
        libscigraphics_algo_la-get_material_shininess_property.lo \
-       libscigraphics_algo_la-get_lighting_property.lo \
        libscigraphics_algo_la-get_light_type_property.lo \
        libscigraphics_algo_la-get_light_direction_property.lo \
        libscigraphics_algo_la-get_light_position_property.lo \
@@ -460,10 +459,10 @@ am__objects_1 = libscigraphics_algo_la-GetCommandArg.lo \
        libscigraphics_algo_la-set_specular_color_property.lo \
        libscigraphics_algo_la-set_color_material_property.lo \
        libscigraphics_algo_la-set_material_shininess_property.lo \
-       libscigraphics_algo_la-set_lighting_property.lo \
        libscigraphics_algo_la-set_light_type_property.lo \
        libscigraphics_algo_la-set_light_direction_property.lo \
-       libscigraphics_algo_la-set_light_position_property.lo
+       libscigraphics_algo_la-set_light_position_property.lo \
+       libscigraphics_algo_la-Light.lo
 am_libscigraphics_algo_la_OBJECTS = $(am__objects_1)
 libscigraphics_algo_la_OBJECTS = $(am_libscigraphics_algo_la_OBJECTS)
 @GUI_TRUE@am_libscigraphics_algo_la_rpath =
@@ -522,7 +521,9 @@ 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_Legend.lo \
+       libscigraphics_la-sci_light_create.lo \
+       libscigraphics_la-sci_light_delete.lo
 am_libscigraphics_la_OBJECTS = $(am__objects_2)
 libscigraphics_la_OBJECTS = $(am_libscigraphics_la_OBJECTS)
 @GUI_TRUE@am_libscigraphics_la_rpath = -rpath $(pkglibdir)
@@ -1136,7 +1137,6 @@ src/c/getHandleProperty/get_diffuse_color_property.c \
 src/c/getHandleProperty/get_specular_color_property.c \
 src/c/getHandleProperty/get_color_material_property.c \
 src/c/getHandleProperty/get_material_shininess_property.c \
-src/c/getHandleProperty/get_lighting_property.c \
 src/c/getHandleProperty/get_light_type_property.c \
 src/c/getHandleProperty/get_light_direction_property.c \
 src/c/getHandleProperty/get_light_position_property.c \
@@ -1145,10 +1145,10 @@ src/c/getHandleProperty/set_diffuse_color_property.c \
 src/c/getHandleProperty/set_specular_color_property.c \
 src/c/getHandleProperty/set_color_material_property.c \
 src/c/getHandleProperty/set_material_shininess_property.c \
-src/c/getHandleProperty/set_lighting_property.c \
 src/c/getHandleProperty/set_light_type_property.c \
 src/c/getHandleProperty/set_light_direction_property.c \
-src/c/getHandleProperty/set_light_position_property.c
+src/c/getHandleProperty/set_light_position_property.c \
+src/c/Light.c
 
 GATEWAY_C_SOURCES = sci_gateway/c/sci_swap_handles.c \
 sci_gateway/c/sci_grayplot.c \
@@ -1211,7 +1211,9 @@ sci_gateway/c/sci_fec.c \
 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_Legend.c \
+sci_gateway/c/sci_light_create.c \
+sci_gateway/c/sci_light_delete.c
 
 libscigraphics_la_CPPFLAGS = \
        -I$(srcdir)/includes/ \
@@ -1482,6 +1484,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-Gray.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-InitObjects.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-Interaction.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-Light.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-Plo2dEch.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-Plo2dn.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-SetHashTable.Plo@am__quote@
@@ -1573,7 +1576,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-get_light_direction_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-get_light_position_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-get_light_type_property.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-get_lighting_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-get_line_mode_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-get_line_style_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-get_links_property.Plo@am__quote@
@@ -1724,7 +1726,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-set_light_direction_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-set_light_position_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-set_light_type_property.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-set_lighting_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-set_line_mode_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-set_line_style_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphics_algo_la-set_links_property.Plo@am__quote@
@@ -1805,6 +1806,8 @@ 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_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@
@@ -4026,13 +4029,6 @@ libscigraphics_algo_la-get_material_shininess_property.lo: src/c/getHandleProper
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_algo_la-get_material_shininess_property.lo `test -f 'src/c/getHandleProperty/get_material_shininess_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/get_material_shininess_property.c
 
-libscigraphics_algo_la-get_lighting_property.lo: src/c/getHandleProperty/get_lighting_property.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_algo_la-get_lighting_property.lo -MD -MP -MF $(DEPDIR)/libscigraphics_algo_la-get_lighting_property.Tpo -c -o libscigraphics_algo_la-get_lighting_property.lo `test -f 'src/c/getHandleProperty/get_lighting_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/get_lighting_property.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigraphics_algo_la-get_lighting_property.Tpo $(DEPDIR)/libscigraphics_algo_la-get_lighting_property.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/getHandleProperty/get_lighting_property.c' object='libscigraphics_algo_la-get_lighting_property.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_algo_la-get_lighting_property.lo `test -f 'src/c/getHandleProperty/get_lighting_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/get_lighting_property.c
-
 libscigraphics_algo_la-get_light_type_property.lo: src/c/getHandleProperty/get_light_type_property.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_algo_la-get_light_type_property.lo -MD -MP -MF $(DEPDIR)/libscigraphics_algo_la-get_light_type_property.Tpo -c -o libscigraphics_algo_la-get_light_type_property.lo `test -f 'src/c/getHandleProperty/get_light_type_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/get_light_type_property.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigraphics_algo_la-get_light_type_property.Tpo $(DEPDIR)/libscigraphics_algo_la-get_light_type_property.Plo
@@ -4089,13 +4085,6 @@ libscigraphics_algo_la-set_material_shininess_property.lo: src/c/getHandleProper
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_algo_la-set_material_shininess_property.lo `test -f 'src/c/getHandleProperty/set_material_shininess_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_material_shininess_property.c
 
-libscigraphics_algo_la-set_lighting_property.lo: src/c/getHandleProperty/set_lighting_property.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_algo_la-set_lighting_property.lo -MD -MP -MF $(DEPDIR)/libscigraphics_algo_la-set_lighting_property.Tpo -c -o libscigraphics_algo_la-set_lighting_property.lo `test -f 'src/c/getHandleProperty/set_lighting_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_lighting_property.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigraphics_algo_la-set_lighting_property.Tpo $(DEPDIR)/libscigraphics_algo_la-set_lighting_property.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/getHandleProperty/set_lighting_property.c' object='libscigraphics_algo_la-set_lighting_property.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_algo_la-set_lighting_property.lo `test -f 'src/c/getHandleProperty/set_lighting_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_lighting_property.c
-
 libscigraphics_algo_la-set_light_type_property.lo: src/c/getHandleProperty/set_light_type_property.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_algo_la-set_light_type_property.lo -MD -MP -MF $(DEPDIR)/libscigraphics_algo_la-set_light_type_property.Tpo -c -o libscigraphics_algo_la-set_light_type_property.lo `test -f 'src/c/getHandleProperty/set_light_type_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_light_type_property.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigraphics_algo_la-set_light_type_property.Tpo $(DEPDIR)/libscigraphics_algo_la-set_light_type_property.Plo
@@ -4117,6 +4106,13 @@ libscigraphics_algo_la-set_light_position_property.lo: src/c/getHandleProperty/s
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_algo_la-set_light_position_property.lo `test -f 'src/c/getHandleProperty/set_light_position_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_light_position_property.c
 
+libscigraphics_algo_la-Light.lo: src/c/Light.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_algo_la-Light.lo -MD -MP -MF $(DEPDIR)/libscigraphics_algo_la-Light.Tpo -c -o libscigraphics_algo_la-Light.lo `test -f 'src/c/Light.c' || echo '$(srcdir)/'`src/c/Light.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigraphics_algo_la-Light.Tpo $(DEPDIR)/libscigraphics_algo_la-Light.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/Light.c' object='libscigraphics_algo_la-Light.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscigraphics_algo_la-Light.lo `test -f 'src/c/Light.c' || echo '$(srcdir)/'`src/c/Light.c
+
 libscigraphics_disable_la-nographics.lo: src/nographics/nographics.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_disable_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscigraphics_disable_la-nographics.lo -MD -MP -MF $(DEPDIR)/libscigraphics_disable_la-nographics.Tpo -c -o libscigraphics_disable_la-nographics.lo `test -f 'src/nographics/nographics.c' || echo '$(srcdir)/'`src/nographics/nographics.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigraphics_disable_la-nographics.Tpo $(DEPDIR)/libscigraphics_disable_la-nographics.Plo
@@ -4558,6 +4554,20 @@ libscigraphics_la-sci_Legend.lo: sci_gateway/c/sci_Legend.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --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@   $(LIBTOOL)  --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__mv) $(DEPDIR)/libscigraphics_la-sci_light_create.Tpo $(DEPDIR)/libscigraphics_la-sci_light_create.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_light_create.c' object='libscigraphics_la-sci_light_create.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --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@   $(LIBTOOL)  --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__mv) $(DEPDIR)/libscigraphics_la-sci_light_delete.Tpo $(DEPDIR)/libscigraphics_la-sci_light_delete.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      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@  $(LIBTOOL)  --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
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 49b6fca..ba9a532 100644 (file)
@@ -194,6 +194,8 @@ 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="src\c\Axes.c" />
     <ClCompile Include="src\c\axesScale.c" />
     <ClCompile Include="src\c\BasicAlgos.c" />
@@ -286,7 +288,6 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile Include="src\c\getHandleProperty\get_labels_font_size_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_labels_font_style_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_legend_location_property.c" />
-    <ClCompile Include="src\c\getHandleProperty\get_lighting_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_light_direction_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_light_position_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_light_type_property.c" />
@@ -327,7 +328,6 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile Include="src\c\getHandleProperty\set_diffuse_color_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_figure_closerequestfcn_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_figure_resizefcn_property.c" />
-    <ClCompile Include="src\c\getHandleProperty\set_lighting_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_light_direction_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_light_position_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_light_type_property.c" />
@@ -373,6 +373,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile Include="sci_gateway\c\gw_graphics.c" />
     <ClCompile Include="src\c\InitObjects.c" />
     <ClCompile Include="src\c\Interaction.c" />
+    <ClCompile Include="src\c\Light.c" />
     <ClCompile Include="src\c\loadTextRenderingAPI.c" />
     <ClCompile Include="src\c\math_graphics.c">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MinSpace</Optimization>
@@ -586,6 +587,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClInclude Include="includes\BasicAlgos.h" />
     <ClInclude Include="includes\BuildObjects.h" />
     <ClInclude Include="includes\Champ.h" />
+    <ClInclude Include="includes\Light.h" />
     <ClInclude Include="src\c\CheckScilabXgc.h" />
     <ClInclude Include="src\c\getHandleProperty\CheckTicksProperty.h" />
     <ClInclude Include="includes\CloneObjects.h" />
index ae72a36..3798821 100644 (file)
     <ClCompile Include="src\c\getHandleProperty\get_light_type_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\c\getHandleProperty\get_lighting_property.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="src\c\getHandleProperty\get_specular_color_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="src\c\getHandleProperty\set_light_type_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\c\getHandleProperty\set_lighting_property.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="src\c\getHandleProperty\set_specular_color_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="src\c\getHandleProperty\set_material_shininess_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <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>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="includes\Axes.h">
     <ClInclude Include="src\c\loadTextRenderingAPI.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="includes\Light.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="Gui_Import.def">
diff --git a/scilab/modules/graphics/includes/Light.h b/scilab/modules/graphics/includes/Light.h
new file mode 100644 (file)
index 0000000..f82ca9d
--- /dev/null
@@ -0,0 +1,15 @@
+/*\r
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab\r
+ * Copyright (C) 2013 - Pedro SOUZA\r
+ *\r
+ * This file must be used under the terms of the CeCILL.\r
+ * This source file is licensed as described in the file COPYING, which\r
+ * you should have received as part of this distribution.  The terms\r
+ * are also available at\r
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt\r
+ *\r
+ */\r
+\r
+BOOL createLight(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 a562e45..0d5c19d 100644 (file)
@@ -95,6 +95,8 @@ 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);
 
 /*--------------------------------------------------------------------------*/
 #endif /* __INTGRAPHICS__ */
index bf5688f..87cba7f 100644 (file)
@@ -207,10 +207,6 @@ function %h_p(h)
             "ambient_color = "+sci2exp(h.ambient_color)
             "diffuse_color = "+sci2exp(h.diffuse_color)
             "specular_color = "+sci2exp(h.specular_color)
-            "lighting = "+sci2exp(h.lighting)
-            "light_type = "+sci2exp(h.light_type)
-            "light_position = "+sci2exp(h.light_position)
-            "light_direction = "+sci2exp(h.light_direction)
             "user_data = "+fmtuser_data(h.user_data)
             "tag = "+h.tag
             ]
@@ -932,6 +928,20 @@ function %h_p(h)
             "Children: "+fmtchildren(h.children)
             "ShowHiddenHandles: "+sci2exp(h.showhiddenhandles)
             ]
+                       // Light
+            // =====================================================================
+
+        case "Light"
+            t=[t;
+            "parent: "+h.parent.type
+            "visible = "+sci2exp(h.visible)
+            "light_type = "+sci2exp(h.light_type)
+            "light_position = "+sci2exp(h.light_position)
+            "light_direction = "+sci2exp(h.light_direction)
+            "ambient_color = "+sci2exp(h.ambient_color)
+            "diffuse_color = "+sci2exp(h.diffuse_color)
+            "specular_color= "+sci2exp(h.specular_color)
+            ]
         end
     end
     write(%io(2),t)
index 14265da..1bc801e 100644 (file)
@@ -97,7 +97,9 @@ static gw_generic_table Tab[] =
     {sci_rubberbox, "rubberbox"},
     {sci_rotate_axes, "rotate_axes"},
     {sci_is_handle_valid, "is_handle_valid"},
-    {sci_Legend, "captions"}
+    {sci_Legend, "captions"},
+    {sci_light_create, "light_create"},
+    {sci_light_delete, "light_delete"}
 };
 
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/graphics/sci_gateway/c/sci_light_create.c b/scilab/modules/graphics/sci_gateway/c/sci_light_create.c
new file mode 100644 (file)
index 0000000..d04466e
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * 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"
+#include "stricmp.h"
+
+
+
+int sci_light_create(char *fname, unsigned long fname_len)
+{
+    char * axes = NULL;
+    int type = -1;
+    BOOL visible = TRUE;
+    double * position = NULL;
+    double * direction = NULL;
+    double * ambient_color = NULL;
+    double * diffuse_color = NULL;
+    double * specular_color = NULL;
+
+    SciErr sciErr;
+    int* piAddr        = NULL;
+    int nbRow, nbCol;
+    int * piBool;
+    int length = 0;
+    char str[16];
+    char * pStr = str;
+    char * light;
+    long long light_handle;
+    long long axes_hdl = -1;
+    long long* pAxesHandle = &axes_hdl;
+    BOOL result;
+
+
+    static rhs_opts opts[] =
+    {
+
+        { -1, "ambient_color", -1, 0, 0, NULL},
+        { -1, "diffuse_color", -1, 0, 0, NULL},
+        { -1, "direction", -1, 0, 0, NULL},
+        { -1, "position", -1, 0, 0, NULL},
+        { -1, "specular_color", -1, 0, 0, NULL},
+        { -1, "type", -1, 0, 0, NULL},
+        { -1, "visible", -1, 0, 0, NULL},
+        { -1, NULL, -1, 0, 0, NULL}
+    };
+
+
+    if (nbInputArgument(pvApiCtx) == 0)
+    {
+        result = createLight(-1, -1, TRUE, NULL, NULL, NULL, NULL, NULL, &light_handle);
+    }
+    else
+    {
+
+        CheckInputArgument(pvApiCtx, 1, 15);
+
+
+        if (checkInputArgumentType(pvApiCtx, 1, sci_handles))
+        {
+            sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
+            if (sciErr.iErr)
+            {
+                return 0;
+            }
+            getMatrixOfHandle(pvApiCtx, piAddr, &nbRow, &nbCol, &pAxesHandle);
+
+            if (pAxesHandle == NULL) return FALSE;
+
+            if (nbRow * nbCol != 1)
+            {
+                Scierror(999, _("%s: Wrong size for input argument #%d: A graphic handle expected.\n"), fname, 1);
+                return FALSE;
+            }
+        }
+
+        if (getOptionals(pvApiCtx, fname, opts) == 0)
+        {
+            ReturnArguments(pvApiCtx);
+            return 0;
+        }
+
+        if ((opts[6].iPos != -1) && (opts[6].iType == sci_strings) && (opts[6].iCols * opts[6].iRows == 1))
+        {
+            piBool = &visible;
+            sciErr = getMatrixOfBoolean(pvApiCtx, opts[6].piAddr, &nbRow, &nbCol, &piBool);
+        }
+
+        if ((opts[5].iPos != -1) && (opts[5].iType == sci_strings) && (opts[5].iCols * opts[5].iRows == 1))
+        {
+            sciErr = getMatrixOfString(pvApiCtx, opts[5].piAddr, &nbRow, &nbCol, &length, NULL);
+            if (length < 15)
+            {
+                sciErr = getMatrixOfString(pvApiCtx, opts[5].piAddr, &nbRow, &nbCol, &length, &pStr);
+                if (stricmp(str, "directional") == 0)
+                {
+                    type = 0;
+                }
+                else if (stricmp(str, "point") == 0)
+                {
+                    type = 1;
+                }
+            }
+        }
+
+        if ((opts[3].iPos != -1) && (opts[3].iType == sci_matrix) && (opts[3].iCols * opts[3].iRows == 3))
+        {
+            sciErr = getMatrixOfDouble(pvApiCtx, opts[3].piAddr, &nbRow, &nbCol, &position);
+        }
+
+        if ((opts[2].iPos != -1) && (opts[2].iType == sci_matrix) && (opts[2].iCols * opts[2].iRows == 3))
+        {
+            sciErr = getMatrixOfDouble(pvApiCtx, opts[2].piAddr, &nbRow, &nbCol, &direction);
+        }
+
+        if ((opts[0].iPos != -1) && (opts[0].iType == sci_matrix) && (opts[0].iCols * opts[0].iRows == 3))
+        {
+            sciErr = getMatrixOfDouble(pvApiCtx, opts[0].piAddr, &nbRow, &nbCol, &ambient_color);
+        }
+
+        if ((opts[1].iPos != -1) && (opts[1].iType == sci_matrix) && (opts[1].iCols * opts[1].iRows == 3))
+        {
+            sciErr = getMatrixOfDouble(pvApiCtx, opts[4].piAddr, &nbRow, &nbCol, &diffuse_color);
+        }
+
+        if ((opts[4].iPos != -1) && (opts[4].iType == sci_matrix) && (opts[4].iCols * opts[4].iRows == 3))
+        {
+            sciErr = getMatrixOfDouble(pvApiCtx, opts[4].piAddr, &nbRow, &nbCol, &specular_color);
+        }
+
+        result = createLight(*pAxesHandle, type, visible, position, direction, ambient_color, diffuse_color, specular_color, &light_handle);
+
+    }
+
+    if (result == FALSE) return FALSE;
+
+
+    nbRow = 1;
+    nbCol = 1;
+
+    sciErr = createMatrixOfHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, nbRow, nbCol, &light_handle);
+    if (sciErr.iErr)
+    {
+        return FALSE;
+    }
+
+    AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+    ReturnArguments(pvApiCtx);
+    return TRUE;
+
+}
diff --git a/scilab/modules/graphics/sci_gateway/c/sci_light_delete.c b/scilab/modules/graphics/sci_gateway/c/sci_light_delete.c
new file mode 100644 (file)
index 0000000..7fea7b7
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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;
+    char * light;
+    long long* pLightHandle = NULL;
+    BOOL result;
+
+
+    CheckInputArgument(pvApiCtx, 1, 1);
+
+    if (checkInputArgumentType(pvApiCtx, 1, sci_handles))
+    {
+        sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
+        if (sciErr.iErr)
+        {
+            return 0;
+        }
+        getMatrixOfHandle(pvApiCtx, piAddr, &nbRow, &nbCol, &pLightHandle);
+        if (pLightHandle == NULL) return FALSE;
+
+        if (nbRow * nbCol != 1)
+        {
+            Scierror(999, _("%s: Wrong size for input argument #%d: A graphic handle expected.\n"), fname, 1);
+            return FALSE;
+        }
+
+        result = deleteLight(*pLightHandle);
+        if (result == FALSE)
+        {
+            return FALSE;
+        }
+    }
+    else
+    {
+        Scierror(999, _("%s: Wrong type for argument %d: A graphic handle expected.\n"), fname, 1);
+        return FALSE;
+    }
+
+    return TRUE;
+}
index 3d659eb..9092e8e 100644 (file)
@@ -87,4 +87,6 @@
     <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"/>
 </GATEWAY>
diff --git a/scilab/modules/graphics/src/c/Light.c b/scilab/modules/graphics/src/c/Light.c
new file mode 100644 (file)
index 0000000..a4af3dc
--- /dev/null
@@ -0,0 +1,116 @@
+/*\r
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab\r
+ * Copyright (C) 2013 - Pedro SOUZA\r
+ *\r
+ * This file must be used under the terms of the CeCILL.\r
+ * This source file is licensed as described in the file COPYING, which\r
+ * you should have received as part of this distribution.  The terms\r
+ * are also available at\r
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt\r
+ *\r
+ */\r
+\r
+#include "createGraphicObject.h"\r
+#include "deleteGraphicObject.h"\r
+#include "returnType.h"\r
+#include "getGraphicObjectProperty.h"\r
+#include "setGraphicObjectProperty.h"\r
+#include "graphicObjectProperties.h"\r
+#include "HandleManagement.h"\r
+#include "CurrentSubwin.h"\r
+\r
+\r
+BOOL isValidType(int type)\r
+{\r
+    return type >= 0 && type <= 1;\r
+}\r
+\r
+BOOL isValidColor(double * color)\r
+{\r
+    if (color != NULL)\r
+    {\r
+        return (color[0] >= 0.0 && color[0] <= 1.0) &&\r
+            (color[1] >= 0.0 && color[1] <= 1.0) &&\r
+            (color[2] >= 0.0 && color[2] <= 1.0);\r
+    }\r
+    return FALSE;\r
+}\r
+\r
+BOOL createLight(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
+    const char * axes;\r
+    char * light;\r
+    int * piType = &type;\r
+    int * piVisible = &visible;\r
+\r
+    if (pLightHandle == NULL) return FALSE;\r
+\r
+    axes = getObjectFromHandle(axes_handle);\r
+    if (axes == NULL)\r
+    {\r
+        axes = getCurrentSubWin();\r
+        if (axes == NULL) return FALSE;\r
+    }\r
+\r
+    light = createGraphicObject(__GO_LIGHT__);\r
+\r
+    if (light == NULL) return FALSE;\r
+\r
+    setGraphicObjectProperty(light, __GO_VISIBLE__, piVisible, jni_bool, 1);\r
+\r
+    if (isValidType(type))\r
+    {\r
+        setGraphicObjectProperty(light, __GO_LIGHT_TYPE__, piType, jni_int, 1);\r
+    }\r
+\r
+    if (position)\r
+    {\r
+        setGraphicObjectProperty(light, __GO_LIGHT_POSITION__, position, jni_double_vector, 3);\r
+    }\r
+\r
+    if (direction)\r
+    {\r
+        setGraphicObjectProperty(light, __GO_LIGHT_DIRECTION__, direction, jni_double_vector, 3);\r
+    }\r
+\r
+    if (isValidColor(ambient_color))\r
+    {\r
+        setGraphicObjectProperty(light, __GO_AMBIENTCOLOR__, ambient_color, jni_double_vector, 3);\r
+    }\r
+\r
+    if (isValidColor(diffuse_color))\r
+    {\r
+        setGraphicObjectProperty(light, __GO_DIFFUSECOLOR__, diffuse_color, jni_double_vector, 3);\r
+    }\r
+\r
+    if (isValidColor(specular_color))\r
+    {\r
+        setGraphicObjectProperty(light, __GO_SPECULARCOLOR__, specular_color, jni_double_vector, 3);\r
+    }\r
+    \r
+    *pLightHandle = getHandle(light);\r
+\r
+    setGraphicObjectRelationship(axes, light);\r
+    releaseGraphicObjectProperty(__GO_PARENT__, light, jni_string, 1);\r
+\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) return FALSE;\r
+\r
+    getGraphicObjectProperty(uid, __GO_TYPE__, jni_int, (void **)&piType);\r
+\r
+    if (iType != __GO_LIGHT__) return FALSE;\r
+\r
+    deleteGraphicObject((char*)uid);\r
+\r
+    return TRUE;\r
+}\r
index cfa3d0b..23e454b 100644 (file)
@@ -46,7 +46,7 @@ typedef struct
  * don't forget to modify it each time the propertyTable
  * is modified.
  */
-#define NB_PROPERTIES 171
+#define NB_PROPERTIES 170
 
 /**
  * list of all property names and associated functions in scilab
@@ -221,7 +221,6 @@ static getHashTableCouple propertyTable[NB_PROPERTIES] =
     {"specular_color", get_specular_color_property},
     {"color_material", get_color_material_property},
     {"material_shininess", get_material_shininess_property},
-    {"lighting", get_lighting_property},
     {"light_type", get_light_type_property},
     {"light_direction", get_light_direction_property},
     {"light_position", get_light_position_property}
index e3fb137..ada386b 100644 (file)
@@ -52,7 +52,7 @@ typedef struct
 * don't forget to modify it each time the propertyTable
 * is modified.
 */
-#define NB_PROPERTIES 166
+#define NB_PROPERTIES 165
 
 /**
 * list of all property names and associated functions in scilab
@@ -222,7 +222,6 @@ static setHashTableCouple propertyTable[NB_PROPERTIES] =
     {"specular_color", set_specular_color_property},
     {"color_material", set_color_material_property},
     {"material_shininess", set_material_shininess_property},
-    {"lighting", set_lighting_property},
     {"light_type", set_light_type_property},
     {"light_direction", set_light_direction_property},
     {"light_position", set_light_position_property}
index 8a393b1..6ea0e64 100644 (file)
@@ -185,7 +185,6 @@ int get_diffuse_color_property(void* _pvCtx, char* pobjUID);
 int get_specular_color_property(void* _pvCtx, char* pobjUID);
 int get_color_material_property(void* _pvCtx, char* pobjUID);
 int get_material_shininess_property(void* _pvCtx, char* pobjUID);
-int get_lighting_property(void* _pvCtx, char* pobjUID);
 int get_light_type_property(void* _pvCtx, char* pobjUID);
 int get_light_direction_property(void* _pvCtx, char* pobjUID);
 int get_light_position_property(void* _pvCtx, char* pobjUID);
index b49f033..5840ee8 100644 (file)
@@ -80,6 +80,8 @@ static char *getTypeNameFromInt(int _iType)
             return "ShowHiddenHandles";
         case __GO_WAITBAR__ :
             return "Waitbar";
+        case __GO_LIGHT__ :
+            return "Light";
         default :
             return "????";
     }
index cb8a89b..de18cec 100644 (file)
@@ -185,7 +185,6 @@ int set_diffuse_color_property(void* _pvCtx, char* pobj, void* _pvData, int valu
 int set_specular_color_property(void* _pvCtx, char* pobj, void* _pvData, int valueType, int nbRow, int nbCol);
 int set_color_material_property(void* _pvCtx, char* pobj, void* _pvData, int valueType, int nbRow, int nbCol);
 int set_material_shininess_property(void* _pvCtx, char* pobj, void* _pvData, int valueType, int nbRow, int nbCol);
-int set_lighting_property(void* _pvCtx, char* pobj, void* _pvData, int valueType, int nbRow, int nbCol);
 int set_light_type_property(void* _pvCtx, char* pobj, void* _pvData, int valueType, int nbRow, int nbCol);
 int set_light_direction_property(void* _pvCtx, char* pobj, void* _pvData, int valueType, int nbRow, int nbCol);
 int set_light_position_property(void* _pvCtx, char* pobj, void* _pvData, int valueType, int nbRow, int nbCol);
index 5c9f72f..074d287 100644 (file)
@@ -586,7 +586,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
                     /* Front-facing triangles */
                     Appearance appearance = new Appearance();
                     appearance.setMaterial(LightingUtils.getMaterial(fac3d.getMaterial()));
-                    LightingUtils.setLight(drawingTools.getLightManager(), currentAxes.getLight());
+                    LightingUtils.setupLights(drawingTools.getLightManager(), currentAxes);
 
                     if (fac3d.getColorMode() != 0) {
                         geometry.setFillDrawingMode(Geometry.FillDrawingMode.TRIANGLES);
@@ -678,7 +678,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
                     /* Front-facing triangles */
                     Appearance appearance = new Appearance();
                     appearance.setMaterial(LightingUtils.getMaterial(plot3d.getMaterial()));
-                    LightingUtils.setLight(drawingTools.getLightManager(), currentAxes.getLight());
+                    LightingUtils.setupLights(drawingTools.getLightManager(), currentAxes);
 
                     if (plot3d.getColorFlag() == 1) {
                         geometry.setColors(dataManager.getColorBuffer(plot3d.getIdentifier()));
index d619618..0e44944 100644 (file)
@@ -16,6 +16,9 @@ import org.scilab.forge.scirenderer.tranformations.Vector3d;
 import org.scilab.forge.scirenderer.lightning.Light;
 import org.scilab.forge.scirenderer.lightning.LightManager;
 
+import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
+import org.scilab.modules.graphic_objects.graphicController.GraphicController;
+
 /**
  * Utility functions to setup lighting.
  * @author Pedro SOUZA
@@ -42,44 +45,69 @@ public class LightingUtils {
     }
 
     /**
-     * Setup the give light.
+     * Enables/disables lighting.
      * @param manager the light manager.
-     * @param light the light.
+     * @param status the status.
      */
-    public static void setLight(LightManager manager, org.scilab.modules.graphic_objects.lighting.Light light) {
-
+    public static void setLightingEnable(LightManager manager, Boolean status) {
         if (manager == null) return;
-        setLightingEnable(manager, light.isEnable());
+        manager.setLightningEnable(status.booleanValue());
+        Light light = manager.getLight(0);
+        light.setEnable(status.booleanValue());
+    }
+
 
-        Light sciLight = manager.getLight(0);
-        Double[] color = light.getAmbientColor();
-        sciLight.setAmbientColor(new Color(color[0].floatValue(), color[1].floatValue(), color[2].floatValue()));
-        color = light.getDiffuseColor();
-        sciLight.setDiffuseColor(new Color(color[0].floatValue(), color[1].floatValue(), color[2].floatValue()));
-        color = light.getSpecularColor();
-        sciLight.setSpecularColor(new Color(color[0].floatValue(), color[1].floatValue(), color[2].floatValue()));
+    public static void setupLights(LightManager manager, org.scilab.modules.graphic_objects.axes.Axes axes) {
 
-        switch (light.getTypeAsInteger()) {
-            case 0: //directional
-                sciLight.setDirection(new Vector3d(light.getDirection()));
-                break;
-            case 1: //point
-                sciLight.setPosition(new Vector3d(light.getPosition()));
-                break;
-            default:
-                break;
+        if (manager == null) return;
+        
+        boolean hasLight = false;
+        int index = 0;
+        
+        for (String child : axes.getChildren()) {
+            GraphicObject object = GraphicController.getController().getObjectFromId(child);
+            if (object instanceof org.scilab.modules.graphic_objects.lighting.Light) {
+                hasLight |= setLight(manager, (org.scilab.modules.graphic_objects.lighting.Light)object, index++);
+            }
+            if (index >= manager.getLightNumber()) break;
         }
+        for (int i = index; i < manager.getLightNumber(); ++i) {
+            manager.getLight(i).setEnable(false);
+        }
+        manager.setLightningEnable(hasLight);
     }
 
     /**
-     * Enables/disables lighting.
+     * Setup the give light.
      * @param manager the light manager.
-     * @param status the status.
+     * @param light the light.
+     * @param index the light index.
+     * @return the light status.
      */
-    public static void setLightingEnable(LightManager manager, Boolean status) {
-        if (manager == null) return;
-        manager.setLightningEnable(status.booleanValue());
-        Light light = manager.getLight(0);
-        light.setEnable(status.booleanValue());
+    public static boolean setLight(LightManager manager, org.scilab.modules.graphic_objects.lighting.Light light, int index) {
+
+        boolean status = light.getVisible();
+        Light sciLight = manager.getLight(index);
+        if (status) {
+            Double[] color = light.getAmbientColor();
+            sciLight.setAmbientColor(new Color(color[0].floatValue(), color[1].floatValue(), color[2].floatValue()));
+            color = light.getDiffuseColor();
+            sciLight.setDiffuseColor(new Color(color[0].floatValue(), color[1].floatValue(), color[2].floatValue()));
+            color = light.getSpecularColor();
+            sciLight.setSpecularColor(new Color(color[0].floatValue(), color[1].floatValue(), color[2].floatValue()));
+
+            switch (light.getLightTypeAsInteger()) {
+                case 0: //directional
+                    sciLight.setDirection(new Vector3d(light.getDirection()));
+                    break;
+                case 1: //point
+                    sciLight.setPosition(new Vector3d(light.getPosition()));
+                    break;
+                default:
+                    break;
+            }
+        }
+        sciLight.setEnable(status);
+        return status;
     }
 }