The goal is to simplify the maintenance of Scirenderer with Scilab.
For now, during the release process, a lot of version of Scirenderer have to be published.
By this commit, we move the maintenance in a common place.
Scirenderer is STILL maintained as an independant project/library
Push from Scilab to the Scirenderer repository will be regularly done.
The configure argument "--without-embedded-scirenderer" bring back the same old behavior
Change-Id: I97bb98f1efb25eca31e7cc79ee4b291fbc48d0c8
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SKINLF
LOOKS
FLEXDOCK
+SCIRENDERER_CP
SCIRENDERER
JGRAPHX
ANT
with_min_macosx_version
with_hdf5_include
with_hdf5_library
+with_embedded_scirenderer
with_xcos
with_modelica
with_jdk
MacOSX minimal version.
--with-hdf5-include=DIR Set the path to the HDF5 headers
--with-hdf5-library=DIR Set the path to the HDF5 libraries
+ --without-embedded-scirenderer
+ Disable the usage of the internal copy of
+ scirenderer. Intended for packaging of Scilab
--without-xcos Disable Xcos
--without-modelica Disable the OCaml module (modelica)
--with-jdk=DIR use JDK from DIR
# The Java detection is done after in this file.
#################
+## scirenderer
+#################
+
+
+# Check whether --with-embedded-scirenderer was given.
+if test "${with_embedded_scirenderer+set}" = set; then :
+ withval=$with_embedded_scirenderer;
+fi
+
+
+
+#################
## XCOS
#################
$as_echo_n "checking to see if the java compiler works... " >&6; }
cat << \EOF > conftest.java
-// #line 10621 "configure"
+// #line 10638 "configure"
import java.util.regex.Pattern;
if test "x$ac_java_jvm_name" = "x" ; then
cat << \EOF > conftest.java
-// #line 10708 "configure"
+// #line 10725 "configure"
import java.util.regex.Pattern;
import gnu.java.io.EncodingManager;
# The class java.nio.charset.Charset is new to 1.4
cat << \EOF > conftest.java
-// #line 10792 "configure"
+// #line 10809 "configure"
import java.util.regex.Pattern;
import java.nio.charset.Charset;
# The class java.lang.StringBuilder is new to 1.5
cat << \EOF > conftest.java
-// #line 10857 "configure"
+// #line 10874 "configure"
import java.util.regex.Pattern;
import java.lang.StringBuilder;
# The class java.util.ArrayDeque is new to 1.6
cat << \EOF > conftest.java
-// #line 10922 "configure"
+// #line 10939 "configure"
import java.util.regex.Pattern;
import java.util.ArrayDeque;
# The class java.nio.file.Path is new to 1.7
cat << \EOF > conftest.java
-// #line 10987 "configure"
+// #line 11004 "configure"
import java.util.regex.Pattern;
import java.nio.file.Path;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 12371 "configure"
+// #line 12388 "configure"
import java.util.regex.Pattern;
import com.mxgraph.model.mxCell;
if test "x" == "x"; then
cat << \EOF > conftest.java
-// #line 12478 "configure"
+// #line 12495 "configure"
import java.util.regex.Pattern;
import com.mxgraph.view.mxGraph;
else
cat << \EOF > conftest.java
-// #line 12550 "configure"
+// #line 12567 "configure"
import java.util.regex.Pattern;
import com.mxgraph.view.mxGraph;
fi
-
- # scirenderer
+ if test "$with_embedded_scirenderer" = yes; then
+ # scirenderer
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking scirenderer" >&5
$as_echo_n "checking scirenderer... " >&6; }
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 12644 "configure"
+// #line 12661 "configure"
import java.util.regex.Pattern;
import org.scilab.forge.scirenderer.PackageInfo;
fi
fi
- SCIRENDERER=$PACKAGE_JAR_FILE
-
+ SCIRENDERER=$PACKAGE_JAR_FILE
+ SCIRENDERER_CP=$PACKAGE_JAR_FILE
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking minimal version (1.1.0) of scirenderer" >&5
if test "x" == "x"; then
cat << \EOF > conftest.java
-// #line 12751 "configure"
+// #line 12768 "configure"
import java.util.regex.Pattern;
import org.scilab.forge.scirenderer.PackageInfo;
else
cat << \EOF > conftest.java
-// #line 12823 "configure"
+// #line 12840 "configure"
import java.util.regex.Pattern;
import org.scilab.forge.scirenderer.PackageInfo;
fi
ac_java_classpath=$saved_ac_java_classpath
+ else
+ echo "Use embedded version of scirenderer"
+ # Use the scirenderer in Scilab sources
+ SCIRENDERER="\${modules.dir}/scirenderer/\${build.jar.dir}/scirenderer.jar"
+ SCIRENDERER_CP="\$SCILAB/modules/scirenderer/jar/scirenderer.jar"
+ fi
+
+
# Docking system
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 12914 "configure"
+// #line 12939 "configure"
import java.util.regex.Pattern;
import org.flexdock.docking.DockingManager;
if test "x" == "x"; then
cat << \EOF > conftest.java
-// #line 13021 "configure"
+// #line 13046 "configure"
import java.util.regex.Pattern;
import org.flexdock.util.Utilities;
else
cat << \EOF > conftest.java
-// #line 13093 "configure"
+// #line 13118 "configure"
import java.util.regex.Pattern;
import org.flexdock.util.Utilities;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 13184 "configure"
+// #line 13209 "configure"
import java.util.regex.Pattern;
import com.jgoodies.looks.common.MenuItemRenderer;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 13301 "configure"
+// #line 13326 "configure"
import java.util.regex.Pattern;
import com.jgoodies.looks.common.MenuItemRenderer;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 13419 "configure"
+// #line 13444 "configure"
import java.util.regex.Pattern;
import com.l2fprod.util.AccessUtils;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 13536 "configure"
+// #line 13561 "configure"
import java.util.regex.Pattern;
import javax.media.opengl.glu.GLUnurbs;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 13759 "configure"
+// #line 13784 "configure"
import java.util.regex.Pattern;
import jogamp.common.os.MachineDescriptionRuntime;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 13933 "configure"
+// #line 13958 "configure"
import java.util.regex.Pattern;
import javax.help.JHelp;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 14050 "configure"
+// #line 14075 "configure"
import java.util.regex.Pattern;
import javax.help.JHelp;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 14168 "configure"
+// #line 14193 "configure"
import java.util.regex.Pattern;
import com.artenum.rosetta.interfaces.core.ConsoleConfiguration;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 14283 "configure"
+// #line 14308 "configure"
import java.util.regex.Pattern;
import com.artenum.rosetta.interfaces.core.ConsoleConfiguration;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 14401 "configure"
+// #line 14426 "configure"
import java.util.regex.Pattern;
import com.artenum.rosetta.core.action.AbstractConsoleAction;
if test "x" == "x"; then
cat << \EOF > conftest.java
-// #line 14507 "configure"
+// #line 14532 "configure"
import java.util.regex.Pattern;
import com.artenum.rosetta.util.ConfigurationBuilder;
else
cat << \EOF > conftest.java
-// #line 14579 "configure"
+// #line 14604 "configure"
import java.util.regex.Pattern;
import com.artenum.rosetta.util.ConfigurationBuilder;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 14672 "configure"
+// #line 14697 "configure"
import java.util.regex.Pattern;
import net.sourceforge.jeuclid.LayoutContext;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 14791 "configure"
+// #line 14816 "configure"
import java.util.regex.Pattern;
import org.apache.fop.pdf.PDFInfo;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 14908 "configure"
+// #line 14933 "configure"
import java.util.regex.Pattern;
import org.apache.batik.parser.Parser;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 15025 "configure"
+// #line 15050 "configure"
import java.util.regex.Pattern;
import org.apache.batik.parser.Parser;
if test "x" == "x"; then
cat << \EOF > conftest.java
-// #line 15132 "configure"
+// #line 15157 "configure"
import java.util.regex.Pattern;
import org.apache.batik.Version;
else
cat << \EOF > conftest.java
-// #line 15204 "configure"
+// #line 15229 "configure"
import java.util.regex.Pattern;
import org.apache.batik.Version;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 15295 "configure"
+// #line 15320 "configure"
import java.util.regex.Pattern;
import org.apache.commons.io.output.CountingOutputStream;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 15412 "configure"
+// #line 15437 "configure"
import java.util.regex.Pattern;
import org.apache.xmlgraphics.util.Service;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 15529 "configure"
+// #line 15554 "configure"
import java.util.regex.Pattern;
import org.apache.avalon.framework.configuration.ConfigurationException;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 15646 "configure"
+// #line 15671 "configure"
import java.util.regex.Pattern;
import org.w3c.dom.svg.SVGDocument;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 15763 "configure"
+// #line 15788 "configure"
import java.util.regex.Pattern;
import org.w3c.dom.svg.SVGDocument;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 15884 "configure"
+// #line 15909 "configure"
import java.util.regex.Pattern;
import org.apache.commons.logging.LogFactory;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 16001 "configure"
+// #line 16026 "configure"
import java.util.regex.Pattern;
import org.scilab.forge.jlatexmath.TeXFormula;
if test "x" == "x"; then
cat << \EOF > conftest.java
-// #line 16108 "configure"
+// #line 16133 "configure"
import java.util.regex.Pattern;
import org.scilab.forge.jlatexmath.TeXFormula;
else
cat << \EOF > conftest.java
-// #line 16180 "configure"
+// #line 16205 "configure"
import java.util.regex.Pattern;
import org.scilab.forge.jlatexmath.TeXFormula;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 16277 "configure"
+// #line 16302 "configure"
import java.util.regex.Pattern;
import com.puppycrawl.tools.checkstyle.CheckStyleTask;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 16394 "configure"
+// #line 16419 "configure"
import java.util.regex.Pattern;
import org.apache.commons.beanutils.Converter;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 16511 "configure"
+// #line 16536 "configure"
import java.util.regex.Pattern;
import antlr.TokenStreamException;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 16628 "configure"
+// #line 16653 "configure"
import java.util.regex.Pattern;
import org.junit.Assert;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 16745 "configure"
+// #line 16770 "configure"
import java.util.regex.Pattern;
import net.sourceforge.cobertura.merge.Main;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 16862 "configure"
+// #line 16887 "configure"
import java.util.regex.Pattern;
import org.objectweb.asm.Type;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 16978 "configure"
+// #line 17003 "configure"
import java.util.regex.Pattern;
import org.objectweb.asm.Type;
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if tcl is version $CHK_TCL_MAJOR.$CHK_TCL_MINOR or later" >&5
$as_echo_n "checking if tcl is version $CHK_TCL_MAJOR.$CHK_TCL_MINOR or later... " >&6; }
cat > conftest.$ac_ext <<EOF
-#line 25206 "configure"
+#line 25231 "configure"
#include "confdefs.h"
#include "$CHK_TCL_INCLUDE_PATH/$CHK_TCL_INC_NAME"
$as_echo_n "checking if tk is version $CHK_TK_MAJOR.$CHK_TK_MINOR or later... " >&6; }
cat > conftest.$ac_ext <<EOF
-#line 25516 "configure"
+#line 25541 "configure"
#include "confdefs.h"
#include "$CHK_TK_INCLUDE_PATH/$CHK_TK_INC_NAME"
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 26094 "configure"
+// #line 26119 "configure"
import java.util.regex.Pattern;
import com.icl.saxon.Loader;
export ac_java_classpath="$jar_resolved:$ac_java_classpath"
cat << \EOF > conftest.java
-// #line 26211 "configure"
+// #line 26236 "configure"
import java.util.regex.Pattern;
import org.scilab.forge.jlatexmath.fop.JLaTeXMathObj;
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 32639 "configure"
+#line 32664 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 32745 "configure"
+#line 32770 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
# The Java detection is done after in this file.
#################
+## scirenderer
+#################
+
+AC_ARG_WITH(embedded-scirenderer,
+ AC_HELP_STRING([--without-embedded-scirenderer],[Disable the usage of the internal copy of scirenderer. Intended for packaging of Scilab]))
+
+
+#################
## XCOS
#################
fi
-
- # scirenderer
- AC_JAVA_CHECK_PACKAGE([scirenderer],[org.scilab.forge.scirenderer.PackageInfo],[Scilab Renderer])
- SCIRENDERER=$PACKAGE_JAR_FILE
+ if test "$with_embedded_scirenderer" = yes; then
+ # scirenderer
+ AC_JAVA_CHECK_PACKAGE([scirenderer],[org.scilab.forge.scirenderer.PackageInfo],[Scilab Renderer])
+ SCIRENDERER=$PACKAGE_JAR_FILE
+ SCIRENDERER_CP=$PACKAGE_JAR_FILE
+
+ AC_JAVA_CHECK_VERSION_PACKAGE([scirenderer],[import org.scilab.forge.scirenderer.PackageInfo;],$SCIRENDERER,[1.1.0],[PackageInfo.VERSION])
+ else
+ echo "Use embedded version of scirenderer"
+ # Use the scirenderer in Scilab sources
+ SCIRENDERER="\${modules.dir}/scirenderer/\${build.jar.dir}/scirenderer.jar"
+ SCIRENDERER_CP="\$SCILAB/modules/scirenderer/jar/scirenderer.jar"
+ fi
AC_SUBST(SCIRENDERER)
-
- AC_JAVA_CHECK_VERSION_PACKAGE([scirenderer],[import org.scilab.forge.scirenderer.PackageInfo;],$SCIRENDERER,[1.1.0],[PackageInfo.VERSION])
+ AC_SUBST(SCIRENDERER_CP)
# Docking system
AC_JAVA_CHECK_PACKAGE([flexdock],[org.flexdock.docking.DockingManager],[Scilab Gui])
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
<load on="documentationGeneration"/>
</path>
-<path value="@SCIRENDERER@" load="onUse">
+<path value="@SCIRENDERER_CP@" load="onUse">
<load on="graphics"/>
<load on="graphic_ojects"/>
<load on="Xcos"/>
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
*
-->
<project default="all" name="build-all-jar">
- <!-- Call World
+ <!-- Call World
The main idea is to build at once all the var files
-->
- <property name="target-jar" value="jar"/>
- <property file="../../scilab-lib.properties"/>
-
- <!-- Order matter : fixed order to avoid dependency handling-->
- <target name="all" depends="localization, commons, history_manager, jvm, action_binding, graphic_objects, completion, console, renderer, graphic_export, gui, core, helptools, types, scinotes, ui_data, history_browser, javasci, graph, xcos, preferences" />
- <target name="clean">
- <antcall target="all">
- <param name="target-jar" value="clean"/>
- </antcall>
- </target>
- <target name="test"/>
-
- <target name="action_binding">
- <ant antfile="../action_binding/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="commons">
- <ant antfile="../commons/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="completion">
- <ant antfile="../completion/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="console">
- <ant antfile="../console/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="core">
- <ant antfile="../core/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="graph">
- <ant antfile="../graph/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="graphic_export">
- <ant antfile="../graphic_export/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="graphic_objects">
- <ant antfile="../graphic_objects/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="gui">
- <ant antfile="../gui/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="helptools">
- <ant antfile="../helptools/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="history_browser">
- <ant antfile="../history_browser/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="history_manager">
- <ant antfile="../history_manager/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="javasci" if="build_javasci">
- <ant antfile="../javasci/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="jvm">
- <ant antfile="../jvm/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="localization">
- <ant antfile="../localization/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="output_stream">
- <ant antfile="../output_stream/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="renderer">
- <ant antfile="../renderer/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="scinotes">
- <ant antfile="../scinotes/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="types">
- <ant antfile="../types/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="ui_data">
- <ant antfile="../ui_data/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="xcos" if="build_xcos" depends="javasci">
- <ant antfile="../xcos/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
- <target name="preferences">
- <ant antfile="../preferences/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
- </target>
+ <property name="target-jar" value="jar"/>
+ <property file="../../scilab-lib.properties"/>
+
+ <!-- Order matter : fixed order to avoid dependency handling-->
+ <target name="all" depends="scirenderer, localization, commons, history_manager, jvm, action_binding, graphic_objects, completion, console, renderer, graphic_export, gui, core, helptools, types, scinotes, ui_data, history_browser, javasci, graph, xcos, preferences" />
+ <target name="clean">
+ <antcall target="all">
+ <param name="target-jar" value="clean"/>
+ </antcall>
+ </target>
+ <target name="test"/>
+
+ <target name="scirenderer">
+ <condition property="thirdparty.dir" value="../../thirdparty/">
+ <os family="windows"/>
+ </condition>
+ <ant antfile="../scirenderer/build.xml" target="${target-jar}" useNativeBasedir="true" inheritAll="false">
+ <property name="fromScilab" value="yes"/>
+
+ </ant>
+ </target>
+
+ <target name="action_binding">
+ <ant antfile="../action_binding/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="commons">
+ <ant antfile="../commons/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="completion">
+ <ant antfile="../completion/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="console">
+ <ant antfile="../console/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="core">
+ <ant antfile="../core/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="graph">
+ <ant antfile="../graph/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="graphic_export">
+ <ant antfile="../graphic_export/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="graphic_objects">
+ <ant antfile="../graphic_objects/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="gui">
+ <ant antfile="../gui/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="helptools">
+ <ant antfile="../helptools/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="history_browser">
+ <ant antfile="../history_browser/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="history_manager">
+ <ant antfile="../history_manager/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="javasci" if="build_javasci">
+ <ant antfile="../javasci/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="jvm">
+ <ant antfile="../jvm/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="localization">
+ <ant antfile="../localization/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="output_stream">
+ <ant antfile="../output_stream/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="renderer">
+ <ant antfile="../renderer/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="scinotes">
+ <ant antfile="../scinotes/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="types">
+ <ant antfile="../types/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="ui_data">
+ <ant antfile="../ui_data/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="xcos" if="build_xcos" depends="javasci">
+ <ant antfile="../xcos/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
+ <target name="preferences">
+ <ant antfile="../preferences/build.xml" target="${target-jar}" inheritRefs="false" inheritAll="false" />
+ </target>
</project>
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@
SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@
SCIRENDERER = @SCIRENDERER@
+SCIRENDERER_CP = @SCIRENDERER_CP@
SCI_CFLAGS = @SCI_CFLAGS@
SCI_CXXFLAGS = @SCI_CXXFLAGS@
SCI_FFLAGS = @SCI_FFLAGS@
--- /dev/null
+
+# Java stuff
+*.class
+*.jar
+docs
+
+# C/C++ stuff
+*.[oa]
+*.so
+*.dll
+*.lib
+*.exp
+*.ilk
+*.def
+*.mak
+*.obj
+
+# other
+*~
+*.log
+*.iml
+.idea
+loader.sce
+cleaner.sce
+loader_gateway.sce
+cleaner_gateway.sce
--- /dev/null
+scirenderer has been mainly developped by Pierre Lando <pierre.lando@scilab.org>
+
+Many others contributed to this project:
+ - Bruno JOFRET <bruno.jofret@scilab-enterprises.com>
+ - Manuel Juliachs <manuel.juliachs@scilab.org>
+ - Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com>
+ - ...
+
--- /dev/null
+scirenderer (1.1.0)
+
+ * Fix bad subticks number.
+
+ * Draw the last tick.
+
+ * Avoid to return subtick when no ticks defined.
+
+scirenderer (1.0.9)
+
+ * Return all subticks when defined by their numbers
+
+ -- Calixte DENIZET <calixte.denizet@scilab-enterprises.com> Thu, 28 Mar 2013 10:33:28 +0100
+
+scirenderer (1.0.8)
+
+ * Bug #12289 fixed: sub_ticks property was ignored.
+ * Bug #12405 fixed: Floating point errors could lead to an infinite loop
+ in ticks computation.
+
+ -- Calixte DENIZET <calixte.denizet@scilab-enterprises.com> Wed, 27 Mar 2013 09:11:22 +0100
+
+scirenderer (1.0.7)
+
+ * Can change the graphics2D on export
+ * Bug #11982 fixed - Ticks computations were made when drawing.
+ * Legends were not drawn
+ * Bug #12398 fixed: dotted lines were displayed as plain lines.
+ * Fix various issues in the export
+
+ -- Calixte DENIZET <calixte.denizet@scilab-enterprises.com> Fri, 15 Mar 2013 15:10:40 +0100
+
+scirenderer (1.0.6)
+
+ * Improve memory management on export.
+ * Bug #2547 fixed - Too small marks were not correctly rendered in vectorial export.
+ * Bug #11407 fixed - Exception with dashed line with numm thickness.
+ * Bug #12051 fixed - Legends were not correctly exported.
+ * Fix bugs (line width and line style) on export.
+ * Bug #10633 fixed - Exported graphics were mirrored on some graphics cards.
+ * Bug #11399 fixed - 2D plot with small axes were slanted.
+ * Bug #12250 fixed - Export functions could be called before the graph was really built.
+
+ -- Calixte DENIZET <calixte.denizet@scilab-enterprises.com> Tue, 19 Feb 2013 13:04:58 +0100
+
+scirenderer (1.0.5)
+
+ * Avoid "UnsupportedOperationException" when clearing ticks
+ * Avoid "ConcurrentAccessException" when disposing OneShotRuler resources.
+ * Fix export problems.
+ * Bug #11791 fixed - Avoid to bind empty buffers.
+
+ -- Calixte DENIZET <calixte.denizet@scilab-enterprises.com> Fri, 18 Jan 2013 08:59:49 +0100
+
+scirenderer (1.0.4)
+
+ * Fix for bug 11477: textures were not correctly delete.
+ * Export: Remove artefacts and draw correctly segments on surface
+ * Avoid to draw empty buffers
+
+ -- Calixte DENIZET <calixte.denizet@scilab-enterprises.com> Wed, 09 Jan 2013 11:07:49 +0100
+
+scirenderer (1.0.3)
+
+ * Fix for Scilab's bug 11947: texture was not correctly scaled
+ * Add a synchronous draw method for Scilab drawlater/drawnow
+ * Remove memory leaks
+
+ [ Sylvestre Ledru ]
+ * The scirenderer jar was containing the examples (but not documented in
+ it usages)
+
+ -- Calixte DENIZET <calixte.denizet@scilab-enterprises.com> Wed, 19 Dec 2012 15:27:40 +0100
+
+scirenderer (1.0.2)
+
+ * Fix a problem with the memory cleaning with the Scilab graphic export.
+
+ -- Bruno Jofret <bruno.jofret@scilab-enterprises.com> Wed, 26 Sep 2012 12:12:22 +0200
+
+scirenderer (1.0.1)
+
+ * Remove unused import.
+ * Clear Raw Memory direct buffer.
+
+ -- Bruno Jofret <bruno.jofret@scilab-enterprises.com> Tue, 25 Sep 2012 14:50:27 +0200
+
+scirenderer (1.0.0)
+
+ * Force ticks/grid margin to avoid big display density on small figures.
+ * Limit Graduations values to be within Double precision.
+
+ -- Bruno Jofret <bruno.jofret@scilab-enterprises.com> Mon, 24 Sep 2012 16:03:12 +0200
+
+scirenderer (0.5.8)
+
+ * Fix bug with NaN values when export
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Tue, 04 Sep 2012 10:54:11 +0200
+
+scirenderer (0.5.7)
+
+ * Fix a bug on the export of boxes in the 2d export.
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Thu, 30 Aug 2012 09:22:39 +0200
+
+scirenderer (0.5.6)
+
+ * Fix crash on scilab -nw -e 'plot3d();exit' (See Scilab bug #11508)
+ * Check correctly the vbo availability
+ * Improve graypolarplot rendering (and make it available in SVG and PDF)
+ * Remove blue dashed line in 2D export
+ * Fix bugs on Scilab's surf() export
+
+ [ Sylvestre Ledru ]
+ * Silent the serial warnings at compilation time
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Sat, 04 Aug 2012 10:53:49 +0200
+
+scirenderer (0.5.5)
+
+ * Fix a problem of display with the marks
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Wed, 01 Aug 2012 15:10:47 +0200
+
+scirenderer (0.5.4)
+
+ * Fix a color problem with sgrayplot on Scilab
+ * Fix a bug on texture rendering, when plot2d() was rotated
+ * Remove gray background in legends
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Mon, 30 Jul 2012 16:23:44 +0200
+
+scirenderer (0.5.3)
+
+ * Revert the "scilab -nw -e 'plot3d();exit'" patch. It was causing some
+ issues in Javasci
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Mon, 30 Jul 2012 16:23:44 +0200
+
+scirenderer (0.5.2)
+
+ * Improve performances (390 => 24 seconds) on
+ stacksize("max");a=rand(1,5000000);b=rand(a);tic();plot2d(a,b,-4);toc()
+ in Scilab
+ * Fix crash on scilab -nw -e 'plot3d();exit' (See Scilab bug #11508)
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Mon, 30 Jul 2012 15:18:01 +0200
+
+scirenderer (0.5.1)
+
+ * Fix some antialiasing issues under some operating systems.
+ * Fix ticks precision on small/huge inner values.
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Sun, 15 Jul 2012 23:06:10 +0200
+
+scirenderer (0.5.0)
+
+ * Fix a Null Pointer Exception when doing in Scilab:
+ driver('png');xinit('/tmp/foo.png');errbar();xend()
+ * G2D export: Improve speed of 2D offscreen export
+ * Export: avoid memleaks
+ * Fix for Scilab bug #11407: Exception with lineWidth lower than 1 with
+ offscreen export
+ * Avoid a java.nio.BufferUnderflowException on offscreen export
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Mon, 09 Jul 2012 09:23:39 -0600
+
+scirenderer (0.4.9)
+
+ * User defined ticks rendering issue fixed (Regression introduced in version 0.4.8)
+ * Transparency managed using alpha channel
+
+ -- Vincent Couvert <vincent.couvert@scilab.org> Wed, 20 Jun 2012 21:30:46 (UTC+0200)
+
+scirenderer (0.4.8)
+
+ * Figures were not reset when using clf() (See Scilab bug #11268)
+ * Objects ordering was wrong when drawing rectangles and polylines (See Scilab bug #11271)
+ * Ticks rendering speed up using Java cached values
+
+ -- Vincent Couvert <vincent.couvert@scilab.org> Wed, 20 Jun 2012 12:21:46 (UTC+0200)
+
+scirenderer (0.4.7)
+
+ * Ticks labels were truncated (See Scilab bug #11238)
+ * Thickness property was not managed for Axes objects
+ * Threads were not killed in canvas animator
+
+ -- Vincent Couvert <vincent.couvert@scilab.org> Thu, 12 Jun 2012 16:22:27 (UTC+0200)
+
+scirenderer (0.4.6)
+
+ * Fix a problem with the drawlater
+ * Add used DecimalFormat in RulerDrawingResult
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Fri, 08 Jun 2012 08:55:57 +0200
+
+scirenderer (0.4.5)
+
+ * Bad position for rotated labels fixed
+ * Fix a crash when playing with export with legends
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Tue, 22 May 2012 15:04:47 +0200
+
+scirenderer (0.4.4)
+
+ * Plug anti-aliasing capabilities.
+
+ -- Vincent Couvert <vincent.couvert@scilab.org> Wed 16 May 2012, 11:40:27 (UTC+0200)
+
+scirenderer (0.4.3)
+
+ * Fix a problem in canvas.waitEndOfDrawing() (Needed for Scilab drawlater/drawnow)
+
+ -- Vincent Couvert <vincent.couvert@scilab.org> Fri 11 May 2012 15:55:43 (UTC+0200)
+
+scirenderer (0.4.2)
+
+ * Canvas redrawing was synchronous and lead to performances issues: now redrawing in asynchronous.
+ * Add a waitImage() method for canvas to synchronously wait an image to be drawn.
+
+ -- Vincent Couvert <vincent.couvert@scilab.org> Thu 10 May 2012 15:01:22 (UTC+0200)
+
+scirenderer (0.4.1)
+
+ * Disable DEBUG mode & add a setter to enable debug mode
+
+ [ Sylvestre Ledru ]
+ * Show warnings at build time
+ * Various improvements on the jar
+ * Add a manifest to avoid load of jogl.jar
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Thu, 19 Apr 2012 14:16:08 +0200
+
+scirenderer (0.4.0)
+
+ * Moved to jogl2
+ * Improve the detection of the VBO. See Scilab bug #10996
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Sun, 15 Apr 2012 17:22:49 +0200
+
+scirenderer (0.3.5)
+
+ * Graphic export added
+
+ -- Calixte Denizet <calixte.denizet@scilab-enterprises.com> Tue, 10 Apr 2012 17:22:49 +0200
+
+scirenderer (0.3.4)
+
+ * More examples/demos
+ * Comments of the code
+ * Coding style
+ * More documentations in the source code
+
+ [ Sylvestre Ledru ]
+ * ant clean really cleans everything
+
+ -- Pierre Lando <pierre.lando@scilab.org> Fri, 02 Mar 2012 16:43:42 +0100
+
+scirenderer (0.3.3)
+
+ * Allow texture rendering
+
+ [ Sylvestre Ledru ]
+ * "ant javadoc" target added
+ * "ant all" target added
+ * AUTHORS CHANGES COPYING COPYING-FR README files added
+
+ -- Bruno JOFRET <bruno.jofret@scilab-enterprises.com> Sat, 18 Feb 2012 12:33:46 +0100
+
+scirenderer (0.3.2)
+
+ * Ticks distance fixed to have more readable ticks
+ * Fix update on OpenGL clipping plane.
+
+ -- Bruno JOFRET <bruno.jofret@scilab-enterprises.com> Sat, 18 Feb 2012 12:33:46 +0100
+
+scirenderer (0.3.0)
+
+ * Logarithmic Ruler added
+ * Avoid duplicate FloatBuffer when not needed
+ * Add Latex rendering
+
+ -- Bruno JOFRET <bruno.jofret@scilab-enterprises.com> Sat, 18 Feb 2012 12:33:46 +0100
--- /dev/null
+
+CeCILL FREE SOFTWARE LICENSE AGREEMENT
+
+
+ Notice
+
+This Agreement is a Free Software license agreement that is the result
+of discussions between its authors in order to ensure compliance with
+the two main principles guiding its drafting:
+
+ * firstly, compliance with the principles governing the distribution
+ of Free Software: access to source code, broad rights granted to
+ users,
+ * secondly, the election of a governing law, French law, with which
+ it is conformant, both as regards the law of torts and
+ intellectual property law, and the protection that it offers to
+ both authors and holders of the economic rights over software.
+
+The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre])
+license are:
+
+Commissariat à l'Energie Atomique - CEA, a public scientific, technical
+and industrial research establishment, having its principal place of
+business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France.
+
+Centre National de la Recherche Scientifique - CNRS, a public scientific
+and technological establishment, having its principal place of business
+at 3 rue Michel-Ange, 75794 Paris cedex 16, France.
+
+Institut National de Recherche en Informatique et en Automatique -
+INRIA, a public scientific and technological establishment, having its
+principal place of business at Domaine de Voluceau, Rocquencourt, BP
+105, 78153 Le Chesnay cedex, France.
+
+
+ Preamble
+
+The purpose of this Free Software license agreement is to grant users
+the right to modify and redistribute the software governed by this
+license within the framework of an open source distribution model.
+
+The exercising of these rights is conditional upon certain obligations
+for users so as to preserve this status for all subsequent redistributions.
+
+In consideration of access to the source code and the rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty and the software's author, the holder of the
+economic rights, and the successive licensors only have limited liability.
+
+In this respect, the risks associated with loading, using, modifying
+and/or developing or reproducing the software by the user are brought to
+the user's attention, given its Free Software status, which may make it
+complicated to use, with the result that its use is reserved for
+developers and experienced professionals having in-depth computer
+knowledge. Users are therefore encouraged to load and test the
+suitability of the software as regards their requirements in conditions
+enabling the security of their systems and/or data to be ensured and,
+more generally, to use and operate it in the same conditions of
+security. This Agreement may be freely reproduced and published,
+provided it is not altered, and that no provisions are either added or
+removed herefrom.
+
+This Agreement may apply to any or all software for which the holder of
+the economic rights decides to submit the use thereof to its provisions.
+
+
+ Article 1 - DEFINITIONS
+
+For the purpose of this Agreement, when the following expressions
+commence with a capital letter, they shall have the following meaning:
+
+Agreement: means this license agreement, and its possible subsequent
+versions and annexes.
+
+Software: means the software in its Object Code and/or Source Code form
+and, where applicable, its documentation, "as is" when the Licensee
+accepts the Agreement.
+
+Initial Software: means the Software in its Source Code and possibly its
+Object Code form and, where applicable, its documentation, "as is" when
+it is first distributed under the terms and conditions of the Agreement.
+
+Modified Software: means the Software modified by at least one
+Contribution.
+
+Source Code: means all the Software's instructions and program lines to
+which access is required so as to modify the Software.
+
+Object Code: means the binary files originating from the compilation of
+the Source Code.
+
+Holder: means the holder(s) of the economic rights over the Initial
+Software.
+
+Licensee: means the Software user(s) having accepted the Agreement.
+
+Contributor: means a Licensee having made at least one Contribution.
+
+Licensor: means the Holder, or any other individual or legal entity, who
+distributes the Software under the Agreement.
+
+Contribution: means any or all modifications, corrections, translations,
+adaptations and/or new functions integrated into the Software by any or
+all Contributors, as well as any or all Internal Modules.
+
+Module: means a set of sources files including their documentation that
+enables supplementary functions or services in addition to those offered
+by the Software.
+
+External Module: means any or all Modules, not derived from the
+Software, so that this Module and the Software run in separate address
+spaces, with one calling the other when they are run.
+
+Internal Module: means any or all Module, connected to the Software so
+that they both execute in the same address space.
+
+GNU GPL: means the GNU General Public License version 2 or any
+subsequent version, as published by the Free Software Foundation Inc.
+
+Parties: mean both the Licensee and the Licensor.
+
+These expressions may be used both in singular and plural form.
+
+
+ Article 2 - PURPOSE
+
+The purpose of the Agreement is the grant by the Licensor to the
+Licensee of a non-exclusive, transferable and worldwide license for the
+Software as set forth in Article 5 hereinafter for the whole term of the
+protection granted by the rights over said Software.
+
+
+ Article 3 - ACCEPTANCE
+
+3.1 The Licensee shall be deemed as having accepted the terms and
+conditions of this Agreement upon the occurrence of the first of the
+following events:
+
+ * (i) loading the Software by any or all means, notably, by
+ downloading from a remote server, or by loading from a physical
+ medium;
+ * (ii) the first time the Licensee exercises any of the rights
+ granted hereunder.
+
+3.2 One copy of the Agreement, containing a notice relating to the
+characteristics of the Software, to the limited warranty, and to the
+fact that its use is restricted to experienced users has been provided
+to the Licensee prior to its acceptance as set forth in Article 3.1
+hereinabove, and the Licensee hereby acknowledges that it has read and
+understood it.
+
+
+ Article 4 - EFFECTIVE DATE AND TERM
+
+
+ 4.1 EFFECTIVE DATE
+
+The Agreement shall become effective on the date when it is accepted by
+the Licensee as set forth in Article 3.1.
+
+
+ 4.2 TERM
+
+The Agreement shall remain in force for the entire legal term of
+protection of the economic rights over the Software.
+
+
+ Article 5 - SCOPE OF RIGHTS GRANTED
+
+The Licensor hereby grants to the Licensee, who accepts, the following
+rights over the Software for any or all use, and for the term of the
+Agreement, on the basis of the terms and conditions set forth hereinafter.
+
+Besides, if the Licensor owns or comes to own one or more patents
+protecting all or part of the functions of the Software or of its
+components, the Licensor undertakes not to enforce the rights granted by
+these patents against successive Licensees using, exploiting or
+modifying the Software. If these patents are transferred, the Licensor
+undertakes to have the transferees subscribe to the obligations set
+forth in this paragraph.
+
+
+ 5.1 RIGHT OF USE
+
+The Licensee is authorized to use the Software, without any limitation
+as to its fields of application, with it being hereinafter specified
+that this comprises:
+
+ 1. permanent or temporary reproduction of all or part of the Software
+ by any or all means and in any or all form.
+
+ 2. loading, displaying, running, or storing the Software on any or
+ all medium.
+
+ 3. entitlement to observe, study or test its operation so as to
+ determine the ideas and principles behind any or all constituent
+ elements of said Software. This shall apply when the Licensee
+ carries out any or all loading, displaying, running, transmission
+ or storage operation as regards the Software, that it is entitled
+ to carry out hereunder.
+
+
+ 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS
+
+The right to make Contributions includes the right to translate, adapt,
+arrange, or make any or all modifications to the Software, and the right
+to reproduce the resulting software.
+
+The Licensee is authorized to make any or all Contributions to the
+Software provided that it includes an explicit notice that it is the
+author of said Contribution and indicates the date of the creation thereof.
+
+
+ 5.3 RIGHT OF DISTRIBUTION
+
+In particular, the right of distribution includes the right to publish,
+transmit and communicate the Software to the general public on any or
+all medium, and by any or all means, and the right to market, either in
+consideration of a fee, or free of charge, one or more copies of the
+Software by any means.
+
+The Licensee is further authorized to distribute copies of the modified
+or unmodified Software to third parties according to the terms and
+conditions set forth hereinafter.
+
+
+ 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
+
+The Licensee is authorized to distribute true copies of the Software in
+Source Code or Object Code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's
+ warranty and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the Object Code of the Software is
+redistributed, the Licensee allows future Licensees unhindered access to
+the full Source Code of the Software by indicating how to access it, it
+being understood that the additional cost of acquiring the Source Code
+shall not exceed the cost of transferring the data.
+
+
+ 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
+
+When the Licensee makes a Contribution to the Software, the terms and
+conditions for the distribution of the resulting Modified Software
+become subject to all the provisions of this Agreement.
+
+The Licensee is authorized to distribute the Modified Software, in
+source code or object code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's
+ warranty and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the object code of the Modified
+Software is redistributed, the Licensee allows future Licensees
+unhindered access to the full source code of the Modified Software by
+indicating how to access it, it being understood that the additional
+cost of acquiring the source code shall not exceed the cost of
+transferring the data.
+
+
+ 5.3.3 DISTRIBUTION OF EXTERNAL MODULES
+
+When the Licensee has developed an External Module, the terms and
+conditions of this Agreement do not apply to said External Module, that
+may be distributed under a separate license agreement.
+
+
+ 5.3.4 COMPATIBILITY WITH THE GNU GPL
+
+The Licensee can include a code that is subject to the provisions of one
+of the versions of the GNU GPL in the Modified or unmodified Software,
+and distribute that entire code under the terms of the same version of
+the GNU GPL.
+
+The Licensee can include the Modified or unmodified Software in a code
+that is subject to the provisions of one of the versions of the GNU GPL,
+and distribute that entire code under the terms of the same version of
+the GNU GPL.
+
+
+ Article 6 - INTELLECTUAL PROPERTY
+
+
+ 6.1 OVER THE INITIAL SOFTWARE
+
+The Holder owns the economic rights over the Initial Software. Any or
+all use of the Initial Software is subject to compliance with the terms
+and conditions under which the Holder has elected to distribute its work
+and no one shall be entitled to modify the terms and conditions for the
+distribution of said Initial Software.
+
+The Holder undertakes that the Initial Software will remain ruled at
+least by this Agreement, for the duration set forth in Article 4.2.
+
+
+ 6.2 OVER THE CONTRIBUTIONS
+
+The Licensee who develops a Contribution is the owner of the
+intellectual property rights over this Contribution as defined by
+applicable law.
+
+
+ 6.3 OVER THE EXTERNAL MODULES
+
+The Licensee who develops an External Module is the owner of the
+intellectual property rights over this External Module as defined by
+applicable law and is free to choose the type of agreement that shall
+govern its distribution.
+
+
+ 6.4 JOINT PROVISIONS
+
+The Licensee expressly undertakes:
+
+ 1. not to remove, or modify, in any manner, the intellectual property
+ notices attached to the Software;
+
+ 2. to reproduce said notices, in an identical manner, in the copies
+ of the Software modified or not.
+
+The Licensee undertakes not to directly or indirectly infringe the
+intellectual property rights of the Holder and/or Contributors on the
+Software and to take, where applicable, vis-Ã -vis its staff, any and all
+measures required to ensure respect of said intellectual property rights
+of the Holder and/or Contributors.
+
+
+ Article 7 - RELATED SERVICES
+
+7.1 Under no circumstances shall the Agreement oblige the Licensor to
+provide technical assistance or maintenance services for the Software.
+
+However, the Licensor is entitled to offer this type of services. The
+terms and conditions of such technical assistance, and/or such
+maintenance, shall be set forth in a separate instrument. Only the
+Licensor offering said maintenance and/or technical assistance services
+shall incur liability therefor.
+
+7.2 Similarly, any Licensor is entitled to offer to its licensees, under
+its sole responsibility, a warranty, that shall only be binding upon
+itself, for the redistribution of the Software and/or the Modified
+Software, under terms and conditions that it is free to decide. Said
+warranty, and the financial terms and conditions of its application,
+shall be subject of a separate instrument executed between the Licensor
+and the Licensee.
+
+
+ Article 8 - LIABILITY
+
+8.1 Subject to the provisions of Article 8.2, the Licensee shall be
+entitled to claim compensation for any direct loss it may have suffered
+from the Software as a result of a fault on the part of the relevant
+Licensor, subject to providing evidence thereof.
+
+8.2 The Licensor's liability is limited to the commitments made under
+this Agreement and shall not be incurred as a result of in particular:
+(i) loss due the Licensee's total or partial failure to fulfill its
+obligations, (ii) direct or consequential loss that is suffered by the
+Licensee due to the use or performance of the Software, and (iii) more
+generally, any consequential loss. In particular the Parties expressly
+agree that any or all pecuniary or business loss (i.e. loss of data,
+loss of profits, operating loss, loss of customers or orders,
+opportunity cost, any disturbance to business activities) or any or all
+legal proceedings instituted against the Licensee by a third party,
+shall constitute consequential loss and shall not provide entitlement to
+any or all compensation from the Licensor.
+
+
+ Article 9 - WARRANTY
+
+9.1 The Licensee acknowledges that the scientific and technical
+state-of-the-art when the Software was distributed did not enable all
+possible uses to be tested and verified, nor for the presence of
+possible defects to be detected. In this respect, the Licensee's
+attention has been drawn to the risks associated with loading, using,
+modifying and/or developing and reproducing the Software which are
+reserved for experienced users.
+
+The Licensee shall be responsible for verifying, by any or all means,
+the suitability of the product for its requirements, its good working
+order, and for ensuring that it shall not cause damage to either persons
+or properties.
+
+9.2 The Licensor hereby represents, in good faith, that it is entitled
+to grant all the rights over the Software (including in particular the
+rights set forth in Article 5).
+
+9.3 The Licensee acknowledges that the Software is supplied "as is" by
+the Licensor without any other express or tacit warranty, other than
+that provided for in Article 9.2 and, in particular, without any warranty
+as to its commercial value, its secured, safe, innovative or relevant
+nature.
+
+Specifically, the Licensor does not warrant that the Software is free
+from any error, that it will operate without interruption, that it will
+be compatible with the Licensee's own equipment and software
+configuration, nor that it will meet the Licensee's requirements.
+
+9.4 The Licensor does not either expressly or tacitly warrant that the
+Software does not infringe any third party intellectual property right
+relating to a patent, software or any other property right. Therefore,
+the Licensor disclaims any and all liability towards the Licensee
+arising out of any or all proceedings for infringement that may be
+instituted in respect of the use, modification and redistribution of the
+Software. Nevertheless, should such proceedings be instituted against
+the Licensee, the Licensor shall provide it with technical and legal
+assistance for its defense. Such technical and legal assistance shall be
+decided on a case-by-case basis between the relevant Licensor and the
+Licensee pursuant to a memorandum of understanding. The Licensor
+disclaims any and all liability as regards the Licensee's use of the
+name of the Software. No warranty is given as regards the existence of
+prior rights over the name of the Software or as regards the existence
+of a trademark.
+
+
+ Article 10 - TERMINATION
+
+10.1 In the event of a breach by the Licensee of its obligations
+hereunder, the Licensor may automatically terminate this Agreement
+thirty (30) days after notice has been sent to the Licensee and has
+remained ineffective.
+
+10.2 A Licensee whose Agreement is terminated shall no longer be
+authorized to use, modify or distribute the Software. However, any
+licenses that it may have granted prior to termination of the Agreement
+shall remain valid subject to their having been granted in compliance
+with the terms and conditions hereof.
+
+
+ Article 11 - MISCELLANEOUS
+
+
+ 11.1 EXCUSABLE EVENTS
+
+Neither Party shall be liable for any or all delay, or failure to
+perform the Agreement, that may be attributable to an event of force
+majeure, an act of God or an outside cause, such as defective
+functioning or interruptions of the electricity or telecommunications
+networks, network paralysis following a virus attack, intervention by
+government authorities, natural disasters, water damage, earthquakes,
+fire, explosions, strikes and labor unrest, war, etc.
+
+11.2 Any failure by either Party, on one or more occasions, to invoke
+one or more of the provisions hereof, shall under no circumstances be
+interpreted as being a waiver by the interested Party of its right to
+invoke said provision(s) subsequently.
+
+11.3 The Agreement cancels and replaces any or all previous agreements,
+whether written or oral, between the Parties and having the same
+purpose, and constitutes the entirety of the agreement between said
+Parties concerning said purpose. No supplement or modification to the
+terms and conditions hereof shall be effective as between the Parties
+unless it is made in writing and signed by their duly authorized
+representatives.
+
+11.4 In the event that one or more of the provisions hereof were to
+conflict with a current or future applicable act or legislative text,
+said act or legislative text shall prevail, and the Parties shall make
+the necessary amendments so as to comply with said act or legislative
+text. All other provisions shall remain effective. Similarly, invalidity
+of a provision of the Agreement, for any reason whatsoever, shall not
+cause the Agreement as a whole to be invalid.
+
+
+ 11.5 LANGUAGE
+
+The Agreement is drafted in both French and English and both versions
+are deemed authentic.
+
+
+ Article 12 - NEW VERSIONS OF THE AGREEMENT
+
+12.1 Any person is authorized to duplicate and distribute copies of this
+Agreement.
+
+12.2 So as to ensure coherence, the wording of this Agreement is
+protected and may only be modified by the authors of the License, who
+reserve the right to periodically publish updates or new versions of the
+Agreement, each with a separate number. These subsequent versions may
+address new issues encountered by Free Software.
+
+12.3 Any Software distributed under a given version of the Agreement may
+only be subsequently distributed under the same version of the Agreement
+or a subsequent version, subject to the provisions of Article 5.3.4.
+
+
+ Article 13 - GOVERNING LAW AND JURISDICTION
+
+13.1 The Agreement is governed by French law. The Parties agree to
+endeavor to seek an amicable solution to any disagreements or disputes
+that may arise during the performance of the Agreement.
+
+13.2 Failing an amicable solution within two (2) months as from their
+occurrence, and unless emergency proceedings are necessary, the
+disagreements or disputes shall be referred to the Paris Courts having
+jurisdiction, by the more diligent Party.
+
+
+Version 2.0 dated 2006-09-05.
--- /dev/null
+
+CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL
+
+
+ Avertissement
+
+Ce contrat est une licence de logiciel libre issue d'une concertation
+entre ses auteurs afin que le respect de deux grands principes préside Ã
+sa rédaction:
+
+ * d'une part, le respect des principes de diffusion des logiciels
+ libres: accès au code source, droits étendus conférés aux
+ utilisateurs,
+ * d'autre part, la désignation d'un droit applicable, le droit
+ français, auquel elle est conforme, tant au regard du droit de la
+ responsabilité civile que du droit de la propriété intellectuelle
+ et de la protection qu'il offre aux auteurs et titulaires des
+ droits patrimoniaux sur un logiciel.
+
+Les auteurs de la licence CeCILL (pour Ce[a] C[nrs] I[nria] L[ogiciel]
+L[ibre]) sont:
+
+Commissariat à l'Energie Atomique - CEA, établissement public de
+recherche à caractère scientifique, technique et industriel, dont le
+siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris.
+
+Centre National de la Recherche Scientifique - CNRS, établissement
+public à caractère scientifique et technologique, dont le siège est
+situé 3 rue Michel-Ange, 75794 Paris cedex 16.
+
+Institut National de Recherche en Informatique et en Automatique -
+INRIA, établissement public à caractère scientifique et technologique,
+dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153
+Le Chesnay cedex.
+
+
+ Préambule
+
+Ce contrat est une licence de logiciel libre dont l'objectif est de
+conférer aux utilisateurs la liberté de modification et de
+redistribution du logiciel régi par cette licence dans le cadre d'un
+modèle de diffusion en logiciel libre.
+
+L'exercice de ces libertés est assorti de certains devoirs à la charge
+des utilisateurs afin de préserver ce statut au cours des
+redistributions ultérieures.
+
+L'accessibilité au code source et les droits de copie, de modification
+et de redistribution qui en découlent ont pour contrepartie de n'offrir
+aux utilisateurs qu'une garantie limitée et de ne faire peser sur
+l'auteur du logiciel, le titulaire des droits patrimoniaux et les
+concédants successifs qu'une responsabilité restreinte.
+
+A cet égard l'attention de l'utilisateur est attirée sur les risques
+associés au chargement, à l'utilisation, à la modification et/ou au
+développement et à la reproduction du logiciel par l'utilisateur étant
+donné sa spécificité de logiciel libre, qui peut le rendre complexe Ã
+manipuler et qui le réserve donc à des développeurs ou des
+professionnels avertis possédant des connaissances informatiques
+approfondies. Les utilisateurs sont donc invités à charger et tester
+l'adéquation du logiciel à leurs besoins dans des conditions permettant
+d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus
+généralement, à l'utiliser et l'exploiter dans les mêmes conditions de
+sécurité. Ce contrat peut être reproduit et diffusé librement, sous
+réserve de le conserver en l'état, sans ajout ni suppression de clauses.
+
+Ce contrat est susceptible de s'appliquer à tout logiciel dont le
+titulaire des droits patrimoniaux décide de soumettre l'exploitation aux
+dispositions qu'il contient.
+
+
+ Article 1 - DEFINITIONS
+
+Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une
+lettre capitale, auront la signification suivante:
+
+Contrat: désigne le présent contrat de licence, ses éventuelles versions
+postérieures et annexes.
+
+Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code
+Source et le cas échéant sa documentation, dans leur état au moment de
+l'acceptation du Contrat par le Licencié.
+
+Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et
+éventuellement de Code Objet et le cas échéant sa documentation, dans
+leur état au moment de leur première diffusion sous les termes du Contrat.
+
+Logiciel Modifié: désigne le Logiciel modifié par au moins une
+Contribution.
+
+Code Source: désigne l'ensemble des instructions et des lignes de
+programme du Logiciel et auquel l'accès est nécessaire en vue de
+modifier le Logiciel.
+
+Code Objet: désigne les fichiers binaires issus de la compilation du
+Code Source.
+
+Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur
+sur le Logiciel Initial.
+
+Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le
+Contrat.
+
+Contributeur: désigne le Licencié auteur d'au moins une Contribution.
+
+Concédant: désigne le Titulaire ou toute personne physique ou morale
+distribuant le Logiciel sous le Contrat.
+
+Contribution: désigne l'ensemble des modifications, corrections,
+traductions, adaptations et/ou nouvelles fonctionnalités intégrées dans
+le Logiciel par tout Contributeur, ainsi que tout Module Interne.
+
+Module: désigne un ensemble de fichiers sources y compris leur
+documentation qui permet de réaliser des fonctionnalités ou services
+supplémentaires à ceux fournis par le Logiciel.
+
+Module Externe: désigne tout Module, non dérivé du Logiciel, tel que ce
+Module et le Logiciel s'exécutent dans des espaces d'adressage
+différents, l'un appelant l'autre au moment de leur exécution.
+
+Module Interne: désigne tout Module lié au Logiciel de telle sorte
+qu'ils s'exécutent dans le même espace d'adressage.
+
+GNU GPL: désigne la GNU General Public License dans sa version 2 ou
+toute version ultérieure, telle que publiée par Free Software Foundation
+Inc.
+
+Parties: désigne collectivement le Licencié et le Concédant.
+
+Ces termes s'entendent au singulier comme au pluriel.
+
+
+ Article 2 - OBJET
+
+Le Contrat a pour objet la concession par le Concédant au Licencié d'une
+licence non exclusive, cessible et mondiale du Logiciel telle que
+définie ci-après à l'article 5 pour toute la durée de protection des droits
+portant sur ce Logiciel.
+
+
+ Article 3 - ACCEPTATION
+
+3.1 L'acceptation par le Licencié des termes du Contrat est réputée
+acquise du fait du premier des faits suivants:
+
+ * (i) le chargement du Logiciel par tout moyen notamment par
+ téléchargement à partir d'un serveur distant ou par chargement Ã
+ partir d'un support physique;
+ * (ii) le premier exercice par le Licencié de l'un quelconque des
+ droits concédés par le Contrat.
+
+3.2 Un exemplaire du Contrat, contenant notamment un avertissement
+relatif aux spécificités du Logiciel, à la restriction de garantie et Ã
+la limitation à un usage par des utilisateurs expérimentés a été mis Ã
+disposition du Licencié préalablement à son acceptation telle que
+définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris
+connaissance.
+
+
+ Article 4 - ENTREE EN VIGUEUR ET DUREE
+
+
+ 4.1 ENTREE EN VIGUEUR
+
+Le Contrat entre en vigueur à la date de son acceptation par le Licencié
+telle que définie en 3.1.
+
+
+ 4.2 DUREE
+
+Le Contrat produira ses effets pendant toute la durée légale de
+protection des droits patrimoniaux portant sur le Logiciel.
+
+
+ Article 5 - ETENDUE DES DROITS CONCEDES
+
+Le Concédant concède au Licencié, qui accepte, les droits suivants sur
+le Logiciel pour toutes destinations et pour la durée du Contrat dans
+les conditions ci-après détaillées.
+
+Par ailleurs, si le Concédant détient ou venait à détenir un ou
+plusieurs brevets d'invention protégeant tout ou partie des
+fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas
+opposer les éventuels droits conférés par ces brevets aux Licenciés
+successifs qui utiliseraient, exploiteraient ou modifieraient le
+Logiciel. En cas de cession de ces brevets, le Concédant s'engage Ã
+faire reprendre les obligations du présent alinéa aux cessionnaires.
+
+
+ 5.1 DROIT D'UTILISATION
+
+Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant
+aux domaines d'application, étant ci-après précisé que cela comporte:
+
+ 1. la reproduction permanente ou provisoire du Logiciel en tout ou
+ partie par tout moyen et sous toute forme.
+
+ 2. le chargement, l'affichage, l'exécution, ou le stockage du
+ Logiciel sur tout support.
+
+ 3. la possibilité d'en observer, d'en étudier, ou d'en tester le
+ fonctionnement afin de déterminer les idées et principes qui sont
+ à la base de n'importe quel élément de ce Logiciel; et ceci,
+ lorsque le Licencié effectue toute opération de chargement,
+ d'affichage, d'exécution, de transmission ou de stockage du
+ Logiciel qu'il est en droit d'effectuer en vertu du Contrat.
+
+
+ 5.2 DROIT D'APPORTER DES CONTRIBUTIONS
+
+Le droit d'apporter des Contributions comporte le droit de traduire,
+d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel
+et le droit de reproduire le logiciel en résultant.
+
+Le Licencié est autorisé à apporter toute Contribution au Logiciel sous
+réserve de mentionner, de façon explicite, son nom en tant qu'auteur de
+cette Contribution et la date de création de celle-ci.
+
+
+ 5.3 DROIT DE DISTRIBUTION
+
+Le droit de distribution comporte notamment le droit de diffuser, de
+transmettre et de communiquer le Logiciel au public sur tout support et
+par tout moyen ainsi que le droit de mettre sur le marché à titre
+onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé.
+
+Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou
+non, à des tiers dans les conditions ci-après détaillées.
+
+
+ 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION
+
+Le Licencié est autorisé à distribuer des copies conformes du Logiciel,
+sous forme de Code Source ou de Code Objet, Ã condition que cette
+distribution respecte les dispositions du Contrat dans leur totalité et
+soit accompagnée:
+
+ 1. d'un exemplaire du Contrat,
+
+ 2. d'un avertissement relatif à la restriction de garantie et de
+ responsabilité du Concédant telle que prévue aux articles 8
+ et 9,
+
+et que, dans le cas où seul le Code Objet du Logiciel est redistribué,
+le Licencié permette aux futurs Licenciés d'accéder facilement au Code
+Source complet du Logiciel en indiquant les modalités d'accès, étant
+entendu que le coût additionnel d'acquisition du Code Source ne devra
+pas excéder le simple coût de transfert des données.
+
+
+ 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE
+
+Lorsque le Licencié apporte une Contribution au Logiciel, les conditions
+de distribution du Logiciel Modifié en résultant sont alors soumises Ã
+l'intégralité des dispositions du Contrat.
+
+Le Licencié est autorisé à distribuer le Logiciel Modifié, sous forme de
+code source ou de code objet, Ã condition que cette distribution
+respecte les dispositions du Contrat dans leur totalité et soit
+accompagnée:
+
+ 1. d'un exemplaire du Contrat,
+
+ 2. d'un avertissement relatif à la restriction de garantie et de
+ responsabilité du Concédant telle que prévue aux articles 8
+ et 9,
+
+et que, dans le cas où seul le code objet du Logiciel Modifié est
+redistribué, le Licencié permette aux futurs Licenciés d'accéder
+facilement au code source complet du Logiciel Modifié en indiquant les
+modalités d'accès, étant entendu que le coût additionnel d'acquisition
+du code source ne devra pas excéder le simple coût de transfert des données.
+
+
+ 5.3.3 DISTRIBUTION DES MODULES EXTERNES
+
+Lorsque le Licencié a développé un Module Externe les conditions du
+Contrat ne s'appliquent pas à ce Module Externe, qui peut être distribué
+sous un contrat de licence différent.
+
+
+ 5.3.4 COMPATIBILITE AVEC LA LICENCE GNU GPL
+
+Le Licencié peut inclure un code soumis aux dispositions d'une des
+versions de la licence GNU GPL dans le Logiciel modifié ou non et
+distribuer l'ensemble sous les conditions de la même version de la
+licence GNU GPL.
+
+Le Licencié peut inclure le Logiciel modifié ou non dans un code soumis
+aux dispositions d'une des versions de la licence GNU GPL et distribuer
+l'ensemble sous les conditions de la même version de la licence GNU GPL.
+
+
+ Article 6 - PROPRIETE INTELLECTUELLE
+
+
+ 6.1 SUR LE LOGICIEL INITIAL
+
+Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel
+Initial. Toute utilisation du Logiciel Initial est soumise au respect
+des conditions dans lesquelles le Titulaire a choisi de diffuser son
+oeuvre et nul autre n'a la faculté de modifier les conditions de
+diffusion de ce Logiciel Initial.
+
+Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi
+par le Contrat et ce, pour la durée visée à l'article 4.2.
+
+
+ 6.2 SUR LES CONTRIBUTIONS
+
+Le Licencié qui a développé une Contribution est titulaire sur celle-ci
+des droits de propriété intellectuelle dans les conditions définies par
+la législation applicable.
+
+
+ 6.3 SUR LES MODULES EXTERNES
+
+Le Licencié qui a développé un Module Externe est titulaire sur celui-ci
+des droits de propriété intellectuelle dans les conditions définies par
+la législation applicable et reste libre du choix du contrat régissant
+sa diffusion.
+
+
+ 6.4 DISPOSITIONS COMMUNES
+
+Le Licencié s'engage expressément:
+
+ 1. à ne pas supprimer ou modifier de quelque manière que ce soit les
+ mentions de propriété intellectuelle apposées sur le Logiciel;
+
+ 2. à reproduire à l'identique lesdites mentions de propriété
+ intellectuelle sur les copies du Logiciel modifié ou non.
+
+Le Licencié s'engage à ne pas porter atteinte, directement ou
+indirectement, aux droits de propriété intellectuelle du Titulaire et/ou
+des Contributeurs sur le Logiciel et à prendre, le cas échéant, Ã
+l'égard de son personnel toutes les mesures nécessaires pour assurer le
+respect des dits droits de propriété intellectuelle du Titulaire et/ou
+des Contributeurs.
+
+
+ Article 7 - SERVICES ASSOCIES
+
+7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de
+prestations d'assistance technique ou de maintenance du Logiciel.
+
+Cependant le Concédant reste libre de proposer ce type de services. Les
+termes et conditions d'une telle assistance technique et/ou d'une telle
+maintenance seront alors déterminés dans un acte séparé. Ces actes de
+maintenance et/ou assistance technique n'engageront que la seule
+responsabilité du Concédant qui les propose.
+
+7.2 De même, tout Concédant est libre de proposer, sous sa seule
+responsabilité, à ses licenciés une garantie, qui n'engagera que lui,
+lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce,
+dans les conditions qu'il souhaite. Cette garantie et les modalités
+financières de son application feront l'objet d'un acte séparé entre le
+Concédant et le Licencié.
+
+
+ Article 8 - RESPONSABILITE
+
+8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la
+faculté, sous réserve de prouver la faute du Concédant concerné, de
+solliciter la réparation du préjudice direct qu'il subirait du fait du
+Logiciel et dont il apportera la preuve.
+
+8.2 La responsabilité du Concédant est limitée aux engagements pris en
+application du Contrat et ne saurait être engagée en raison notamment:
+(i) des dommages dus à l'inexécution, totale ou partielle, de ses
+obligations par le Licencié, (ii) des dommages directs ou indirects
+découlant de l'utilisation ou des performances du Logiciel subis par le
+Licencié et (iii) plus généralement d'un quelconque dommage indirect. En
+particulier, les Parties conviennent expressément que tout préjudice
+financier ou commercial (par exemple perte de données, perte de
+bénéfices, perte d'exploitation, perte de clientèle ou de commandes,
+manque à gagner, trouble commercial quelconque) ou toute action dirigée
+contre le Licencié par un tiers, constitue un dommage indirect et
+n'ouvre pas droit à réparation par le Concédant.
+
+
+ Article 9 - GARANTIE
+
+9.1 Le Licencié reconnaît que l'état actuel des connaissances
+scientifiques et techniques au moment de la mise en circulation du
+Logiciel ne permet pas d'en tester et d'en vérifier toutes les
+utilisations ni de détecter l'existence d'éventuels défauts. L'attention
+du Licencié a été attirée sur ce point sur les risques associés au
+chargement, à l'utilisation, la modification et/ou au développement et Ã
+la reproduction du Logiciel qui sont réservés à des utilisateurs avertis.
+
+Il relève de la responsabilité du Licencié de contrôler, par tous
+moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et
+de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens.
+
+9.2 Le Concédant déclare de bonne foi être en droit de concéder
+l'ensemble des droits attachés au Logiciel (comprenant notamment les
+droits visés à l'article 5).
+
+9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le
+Concédant sans autre garantie, expresse ou tacite, que celle prévue Ã
+l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale,
+son caractère sécurisé, innovant ou pertinent.
+
+En particulier, le Concédant ne garantit pas que le Logiciel est exempt
+d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible
+avec l'équipement du Licencié et sa configuration logicielle ni qu'il
+remplira les besoins du Licencié.
+
+9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le
+Logiciel ne porte pas atteinte à un quelconque droit de propriété
+intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout
+autre droit de propriété. Ainsi, le Concédant exclut toute garantie au
+profit du Licencié contre les actions en contrefaçon qui pourraient être
+diligentées au titre de l'utilisation, de la modification, et de la
+redistribution du Logiciel. Néanmoins, si de telles actions sont
+exercées contre le Licencié, le Concédant lui apportera son aide
+technique et juridique pour sa défense. Cette aide technique et
+juridique est déterminée au cas par cas entre le Concédant concerné et
+le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage
+toute responsabilité quant à l'utilisation de la dénomination du
+Logiciel par le Licencié. Aucune garantie n'est apportée quant Ã
+l'existence de droits antérieurs sur le nom du Logiciel et sur
+l'existence d'une marque.
+
+
+ Article 10 - RESILIATION
+
+10.1 En cas de manquement par le Licencié aux obligations mises à sa
+charge par le Contrat, le Concédant pourra résilier de plein droit le
+Contrat trente (30) jours après notification adressée au Licencié et
+restée sans effet.
+
+10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé Ã
+utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les
+licences qu'il aura concédées antérieurement à la résiliation du Contrat
+resteront valides sous réserve qu'elles aient été effectuées en
+conformité avec le Contrat.
+
+
+ Article 11 - DISPOSITIONS DIVERSES
+
+
+ 11.1 CAUSE EXTERIEURE
+
+Aucune des Parties ne sera responsable d'un retard ou d'une défaillance
+d'exécution du Contrat qui serait dû à un cas de force majeure, un cas
+fortuit ou une cause extérieure, telle que, notamment, le mauvais
+fonctionnement ou les interruptions du réseau électrique ou de
+télécommunication, la paralysie du réseau liée à une attaque
+informatique, l'intervention des autorités gouvernementales, les
+catastrophes naturelles, les dégâts des eaux, les tremblements de terre,
+le feu, les explosions, les grèves et les conflits sociaux, l'état de
+guerre...
+
+11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou
+plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du
+Contrat, ne pourra en aucun cas impliquer renonciation par la Partie
+intéressée à s'en prévaloir ultérieurement.
+
+11.3 Le Contrat annule et remplace toute convention antérieure, écrite
+ou orale, entre les Parties sur le même objet et constitue l'accord
+entier entre les Parties sur cet objet. Aucune addition ou modification
+aux termes du Contrat n'aura d'effet à l'égard des Parties à moins
+d'être faite par écrit et signée par leurs représentants dûment habilités.
+
+11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat
+s'avèrerait contraire à une loi ou à un texte applicable, existants ou
+futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les
+amendements nécessaires pour se conformer à cette loi ou à ce texte.
+Toutes les autres dispositions resteront en vigueur. De même, la
+nullité, pour quelque raison que ce soit, d'une des dispositions du
+Contrat ne saurait entraîner la nullité de l'ensemble du Contrat.
+
+
+ 11.5 LANGUE
+
+Le Contrat est rédigé en langue française et en langue anglaise, ces
+deux versions faisant également foi.
+
+
+ Article 12 - NOUVELLES VERSIONS DU CONTRAT
+
+12.1 Toute personne est autorisée à copier et distribuer des copies de
+ce Contrat.
+
+12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé
+et ne peut être modifié que par les auteurs de la licence, lesquels se
+réservent le droit de publier périodiquement des mises à jour ou de
+nouvelles versions du Contrat, qui posséderont chacune un numéro
+distinct. Ces versions ultérieures seront susceptibles de prendre en
+compte de nouvelles problématiques rencontrées par les logiciels libres.
+
+12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra
+faire l'objet d'une diffusion ultérieure que sous la même version du
+Contrat ou une version postérieure, sous réserve des dispositions de
+l'article 5.3.4.
+
+
+ Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE
+
+13.1 Le Contrat est régi par la loi française. Les Parties conviennent
+de tenter de régler à l'amiable les différends ou litiges qui
+viendraient à se produire par suite ou à l'occasion du Contrat.
+
+13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter
+de leur survenance et sauf situation relevant d'une procédure d'urgence,
+les différends ou litiges seront portés par la Partie la plus diligente
+devant les Tribunaux compétents de Paris.
+
+
+Version 2.0 du 2006-09-05.
--- /dev/null
+SciRenderer is a rendering library based on JoGL.
+
+This Java API allows contructor of 2D or 3D plotting of simple 2d graph to
+complex scenes.
+
+This library has been developped by the Scilab Consortium (DIGITEO) and
+Scilab Enterprises.
+
+This library has been developed in the context of the Collaviz project
+http://www.collaviz.org/ .
+
+Collaviz is a project with the financial support of the French National
+Research Agency (ANR).
+
+This library is released under the CeCILL license. See COPYING-FR or COPYING.
+
+Source releases are prepared with:
+VERSION=1.1.0
+git archive master -o scirenderer-$VERSION.tar.gz -9 --prefix scirenderer-$VERSION/
--- /dev/null
+This is a copy of scirenderer.
+This has been done to simplify the work on scirenderer + Scilab.
+
+This copy should be the most up-to-date and synchronised regularly with scirenderer:
+http://forge.scilab.org/index.php/p/scirenderer
--- /dev/null
+<project name="scirenderer" default="jar">
+
+
+
+ <property file="scirenderer-version.properties"/>
+
+ <!-- Scirenderer is built from Scilab itself -->
+ <condition property="dependencies.prop" value="../../scilab-lib.properties">
+ <isset property="fromScilab" />
+ </condition>
+
+ <!-- Scirenderer is built as a thirdparty application -->
+ <condition property="dependencies.prop" value="scirenderer-libs.properties">
+ <not>
+ <isset property="fromScilab"/>
+ </not>
+ </condition>
+
+ <property file="${dependencies.prop}"/>
+
+ <!-- Scirenderer is built from Scilab itself -->
+ <condition property="library.name" value="scirenderer.jar">
+ <isset property="fromScilab" />
+ </condition>
+
+ <!-- Scirenderer is built as a thirdparty application -->
+ <condition property="library.name" value="scirenderer-${version}.jar">
+ <not>
+ <isset property="fromScilab"/>
+ </not>
+ </condition>
+
+ <echo message="Using:" />
+ <echo message="${jogl2.jar}"/>
+ <echo message="${gluegen2.jar}"/>
+ <echo message="${jlatexmath.jar}"/>
+
+ <description>
+ Build scirenderer
+ </description>
+
+ <!-- Where the module should be created (modules/xxx/jar) -->
+ <property name="build.jar.dir" value="jar/" />
+
+ <property name="library.jar" value="${build.jar.dir}/${library.name}" />
+ <property name="library.no-version.jar" value="${build.jar.dir}/${library.no-version.name}" />
+
+ <!-- The building directory -->
+ <property name="build.dir" location="build/"/>
+
+ <!-- The building example directory -->
+ <property name="build.example.dir" location="build-example/"/>
+
+ <!-- The building document directory -->
+ <property name="doc.dir" location="docs/"/>
+
+
+ <!-- The building test directory -->
+ <property name="build.test.dir" location="build/test"/>
+
+ <!-- Where builded classes will be generated -->
+ <property name="classes.dir" location="${build.dir}/classes" />
+
+ <!-- Where builded test classes will be generated -->
+ <property name="classes.test.dir" location="${build.test.dir}/" />
+
+ <!-- Where we store cache files -->
+ <property name="cache.dir" location="${build.dir}/cachefile" />
+
+ <!-- Where we can find the sources -->
+ <property name="src.dir" location="src/" />
+
+ <!-- Where we can find the sources -->
+ <property name="src.examples.dir" location="examples/" />
+
+ <path id="compile.classpath">
+ <pathelement location="${jogl2.jar}"/>
+ <pathelement location="${gluegen2.jar}"/>
+ <pathelement location="${jlatexmath.jar}"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${classes.test.dir}"/>
+ <mkdir dir="${build.jar.dir}"/>
+ <!-- Create the time stamp -->
+ <tstamp/>
+ </target>
+
+ <!-- Clean sources -->
+ <target name="clean" description="Clean built files" depends="clean-test">
+ <delete dir="${build.dir}"/>
+ <delete dir="${build.example.dir}"/>
+ <delete dir="${build.jar.dir}"/>
+ <delete dir="${doc.dir}"/>
+ <delete file="${library.jar}"/>
+ </target>
+
+ <!-- Clean test -->
+ <target name="clean-test" description="Clean test files">
+ <delete dir="${build.test.dir}"/>
+ </target>
+
+ <!-- Compile sources -->
+ <target name="compile" description="Build sources" depends="init">
+ <javac
+ srcdir="${src.dir}"
+ destdir="${classes.dir}"
+ classpathref="compile.classpath"
+ deprecation="on"
+ debug="off"
+ verbose="off"
+ listfiles="on"
+ includeAntRuntime="no"
+ source="6"
+ target="6"
+ >
+ <compilerarg value="-Xlint"/>
+ </javac>
+ </target>
+
+ <!-- Compile examples -->
+ <target name="compile-examples" description="Build the examples" depends="compile">
+ <javac
+ srcdir="${src.examples.dir}"
+ destdir="${classes.dir}"
+ classpathref="compile.classpath"
+ deprecation="on"
+ debug="off"
+ verbose="off"
+ listfiles="on"
+ includeAntRuntime="no"
+ source="6"
+ target="6"
+ >
+ <compilerarg value="-Xlint"/>
+ </javac>
+ </target>
+
+ <target name="existing-tests">
+ <available property="test-present"
+ file="${src.examples.dir}"
+ />
+ </target>
+
+ <!-- Compile test sources -->
+ <target name="compile-test" description="Build tests" depends="existing-tests, jar" if="test-present">
+ <mkdir dir="${build.test.dir}"/>
+
+ <!-- clean the test to make sure it will build properly -->
+ <javac
+ srcdir="${src.examples.dir}"
+ destdir="${classes.test.dir}"
+ deprecation="on"
+ debug="off"
+ verbose="off"
+ listfiles="on"
+ includeAntRuntime="no"
+ source="5"
+ >
+ <classpath>
+ <path refid="compile.classpath" />
+ <path location="${library.jar}" />
+ </classpath>
+ </javac>
+ </target>
+
+ <!-- Create the jar -->
+ <target name="jar" description="Build the jar file" depends="compile">
+
+ <jar destfile="${library.jar}" basedir="${classes.dir}">
+ <manifest>
+ <attribute name="Class-Path" value="jogl2.jar gluegen2.jar"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="doc">
+ <javadoc
+ destdir="${doc.dir}"
+ author="true"
+ version="true"
+ use="true"
+ windowtitle="SciRenderer API">
+ <packageset dir="src" defaultexcludes="yes">
+ <include name="org/**"/>
+ </packageset>
+ </javadoc>
+ </target>
+
+ <target name="all" depends="jar, doc" />
+
+ <target name="list-example" description="List all examples available">
+ <echo message="Examples available :"/>
+ <echo message=""/>
+ <echo message=" plot2d"/>
+ <echo message=" lightenedrotatingcube"/>
+ <echo message=" linerendering"/>
+ <echo message=" milkdrop"/>
+ <echo message=" simplerotatingcube"/>
+ <echo message=" clipping"/>
+ <echo message=" JLatexMath"/>
+ </target>
+
+ <target name="all-examples" description="Launch all examples" depends="
+ example-lightened-cube,
+ example-plot2d,
+ example-chicken-pox-cube,
+ example-clipped-tetrahedron,
+ example-jLatex-math,
+ example-line-rendering,
+ example-milk-drop,
+ example-sprite,
+ example-rotatable-sprite,
+ example-ruler,
+ example-texture
+ "/>
+
+ <target name="example-plot2d" description="Scilab Like Plot2d Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.ScilabLikePlot2D"/>
+ </antcall>
+ </target>
+
+ <target name="example-lightened-cube" description="Lightened Rotating Cube Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.LightenedCube" />
+ </antcall>
+ </target>
+
+ <target name="example-line-rendering" description="Line Rendering Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.LineRendering" />
+ </antcall>
+ </target>
+
+ <target name="example-milk-drop" description="Milk Drop Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.MilkDrop" />
+ </antcall>
+ </target>
+
+ <target name="example-chicken-pox-cube" description="Cube With Chicken Pox Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.ChickenPoxCube" />
+ </antcall>
+ </target>
+
+ <target name="example-clipped-tetrahedron" description="Clipping Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.ClippedTetrahedron" />
+ </antcall>
+ </target>
+
+ <target name="example-sprite" description="Sprite Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.Sprites" />
+ </antcall>
+ </target>
+
+ <target name="example-rotatable-sprite" description="Rotatable Sprite Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.RotatableSprite" />
+ </antcall>
+ </target>
+
+ <target name="example-jLatex-math" description="JLatexMath editor Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.JLatexMath" />
+ </antcall>
+ </target>
+
+ <target name="example-ruler" description="Ruler Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.SimpleRuler" />
+ </antcall>
+ </target>
+
+ <target name="example-texture" description="Texture Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.TextureExample" />
+ </antcall>
+ </target>
+
+ <target name="example-JScrollPane" description="JScrollPane Example">
+ <antcall target="check">
+ <param name="ClassName" value="org.scilab.forge.scirenderer.examples.JScrollPaneExample" />
+ </antcall>
+ </target>
+
+ <target name="check" description="Launch some Examples" depends="jar, compile-test">
+ <fail unless="ClassName" message="check should not be called directly. Please use all-examples"/>
+ <java ClassName="${ClassName}" fork="yes">
+ <classpath>
+ <pathelement path="${jogl2.jar}"/>
+ <pathelement path="${gluegen2.jar}"/>
+ <pathelement path="${jlatexmath.jar}"/>
+ <pathelement path="${library.jar}"/>
+ <pathelement path="${build.test.dir}"/>
+ </classpath>
+ <jvmarg value="-Djava.library.path=${jni.path}"/>
+ </java>
+ </target>
+
+</project>
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.buffers.ElementsBuffer;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.picking.PickingTask;
+import org.scilab.forge.scirenderer.picking.PickingTools;
+import org.scilab.forge.scirenderer.renderer.Renderer;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.texture.AnchorPosition;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.texture.TextureDrawer;
+import org.scilab.forge.scirenderer.texture.TextureDrawingTools;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+import org.scilab.forge.scirenderer.utils.shapes.geometry.CubeFactory;
+
+import java.awt.Dimension;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.nio.FloatBuffer;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class ChickenPoxCube extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Rotating Cube Example";
+
+ /**
+ * The last used transformation.
+ */
+ private Transformation lastTransformation;
+
+ /**
+ * The clicked point.
+ */
+ private final ElementsBuffer spritePosition;
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private ChickenPoxCube() {
+ setTitle(TITLE);
+
+ /**
+ * Add a {@link MouseUnprojectAdapter}
+ */
+ MouseListener mua = new MouseUnprojectAdapter(getCanvas());
+ getPanel().addMouseListener(mua);
+
+ getCanvas().setMainDrawer(new SimpleCubeDrawer(getCanvas()));
+ spritePosition = getCanvas().getBuffersManager().createElementsBuffer();
+
+ animate(true);
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new ChickenPoxCube();
+ }
+
+ /**
+ * A simple cube drawer.
+ */
+ private final class SimpleCubeDrawer implements Drawer {
+
+ /**
+ * The sprite size.
+ */
+ private static final int SPRITE_RADIUS = 15;
+
+ /**
+ * The cube geometry.
+ */
+ private final Geometry cube;
+
+ /**
+ * A rendering proxy.
+ */
+ private final Renderer renderer;
+ private final Texture sprite;
+
+ /**
+ * Default constructor.
+ * @param canvas the canvas where the cube is drawn.
+ */
+ public SimpleCubeDrawer(Canvas canvas) {
+ cube = CubeFactory.createCube(canvas, 3, true);
+ renderer = canvas.getRendererManager().createRenderer();
+
+ final Appearance appearance = new Appearance();
+ appearance.setLineColor(new Color(0, 0, 0));
+ appearance.setLineWidth(4);
+
+ sprite = createSprite(canvas);
+
+ renderer.setDrawer(new Drawer() {
+ @Override
+ public void draw(DrawingTools dt) {
+ try {
+ dt.draw(cube, appearance);
+ } catch (SciRendererException ignored) {
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * Sprite creator.
+ * @param canvas the canvas where the sprite will be drawn.
+ * @return a sprite to represent clicked point.
+ */
+ private Texture createSprite(Canvas canvas) {
+ Texture newSprite = canvas.getTextureManager().createTexture();
+ newSprite.setDrawer(new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ drawingTools.fillDisc(0, 0, SPRITE_RADIUS, new Color(1, 0, 0));
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return new Dimension(SPRITE_RADIUS * 2, SPRITE_RADIUS * 2);
+ }
+
+ @Override
+ public OriginPosition getOriginPosition() {
+ return OriginPosition.CENTER;
+ }
+ });
+
+ return newSprite;
+ }
+
+ @Override
+ public void draw(DrawingTools dt) {
+ try {
+ double t = System.currentTimeMillis() / 50.;
+ dt.clear(new Color());
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(dt.getCanvas().getDimension(), 1f);
+ Transformation perspective = TransformationFactory.getPerspectiveTransformation(1, 10, 45);
+ Transformation displacement = TransformationFactory.getTranslateTransformation(0, 0, -5);
+ dt.getTransformationManager().getProjectionStack().push(projection.rightTimes(perspective.rightTimes(displacement)));
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(t, 1, 2, 3));
+ lastTransformation = dt.getTransformationManager().getTransformation();
+ dt.draw(renderer);
+ dt.draw(sprite, AnchorPosition.CENTER, spritePosition);
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+ }
+
+ /**
+ * This class is a simple example of picking usage.
+ * @author Pierre Lando
+ */
+ private final class MouseUnprojectAdapter extends MouseAdapter {
+
+ private final Canvas canvas;
+
+ /**
+ * Default constructor.
+ * @param canvas the listened canvas.
+ */
+ public MouseUnprojectAdapter(Canvas canvas) {
+ this.canvas = canvas;
+ }
+
+ @Override
+ public void mousePressed(final MouseEvent e) {
+ canvas.getPickingManager().addPickingTask(new PickingTask() {
+ @Override
+ public void perform(PickingTools pickingTools) {
+ Vector3d l = pickingTools.getUnderlyingPoint(e.getPoint());
+ if ((lastTransformation != null) && (l.getZ() != 1)) {
+ Vector3d lastClickedPoint = lastTransformation.unproject(l);
+ FloatBuffer data = spritePosition.getData();
+ FloatBuffer newData;
+ if (data == null) {
+ newData = FloatBuffer.allocate(4);
+ newData.rewind();
+ } else {
+ data.rewind();
+ newData = FloatBuffer.allocate(data.limit() + 4);
+ float[] dataArray = new float[data.limit()];
+ data.get(dataArray);
+ newData.put(dataArray);
+ }
+ newData.put(lastClickedPoint.getDataAsFloatArray(4));
+ spritePosition.setData(newData, 4);
+ }
+ }
+ });
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.clipping.ClippingPlane;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.tranformations.Rotation;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+import org.scilab.forge.scirenderer.tranformations.Vector4d;
+import org.scilab.forge.scirenderer.utils.shapes.geometry.TetrahedronFactory;
+
+import javax.swing.BoundedRangeModel;
+import javax.swing.DefaultBoundedRangeModel;
+import javax.swing.JSlider;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import java.awt.BorderLayout;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class ClippedTetrahedron extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Clipping Example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private ClippedTetrahedron() {
+ setTitle(TITLE);
+
+ BoundedRangeModel brm = new DefaultBoundedRangeModel(0, 0, -100, 100);
+ add(new JSlider(brm), BorderLayout.SOUTH);
+
+ /**
+ * Add a mouse rotation adapter.
+ */
+ final MouseRotationAdapter mra = new MouseRotationAdapter(
+ new Rotation(Math.toRadians(90), new Vector3d(1, 0, 0)),
+ getCanvas()
+ );
+ getPanel().addMouseListener(mra);
+
+ /**
+ * Set main drawer.
+ */
+ getCanvas().setMainDrawer(new ClippingDrawer(getCanvas(), mra, brm));
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new ClippedTetrahedron();
+ }
+
+ /**
+ * The clipped tetrahedron drawer.
+ * @author Pierre Lando
+ */
+ private final class ClippingDrawer implements Drawer {
+ private final MouseRotationAdapter mra;
+ private final Geometry tetrahedron;
+ private final BoundedRangeModel brm;
+
+ /**
+ * Clipping example drawer constructor.
+ * @param canvas the canvas.
+ * @param mra the mouse rotation adapter used for interaction.
+ * @param brm the {@link javax.swing.BoundedRangeModel} used for the clipping plane coordinate.
+ */
+ public ClippingDrawer(final Canvas canvas, MouseRotationAdapter mra, BoundedRangeModel brm) {
+ this.mra = mra;
+ this.tetrahedron = TetrahedronFactory.createTetrahedron(canvas);
+ this.brm = brm;
+
+ brm.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ canvas.redraw();
+ }
+ });
+ }
+
+ @Override
+ public void draw(DrawingTools dt) {
+ dt.clear(new Color(1f, 1f, 1f));
+
+ try {
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(dt.getCanvas().getDimension(), 1f);
+ dt.getTransformationManager().getProjectionStack().push(projection);
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getScaleTransformation(.5, .5, .5));
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(mra.getRotation()));
+ ClippingPlane cp = dt.getClippingManager().getClippingPlane(0);
+ cp.setEnable(true);
+ cp.setEquation(new Vector4d(-1, 0, 0, -getValue()));
+
+ Appearance appearance = new Appearance();
+ appearance.setFillColor(new Color(1f, 0f, 0f));
+ appearance.setLineColor(new Color(.2f, .2f, .2f));
+ appearance.setLineWidth(3);
+ dt.draw(tetrahedron, appearance);
+
+ cp.setEquation(new Vector4d(1, 0, 0, getValue()));
+ appearance.setFillColor(new Color(0f, 1f, 0f));
+ dt.draw(tetrahedron, appearance);
+
+ cp.setEnable(false);
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+
+ /**
+ * Current {@link javax.swing.BoundedRangeModel} value getter.
+ * @return the current {@link javax.swing.BoundedRangeModel}.
+ */
+ private double getValue() {
+ return -(double) brm.getValue() / 100.0;
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.jlatexmath.TeXConstants;
+import org.scilab.forge.jlatexmath.TeXFormula;
+import org.scilab.forge.jlatexmath.TeXIcon;
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.texture.AnchorPosition;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.texture.TextureDrawer;
+import org.scilab.forge.scirenderer.texture.TextureDrawingTools;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+import javax.swing.JComponent;
+import javax.swing.JTextArea;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.util.EventListener;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class JLatexMath extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "JLatexMath Drawing Example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private JLatexMath() {
+ setTitle(TITLE);
+ LatexCompositor latexCompositor = new LatexCompositor();
+
+
+ add(latexCompositor, BorderLayout.SOUTH);
+ LatexDrawer latexDrawer = new LatexDrawer(getCanvas());
+ latexCompositor.addListener(latexDrawer);
+ getCanvas().setMainDrawer(latexDrawer);
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new JLatexMath();
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private final class LatexCompositor extends JComponent {
+
+ private static final String GAUSS = "\\int_{-\\infty}^{+\\infty}\\!e^{-x^2}\\, \\mathrm{d}x = \\sqrt \\pi";
+ private final PlainDocument document;
+ private final JTextArea textArea;
+
+ /**
+ * Default constructor.
+ */
+ public LatexCompositor() {
+ setLayout(new BorderLayout());
+ document = new PlainDocument();
+ try {
+ document.insertString(0, GAUSS, null);
+ } catch (BadLocationException ignored) {
+ }
+
+ document.addDocumentListener(new DocumentListener() {
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ fireDataChanged();
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ fireDataChanged();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ fireDataChanged();
+ }
+ });
+
+ textArea = new JTextArea(document);
+ add(textArea, BorderLayout.CENTER);
+ }
+
+ /**
+ * Compute the {@see TeXIcon} corresponding to the current formula.
+ * @return the {@see TeXIcon} corresponding to the current formula.
+ */
+ public TeXIcon getTextIcon() {
+ try {
+ TeXFormula formula = new TeXFormula(document.getText(0, document.getLength()));
+ return formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 32);
+ } catch (org.scilab.forge.jlatexmath.ParseException e) {
+ return null;
+ } catch (BadLocationException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Add a listener on the latex composition.
+ * @param latexDrawer the new listener.
+ */
+ public void addListener(LatexDrawer latexDrawer) {
+ listenerList.add(LatexCompositorListener.class, latexDrawer);
+ latexDrawer.dataChanged(this);
+ }
+
+ /**
+ * Notify listeners for a data change.
+ */
+ private void fireDataChanged() {
+ for (LatexCompositorListener listener : listenerList.getListeners(LatexCompositorListener.class)) {
+ listener.dataChanged(this);
+ }
+ }
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private interface LatexCompositorListener extends EventListener {
+
+ /**
+ * Inform listeners from data changes.
+ * @param compositor compositor where data have changed.
+ */
+ void dataChanged(LatexCompositor compositor);
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private final class LatexDrawer implements Drawer, LatexCompositorListener {
+
+
+ private final Canvas canvas;
+ private Texture sprite;
+
+ /**
+ * Default constructor.
+ * @param canvas the {@link org.scilab.forge.scirenderer.Canvas} where the drawn will be performed.
+ */
+ public LatexDrawer(Canvas canvas) {
+ this.canvas = canvas;
+ sprite = null;
+ }
+
+ @Override
+ public void draw(DrawingTools drawingTools) {
+ drawingTools.clear(new Color());
+
+ try {
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(drawingTools.getCanvas().getDimension(), 1f);
+ drawingTools.getTransformationManager().getProjectionStack().push(projection);
+ drawingTools.getTransformationManager().getModelViewStack().push(TransformationFactory.getScaleTransformation(.1, .1, .1));
+ if (sprite != null) {
+ drawingTools.draw(sprite, AnchorPosition.CENTER, new Vector3d(0, 0, 0));
+ }
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+
+ @Override
+ public void dataChanged(final LatexCompositor compositor) {
+ compositor.textArea.setBackground(Color.RED);
+ final TeXIcon ti = compositor.getTextIcon();
+ canvas.getTextureManager().dispose(sprite);
+ sprite = null;
+ if (ti != null) {
+ ti.setForeground(java.awt.Color.WHITE);
+
+ sprite = canvas.getTextureManager().createTexture();
+ sprite.setDrawer(new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ drawingTools.clear(new Color(0, 0, 0));
+ drawingTools.draw(ti, -(ti.getIconWidth() / 2), -(ti.getIconHeight() / 2));
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return new Dimension(ti.getIconWidth(), ti.getIconHeight());
+ }
+
+ @Override
+ public TextureDrawer.OriginPosition getOriginPosition() {
+ return TextureDrawer.OriginPosition.CENTER;
+ }
+ });
+ }
+
+ /** Wait image to set text area background to green */
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ canvas.waitImage();
+ compositor.textArea.setBackground(Color.GREEN);
+ }
+ }).start();
+
+ canvas.redraw();
+ }
+ }
+}
--- /dev/null
+package org.scilab.forge.scirenderer.examples;
+
+import com.jogamp.opengl.util.Animator;
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.implementation.jogl.JoGLCanvasFactory;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.utils.shapes.geometry.CubeFactory;
+
+import javax.media.opengl.awt.GLCanvas;
+import javax.media.opengl.awt.GLJPanel;
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * @Author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public class JScrollPaneExample extends JFrame {
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new JScrollPaneExample();
+ }
+
+ /** The canvas. */
+ private final Canvas canvas;
+
+ /** The gl panel. */
+ private final GLCanvas glPanel;
+
+ private JScrollPaneExample() {
+ glPanel = new GLCanvas();
+ canvas = JoGLCanvasFactory.createCanvas(glPanel);
+ glPanel.setPreferredSize(new Dimension(1024, 768));
+
+ Animator animator = new Animator();
+ animator.add(glPanel);
+ animator.start();
+
+ final Geometry cube = CubeFactory.createCube(canvas, 5, true);
+ final Appearance appearance = new Appearance();
+ appearance.setLineWidth(3);
+ appearance.setLineColor(new Color(.7f, .6f, .5f));
+
+ canvas.setMainDrawer(new Drawer() {
+ @Override
+ public void draw(DrawingTools drawingTools) {
+ try {
+ double t = System.currentTimeMillis() / 50.;
+ drawingTools.clear(new Color());
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(drawingTools.getCanvas().getDimension(), 1f);
+ Transformation perspective = TransformationFactory.getPerspectiveTransformation(1, 10, 45);
+ Transformation displacement = TransformationFactory.getTranslateTransformation(0, 0, -5);
+ drawingTools.getTransformationManager().getProjectionStack().push(projection.rightTimes(perspective.rightTimes(displacement)));
+ drawingTools.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(t, 1, 2, 3));
+
+ drawingTools.draw(cube, appearance);
+ } catch (SciRendererException ignored) {
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+ });
+
+ JPanel panel = new JPanel(new BorderLayout());
+ JScrollPane scrollPane = new JScrollPane(glPanel);
+ JTextArea textArea = new JTextArea();
+ textArea.setText("Test\nTest\nTest\nTest\n");
+
+ panel.add(scrollPane, BorderLayout.CENTER);
+ panel.add(textArea, BorderLayout.NORTH);
+
+
+ add(panel);
+ setLocationRelativeTo(null);
+ setTitle("GLCanvas in JScrollPane example");
+ setSize(800, 600);
+ setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ setVisible(true);
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter;
+import org.scilab.forge.scirenderer.lightning.Light;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.texture.AnchorPosition;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.texture.TextureDrawer;
+import org.scilab.forge.scirenderer.texture.TextureDrawingTools;
+import org.scilab.forge.scirenderer.tranformations.Rotation;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+import org.scilab.forge.scirenderer.utils.shapes.geometry.CubeFactory;
+
+import java.awt.Dimension;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class LightenedCube extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Lightening Example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private LightenedCube() {
+ setTitle(TITLE);
+
+ /**
+ * A MouseRotationAdapter to add some interactivity.
+ */
+ final MouseRotationAdapter mra = new MouseRotationAdapter(
+ new Rotation(),
+ getCanvas()
+ );
+ getPanel().addMouseListener(mra);
+
+ getCanvas().setMainDrawer(new LightenedCubeDrawer(mra, getCanvas()));
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new LightenedCube();
+ }
+
+ /**
+ * The lightened cube drawer.
+ */
+ private final class LightenedCubeDrawer implements Drawer {
+
+ /**
+ * A sprite to represent light position.
+ */
+ private final Texture sprite;
+
+ /**
+ * The cube geometry.
+ */
+ private final Geometry cube;
+
+ /**
+ * The mouse rotation adapter used for interactivity.
+ */
+ private final MouseRotationAdapter mra;
+
+ /**
+ * Default constructor.
+ * @param mouseRotationAdapter the mouse rotation adapter used for interactivity.
+ * @param canvas the canvas where the draw will be performed.
+ */
+ public LightenedCubeDrawer(MouseRotationAdapter mouseRotationAdapter, Canvas canvas) {
+ sprite = createSprite(canvas);
+ cube = CubeFactory.createCube(canvas, 10);
+ mra = mouseRotationAdapter;
+ }
+
+ /**
+ * Sprite constructor.
+ * @param canvas the canvas where the sprite is created.
+ * @return the sprite representing the light.
+ */
+ private Texture createSprite(Canvas canvas) {
+ Texture newSprite = canvas.getTextureManager().createTexture();
+ newSprite.setDrawer(new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ drawingTools.fillDisc(0, 0, 10, new Color(1, 0, 0));
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return new Dimension(16, 16);
+ }
+
+ @Override
+ public OriginPosition getOriginPosition() {
+ return OriginPosition.CENTER;
+ }
+ });
+ return newSprite;
+ }
+
+
+
+ @Override
+ public void draw(DrawingTools dt) {
+ dt.clear(new Color());
+
+ try {
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(dt.getCanvas().getDimension(), 1f);
+ dt.getTransformationManager().getProjectionStack().push(projection);
+ dt.getTransformationManager().getModelViewStack().push(TransformationFactory.getScaleTransformation(.2, .2, .2));
+
+ dt.getLightManager().setLightningEnable(true);
+ Light light = dt.getLightManager().getLight(0);
+ light.setEnable(true);
+ light.setAmbientColor(new Color(.5f, .5f, .5f));
+ light.setDiffuseColor(new Color(.5f, 0, 0));
+ light.setSpecularColor(new Color(.4f, .4f, 0));
+
+ Vector3d lightPosition = new Vector3d(0, 2, -2);
+ light.setPosition(lightPosition);
+ dt.draw(sprite, AnchorPosition.CENTER, lightPosition);
+
+
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(mra.getRotation()));
+ dt.draw(cube);
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.DefaultGeometry;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.texture.AnchorPosition;
+import org.scilab.forge.scirenderer.texture.TextEntity;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.texture.TextureDrawer;
+import org.scilab.forge.scirenderer.texture.TextureDrawingTools;
+import org.scilab.forge.scirenderer.tranformations.DegenerateMatrixException;
+import org.scilab.forge.scirenderer.tranformations.Rotation;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+import org.scilab.forge.scirenderer.utils.shapes.geometry.TetrahedronFactory;
+
+import java.awt.Dimension;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class LineRendering extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Line Rendering Example";
+
+ private final LineDrawer drawer;
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private LineRendering() {
+ setTitle(TITLE);
+
+ /**
+ * Add a mouse rotation adapter.
+ */
+ final MouseRotationAdapter mra = new MouseRotationAdapter(
+ new Rotation(Math.toRadians(90), new Vector3d(1, 0, 0)),
+ getCanvas()
+ );
+ getPanel().addMouseListener(mra);
+
+ drawer = new LineDrawer(getCanvas(), mra);
+ getCanvas().setMainDrawer(drawer);
+
+ /**
+ * Add a key listener.
+ */
+ addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_F) {
+ drawer.switchFace();
+ getCanvas().redraw();
+ }
+ }
+ });
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new LineRendering();
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private final class LineDrawer implements Drawer {
+ private static final String MESSAGE_TEXT = "Press 'F' to switch culling mode";
+ private final DefaultGeometry tetrahedron;
+ private final MouseRotationAdapter mra;
+ private final Texture message;
+
+ /**
+ * Default constructor.
+ * @param canvas the canvas where the drawing will be performed.
+ * @param mouseRotationAdapter the {@link org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter} used for interactivity.
+ */
+ public LineDrawer(Canvas canvas, MouseRotationAdapter mouseRotationAdapter) {
+ tetrahedron = TetrahedronFactory.createTetrahedron(canvas);
+ tetrahedron.setFaceCullingMode(Geometry.FaceCullingMode.CCW);
+ message = createMessage(canvas);
+ mra = mouseRotationAdapter;
+ }
+
+ /**
+ * Switch culled face.
+ */
+ public void switchFace() {
+ switch (tetrahedron.getFaceCullingMode()) {
+ case CCW:
+ tetrahedron.setFaceCullingMode(Geometry.FaceCullingMode.CW);
+ break;
+ default:
+ tetrahedron.setFaceCullingMode(Geometry.FaceCullingMode.CCW);
+ }
+ }
+
+ @Override
+ public void draw(DrawingTools dt) {
+ dt.clear(new Color(1f, 1f, 1f));
+
+ try {
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(dt.getCanvas().getDimension(), 1f);
+ dt.getTransformationManager().getProjectionStack().push(projection);
+ } catch (DegenerateMatrixException ignored) {
+ // Should not occur.
+ }
+
+ try {
+ dt.draw(message, AnchorPosition.UPPER_LEFT, new Vector3d(-.95, .95, 0));
+ } catch (SciRendererException ignored) {
+ }
+
+ try {
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getScaleTransformation(.5, .5, .5));
+
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(mra.getRotation()));
+
+ Appearance appearance = new Appearance();
+ appearance.setLineColor(new Color(.2f, .2f, .2f));
+ appearance.setLineWidth(3);
+ dt.draw(tetrahedron, appearance);
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+
+ /**
+ * Create a help message.
+ * @param canvas the canvas where the message sprite is created.
+ * @return a sprite that draws the message.
+ */
+ private Texture createMessage(final Canvas canvas) {
+ final TextEntity text = new TextEntity(MESSAGE_TEXT);
+ Texture texture = canvas.getTextureManager().createTexture();
+ texture.setDrawer(new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ drawingTools.draw(text, 0, 0);
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return text.getSize();
+ }
+
+ @Override
+ public OriginPosition getOriginPosition() {
+ return OriginPosition.UPPER_LEFT;
+ }
+ });
+
+ return texture;
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.buffers.ElementsBuffer;
+import org.scilab.forge.scirenderer.buffers.IndicesBuffer;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter;
+import org.scilab.forge.scirenderer.ruler.DefaultRulerModel;
+import org.scilab.forge.scirenderer.ruler.RulerDrawer;
+import org.scilab.forge.scirenderer.ruler.RulerModel;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.DefaultGeometry;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.tranformations.Rotation;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+
+/**
+ * Simple example of SciRenderer usage.
+ *
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class MilkDrop extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "MilkDrop example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private MilkDrop() {
+ setTitle(TITLE);
+
+ /**
+ * Add a mouse rotation adapter for interactivity.
+ */
+ final MouseRotationAdapter mra = new MouseRotationAdapter(
+ new Rotation(Math.toRadians(90), new Vector3d(1, 0, 0)),
+ getCanvas()
+ );
+ getPanel().addMouseListener(mra);
+
+ getCanvas().setMainDrawer(new MilkDropDrawer(getCanvas(), mra));
+ }
+
+ /**
+ * Main function.
+ * @param arguments main arguments.
+ */
+ public static void main(String[] arguments) {
+ new MilkDrop();
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private final class MilkDropDrawer implements Drawer {
+ private final RulerDrawer rulerDrawer;
+ private final Geometry milkDrop;
+ private final MouseRotationAdapter mouseRotationAdapter;
+ private final Appearance appearance;
+
+ private DefaultRulerModel xRulerModel;
+ private DefaultRulerModel yRulerModel;
+ private DefaultRulerModel zRulerModel;
+
+ /**
+ * Default constructor.
+ * @param canvas the canvas where the draw will be done.
+ * @param mra the {@link org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter} used for interactivity.
+ */
+ public MilkDropDrawer(Canvas canvas, MouseRotationAdapter mra) {
+ this.mouseRotationAdapter = mra;
+
+ appearance = new Appearance();
+ appearance.setLineWidth(1);
+ appearance.setLineColor(new Color(0, 0, 0));
+ rulerDrawer = new RulerDrawer(canvas.getTextureManager());
+ milkDrop = new MilkDropGeometry(canvas);
+ }
+
+ @Override
+ public void draw(DrawingTools dt) {
+ dt.clear(new Color(1f, 1f, 1f));
+
+ try {
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(dt.getCanvas().getDimension(), 1f);
+ dt.getTransformationManager().getProjectionStack().push(projection);
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getScaleTransformation(.03, .03, .03));
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(mouseRotationAdapter.getRotation()));
+ dt.draw(milkDrop, appearance);
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+
+ rulerDrawer.draw(dt, getXRulerModel());
+ rulerDrawer.draw(dt, getYRulerModel());
+ rulerDrawer.draw(dt, getZRulerModel());
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+
+ /**
+ * X ruler model getter.
+ * @return the X ruler model.
+ */
+ public RulerModel getXRulerModel() {
+ if (xRulerModel == null) {
+ xRulerModel = new DefaultRulerModel();
+ xRulerModel.setFirstPoint(new Vector3d(-20, 20, 0));
+ xRulerModel.setSecondPoint(new Vector3d(20, 20, 0));
+ xRulerModel.setValues(-20, 20);
+ xRulerModel.setLineVisible(true);
+ xRulerModel.setTicksDirection(new Vector3d(0, 1, 0));
+ }
+ return xRulerModel;
+ }
+
+ /**
+ * Y ruler model getter.
+ * @return the Y ruler model.
+ */
+ public RulerModel getYRulerModel() {
+ if (yRulerModel == null) {
+ yRulerModel = new DefaultRulerModel();
+ yRulerModel.setFirstPoint(new Vector3d(20, -20, 0));
+ yRulerModel.setSecondPoint(new Vector3d(20, 20, 0));
+ yRulerModel.setValues(-20, 20);
+ yRulerModel.setLineVisible(true);
+ yRulerModel.setTicksDirection(new Vector3d(1, 0, 0));
+ }
+ return yRulerModel;
+ }
+
+ /**
+ * Z ruler model getter.
+ * @return the Z ruler model.
+ */
+ public RulerModel getZRulerModel() {
+ if (zRulerModel == null) {
+ zRulerModel = new DefaultRulerModel();
+ zRulerModel.setFirstPoint(new Vector3d(20, 20, 20));
+ zRulerModel.setSecondPoint(new Vector3d(20, 20, -20));
+ zRulerModel.setValues(-20, 20);
+ zRulerModel.setLineVisible(true);
+ zRulerModel.setTicksDirection(new Vector3d(1, 1, 0));
+ }
+ return zRulerModel;
+ }
+ }
+
+ /**
+ * A geometry implementation representing a MilkDrop.
+ * @author Pierre Lando
+ */
+ private final class MilkDropGeometry extends DefaultGeometry {
+ private static final int HALF_SIDE = 20;
+ private static final int SIDE = 2 * HALF_SIDE + 1;
+ private static final int ELEMENTS_SIZE = 4;
+
+
+ /**
+ * @param canvas the canvas where the buffers are created.
+ */
+ public MilkDropGeometry(Canvas canvas) {
+ FloatBuffer vertices = FloatBuffer.allocate(SIDE * SIDE * ELEMENTS_SIZE);
+ FloatBuffer colors = FloatBuffer.allocate(SIDE * SIDE * ELEMENTS_SIZE);
+ IntBuffer wireIndices = IntBuffer.allocate((SIDE - 1) * (SIDE - 1) * 8);
+ IntBuffer indices = IntBuffer.allocate((SIDE - 1) * (SIDE - 1) * 6);
+
+ fillVerticesAndColors(vertices, colors);
+ fillIndices(indices, wireIndices);
+
+ ElementsBuffer vertexBuffer = canvas.getBuffersManager().createElementsBuffer();
+ ElementsBuffer colorBuffer = canvas.getBuffersManager().createElementsBuffer();
+ IndicesBuffer indicesBuffer = canvas.getBuffersManager().createIndicesBuffer();
+ IndicesBuffer wireIndicesBuffer = canvas.getBuffersManager().createIndicesBuffer();
+
+ vertexBuffer.setData(vertices, ELEMENTS_SIZE);
+ colorBuffer.setData(colors, ELEMENTS_SIZE);
+ indicesBuffer.setData(indices);
+ wireIndicesBuffer.setData(wireIndices);
+
+ setFillDrawingMode(FillDrawingMode.TRIANGLES);
+ setLineDrawingMode(LineDrawingMode.SEGMENTS);
+ setPolygonOffsetMode(true);
+ setVertices(vertexBuffer);
+ setColors(colorBuffer);
+ setIndices(indicesBuffer);
+ setWireIndices(wireIndicesBuffer);
+ }
+
+ /**
+ * Fill indices buffers.
+ * @param indices the triangles indices to fill.
+ * @param wireIndices the segments indices to fill.s
+ */
+ private void fillIndices(IntBuffer indices, IntBuffer wireIndices) {
+ for (int x = 0; x < SIDE - 1; x++) {
+ for (int y = 0; y < SIDE - 1; y++) {
+ /**
+ * (x, y) -- (x+1, y)
+ * | |
+ * | |
+ * (x, y+1)--(x+1, y+1)
+ *
+ * (x,y) => (x*SIDE + y);
+ *
+ */
+
+ if (((x >= 0) && (y < 0)) || ((x < 0) && (y >= 0))) {
+ indices.put((x * SIDE) + y);
+ indices.put(((x + 1) * SIDE) + y);
+ indices.put(((x + 1) * SIDE) + (y + 1));
+
+ indices.put((x * SIDE) + y);
+ indices.put(((x + 1) * SIDE) + (y + 1));
+ indices.put((x * SIDE) + (y + 1));
+ } else {
+ indices.put((x * SIDE) + y);
+ indices.put(((x + 1) * SIDE) + y);
+ indices.put((x * SIDE) + (y + 1));
+
+ indices.put(((x + 1) * SIDE) + y);
+ indices.put(((x + 1) * SIDE) + (y + 1));
+ indices.put((x * SIDE) + (y + 1));
+ }
+
+ wireIndices.put((x * SIDE) + y);
+ wireIndices.put((x * SIDE) + (y + 1));
+ wireIndices.put((x * SIDE) + (y + 1));
+ wireIndices.put(((x + 1) * SIDE) + (y + 1));
+ wireIndices.put(((x + 1) * SIDE) + (y + 1));
+ wireIndices.put(((x + 1) * SIDE) + y);
+ wireIndices.put(((x + 1) * SIDE) + y);
+ wireIndices.put((x * SIDE) + y);
+ }
+ }
+ }
+
+ /**
+ * Fill the given buffer with vertices data and color data.
+ * @param vertices the vertices buffer.
+ * @param colors the colors buffer.
+ */
+ private void fillVerticesAndColors(FloatBuffer vertices, FloatBuffer colors) {
+ vertices.rewind();
+ colors.rewind();
+ for (int x = -HALF_SIDE; x <= HALF_SIDE; x++) {
+ for (int y = -HALF_SIDE; y <= HALF_SIDE; y++) {
+ double d = Math.sqrt((x * x) + (y * y));
+ double z = HALF_SIDE * Math.cos(d) * Math.exp(-d / 6) / 2;
+
+ vertices.put(x);
+ vertices.put(y);
+ vertices.put((float) z);
+ vertices.put(1);
+
+ colors.put((float) z);
+ colors.put((float) (1 - z));
+ colors.put(0);
+ colors.put(1);
+ }
+ }
+ vertices.rewind();
+ colors.rewind();
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ * Copyright (C) 2011 - DIGITEO - Manuel Juliachs
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.buffers.ElementsBuffer;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.texture.AnchorPosition;
+import org.scilab.forge.scirenderer.texture.TextEntity;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.texture.TextureDrawer;
+import org.scilab.forge.scirenderer.texture.TextureDrawingTools;
+import org.scilab.forge.scirenderer.texture.TextureManager;
+import org.scilab.forge.scirenderer.tranformations.DegenerateMatrixException;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+import java.awt.Dimension;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+
+/**
+ * A basic example featuring rotatable 2D sprites.
+ *
+ * @author Pierre Lando
+ * @author Manuel Juliachs
+ */
+@SuppressWarnings(value = { "serial" })
+public final class RotatableSprite extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Rotatable Sprites Example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private RotatableSprite() {
+ setTitle(TITLE);
+
+ final RotatableSpriteDrawer drawer = new RotatableSpriteDrawer(getCanvas());
+ getCanvas().setMainDrawer(drawer);
+
+ /* Key listener */
+ getPanel().addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_T) {
+ drawer.toggleAnchorDisplay();
+ } else if (e.getKeyCode() == KeyEvent.VK_D) {
+ drawer.switchRotationDirection();
+ } else if (e.getKeyCode() == KeyEvent.VK_M) {
+ drawer.toggleMessageDisplay();
+ }
+ }
+ });
+
+ animate(true);
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new RotatableSprite();
+ }
+
+ /**
+ * A rotatable sprite drawer.
+ * Draws one rotating sprite for each existing sprite anchor position value.
+ *
+ * @author Manuel Juliachs
+ */
+ public static class RotatableSpriteDrawer implements Drawer {
+
+ /** The sprites' text strings. */
+ private static final String[] TEXT_STRINGS = {
+ "Center anchor", "Left anchor", "Lower-left anchor",
+ "Down anchor", "Lower-right anchor", "Right anchor",
+ "Upper-right anchor", "Up anchor", "Upper-left anchor"
+ };
+
+ /** The anchor positions. */
+ private static final AnchorPosition[] ANCHOR_POSITIONS = {
+ AnchorPosition.CENTER, AnchorPosition.LEFT, AnchorPosition.LOWER_LEFT,
+ AnchorPosition.DOWN, AnchorPosition.LOWER_RIGHT, AnchorPosition.RIGHT,
+ AnchorPosition.UPPER_RIGHT, AnchorPosition.UP, AnchorPosition.UPPER_LEFT
+ };
+
+ /** The step added to the rotation angle at each draw call. */
+ private static final float ROTATION_ANGLE_STEP = 2.5f;
+
+ /** Arbitrary displacement used to position the sprites. */
+ private static final float DELTA_POSITION = 0.8f;
+
+ /** The number of sprites to draw, equal to the number of available sprite anchor position values. */
+ private static final int NUM_SPRITES = 9;
+
+ /** The margin used for the text sprites. */
+ private static final int MARGIN = 4;
+
+ /** The sprites' coordinates. */
+ private final float[] positions;
+
+ /** The buffer used to position anchor sprites. */
+ private final ElementsBuffer position;
+
+ /** The text sprites. */
+ private final Texture[] textSprites;
+
+ /** The sprite used to draw anchors. */
+ private final Texture anchorSprite;
+
+ /** The message sprite. */
+ private final Texture messageSprite;
+
+ /** The sprites' text entities. */
+ private final TextEntity[] textEntities;
+
+ /** The rotation angle applied to all the sprites. */
+ private float rotationAngle;
+
+ /** The line width of the sprites' box. */
+ private final int lineWidth = 2;
+
+ /** The line's half width. */
+ private final int halfLineWidth = lineWidth / 2;
+
+ /** Specifies whether anchor sprites are displayed or not. */
+ private boolean anchorsDisplayed;
+
+ /** Specifies the sprites' rotation direction. */
+ private boolean clockwiseRotation;
+
+ /** Specifies whether the message is displayed or not. */
+ private boolean messageDisplayed;
+
+ /**
+ * Constructor.
+ * @param canvas the canvas to use.
+ */
+ public RotatableSpriteDrawer(Canvas canvas) {
+ /* The texture manager. */
+ TextureManager textureManager = canvas.getTextureManager();
+
+ anchorsDisplayed = true;
+ clockwiseRotation = false;
+ messageDisplayed = true;
+ rotationAngle = 0;
+
+ textEntities = new TextEntity[NUM_SPRITES];
+
+ for (int i = 0; i < NUM_SPRITES; i++) {
+ TextEntity textEntity = new TextEntity(TEXT_STRINGS[i]);
+ textEntity.setTextColor(new Color(0.0f, 0.0f, 0.0f));
+ textEntity.setTextAntiAliased(false);
+ textEntities[i] = textEntity;
+ }
+
+ textSprites = new Texture[NUM_SPRITES];
+
+ for (int i = 0; i < NUM_SPRITES; i++) {
+ textSprites[i] = textureManager.createTexture();
+ textSprites[i].setDrawer(getTextDrawer(i));
+ }
+
+ /* The sprite used to visualize anchor points */
+ anchorSprite = textureManager.createTexture();
+ anchorSprite.setDrawer(getSpriteDrawer());
+
+ position = canvas.getBuffersManager().createElementsBuffer();
+
+ positions = new float[] {
+ 0, 0, 0,
+ -DELTA_POSITION, 0, 0,
+ -DELTA_POSITION, -DELTA_POSITION, 0,
+ 0, -DELTA_POSITION, 0,
+ DELTA_POSITION, -DELTA_POSITION, 0,
+ DELTA_POSITION, 0, 0,
+ DELTA_POSITION, DELTA_POSITION, 0,
+ 0, DELTA_POSITION, 0,
+ -DELTA_POSITION, DELTA_POSITION, 0
+ };
+
+ position.setData(positions, 3);
+
+ /* The message sprite */
+ messageSprite = createMessage(canvas);
+ }
+
+ @Override
+ public void draw(DrawingTools drawingTools) {
+ try {
+ drawingTools.clear(new Color(1.0f, 1.0f, 1.0f));
+
+ Transformation projection = null;
+ try {
+ projection = TransformationFactory.getPreferredAspectRatioTransformation(drawingTools.getCanvas().getDimension(), 1f);
+ } catch (DegenerateMatrixException ignored) {
+ // Should not occur.
+ }
+
+ drawingTools.getTransformationManager().getProjectionStack().push(projection);
+
+ for (int i = 0; i < NUM_SPRITES; i++) {
+ drawingTools.draw(
+ textSprites[i],
+ ANCHOR_POSITIONS[i],
+ new Vector3d(positions[3 * i], positions[3 * i + 1], positions[3 * i + 2]),
+ rotationAngle
+ );
+ }
+
+ if (anchorsDisplayed) {
+ drawingTools.draw(anchorSprite, AnchorPosition.CENTER, position);
+ }
+
+ if (messageDisplayed) {
+ drawingTools.draw(messageSprite, AnchorPosition.UPPER_LEFT, new Vector3d(-1.0, 1.0, 0.0));
+ }
+
+
+ if (clockwiseRotation) {
+ rotationAngle -= ROTATION_ANGLE_STEP;
+ } else {
+ rotationAngle += ROTATION_ANGLE_STEP;
+ }
+
+ rotationAngle %= 360.0f;
+ } catch (SciRendererException ignored) {
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+
+ /**
+ * Returns the anchor sprite drawer.
+ * @return the anchor sprite drawer.
+ */
+ public TextureDrawer getSpriteDrawer() {
+
+ return new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ drawingTools.fillDisc(0, 0, 10, new Color(1, 0, 0));
+
+
+ Appearance appearance = new Appearance();
+ appearance.setLineColor(new Color(0, 0, 0));
+ drawingTools.drawCircle(0, 0, 10, appearance);
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return new Dimension(10, 10);
+ }
+
+ @Override
+ public OriginPosition getOriginPosition() {
+ return OriginPosition.CENTER;
+ }
+ };
+ }
+
+ /**
+ * Returns the sprite drawer associated to a particular text sprite.
+ * @param textSpriteIndex the sprite index.
+ * @return the text sprite drawer.
+ */
+ public TextureDrawer getTextDrawer(final int textSpriteIndex) {
+
+ if ((textSpriteIndex > (NUM_SPRITES - 1)) || (textSpriteIndex < 0)) {
+ return null;
+ }
+
+ return new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ TextEntity textEntity = textEntities[textSpriteIndex];
+
+ drawingTools.draw(textEntity, 0 + MARGIN + halfLineWidth, 0 + MARGIN + halfLineWidth);
+
+ Dimension dimension = getTextureSize();
+ int boxWidth = dimension.width;
+ int boxHeight = dimension.height;
+
+ Appearance appearance = new Appearance();
+ appearance.setLineColor(new Color(0, 0, 0));
+ appearance.setLineWidth((float) lineWidth);
+
+ drawingTools.drawPolyline(new int[] {halfLineWidth, halfLineWidth, boxWidth - halfLineWidth, halfLineWidth,
+ boxWidth - halfLineWidth, boxHeight - halfLineWidth, halfLineWidth, boxHeight - halfLineWidth,
+ halfLineWidth, halfLineWidth
+ },
+ appearance);
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ Dimension dimension = textEntities[textSpriteIndex].getSize();
+
+ int boxWidth = (int) dimension.getWidth() + 2 * MARGIN + lineWidth;
+ int boxHeight = (int) dimension.getHeight() + 2 * MARGIN + lineWidth;
+
+ return new Dimension(boxWidth, boxHeight);
+ }
+
+ @Override
+ public OriginPosition getOriginPosition() {
+ return OriginPosition.UPPER_LEFT;
+ }
+
+ };
+ }
+
+ /**
+ * Toggles display of the anchors.
+ */
+ public void toggleAnchorDisplay() {
+ anchorsDisplayed = !anchorsDisplayed;
+ }
+
+ /**
+ * Switches the rotation direction.
+ */
+ public void switchRotationDirection() {
+ clockwiseRotation = !clockwiseRotation;
+ }
+
+ /**
+ * Toggles display of the help message.
+ */
+ public void toggleMessageDisplay() {
+ messageDisplayed = !messageDisplayed;
+ }
+
+ /**
+ * Creates a help message.
+ * @param canvas the canvas where the message sprite is created.
+ * @return a sprite that draws the message.
+ */
+ private Texture createMessage(Canvas canvas) {
+ final TextEntity text = new TextEntity("Press 'T' to toggle anchor drawing, 'D' to switch the rotation direction, 'M' to toggle this message.");
+ Texture message = canvas.getTextureManager().createTexture();
+ message.setDrawer(new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ drawingTools.draw(text, 0, 0);
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return text.getSize();
+ }
+
+ @Override
+ public OriginPosition getOriginPosition() {
+ return OriginPosition.UPPER_LEFT;
+ }
+ });
+
+ return message;
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.buffers.ElementsBuffer;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter;
+import org.scilab.forge.scirenderer.ruler.DefaultRulerModel;
+import org.scilab.forge.scirenderer.ruler.RulerDrawer;
+import org.scilab.forge.scirenderer.ruler.RulerModel;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.DefaultGeometry;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.texture.AnchorPosition;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.texture.TextureDrawer;
+import org.scilab.forge.scirenderer.texture.TextureDrawingTools;
+import org.scilab.forge.scirenderer.tranformations.Rotation;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+import java.awt.Dimension;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class ScilabLikePlot2D extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Scilab like 'plot2D' Example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private ScilabLikePlot2D() {
+ setTitle(TITLE);
+
+ final MouseRotationAdapter mra = new MouseRotationAdapter(
+ new Rotation(Math.toRadians(0), new Vector3d(1, 0, 0)),
+ getCanvas()
+ );
+ getPanel().addMouseListener(mra);
+
+ getCanvas().setMainDrawer(new Plot2DDrawer(getCanvas(), mra));
+ }
+
+ /**
+ * Main function.
+ * @param arguments main arguments.
+ */
+ public static void main(String[] arguments) {
+ new ScilabLikePlot2D();
+ }
+
+ /**
+ * A plot2d like drawer
+ *
+ * @author Pierre Lando
+ */
+ public static class Plot2DDrawer implements Drawer {
+
+ // Some geometry
+ private final DefaultGeometry plot1;
+ private final DefaultGeometry plot2;
+
+ // Some sprite and position buffer for it.
+ private final ElementsBuffer plot3Data;
+ private final Texture sprite;
+
+ // Some rulers.
+ private final RulerDrawer rulerDrawer;
+ private DefaultRulerModel xRulerModel;
+ private DefaultRulerModel yRulerModel;
+
+ private final MouseRotationAdapter mra;
+
+
+ /**
+ * Default constructor.
+ * @param canvas parent {@link org.scilab.forge.scirenderer.Canvas}
+ * @param mra a {@link org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter} to add some interactivity.
+ */
+ public Plot2DDrawer(Canvas canvas, MouseRotationAdapter mra) {
+
+ this.mra = mra;
+ /**
+ * Create the ruler drawer.
+ */
+ rulerDrawer = new RulerDrawer(canvas.getTextureManager());
+
+ // Create a geometry
+ ElementsBuffer sinData1 = canvas.getBuffersManager().createElementsBuffer();
+ sinData1.setData(getSinData(3, 100, 10), 4);
+ plot1 = new DefaultGeometry();
+ plot1.setFillDrawingMode(Geometry.FillDrawingMode.NONE);
+ plot1.setLineDrawingMode(Geometry.LineDrawingMode.SEGMENTS_STRIP);
+ plot1.setVertices(sinData1);
+
+ // Create a second geometry
+ ElementsBuffer sinData2 = canvas.getBuffersManager().createElementsBuffer();
+ sinData2.setData(getSinData(2, 100, 10), 4);
+ plot2 = new DefaultGeometry();
+ plot2.setFillDrawingMode(Geometry.FillDrawingMode.NONE);
+ plot2.setLineDrawingMode(Geometry.LineDrawingMode.SEGMENTS_STRIP);
+ plot2.setVertices(sinData2);
+
+ // Create a position buffer to draw some sprite.
+ plot3Data = canvas.getBuffersManager().createElementsBuffer();
+ plot3Data.setData(getSinData(1, 60, 10), 4);
+
+ // Create a sprite.
+ sprite = canvas.getTextureManager().createTexture();
+ sprite.setDrawer(getSpriteDrawer());
+ }
+
+ @Override
+ public void draw(DrawingTools drawingTools) {
+ drawingTools.clear(new Color(1f, 1f, 1f));
+
+ try {
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(drawingTools.getCanvas().getDimension(), 1f);
+ drawingTools.getTransformationManager().getProjectionStack().push(projection);
+ drawingTools.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getScaleTransformation(.1, .1, .1));
+ drawingTools.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(mra.getRotation()));
+ Appearance appearance = new Appearance();
+
+ // Draw first geometry.
+ appearance.setLineColor(new Color(0, 1, 0));
+ appearance.setLineWidth(4);
+ drawingTools.draw(plot1, appearance);
+
+ // Draw second geometry.
+ appearance.setLineColor(new Color(0, 0, 0));
+ appearance.setLineWidth(1);
+ drawingTools.draw(plot2, appearance);
+
+ // Draw sprites.
+ drawingTools.draw(sprite, AnchorPosition.CENTER, plot3Data);
+
+ // Draw rulers.
+ rulerDrawer.draw(drawingTools, getXRulerModel());
+ rulerDrawer.draw(drawingTools, getYRulerModel());
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+ }
+
+
+ @Override
+ public boolean is2DView() {
+ return true;
+ }
+
+ /**
+ * Return a float array filled with some "y = sin(theta * x)" data.
+ * @param theta the data period.
+ * @param density the data density (number of point).
+ * @param bound the data bounds (result have x in [-bound, bound[).
+ * @return a float array filled with some "y = sin(theta * x)" data.
+ */
+ public float[] getSinData(float theta, int density, float bound) {
+ float[] sinData = new float[density * 4];
+ for (int i = 0; i < density; i++) {
+ float x = bound * 2 * (i - density / 2f) / density; // x : [-bound, bound[
+ float y = (float) Math.sin(x * theta);
+
+ sinData[i * 4] = x;
+ sinData[i * 4 + 1] = y;
+ sinData[i * 4 + 2] = 0;
+ sinData[i * 4 + 3] = 1;
+ }
+ return sinData;
+ }
+
+ /**
+ * Return a sprite drawer.
+ * @return a sprite drawer.
+ */
+ public TextureDrawer getSpriteDrawer() {
+ return new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ Appearance appearance = new Appearance();
+ appearance.setLineColor(new Color(1, 0, 0));
+ drawingTools.drawPolyline(new int[] {
+ -5, 0,
+ +5, 0
+ }, appearance);
+ drawingTools.drawPolyline(new int[] {
+ 0, -5,
+ 0, +5
+ }, appearance);
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return new Dimension(16, 16);
+ }
+
+ @Override
+ public OriginPosition getOriginPosition() {
+ return OriginPosition.CENTER;
+ }
+ };
+ }
+
+ /**
+ * Return the X ruler model.
+ * @return the X ruler model.
+ */
+ public RulerModel getXRulerModel() {
+ if (xRulerModel == null) {
+ xRulerModel = new DefaultRulerModel();
+ xRulerModel.setFirstPoint(new Vector3d(-10, -1, 0));
+ xRulerModel.setSecondPoint(new Vector3d(10, -1, 0));
+ xRulerModel.setValues(10, -10);
+ xRulerModel.setLineVisible(true);
+ xRulerModel.setTicksDirection(new Vector3d(0, -1, 0));
+ }
+ return xRulerModel;
+ }
+
+ /**
+ * Return the Y ruler model.
+ * @return the Y ruler model.
+ */
+ public RulerModel getYRulerModel() {
+ if (yRulerModel == null) {
+ yRulerModel = new DefaultRulerModel();
+ yRulerModel.setFirstPoint(new Vector3d(-10, -1, 0));
+ yRulerModel.setSecondPoint(new Vector3d(-10, 1, 0));
+ yRulerModel.setValues(1, -1);
+ yRulerModel.setLineVisible(true);
+ yRulerModel.setTicksDirection(new Vector3d(-1, 0, 0));
+ }
+ return yRulerModel;
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.ruler.DefaultRulerModel;
+import org.scilab.forge.scirenderer.ruler.RulerDrawer;
+import org.scilab.forge.scirenderer.ruler.RulerModel;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.tranformations.DegenerateMatrixException;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+import javax.swing.BoundedRangeModel;
+import javax.swing.DefaultBoundedRangeModel;
+import javax.swing.JCheckBox;
+import javax.swing.JFormattedTextField;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.text.DecimalFormat;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class SimpleRuler extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Ruler Example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private SimpleRuler() {
+ setTitle(TITLE);
+
+ final BoundedRangeModel zoomLevel = new DefaultBoundedRangeModel(13, 0, 1, 1000);
+
+
+ JPanel buttonsPanel = new JPanel(new FlowLayout());
+
+ final JFormattedTextField minValue = new JFormattedTextField(new DecimalFormat("0.0000"));
+ minValue.setValue(1);
+
+ final JFormattedTextField maxValue = new JFormattedTextField(new DecimalFormat("0.0000"));
+ maxValue.setValue(4);
+
+ final JCheckBox logBox = new JCheckBox("Log");
+ logBox.setSelected(true);
+
+ buttonsPanel.add(minValue);
+ buttonsPanel.add(maxValue);
+ buttonsPanel.add(logBox);
+ buttonsPanel.add(new JSlider(zoomLevel));
+
+ add(buttonsPanel, BorderLayout.SOUTH);
+
+ // SciRenderer canvas.
+ final DefaultRulerModel rulerModel = new DefaultRulerModel();
+ rulerModel.setFirstPoint(new Vector3d(-1, 0, 0));
+ rulerModel.setSecondPoint(new Vector3d(1, 0, 0));
+ rulerModel.setFirstValue(Double.parseDouble(minValue.getValue().toString()));
+ rulerModel.setSecondValue(Double.parseDouble(maxValue.getValue().toString()));
+ rulerModel.setTicksDirection(new Vector3d(0, -1, 0));
+ rulerModel.setLogarithmic(true);
+
+ Drawer drawer = new MainRulerDrawer(getCanvas(), zoomLevel, rulerModel);
+ getCanvas().setMainDrawer(drawer);
+
+ zoomLevel.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ getCanvas().redraw();
+ }
+ });
+
+ logBox.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ if (logBox.isSelected()) {
+ double a = Math.abs(rulerModel.getFirstValue());
+ double b = Math.abs(rulerModel.getSecondValue());
+ if (b == 0) {
+ b = 10;
+ }
+ if (a == 0) {
+ a = 1;
+ }
+ rulerModel.setFirstValue(Math.min(a, b));
+ rulerModel.setSecondValue(Math.max(a, b));
+ rulerModel.setLogarithmic(true);
+ } else {
+ rulerModel.setLogarithmic(false);
+ }
+ getCanvas().redraw();
+ }
+ });
+
+ ActionListener valueChangedListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ rulerModel.setFirstValue(Double.parseDouble(minValue.getValue().toString()));
+ rulerModel.setSecondValue(Double.parseDouble(maxValue.getValue().toString()));
+ getCanvas().redraw();
+ }
+ };
+
+ maxValue.addActionListener(valueChangedListener);
+ minValue.addActionListener(valueChangedListener);
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new SimpleRuler();
+ }
+
+ /**
+ * The ruler drawer.
+ */
+ public static class MainRulerDrawer implements Drawer {
+
+ private final RulerDrawer rulerDrawer;
+ private final RulerModel rulerModel;
+ private final BoundedRangeModel zoomLevel;
+
+ /**
+ * Default constructor.
+ * @param canvas the canvas where the draw will be performed.
+ * @param zoomLevel the current zoom level model.
+ * @param rulerModel the current ruler model.
+ */
+ public MainRulerDrawer(Canvas canvas, BoundedRangeModel zoomLevel, RulerModel rulerModel) {
+ this.zoomLevel = zoomLevel;
+ this.rulerModel = rulerModel;
+ this.rulerDrawer = new RulerDrawer(canvas.getTextureManager());
+ }
+
+ @Override
+ public void draw(DrawingTools dt) {
+ dt.clear(new Color(1f, 1f, 1f));
+
+ try {
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(dt.getCanvas().getDimension(), 1f);
+ dt.getTransformationManager().getProjectionStack().push(projection);
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getScaleTransformation(zoomLevel.getValue() / 100.0));
+
+ } catch (DegenerateMatrixException ignored) {
+ // Should not occur.
+ }
+
+ rulerDrawer.draw(dt, rulerModel);
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.buffers.ElementsBuffer;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.examples.utils.MouseRotationAdapter;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.texture.AnchorPosition;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.texture.TextureDrawer;
+import org.scilab.forge.scirenderer.texture.TextureDrawingTools;
+import org.scilab.forge.scirenderer.tranformations.Rotation;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+import java.awt.Dimension;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class Sprites extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Sprites Example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private Sprites() {
+ setTitle(TITLE);
+
+ /**
+ * Add a mouse rotation adapter.
+ */
+ final MouseRotationAdapter mra = new MouseRotationAdapter(
+ new Rotation(Math.toRadians(90), new Vector3d(1, 0, 0)),
+ getCanvas()
+ );
+ getPanel().addMouseListener(mra);
+
+ getCanvas().setMainDrawer(new SpritesDrawer(getCanvas(), mra));
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new Sprites();
+ }
+
+ /**
+ * Sprites drawer.
+ */
+ public static class SpritesDrawer implements Drawer {
+ private static final int SPRITE_RADIUS = 5;
+ private final int cubeSize = 8;
+ private final MouseRotationAdapter mouseRotationAdapter;
+ private final ElementsBuffer position;
+ private final Texture sprite;
+
+ /**
+ * Constructor.
+ * @param canvas the canvas where the sprites are drawn.
+ * @param mra the mouse listener used for the interaction.
+ */
+ public SpritesDrawer(Canvas canvas, MouseRotationAdapter mra) {
+ mouseRotationAdapter = mra;
+ sprite = createSprite(canvas);
+
+ position = canvas.getBuffersManager().createElementsBuffer();
+ position.setData(createData(), 4);
+ }
+
+ @Override
+ public void draw(DrawingTools drawingTools) {
+ drawingTools.clear(new Color(1, 1, 1));
+
+ try {
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(drawingTools.getCanvas().getDimension(), 1f);
+ drawingTools.getTransformationManager().getProjectionStack().push(projection);
+ drawingTools.getTransformationManager().getModelViewStack().push(TransformationFactory.getScaleTransformation(.6, .6, .6));
+ drawingTools.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(mouseRotationAdapter.getRotation()));
+ drawingTools.draw(sprite, AnchorPosition.CENTER, position);
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+
+ /**
+ * Create sprite position data.
+ * @return an array filled with the position where the sprite will be drawn.
+ */
+ private float[] createData() {
+ float[] data = new float[4 * cubeSize * cubeSize * cubeSize];
+ int index = 0;
+ for (float i = 0; i < cubeSize; i++) {
+ for (float j = 0; j < cubeSize; j++) {
+ for (float k = 0; k < cubeSize; k++) {
+ data[index++] = (i / (cubeSize - 1)) * 2 - 1;
+ data[index++] = (j / (cubeSize - 1)) * 2 - 1;
+ data[index++] = (k / (cubeSize - 1)) * 2 - 1;
+ data[index++] = 1;
+ }
+ }
+ }
+ return data;
+ }
+
+ /**
+ * Sprite constructor.
+ * @param canvas the canvas where the sprite will be drawn.
+ * @return the example sprite.
+ */
+ private Texture createSprite(Canvas canvas) {
+ Texture newSprite = canvas.getTextureManager().createTexture();
+ newSprite.setDrawer(new TextureDrawer() {
+
+ @Override
+ public void draw(TextureDrawingTools drawingTools) {
+ Appearance appearance = new Appearance();
+ appearance.setLineColor(new Color(0, 0, 0));
+ drawingTools.drawPolyline(new int[] {
+ -SPRITE_RADIUS, 0,
+ +SPRITE_RADIUS, 0,
+ }, appearance);
+
+ drawingTools.drawPolyline(new int[] {
+ 0, +SPRITE_RADIUS,
+ 0, -SPRITE_RADIUS
+ }, appearance);
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return new Dimension(SPRITE_RADIUS * 2 + 1, SPRITE_RADIUS * 2 + 1);
+ }
+
+ @Override
+ public OriginPosition getOriginPosition() {
+ return OriginPosition.CENTER;
+ }
+ });
+
+ return newSprite;
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2012 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+package org.scilab.forge.scirenderer.examples;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.Drawer;
+import org.scilab.forge.scirenderer.DrawingTools;
+import org.scilab.forge.scirenderer.SciRendererException;
+import org.scilab.forge.scirenderer.buffers.ElementsBuffer;
+import org.scilab.forge.scirenderer.buffers.IndicesBuffer;
+import org.scilab.forge.scirenderer.examples.utils.ExampleFrame;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.DefaultGeometry;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.texture.AbstractTextureDataProvider;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.TransformationFactory;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+import java.awt.Dimension;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.image.BufferedImage;
+import java.nio.ByteBuffer;
+import java.util.Date;
+
+/**
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public final class TextureExample extends ExampleFrame {
+
+ /**
+ * Frame title.
+ */
+ private static final String TITLE = "Texture Example";
+
+ /**
+ * Private constructor.
+ * This is the main class.
+ */
+ private TextureExample() {
+
+ setTitle(TITLE);
+
+ final ClickCounter clickCounter = new ClickCounter();
+ getPanel().addMouseListener(clickCounter);
+ getCanvas().setMainDrawer(new TextureDrawer(getCanvas(), clickCounter));
+
+ animate(true);
+ }
+
+ /**
+ * Main function.
+ * @param arguments launch arguments. Ignored.
+ */
+ public static void main(String[] arguments) {
+ new TextureExample();
+ }
+
+ /**
+ * Texture drawer.
+ */
+ private final class TextureDrawer implements Drawer {
+ private final ClickCounter clickCounter;
+
+ private final Appearance appearance1;
+ private final Appearance appearance2;
+
+ private final Geometry geometry1;
+ private final Geometry geometry2;
+
+ /**
+ * Constructor.
+ * @param canvas the canvas where the textures will be drawn.
+ * @param clickCounter the click counter used to determine witch texture is drawn.
+ */
+ public TextureDrawer(Canvas canvas, ClickCounter clickCounter) {
+ this.clickCounter = clickCounter;
+
+ geometry1 = new SimpleGeometry(canvas);
+ geometry2 = new LessSimpleGeometry(canvas);
+
+ Texture texture1 = canvas.getTextureManager().createTexture();
+ Texture texture2 = canvas.getTextureManager().createTexture();
+
+ appearance1 = new Appearance();
+ texture1.setDataProvider(new Simple2DTextureDataProvider());
+ appearance1.setTexture(texture1);
+
+ appearance2 = new Appearance();
+ texture2.setDataProvider(new Simple1DTextureDataProvider());
+ appearance2.setTexture(texture2);
+ }
+
+ @Override
+ public void draw(DrawingTools dt) {
+ dt.clear(new Color());
+
+ try {
+ double t = System.currentTimeMillis() / 30.;
+
+ Transformation projection = TransformationFactory.getPreferredAspectRatioTransformation(dt.getCanvas().getDimension(), 1f);
+ dt.getTransformationManager().getProjectionStack().push(projection);
+ dt.getTransformationManager().getModelViewStack().push(TransformationFactory.getScaleTransformation(Math.sqrt(2) / 2));
+ dt.getTransformationManager().getModelViewStack().pushRightMultiply(TransformationFactory.getRotationTransformation(t, 1, 2, 3));
+
+ if (clickCounter.getCount() % 2 == 0) {
+ dt.draw(geometry1, appearance1);
+ } else {
+ dt.draw(geometry2, appearance2);
+ }
+ } catch (SciRendererException ignored) {
+ // Should not occur.
+ }
+ }
+
+ @Override
+ public boolean is2DView() {
+ return false;
+ }
+ }
+
+ /**
+ * This mouse adapter count the number of click.
+ */
+ private final class ClickCounter extends MouseAdapter {
+ private int count;
+
+ /**
+ * Default constructor.
+ */
+ public ClickCounter() {
+ count = 0;
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ count++;
+ }
+
+ /**
+ * Number of click getter.
+ * @return the number of click until the application start.
+ */
+ public int getCount() {
+ return count;
+ }
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private final class SimpleGeometry extends DefaultGeometry implements Geometry {
+
+ /**
+ * Default constructor.
+ * @param canvas the canvas where the geometry will be created.
+ */
+ public SimpleGeometry(Canvas canvas) {
+ ElementsBuffer vertices = canvas.getBuffersManager().createElementsBuffer();
+ vertices.setData(new float[] {
+ -1, -1, 0, 1,
+ -1, +1, 0, 1,
+ +1, +1, 0, 1,
+ +1, -1, 0, 1,
+ }, 4);
+
+ IndicesBuffer indices = canvas.getBuffersManager().createIndicesBuffer();
+ indices.setData(new int[] {
+ 0, 1, 2, 0, 2, 3
+ });
+
+ ElementsBuffer textureCoordinates = canvas.getBuffersManager().createElementsBuffer();
+ textureCoordinates.setData(new float[] {
+ 0, 0,
+ 0, 1,
+ 1, 1,
+ 1, 0
+ }, 2);
+
+ setFillDrawingMode(FillDrawingMode.TRIANGLES);
+ setVertices(vertices);
+ setIndices(indices);
+ setTextureCoordinates(textureCoordinates);
+ }
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private final class LessSimpleGeometry extends DefaultGeometry implements Geometry {
+
+ private static final int SIZE = 65;
+ private static final double HALF_SIZE = SIZE / 2.;
+
+ /**
+ * Default constructor.
+ * @param canvas the {@link org.scilab.forge.scirenderer.Canvas} where the drawn will be performed.
+ */
+ public LessSimpleGeometry(Canvas canvas) {
+ int k;
+ ElementsBuffer vertices = canvas.getBuffersManager().createElementsBuffer();
+ float[] verticesData = new float [SIZE * SIZE * 4];
+ k = 0;
+ for (int i = 0; i < SIZE; i++) {
+ for (int j = 0; j < SIZE; j++) {
+ double x = 2 * (i / (SIZE - 1f) - .5);
+ double y = 2 * (j / (SIZE - 1f) - .5);
+ double d = Math.max(Math.abs(x), Math.abs(y));
+ Vector3d v = new Vector3d(x, y, 0).getNormalized().times(d);
+ verticesData[k++] = (float) v.getX();
+ verticesData[k++] = (float) v.getY();
+ verticesData[k++] = 0;
+ verticesData[k++] = 1;
+ }
+ }
+
+ vertices.setData(verticesData, 4);
+
+ ElementsBuffer textureCoordinates = canvas.getBuffersManager().createElementsBuffer();
+ float[] textureCoordinatesData = new float[SIZE * SIZE];
+ k = 0;
+ for (int i = 0; i < SIZE; i++) {
+ for (int j = 0; j < SIZE; j++) {
+ double v = Math.sqrt(Math.pow(i - HALF_SIZE, 2) + Math.pow(j - HALF_SIZE, 2));
+ v = (Math.sin(4 * Math.PI * v / SIZE) + 1) / 2;
+ textureCoordinatesData[k++] = (float) v;
+ }
+ }
+ textureCoordinates.setData(textureCoordinatesData, 1);
+
+ IndicesBuffer indices = canvas.getBuffersManager().createIndicesBuffer();
+ int[] indicesData = new int [6 * (SIZE - 1) * (SIZE - 1)];
+ k = 0;
+ int u = 0;
+ for (int i = 0; i < SIZE - 1; i++) {
+ for (int j = 0; j < SIZE - 1; j++) {
+ indicesData[k++] = u;
+ indicesData[k++] = u + 1;
+ indicesData[k++] = u + SIZE + 1;
+ indicesData[k++] = u;
+ indicesData[k++] = u + SIZE + 1;
+ indicesData[k++] = u + SIZE;
+ u++;
+ }
+ u++;
+ }
+ indices.setData(indicesData);
+
+ setFillDrawingMode(FillDrawingMode.TRIANGLES);
+ setVertices(vertices);
+ setIndices(indices);
+ setTextureCoordinates(textureCoordinates);
+ }
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private final class Simple1DTextureDataProvider extends AbstractTextureDataProvider {
+ private final int size = 16;
+ private ByteBuffer buffer;
+
+ /**
+ * Default constructor.
+ */
+ public Simple1DTextureDataProvider() {
+ this.buffer = ByteBuffer.allocate(4 * size); // 4 for RGBA.
+ buffer.rewind();
+ new SimpleThread().start();
+ }
+
+ /**
+ * Fill the data buffer.
+ */
+ private void fillBuffer() {
+ double phi = Math.PI * 2 / 1024;
+ long time = new Date().getTime();
+ long base = (int) ((time / 4) % 1024);
+ ByteBuffer tempBuffer = ByteBuffer.allocate(4 * size);
+ tempBuffer.rewind();
+ for (int i = 0; i < size; i++) {
+ tempBuffer.put(toByte((Math.sin(base * phi) + 1) / 2));
+ tempBuffer.put(toByte((Math.sin(2 * base * phi + i) + 1) / 2));
+ tempBuffer.put(toByte((Math.sin(base * phi + i) + 1) / 2));
+ tempBuffer.put(toByte(255));
+ }
+ tempBuffer.rewind();
+ this.buffer = tempBuffer;
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return new Dimension(size, 1);
+ }
+
+ @Override
+ public ByteBuffer getData() {
+ buffer.rewind();
+ return buffer;
+ }
+
+ @Override
+ public ByteBuffer getSubData(int x, int y, final int width, final int height) {
+ ByteBuffer tempBuffer = ByteBuffer.allocate(4 * width * height);
+ this.buffer.position(x + y * size);
+ byte[] data = new byte[4];
+ for (int i = x; i < x + width; i++) {
+ for (int j = y; j < y + height; j++) {
+ this.buffer.get(data);
+ tempBuffer.put(data);
+ }
+ }
+ tempBuffer.rewind();
+ this.buffer.rewind();
+ return tempBuffer;
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ /**
+ * This thread update the texture regularly.
+ */
+ private class SimpleThread extends Thread {
+
+ /**
+ * Default constructor.
+ */
+ public SimpleThread() {
+ }
+
+ @Override
+ public void run() {
+ for (;;) {
+ fillBuffer();
+ fireUpdate();
+ try {
+ synchronized (this) {
+ wait(32);
+ }
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @author Pierre Lando
+ */
+ private final class Simple2DTextureDataProvider extends AbstractTextureDataProvider {
+ private final int size = 16;
+ private ByteBuffer buffer;
+
+ /**
+ * Default constructor.
+ */
+ public Simple2DTextureDataProvider() {
+ this.buffer = ByteBuffer.allocate(4 * size * size); // 4 for RGBA.
+ buffer.rewind();
+ new SimpleThread().start();
+ }
+
+ /**
+ * Fill the data buffer.
+ */
+ private void fillBuffer() {
+ double phi = Math.PI * 2 / 1024;
+ long time = new Date().getTime();
+ long base = (int) ((time / 4) % 1024);
+ ByteBuffer tempBuffer = ByteBuffer.allocate(4 * size * size);
+ tempBuffer.rewind();
+ int k = 0;
+ for (int i = 0; i < size; i++) {
+ for (int j = 0; j < size; j++) {
+ tempBuffer.put(toByte((Math.sin((5 * base + 16 * i) * phi) + 1) / 2));
+ tempBuffer.put(toByte((Math.sin((2 * base + 8 * j) * phi) + 1) / 2));
+ tempBuffer.put(toByte((Math.sin((7 * base + 4 * k) * phi) + 1) / 2));
+ tempBuffer.put(toByte(255));
+ k++;
+ }
+ }
+ tempBuffer.rewind();
+ this.buffer = tempBuffer;
+ }
+
+ @Override
+ public Dimension getTextureSize() {
+ return new Dimension(size, size);
+ }
+
+ @Override
+ public ByteBuffer getData() {
+ buffer.rewind();
+ return buffer;
+ }
+
+ @Override
+ public ByteBuffer getSubData(int x, int y, final int width, final int height) {
+ ByteBuffer tempBuffer = ByteBuffer.allocate(4 * width * height);
+ this.buffer.position(x + y * size);
+ byte[] data = new byte[4];
+ for (int i = x; i < x + width; i++) {
+ for (int j = y; j < y + height; j++) {
+ this.buffer.get(data);
+ tempBuffer.put(data);
+ }
+ }
+ tempBuffer.rewind();
+ this.buffer.rewind();
+ return tempBuffer;
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ /**
+ * This thread update the texture regularly.
+ */
+ private class SimpleThread extends Thread {
+
+ /**
+ * Default constructor.
+ */
+ public SimpleThread() {
+ }
+
+ @Override
+ public void run() {
+ for (;;) {
+ fillBuffer();
+ fireUpdate();
+ try {
+ synchronized (this) {
+ wait(32);
+ }
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2012 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples.utils;
+
+import com.jogamp.opengl.util.Animator;
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.implementation.jogl.JoGLCanvasFactory;
+
+import javax.media.opengl.awt.GLJPanel;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+
+/**
+ * @author Pierre Lando
+ */
+public abstract class ExampleFrame extends JFrame {
+
+ /**
+ * The default frame size.
+ */
+ private static final Dimension DEFAULT_SIZE = new Dimension(800, 800);
+
+ /**
+ * The used animator.
+ */
+ private Animator animator;
+
+ /**
+ * The canvas.
+ */
+ private final Canvas canvas;
+
+ /**
+ * The gl panel.
+ */
+ private final GLJPanel glPanel;
+
+ /**
+ * Default constructor.
+ * Initialise the GUI.
+ */
+ protected ExampleFrame() {
+ glPanel = new GLJPanel();
+ canvas = JoGLCanvasFactory.createCanvas(glPanel);
+
+ setSize(DEFAULT_SIZE);
+ setLayout(new BorderLayout());
+ add(glPanel, BorderLayout.CENTER);
+
+ setLocationRelativeTo(null);
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setVisible(true);
+ }
+
+ /**
+ * Canvas getter.
+ * @return the {@link Canvas}.
+ */
+ protected final Canvas getCanvas() {
+ return canvas;
+ }
+
+ /**
+ * OpenGL panel getter.
+ * @return the OpenGL panel.
+ */
+ protected final JPanel getPanel() {
+ return glPanel;
+ }
+
+ /**
+ * Animated scene setter.
+ * @param animated true if the scene is auto-animated.
+ */
+ protected final void animate(boolean animated) {
+ if (animated && (animator == null)) {
+ animator = new Animator();
+ animator.add(glPanel);
+ animator.start();
+ }
+ if (!animated && (animator != null)) {
+ animator.remove(glPanel);
+ animator.stop();
+ animator = null;
+ }
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.examples.utils;
+
+import org.scilab.forge.scirenderer.Canvas;
+import org.scilab.forge.scirenderer.tranformations.Rotation;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+
+/**
+ * This mouse adapter generate a {@link org.scilab.forge.scirenderer.tranformations.Rotation}, depending on mouse drags.
+ *
+ * @author Pierre Lando
+ */
+public class MouseRotationAdapter implements MouseListener, MouseMotionListener {
+ private static final float SPEED_RATIO = 128f;
+
+ private Rotation currentRotation = new Rotation(Math.toRadians(0), new Vector3d(1, 0, 0));
+ private Rotation startRotation;
+ private Point startPoint;
+
+ /**
+ * The canvas will be notified for update.
+ */
+ private Canvas canvas;
+
+ /**
+ * Default constructor.
+ * @param startRotation the starting rotation.
+ */
+ public MouseRotationAdapter(Rotation startRotation) {
+ currentRotation = startRotation;
+ this.canvas = null;
+ }
+
+ /**
+ * A constructor.
+ * The given canvas will be notified for when the current rotation change.
+ * @param rotation the starting rotation.
+ * @param canvas the canvas to be notified on rotation changes.
+ */
+ public MouseRotationAdapter(Rotation rotation, Canvas canvas) {
+ currentRotation = rotation;
+ this.canvas = canvas;
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ startRotation = currentRotation;
+ startPoint = e.getPoint();
+ e.getComponent().addMouseMotionListener(this);
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ e.getComponent().removeMouseMotionListener(this);
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ int deltaX = e.getX() - startPoint.x;
+ int deltaY = e.getY() - startPoint.y;
+
+ Rotation delta = new Rotation(deltaY / SPEED_RATIO, new Vector3d(1, 0, 0));
+ delta.multiply(new Rotation(deltaX / SPEED_RATIO, new Vector3d(0, 1, 0)));
+
+ currentRotation = startRotation.times(delta);
+
+ if (canvas != null) {
+ canvas.redraw();
+ }
+ }
+
+ /**
+ * Return the current rotation.
+ * @return the current rotation.
+ */
+ public Rotation getRotation() {
+ return currentRotation;
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseMoved(MouseEvent e) {
+ }
+}
--- /dev/null
+; Define all libs needed by scirenderer
+
+; Uncomment this line and declare path to jogl2.jar gluegen2-rt.jar jlatexmath.jar and native libraries
+jogl2.jar = /usr/share/java/jogl2.jar
+gluegen2.jar = /usr/share/java/gluegen2-rt.jar
+jlatexmath.jar = /usr/share/java/jlatexmath.jar
+jni.path = /usr/lib/jni
--- /dev/null
+version=1.1.0
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer;
+
+import org.scilab.forge.scirenderer.buffers.BuffersManager;
+import org.scilab.forge.scirenderer.picking.PickingManager;
+import org.scilab.forge.scirenderer.renderer.RendererManager;
+import org.scilab.forge.scirenderer.texture.TextureManager;
+
+import java.awt.Dimension;
+
+/**
+ * @author Pierre Lando
+ */
+public interface Canvas {
+
+ /**
+ * Set this canvas main drawer.
+ * @param mainDrawer the new canvas main drawer.
+ */
+ void setMainDrawer(Drawer mainDrawer);
+
+ /**
+ * Return the canvas main drawer.
+ * @return the canvas main drawer.
+ */
+ Drawer getMainDrawer();
+
+ /**
+ * Return the renderer manager.
+ * @return the renderer manager.
+ */
+ RendererManager getRendererManager();
+
+ /**
+ * Return the buffers manager of this canvas.
+ * @return the buffers manager of this canvas.
+ */
+ BuffersManager getBuffersManager();
+
+ /**
+ * Return the picking manager.
+ * @return the picking manager.
+ */
+ PickingManager getPickingManager();
+
+ /**
+ * Texture manger getter.
+ * @return the texture manager.
+ */
+ TextureManager getTextureManager();
+
+ /**
+ * Return the canvas width.
+ * @return the canvas width.
+ */
+ int getWidth();
+
+ /**
+ * Return the canvas height.
+ * @return the canvas height.
+ */
+ int getHeight();
+
+ /**
+ * Return the canvas dimension.
+ * @return the canvas dimension.
+ */
+ Dimension getDimension();
+
+ /**
+ * Anti-aliasing level getter.
+ * - 0 for 1x
+ * - 1 for 2x
+ * - 2 for 4x
+ * - 3 for 8x
+ * - 4 for 16x
+ * @return the anti-aliasing level.
+ */
+ public int getAntiAliasingLevel();
+
+ /**
+ * Anti-aliasing level setter.
+ * - 0 for 1x
+ * - 1 for 2x
+ * - 2 for 4x
+ * - 3 for 8x
+ * - 4 for 16x
+ * @param antiAliasingLevel the new level.
+ */
+ public void setAntiAliasingLevel(int antiAliasingLevel);
+
+ /** Ask the canvas to perform asynchronous drawing. */
+ void redraw();
+
+ /** Ask the canvas to perform asynchronous drawing. */
+ void redrawAndWait();
+
+ /** Wait until a drawing has been performed */
+ void waitImage();
+
+ /** Destroy canvas : release Semaphore and associated threads */
+ void destroy();
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer;
+
+/**
+ * @author Pierre Lando
+ */
+public interface Drawer {
+
+ /**
+ * Ask this drawer to draw with the given drawing tools.
+ * @param drawingTools the givens drawing tools.
+ */
+ void draw(DrawingTools drawingTools);
+
+ /**
+ * @return true if it is a 2D drawing
+ */
+ boolean is2DView();
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer;
+
+import org.scilab.forge.scirenderer.buffers.ElementsBuffer;
+import org.scilab.forge.scirenderer.clipping.ClippingManager;
+import org.scilab.forge.scirenderer.lightning.LightManager;
+import org.scilab.forge.scirenderer.renderer.Renderer;
+import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
+import org.scilab.forge.scirenderer.shapes.appearance.Color;
+import org.scilab.forge.scirenderer.shapes.geometry.Geometry;
+import org.scilab.forge.scirenderer.texture.AnchorPosition;
+import org.scilab.forge.scirenderer.texture.Texture;
+import org.scilab.forge.scirenderer.tranformations.TransformationManager;
+import org.scilab.forge.scirenderer.tranformations.Vector3d;
+
+/**
+ * @author Pierre Lando
+ */
+public interface DrawingTools {
+
+ /**
+ * Return the canvas where draw is done.
+ * @return the canvas where draw is done.
+ */
+ Canvas getCanvas();
+
+ /**
+ * Return the transformation manager.
+ * @return the transformation manager.
+ */
+ TransformationManager getTransformationManager();
+
+ /**
+ * Return the light manager.
+ * @return the light manager.
+ */
+ LightManager getLightManager();
+
+ /**
+ * Return the clipping manager.
+ * @return the clipping manager.
+ */
+ ClippingManager getClippingManager();
+
+ /**
+ * Clear the canvas with the given color.
+ * @param color the color used to clear the canvas.
+ */
+ void clear(Color color);
+
+ /**
+ * Clear the canvas with the given color.
+ * @param color the color used to clear the canvas.
+ */
+ void clear(java.awt.Color color);
+
+ /**
+ * Clear the depth buffer.
+ */
+ void clearDepthBuffer();
+
+ /**
+ * Ask the given renderer to perform a draw.
+ * @param renderer the given renderer.
+ */
+ void draw(Renderer renderer);
+
+ /**
+ * Draw the given geometry with default appearance.
+ * @param geometry the geometry to draw.
+ * @throws SciRendererException if the draw is not possible.
+ */
+ void draw(Geometry geometry) throws SciRendererException;
+
+ /**
+ * Draw the given geometry.
+ * @param geometry the geometry to draw.
+ * @param appearance the appearance to use.
+ * @throws SciRendererException if the draw is not possible.
+ */
+ void draw(Geometry geometry, Appearance appearance) throws SciRendererException;
+
+ /**
+ * Draw the texture on XY plane in current coordinate.
+ * The texture is drawn on the rectangle [(0,0)-(texture width,texture height)].
+ * @param texture the texture to drawn.
+ * @throws SciRendererException if the texture is not drawable.
+ */
+ void draw(Texture texture) throws SciRendererException;
+
+ /**
+ * Draw the given texture at all given position.
+ * @param texture the texture to draw.
+ * @param anchor the texture anchor position.
+ * @param positions the positions where the texture will be drawn.
+ * @throws SciRendererException if the texture is not drawable.
+ */
+ void draw(Texture texture, AnchorPosition anchor, ElementsBuffer positions) throws SciRendererException;
+
+ /**
+ * Draw the given texture at all given position with the given rotation angle.
+ * @param texture the texture to draw.
+ * @param anchor the texture anchor position.
+ * @param positions the positions where the texture will be drawn.
+ * @param rotationAngle the rotation angle.
+ * @throws SciRendererException if the texture is not drawable.
+ */
+ void draw(Texture texture, AnchorPosition anchor, ElementsBuffer positions, double rotationAngle) throws SciRendererException;
+
+ /**
+ * Draw the given texture at given position.
+ * @param texture the texture to draw.
+ * @param anchor the texture anchor position.
+ * @param position the position where the texture will be drawn.
+ * @throws SciRendererException if the texture is not drawable.
+ */
+ void draw(Texture texture, AnchorPosition anchor, Vector3d position) throws SciRendererException;
+
+ /**
+ * Draw the given texture at given position with the given rotation angle.
+ * @param texture the texture to draw.
+ * @param anchor the texture anchor position.
+ * @param position the position where the texture will be drawn.
+ * @param rotationAngle the rotation angle.
+ * @throws SciRendererException if the texture is not drawable.
+ */
+ void draw(Texture texture, AnchorPosition anchor, Vector3d position, double rotationAngle) throws SciRendererException;
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer;
+
+/**
+ * This utility class give information about SciRenderer library.
+ * @author Pierre Lando
+ */
+public final class PackageInfo {
+
+ /**
+ * The current version of the library.
+ */
+ public static final String VERSION = "1.1.0";
+
+ /**
+ * Private constructor : this is an utility class.
+ */
+ private PackageInfo() {
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer;
+
+/**
+ * The SciRendererException is the superclass of all Exception from SciRenderer.
+ *
+ * @author Pierre Lando
+ */
+@SuppressWarnings(value = { "serial" })
+public class SciRendererException extends Exception {
+
+ /**
+ * Constructs a new exception with null as its detail message.
+ */
+ public SciRendererException() {
+ super();
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message.
+ * @param message - the detail message. The detail message is saved for later retrieval by the #Throwable.getMessage() method.
+ */
+ public SciRendererException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and cause.
+ * @param message - the detail message (which is saved for later retrieval by the Throwable.getMessage() method).
+ * @param cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public SciRendererException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).
+ * @param cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public SciRendererException(Throwable cause) {
+ super(cause);
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.buffers;
+
+import java.util.Collection;
+
+/**
+ * Interface for a buffers manager.
+ * @author Pierre Lando
+ */
+public interface BuffersManager {
+
+ /**
+ * Create an elements buffer.
+ * @return a new elements buffer.
+ */
+ ElementsBuffer createElementsBuffer();
+
+ /**
+ * Create an indices buffer.
+ * @return a new indices buffer.
+ */
+ IndicesBuffer createIndicesBuffer();
+
+ /**
+ * Release all resources used by the given buffer.
+ * @param buffer the given buffer.
+ */
+ void dispose(DataBuffer buffer);
+
+ /**
+ * Release all resources used by the given buffers.
+ * @param buffers the given buffers.
+ */
+ void dispose(Collection <? extends DataBuffer > buffers);
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.buffers;
+
+import java.nio.Buffer;
+
+/**
+ * Interface for a data buffer.
+ * @author Pierre Lando
+ */
+public interface DataBuffer {
+
+ /**
+ * Return the data.
+ * @return the data.
+ */
+ Buffer getData();
+
+ /**
+ * Return the number of elements.
+ * @return the number of elements.
+ */
+ int getSize();
+
+ void clear();
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.buffers;
+
+import java.nio.FloatBuffer;
+
+/**
+ * @author Pierre Lando
+ */
+public interface ElementsBuffer extends DataBuffer {
+
+ /**
+ * Set the data.
+ * @param data the new data.
+ * @param elementSize the size of data elements.
+ */
+ void setData(float[] data, int elementSize);
+
+ /**
+ * Set the data.
+ * @param data the new data.
+ * @param elementSize the size of data elements.
+ */
+ void setData(Float[] data, int elementSize);
+
+ /**
+ * Set the data.
+ * @param data the new data.
+ * @param elementsSize the size of data elements.
+ */
+ void setData(FloatBuffer data, int elementsSize);
+
+ @Override
+ FloatBuffer getData();
+
+ /**
+ * Return the number of coordinate for one element.
+ * @return the number of coordinate for one element.
+ */
+ int getElementsSize();
+
+ void clear();
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.buffers;
+
+import java.nio.IntBuffer;
+import java.util.Collection;
+
+/**
+ * @author Pierre Lando
+ */
+public interface IndicesBuffer extends DataBuffer {
+
+ /**
+ * Set the data
+ * @param indices the new data.
+ */
+ void setData(int[] indices);
+
+
+ /**
+ * Set the data
+ * @param indices the new data.
+ */
+ void setData(Collection<Integer> indices);
+
+ /**
+ * Set the data.
+ * @param indexBuffer the new data.
+ */
+ void setData(IntBuffer indexBuffer);
+
+ @Override
+ IntBuffer getData();
+
+
+ void clear();
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.clipping;
+
+/**
+ * Clipping manager interface.
+ *
+ * @author Pierre Lando
+ */
+public interface ClippingManager {
+
+ /**
+ * Return the number of available clipping plane.
+ * At least 6 clipping plane are supported.
+ * @return the number of available clipping plane.
+ */
+ int getClippingPlaneNumber();
+
+ /**
+ * Return the i-th clipping plane.
+ * {@code null} is returned if i is not a valid index.
+ * @param i the given index.
+ * @return the i-th clipping plane.
+ */
+ ClippingPlane getClippingPlane(int i);
+
+ /**
+ * Disable all clipping plane.
+ */
+ void disableClipping();
+
+ // TODO add an AABB quick call. (with transformation ?)
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2011 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.clipping;
+
+import org.scilab.forge.scirenderer.tranformations.Transformation;
+import org.scilab.forge.scirenderer.tranformations.Vector4d;
+
+/**
+ * @author Pierre Lando
+ */
+public interface ClippingPlane {
+
+ /**
+ * Return the status of this clipping plane.
+ * @return the status of this clipping plane.
+ */
+ boolean isEnable();
+
+ /**
+ * Set the status of this clipping plane.
+ * @param isEnable new status of this clipping plane.
+ */
+ void setEnable(boolean isEnable);
+
+ /**
+ * Set the clipping plane equation.
+ * @param v the plane coordinate.
+ */
+ void setEquation(Vector4d v);
+
+ /**
+ * Return the plane equation.
+ * @return the plane equation.
+ */
+ Vector4d getEquation();
+
+ /**
+ * Set the coordinate transformation for the plane.
+ * @param transformation the new coordinate transformation for the plane.
+ */
+ void setTransformation(Transformation transformation);
+
+ /**
+ * Return the coordinate transformation for the plane.
+ * @return the coordinate transformation for the plane.
+ */
+ Transformation getTransformation();
+
+ /**
+ * Return the clipping plane index.
+ * @return the clipping plane index.s
+ */
+ int getIndex();
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2012 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.data;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Pierre Lando
+ * @param <DataUserType> The type of data user.
+ */
+public abstract class AbstractDataProvider<DataUserType extends DataUser> implements DataProvider<DataUserType> {
+
+ private final Set<DataUserType> users = Collections.synchronizedSet(new HashSet<DataUserType>());
+
+ @Override
+ public final void removeDataUser(DataUserType dataUser) {
+ users.remove(dataUser);
+ }
+
+ @Override
+ public final void addDataUser(DataUserType dataUser) {
+ users.add(dataUser);
+ }
+
+ /**
+ * Notify all registered data users for a data update.
+ */
+ protected final void fireUpdate() {
+ for (DataUserType dataUser : users) {
+ dataUser.dataUpdated();
+ }
+ }
+
+ /**
+ * Convert given value to a byte.
+ * double in [0, 1] are mapped to [0x00, 0xFF].
+ * @param value the given value.
+ * @return the byte corresponding to the given value.
+ */
+ protected byte toByte(double value) {
+ return (byte) (((int) (value * 255)) & 0xFF);
+ }
+
+ /**
+ * Convert given value to a byte.
+ * double in [0, 1] are mapped to [0x00, 0xFF].
+ * @param values the given value.
+ * @return the byte corresponding to the given value.
+ */
+ protected byte[] toByte(float[] values) {
+ byte bytes[] = new byte[values.length];
+ for (int i = 0; i < values.length; i++) {
+ bytes[i] = toByte(values[i]);
+ }
+ return bytes;
+ }
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2009-2012 - DIGITEO - Pierre Lando
+ *
+ * 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
+ */
+
+package org.scilab.forge.scirenderer.data;
+
+/**
+ * @author Pierre Lando
+ * @param <DataUserType> The type of data user.
+ */
+public interface DataProvider<DataUserType extends DataUser> {
+
+ /**
+ * Remove a data user.
+ * @param dataUser the data user to remove.
+ */
+ void removeDataUser(DataUserType dataUser);
+
+ /**
+ * Add a data user.
+ * @param texture the data user to add.
+ */
+ void addDataUser(DataUserType texture);
+
+ /**
+ * Data provider validity getter.
+ * @return the validity if this data provider.
+ */
+ boolean isValid();
+}
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *