summaryrefslogtreecommitdiffstats
path: root/plug-ins/lighting
diff options
context:
space:
mode:
Diffstat (limited to 'plug-ins/lighting')
-rw-r--r--plug-ins/lighting/Makefile.am65
-rw-r--r--plug-ins/lighting/Makefile.in1155
-rw-r--r--plug-ins/lighting/README39
-rw-r--r--plug-ins/lighting/TODO15
-rw-r--r--plug-ins/lighting/images/Makefile.am29
-rw-r--r--plug-ins/lighting/images/Makefile.in774
-rw-r--r--plug-ins/lighting/images/stock-intensity-ambient-high.pngbin0 -> 725 bytes
-rw-r--r--plug-ins/lighting/images/stock-intensity-ambient-low.pngbin0 -> 918 bytes
-rw-r--r--plug-ins/lighting/images/stock-intensity-diffuse-high.pngbin0 -> 829 bytes
-rw-r--r--plug-ins/lighting/images/stock-intensity-diffuse-low.pngbin0 -> 504 bytes
-rw-r--r--plug-ins/lighting/images/stock-reflectivity-diffuse-high.pngbin0 -> 805 bytes
-rw-r--r--plug-ins/lighting/images/stock-reflectivity-diffuse-low.pngbin0 -> 441 bytes
-rw-r--r--plug-ins/lighting/images/stock-reflectivity-highlight-high.pngbin0 -> 822 bytes
-rw-r--r--plug-ins/lighting/images/stock-reflectivity-highlight-low.pngbin0 -> 805 bytes
-rw-r--r--plug-ins/lighting/images/stock-reflectivity-specular-high.pngbin0 -> 842 bytes
-rw-r--r--plug-ins/lighting/images/stock-reflectivity-specular-low.pngbin0 -> 800 bytes
-rw-r--r--plug-ins/lighting/lighting-apply.c154
-rw-r--r--plug-ins/lighting/lighting-apply.h7
-rw-r--r--plug-ins/lighting/lighting-image.c407
-rw-r--r--plug-ins/lighting/lighting-image.h69
-rw-r--r--plug-ins/lighting/lighting-main.c330
-rw-r--r--plug-ins/lighting/lighting-main.h104
-rw-r--r--plug-ins/lighting/lighting-preview.c496
-rw-r--r--plug-ins/lighting/lighting-preview.h38
-rw-r--r--plug-ins/lighting/lighting-shade.c838
-rw-r--r--plug-ins/lighting/lighting-shade.h20
-rw-r--r--plug-ins/lighting/lighting-stock.c110
-rw-r--r--plug-ins/lighting/lighting-stock.h37
-rw-r--r--plug-ins/lighting/lighting-ui.c1557
-rw-r--r--plug-ins/lighting/lighting-ui.h21
30 files changed, 6265 insertions, 0 deletions
diff --git a/plug-ins/lighting/Makefile.am b/plug-ins/lighting/Makefile.am
new file mode 100644
index 0000000..92c3ce3
--- /dev/null
+++ b/plug-ins/lighting/Makefile.am
@@ -0,0 +1,65 @@
+## Process this file with automake to produce Makefile.in
+
+if OS_WIN32
+mwindows = -mwindows
+else
+libm = -lm
+endif
+
+libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la
+libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
+libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la
+libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la
+libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
+libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
+libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
+
+if HAVE_WINDRES
+include $(top_srcdir)/build/windows/gimprc-plug-ins.rule
+lighting_RC = lighting.rc.o
+endif
+
+AM_LDFLAGS = $(mwindows)
+
+SUBDIRS = images
+
+libexecdir = $(gimpplugindir)/plug-ins/lighting
+
+libexec_PROGRAMS = lighting
+
+lighting_SOURCES = \
+ lighting-apply.c \
+ lighting-apply.h \
+ lighting-image.c \
+ lighting-image.h \
+ lighting-main.c \
+ lighting-main.h \
+ lighting-preview.c \
+ lighting-preview.h \
+ lighting-shade.c \
+ lighting-shade.h \
+ lighting-stock.c \
+ lighting-stock.h \
+ lighting-ui.c \
+ lighting-ui.h
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ $(GTK_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ -I$(includedir)
+
+LDADD = \
+ $(libm) \
+ $(libgimpui) \
+ $(libgimpwidgets) \
+ $(libgimpconfig) \
+ $(libgimp) \
+ $(libgimpcolor) \
+ $(libgimpmath) \
+ $(libgimpbase) \
+ $(GTK_LIBS) \
+ $(GEGL_LIBS) \
+ $(RT_LIBS) \
+ $(INTLLIBS) \
+ $(lighting_RC)
diff --git a/plug-ins/lighting/Makefile.in b/plug-ins/lighting/Makefile.in
new file mode 100644
index 0000000..4f0763e
--- /dev/null
+++ b/plug-ins/lighting/Makefile.in
@@ -0,0 +1,1155 @@
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Version resources for Microsoft Windows
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+libexec_PROGRAMS = lighting$(EXEEXT)
+subdir = plug-ins/lighting
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/gtk-doc.m4 \
+ $(top_srcdir)/m4macros/intltool.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/m4macros/alsa.m4 \
+ $(top_srcdir)/m4macros/ax_compare_version.m4 \
+ $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \
+ $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \
+ $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \
+ $(top_srcdir)/m4macros/detectcflags.m4 \
+ $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(libexecdir)"
+PROGRAMS = $(libexec_PROGRAMS)
+am_lighting_OBJECTS = lighting-apply.$(OBJEXT) \
+ lighting-image.$(OBJEXT) lighting-main.$(OBJEXT) \
+ lighting-preview.$(OBJEXT) lighting-shade.$(OBJEXT) \
+ lighting-stock.$(OBJEXT) lighting-ui.$(OBJEXT)
+lighting_OBJECTS = $(am_lighting_OBJECTS)
+lighting_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+lighting_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libgimpui) \
+ $(libgimpwidgets) $(libgimpconfig) $(libgimp) $(libgimpcolor) \
+ $(libgimpmath) $(libgimpbase) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(lighting_RC)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/lighting-apply.Po \
+ ./$(DEPDIR)/lighting-image.Po ./$(DEPDIR)/lighting-main.Po \
+ ./$(DEPDIR)/lighting-preview.Po ./$(DEPDIR)/lighting-shade.Po \
+ ./$(DEPDIR)/lighting-stock.Po ./$(DEPDIR)/lighting-ui.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(lighting_SOURCES)
+DIST_SOURCES = $(lighting_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+ distdir distdir-am
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+ $(top_srcdir)/build/windows/gimprc-plug-ins.rule \
+ $(top_srcdir)/depcomp README TODO
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+AA_LIBS = @AA_LIBS@
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+ALL_LINGUAS = @ALL_LINGUAS@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPSTREAM_UTIL = @APPSTREAM_UTIL@
+AR = @AR@
+AS = @AS@
+ATK_CFLAGS = @ATK_CFLAGS@
+ATK_LIBS = @ATK_LIBS@
+ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BABL_CFLAGS = @BABL_CFLAGS@
+BABL_LIBS = @BABL_LIBS@
+BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@
+BUG_REPORT_URL = @BUG_REPORT_URL@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+BUILD_OBJEXT = @BUILD_OBJEXT@
+BZIP2_LIBS = @BZIP2_LIBS@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@
+CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@
+CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@
+CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DESKTOP_DATADIR = @DESKTOP_DATADIR@
+DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@
+DLLTOOL = @DLLTOOL@
+DOC_SHOOTER = @DOC_SHOOTER@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILE_AA = @FILE_AA@
+FILE_EXR = @FILE_EXR@
+FILE_HEIF = @FILE_HEIF@
+FILE_JP2_LOAD = @FILE_JP2_LOAD@
+FILE_MNG = @FILE_MNG@
+FILE_PDF_SAVE = @FILE_PDF_SAVE@
+FILE_PS = @FILE_PS@
+FILE_WMF = @FILE_WMF@
+FILE_XMC = @FILE_XMC@
+FILE_XPM = @FILE_XPM@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@
+FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GDBUS_CODEGEN = @GDBUS_CODEGEN@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@
+GEGL = @GEGL@
+GEGL_CFLAGS = @GEGL_CFLAGS@
+GEGL_LIBS = @GEGL_LIBS@
+GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@
+GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GEXIV2_CFLAGS = @GEXIV2_CFLAGS@
+GEXIV2_LIBS = @GEXIV2_LIBS@
+GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@
+GIMP_API_VERSION = @GIMP_API_VERSION@
+GIMP_APP_VERSION = @GIMP_APP_VERSION@
+GIMP_BINARY_AGE = @GIMP_BINARY_AGE@
+GIMP_COMMAND = @GIMP_COMMAND@
+GIMP_DATA_VERSION = @GIMP_DATA_VERSION@
+GIMP_FULL_NAME = @GIMP_FULL_NAME@
+GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@
+GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@
+GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@
+GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@
+GIMP_MKENUMS = @GIMP_MKENUMS@
+GIMP_MODULES = @GIMP_MODULES@
+GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@
+GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@
+GIMP_PLUGINS = @GIMP_PLUGINS@
+GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@
+GIMP_REAL_VERSION = @GIMP_REAL_VERSION@
+GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@
+GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@
+GIMP_UNSTABLE = @GIMP_UNSTABLE@
+GIMP_USER_VERSION = @GIMP_USER_VERSION@
+GIMP_VERSION = @GIMP_VERSION@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@
+GIO_UNIX_LIBS = @GIO_UNIX_LIBS@
+GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@
+GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@
+GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@
+GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+GS_LIBS = @GS_LIBS@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@
+GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@
+GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@
+GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@
+HARFBUZZ_LIBS = @HARFBUZZ_LIBS@
+HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@
+HAVE_CXX14 = @HAVE_CXX14@
+HAVE_FINITE = @HAVE_FINITE@
+HAVE_ISFINITE = @HAVE_ISFINITE@
+HAVE_VFORK = @HAVE_VFORK@
+HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@
+INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@
+INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@
+INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@
+ISO_CODES_LOCATION = @ISO_CODES_LOCATION@
+JPEG_LIBS = @JPEG_LIBS@
+JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@
+JSON_GLIB_LIBS = @JSON_GLIB_LIBS@
+LCMS_CFLAGS = @LCMS_CFLAGS@
+LCMS_LIBS = @LCMS_LIBS@
+LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@
+LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@
+LIBHEIF_LIBS = @LIBHEIF_LIBS@
+LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@
+LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@
+LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@
+LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@
+LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@
+LIBOBJS = @LIBOBJS@
+LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@
+LIBUNWIND_LIBS = @LIBUNWIND_LIBS@
+LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LT_VERSION_INFO = @LT_VERSION_INFO@
+LZMA_CFLAGS = @LZMA_CFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAIL = @MAIL@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@
+MIME_INFO_LIBS = @MIME_INFO_LIBS@
+MIME_TYPES = @MIME_TYPES@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@
+MNG_CFLAGS = @MNG_CFLAGS@
+MNG_LIBS = @MNG_LIBS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@
+MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@
+NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@
+NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
+OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@
+OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
+OPENJPEG_LIBS = @OPENJPEG_LIBS@
+OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@
+PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@
+PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@
+PATHSEP = @PATHSEP@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@
+PERL_VERSION = @PERL_VERSION@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PNG_CFLAGS = @PNG_CFLAGS@
+PNG_LIBS = @PNG_LIBS@
+POFILES = @POFILES@
+POPPLER_CFLAGS = @POPPLER_CFLAGS@
+POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@
+POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@
+POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@
+POPPLER_LIBS = @POPPLER_LIBS@
+POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PYBIN_PATH = @PYBIN_PATH@
+PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
+PYCAIRO_LIBS = @PYCAIRO_LIBS@
+PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@
+PYGTK_CFLAGS = @PYGTK_CFLAGS@
+PYGTK_CODEGEN = @PYGTK_CODEGEN@
+PYGTK_DEFSDIR = @PYGTK_DEFSDIR@
+PYGTK_LIBS = @PYGTK_LIBS@
+PYLINK_LIBS = @PYLINK_LIBS@
+PYTHON = @PYTHON@
+PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@
+RT_LIBS = @RT_LIBS@
+SCREENSHOT_LIBS = @SCREENSHOT_LIBS@
+SED = @SED@
+SENDMAIL = @SENDMAIL@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKET_LIBS = @SOCKET_LIBS@
+SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@
+SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@
+SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@
+STRIP = @STRIP@
+SVG_CFLAGS = @SVG_CFLAGS@
+SVG_LIBS = @SVG_LIBS@
+SYMPREFIX = @SYMPREFIX@
+TIFF_LIBS = @TIFF_LIBS@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WEBKIT_CFLAGS = @WEBKIT_CFLAGS@
+WEBKIT_LIBS = @WEBKIT_LIBS@
+WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@
+WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@
+WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@
+WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@
+WEBPMUX_LIBS = @WEBPMUX_LIBS@
+WEBP_CFLAGS = @WEBP_CFLAGS@
+WEBP_LIBS = @WEBP_LIBS@
+WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@
+WEB_PAGE = @WEB_PAGE@
+WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@
+WINDRES = @WINDRES@
+WMF_CFLAGS = @WMF_CFLAGS@
+WMF_CONFIG = @WMF_CONFIG@
+WMF_LIBS = @WMF_LIBS@
+WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@
+XDG_EMAIL = @XDG_EMAIL@
+XFIXES_CFLAGS = @XFIXES_CFLAGS@
+XFIXES_LIBS = @XFIXES_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@
+XMC_CFLAGS = @XMC_CFLAGS@
+XMC_LIBS = @XMC_LIBS@
+XMKMF = @XMKMF@
+XMLLINT = @XMLLINT@
+XMU_LIBS = @XMU_LIBS@
+XPM_LIBS = @XPM_LIBS@
+XSLTPROC = @XSLTPROC@
+XVFB_RUN = @XVFB_RUN@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+Z_LIBS = @Z_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gimpdatadir = @gimpdatadir@
+gimpdir = @gimpdir@
+gimplocaledir = @gimplocaledir@
+gimpplugindir = @gimpplugindir@
+gimpsysconfdir = @gimpsysconfdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+intltool__v_merge_options_ = @intltool__v_merge_options_@
+intltool__v_merge_options_0 = @intltool__v_merge_options_0@
+libdir = @libdir@
+libexecdir = $(gimpplugindir)/plug-ins/lighting
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+manpage_gimpdir = @manpage_gimpdir@
+mkdir_p = @mkdir_p@
+ms_librarian = @ms_librarian@
+mypaint_brushes_dir = @mypaint_brushes_dir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+@OS_WIN32_TRUE@mwindows = -mwindows
+@OS_WIN32_FALSE@libm = -lm
+libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la
+libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
+libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la
+libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la
+libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
+libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
+libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
+@HAVE_WINDRES_TRUE@GIMPPLUGINRC = $(top_builddir)/build/windows/gimp-plug-ins.rc
+@HAVE_WINDRES_TRUE@lighting_RC = lighting.rc.o
+AM_LDFLAGS = $(mwindows)
+SUBDIRS = images
+lighting_SOURCES = \
+ lighting-apply.c \
+ lighting-apply.h \
+ lighting-image.c \
+ lighting-image.h \
+ lighting-main.c \
+ lighting-main.h \
+ lighting-preview.c \
+ lighting-preview.h \
+ lighting-shade.c \
+ lighting-shade.h \
+ lighting-stock.c \
+ lighting-stock.h \
+ lighting-ui.c \
+ lighting-ui.h
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ $(GTK_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ -I$(includedir)
+
+LDADD = \
+ $(libm) \
+ $(libgimpui) \
+ $(libgimpwidgets) \
+ $(libgimpconfig) \
+ $(libgimp) \
+ $(libgimpcolor) \
+ $(libgimpmath) \
+ $(libgimpbase) \
+ $(GTK_LIBS) \
+ $(GEGL_LIBS) \
+ $(RT_LIBS) \
+ $(INTLLIBS) \
+ $(lighting_RC)
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build/windows/gimprc-plug-ins.rule $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/lighting/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu plug-ins/lighting/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+$(top_srcdir)/build/windows/gimprc-plug-ins.rule $(am__empty):
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libexecPROGRAMS: $(libexec_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-libexecPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libexecdir)" && rm -f $$files
+
+clean-libexecPROGRAMS:
+ @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+lighting$(EXEEXT): $(lighting_OBJECTS) $(lighting_DEPENDENCIES) $(EXTRA_lighting_DEPENDENCIES)
+ @rm -f lighting$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(lighting_OBJECTS) $(lighting_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lighting-apply.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lighting-image.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lighting-main.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lighting-preview.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lighting-shade.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lighting-stock.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lighting-ui.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libexecdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f ./$(DEPDIR)/lighting-apply.Po
+ -rm -f ./$(DEPDIR)/lighting-image.Po
+ -rm -f ./$(DEPDIR)/lighting-main.Po
+ -rm -f ./$(DEPDIR)/lighting-preview.Po
+ -rm -f ./$(DEPDIR)/lighting-shade.Po
+ -rm -f ./$(DEPDIR)/lighting-stock.Po
+ -rm -f ./$(DEPDIR)/lighting-ui.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-libexecPROGRAMS
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f ./$(DEPDIR)/lighting-apply.Po
+ -rm -f ./$(DEPDIR)/lighting-image.Po
+ -rm -f ./$(DEPDIR)/lighting-main.Po
+ -rm -f ./$(DEPDIR)/lighting-preview.Po
+ -rm -f ./$(DEPDIR)/lighting-shade.Po
+ -rm -f ./$(DEPDIR)/lighting-stock.Po
+ -rm -f ./$(DEPDIR)/lighting-ui.Po
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-libexecPROGRAMS
+
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+ am--depfiles check check-am clean clean-generic \
+ clean-libexecPROGRAMS clean-libtool cscopelist-am ctags \
+ ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-libexecPROGRAMS install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-libexecPROGRAMS
+
+.PRECIOUS: Makefile
+
+
+# `windres` seems a very stupid tool and it breaks with double shlashes
+# in parameter paths. Strengthen the rule a little.
+@HAVE_WINDRES_TRUE@%.rc.o:
+@HAVE_WINDRES_TRUE@ $(WINDRES) --define ORIGINALFILENAME_STR="$*$(EXEEXT)" \
+@HAVE_WINDRES_TRUE@ --define INTERNALNAME_STR="$*" \
+@HAVE_WINDRES_TRUE@ --define TOP_SRCDIR="`echo $(top_srcdir) | sed 's*//*/*'`" \
+@HAVE_WINDRES_TRUE@ -I"`echo $(top_srcdir)/app | sed 's%/\+%/%'`" \
+@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir)/app | sed 's%/\+%/%'`"\
+@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir) | sed 's%/\+%/%'`"\
+@HAVE_WINDRES_TRUE@ $(GIMPPLUGINRC) $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/plug-ins/lighting/README b/plug-ins/lighting/README
new file mode 100644
index 0000000..d723d61
--- /dev/null
+++ b/plug-ins/lighting/README
@@ -0,0 +1,39 @@
+
+Lighting Effects 0.2.2 -- image filter plug-in for GIMP
+===================================================================
+
+Copyright (C) 1996-98 Tom Bech
+Copyright (C) 1996-98 Federico Mena Quintero
+
+You can reach the author(s) via E-mail:
+tomb@gimp.org (Tom) or quartic@gimp.org (Federico).
+
+GIMP was developed by Peter Mattis and Spencer Kimball.
+You can contact them at gimp@xcf.berkeley.edu.
+
+There's more GIMP stuff on our home pages:
+http://www.ii.uib.no/~tomb/gimp.html (Tom's page)
+http://www.nuclecu.unam.mx/~federico/gimp/index.html (Quartic's page)
+
+
+Legal stuff
+===========
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+In other words, you can't sue us for whatever happens while using this ;)
+
+Have fun,
+
+Tom
diff --git a/plug-ins/lighting/TODO b/plug-ins/lighting/TODO
new file mode 100644
index 0000000..06609de
--- /dev/null
+++ b/plug-ins/lighting/TODO
@@ -0,0 +1,15 @@
+
+The lighting plug-in "todo"-list:
+=================================
+
+* Supersampling/antialiasing
+* Bilinear filtering of environment map
+* Refraction back in?
+* Support for any-sized non-gray bump-maps.
+* Support for gray or alpha-channeled env-maps.
+* Zooming and scrolling in preview window
+* Autoconf/automake stuff
+* Put spotlight back in
+* Nicer interactive UI
+* Presets
+* Multiple light sources
diff --git a/plug-ins/lighting/images/Makefile.am b/plug-ins/lighting/images/Makefile.am
new file mode 100644
index 0000000..55dfbde
--- /dev/null
+++ b/plug-ins/lighting/images/Makefile.am
@@ -0,0 +1,29 @@
+## Process this file with automake to produce Makefile.in
+
+STOCK_IMAGES = \
+ stock-intensity-ambient-high.png \
+ stock-intensity-ambient-low.png \
+ stock-intensity-diffuse-high.png \
+ stock-intensity-diffuse-low.png \
+ stock-reflectivity-diffuse-high.png \
+ stock-reflectivity-diffuse-low.png \
+ stock-reflectivity-specular-high.png \
+ stock-reflectivity-specular-low.png \
+ stock-reflectivity-highlight-high.png \
+ stock-reflectivity-highlight-low.png
+
+EXTRA_DIST = $(STOCK_IMAGES)
+
+noinst_DATA = stock-pixbufs.h
+CLEANFILES = $(noinst_DATA) stock-icons.list
+
+stock-icons.list: $(STOCK_IMAGES) Makefile.am
+ ( rm -f $@; \
+ for image in $(STOCK_IMAGES); do \
+ echo $$image | \
+ sed -e 's|.*/||' -e 's|-|_|g' -e 's|\.png$$||' >> $@; \
+ echo " $(srcdir)/$$image" >> $@; \
+ done )
+
+$(srcdir)/stock-pixbufs.h: stock-icons.list
+ $(GDK_PIXBUF_CSOURCE) --raw --build-list `cat stock-icons.list` > $(@F)
diff --git a/plug-ins/lighting/images/Makefile.in b/plug-ins/lighting/images/Makefile.in
new file mode 100644
index 0000000..b85a7a2
--- /dev/null
+++ b/plug-ins/lighting/images/Makefile.in
@@ -0,0 +1,774 @@
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = plug-ins/lighting/images
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/gtk-doc.m4 \
+ $(top_srcdir)/m4macros/intltool.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/m4macros/alsa.m4 \
+ $(top_srcdir)/m4macros/ax_compare_version.m4 \
+ $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \
+ $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \
+ $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \
+ $(top_srcdir)/m4macros/detectcflags.m4 \
+ $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(noinst_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+AA_LIBS = @AA_LIBS@
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+ALL_LINGUAS = @ALL_LINGUAS@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPSTREAM_UTIL = @APPSTREAM_UTIL@
+AR = @AR@
+AS = @AS@
+ATK_CFLAGS = @ATK_CFLAGS@
+ATK_LIBS = @ATK_LIBS@
+ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BABL_CFLAGS = @BABL_CFLAGS@
+BABL_LIBS = @BABL_LIBS@
+BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@
+BUG_REPORT_URL = @BUG_REPORT_URL@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+BUILD_OBJEXT = @BUILD_OBJEXT@
+BZIP2_LIBS = @BZIP2_LIBS@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@
+CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@
+CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@
+CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DESKTOP_DATADIR = @DESKTOP_DATADIR@
+DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@
+DLLTOOL = @DLLTOOL@
+DOC_SHOOTER = @DOC_SHOOTER@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILE_AA = @FILE_AA@
+FILE_EXR = @FILE_EXR@
+FILE_HEIF = @FILE_HEIF@
+FILE_JP2_LOAD = @FILE_JP2_LOAD@
+FILE_MNG = @FILE_MNG@
+FILE_PDF_SAVE = @FILE_PDF_SAVE@
+FILE_PS = @FILE_PS@
+FILE_WMF = @FILE_WMF@
+FILE_XMC = @FILE_XMC@
+FILE_XPM = @FILE_XPM@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@
+FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GDBUS_CODEGEN = @GDBUS_CODEGEN@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@
+GEGL = @GEGL@
+GEGL_CFLAGS = @GEGL_CFLAGS@
+GEGL_LIBS = @GEGL_LIBS@
+GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@
+GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GEXIV2_CFLAGS = @GEXIV2_CFLAGS@
+GEXIV2_LIBS = @GEXIV2_LIBS@
+GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@
+GIMP_API_VERSION = @GIMP_API_VERSION@
+GIMP_APP_VERSION = @GIMP_APP_VERSION@
+GIMP_BINARY_AGE = @GIMP_BINARY_AGE@
+GIMP_COMMAND = @GIMP_COMMAND@
+GIMP_DATA_VERSION = @GIMP_DATA_VERSION@
+GIMP_FULL_NAME = @GIMP_FULL_NAME@
+GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@
+GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@
+GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@
+GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@
+GIMP_MKENUMS = @GIMP_MKENUMS@
+GIMP_MODULES = @GIMP_MODULES@
+GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@
+GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@
+GIMP_PLUGINS = @GIMP_PLUGINS@
+GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@
+GIMP_REAL_VERSION = @GIMP_REAL_VERSION@
+GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@
+GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@
+GIMP_UNSTABLE = @GIMP_UNSTABLE@
+GIMP_USER_VERSION = @GIMP_USER_VERSION@
+GIMP_VERSION = @GIMP_VERSION@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@
+GIO_UNIX_LIBS = @GIO_UNIX_LIBS@
+GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@
+GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@
+GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@
+GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+GS_LIBS = @GS_LIBS@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@
+GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@
+GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@
+GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@
+HARFBUZZ_LIBS = @HARFBUZZ_LIBS@
+HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@
+HAVE_CXX14 = @HAVE_CXX14@
+HAVE_FINITE = @HAVE_FINITE@
+HAVE_ISFINITE = @HAVE_ISFINITE@
+HAVE_VFORK = @HAVE_VFORK@
+HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@
+INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@
+INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@
+INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@
+ISO_CODES_LOCATION = @ISO_CODES_LOCATION@
+JPEG_LIBS = @JPEG_LIBS@
+JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@
+JSON_GLIB_LIBS = @JSON_GLIB_LIBS@
+LCMS_CFLAGS = @LCMS_CFLAGS@
+LCMS_LIBS = @LCMS_LIBS@
+LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@
+LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@
+LIBHEIF_LIBS = @LIBHEIF_LIBS@
+LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@
+LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@
+LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@
+LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@
+LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@
+LIBOBJS = @LIBOBJS@
+LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@
+LIBUNWIND_LIBS = @LIBUNWIND_LIBS@
+LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LT_VERSION_INFO = @LT_VERSION_INFO@
+LZMA_CFLAGS = @LZMA_CFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAIL = @MAIL@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@
+MIME_INFO_LIBS = @MIME_INFO_LIBS@
+MIME_TYPES = @MIME_TYPES@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@
+MNG_CFLAGS = @MNG_CFLAGS@
+MNG_LIBS = @MNG_LIBS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@
+MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@
+NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@
+NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
+OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@
+OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
+OPENJPEG_LIBS = @OPENJPEG_LIBS@
+OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@
+PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@
+PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@
+PATHSEP = @PATHSEP@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@
+PERL_VERSION = @PERL_VERSION@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PNG_CFLAGS = @PNG_CFLAGS@
+PNG_LIBS = @PNG_LIBS@
+POFILES = @POFILES@
+POPPLER_CFLAGS = @POPPLER_CFLAGS@
+POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@
+POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@
+POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@
+POPPLER_LIBS = @POPPLER_LIBS@
+POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PYBIN_PATH = @PYBIN_PATH@
+PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
+PYCAIRO_LIBS = @PYCAIRO_LIBS@
+PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@
+PYGTK_CFLAGS = @PYGTK_CFLAGS@
+PYGTK_CODEGEN = @PYGTK_CODEGEN@
+PYGTK_DEFSDIR = @PYGTK_DEFSDIR@
+PYGTK_LIBS = @PYGTK_LIBS@
+PYLINK_LIBS = @PYLINK_LIBS@
+PYTHON = @PYTHON@
+PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@
+RT_LIBS = @RT_LIBS@
+SCREENSHOT_LIBS = @SCREENSHOT_LIBS@
+SED = @SED@
+SENDMAIL = @SENDMAIL@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKET_LIBS = @SOCKET_LIBS@
+SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@
+SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@
+SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@
+STRIP = @STRIP@
+SVG_CFLAGS = @SVG_CFLAGS@
+SVG_LIBS = @SVG_LIBS@
+SYMPREFIX = @SYMPREFIX@
+TIFF_LIBS = @TIFF_LIBS@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WEBKIT_CFLAGS = @WEBKIT_CFLAGS@
+WEBKIT_LIBS = @WEBKIT_LIBS@
+WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@
+WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@
+WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@
+WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@
+WEBPMUX_LIBS = @WEBPMUX_LIBS@
+WEBP_CFLAGS = @WEBP_CFLAGS@
+WEBP_LIBS = @WEBP_LIBS@
+WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@
+WEB_PAGE = @WEB_PAGE@
+WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@
+WINDRES = @WINDRES@
+WMF_CFLAGS = @WMF_CFLAGS@
+WMF_CONFIG = @WMF_CONFIG@
+WMF_LIBS = @WMF_LIBS@
+WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@
+XDG_EMAIL = @XDG_EMAIL@
+XFIXES_CFLAGS = @XFIXES_CFLAGS@
+XFIXES_LIBS = @XFIXES_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@
+XMC_CFLAGS = @XMC_CFLAGS@
+XMC_LIBS = @XMC_LIBS@
+XMKMF = @XMKMF@
+XMLLINT = @XMLLINT@
+XMU_LIBS = @XMU_LIBS@
+XPM_LIBS = @XPM_LIBS@
+XSLTPROC = @XSLTPROC@
+XVFB_RUN = @XVFB_RUN@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+Z_LIBS = @Z_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gimpdatadir = @gimpdatadir@
+gimpdir = @gimpdir@
+gimplocaledir = @gimplocaledir@
+gimpplugindir = @gimpplugindir@
+gimpsysconfdir = @gimpsysconfdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+intltool__v_merge_options_ = @intltool__v_merge_options_@
+intltool__v_merge_options_0 = @intltool__v_merge_options_0@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+manpage_gimpdir = @manpage_gimpdir@
+mkdir_p = @mkdir_p@
+ms_librarian = @ms_librarian@
+mypaint_brushes_dir = @mypaint_brushes_dir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+STOCK_IMAGES = \
+ stock-intensity-ambient-high.png \
+ stock-intensity-ambient-low.png \
+ stock-intensity-diffuse-high.png \
+ stock-intensity-diffuse-low.png \
+ stock-reflectivity-diffuse-high.png \
+ stock-reflectivity-diffuse-low.png \
+ stock-reflectivity-specular-high.png \
+ stock-reflectivity-specular-low.png \
+ stock-reflectivity-highlight-high.png \
+ stock-reflectivity-highlight-low.png
+
+EXTRA_DIST = $(STOCK_IMAGES)
+noinst_DATA = stock-pixbufs.h
+CLEANFILES = $(noinst_DATA) stock-icons.list
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/lighting/images/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu plug-ins/lighting/images/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ cscopelist-am ctags-am distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+stock-icons.list: $(STOCK_IMAGES) Makefile.am
+ ( rm -f $@; \
+ for image in $(STOCK_IMAGES); do \
+ echo $$image | \
+ sed -e 's|.*/||' -e 's|-|_|g' -e 's|\.png$$||' >> $@; \
+ echo " $(srcdir)/$$image" >> $@; \
+ done )
+
+$(srcdir)/stock-pixbufs.h: stock-icons.list
+ $(GDK_PIXBUF_CSOURCE) --raw --build-list `cat stock-icons.list` > $(@F)
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/plug-ins/lighting/images/stock-intensity-ambient-high.png b/plug-ins/lighting/images/stock-intensity-ambient-high.png
new file mode 100644
index 0000000..cb886ec
--- /dev/null
+++ b/plug-ins/lighting/images/stock-intensity-ambient-high.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-intensity-ambient-low.png b/plug-ins/lighting/images/stock-intensity-ambient-low.png
new file mode 100644
index 0000000..fff7b45
--- /dev/null
+++ b/plug-ins/lighting/images/stock-intensity-ambient-low.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-intensity-diffuse-high.png b/plug-ins/lighting/images/stock-intensity-diffuse-high.png
new file mode 100644
index 0000000..628ec4d
--- /dev/null
+++ b/plug-ins/lighting/images/stock-intensity-diffuse-high.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-intensity-diffuse-low.png b/plug-ins/lighting/images/stock-intensity-diffuse-low.png
new file mode 100644
index 0000000..49e02bf
--- /dev/null
+++ b/plug-ins/lighting/images/stock-intensity-diffuse-low.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-reflectivity-diffuse-high.png b/plug-ins/lighting/images/stock-reflectivity-diffuse-high.png
new file mode 100644
index 0000000..88cc4fa
--- /dev/null
+++ b/plug-ins/lighting/images/stock-reflectivity-diffuse-high.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-reflectivity-diffuse-low.png b/plug-ins/lighting/images/stock-reflectivity-diffuse-low.png
new file mode 100644
index 0000000..6bdb5c4
--- /dev/null
+++ b/plug-ins/lighting/images/stock-reflectivity-diffuse-low.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-reflectivity-highlight-high.png b/plug-ins/lighting/images/stock-reflectivity-highlight-high.png
new file mode 100644
index 0000000..b43724b
--- /dev/null
+++ b/plug-ins/lighting/images/stock-reflectivity-highlight-high.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-reflectivity-highlight-low.png b/plug-ins/lighting/images/stock-reflectivity-highlight-low.png
new file mode 100644
index 0000000..88cc4fa
--- /dev/null
+++ b/plug-ins/lighting/images/stock-reflectivity-highlight-low.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-reflectivity-specular-high.png b/plug-ins/lighting/images/stock-reflectivity-specular-high.png
new file mode 100644
index 0000000..fbd5f54
--- /dev/null
+++ b/plug-ins/lighting/images/stock-reflectivity-specular-high.png
Binary files differ
diff --git a/plug-ins/lighting/images/stock-reflectivity-specular-low.png b/plug-ins/lighting/images/stock-reflectivity-specular-low.png
new file mode 100644
index 0000000..2d69d41
--- /dev/null
+++ b/plug-ins/lighting/images/stock-reflectivity-specular-low.png
Binary files differ
diff --git a/plug-ins/lighting/lighting-apply.c b/plug-ins/lighting/lighting-apply.c
new file mode 100644
index 0000000..500ed24
--- /dev/null
+++ b/plug-ins/lighting/lighting-apply.c
@@ -0,0 +1,154 @@
+/******************************************************/
+/* Apply mapping and shading on the whole input image */
+/******************************************************/
+
+#include "config.h"
+
+#include <sys/types.h>
+
+#include <libgimp/gimp.h>
+
+#include "lighting-main.h"
+#include "lighting-image.h"
+#include "lighting-shade.h"
+#include "lighting-apply.h"
+
+#include "libgimp/stdplugins-intl.h"
+
+
+/*************/
+/* Main loop */
+/*************/
+
+void
+compute_image (void)
+{
+ gint xcount, ycount;
+ GimpRGB color;
+ glong progress_counter = 0;
+ GimpVector3 p;
+ gint32 new_image_id = -1;
+ gint32 new_layer_id = -1;
+ gint32 index;
+ guchar *row = NULL;
+ guchar obpp;
+ gboolean has_alpha;
+ get_ray_func ray_func;
+
+ if (mapvals.create_new_image == TRUE ||
+ (mapvals.transparent_background == TRUE &&
+ ! gimp_drawable_has_alpha (input_drawable_id)))
+ {
+ /* Create a new image */
+ /* ================== */
+
+ new_image_id = gimp_image_new (width, height, GIMP_RGB);
+
+ if (mapvals.transparent_background == TRUE)
+ {
+ /* Add a layer with an alpha channel */
+ /* ================================= */
+
+ new_layer_id = gimp_layer_new (new_image_id, "Background",
+ width, height,
+ GIMP_RGBA_IMAGE,
+ 100.0,
+ gimp_image_get_default_new_layer_mode (new_image_id));
+ }
+ else
+ {
+ /* Create a "normal" layer */
+ /* ======================= */
+
+ new_layer_id = gimp_layer_new (new_image_id, "Background",
+ width, height,
+ GIMP_RGB_IMAGE,
+ 100.0,
+ gimp_image_get_default_new_layer_mode (new_image_id));
+ }
+
+ gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
+ output_drawable_id = new_layer_id;
+ }
+
+ if (mapvals.bump_mapped == TRUE && mapvals.bumpmap_id != -1)
+ {
+ bumpmap_setup (mapvals.bumpmap_id);
+ }
+
+ precompute_init (width, height);
+
+ if (! mapvals.env_mapped || mapvals.envmap_id == -1)
+ {
+ ray_func = get_ray_color;
+ }
+ else
+ {
+ envmap_setup (mapvals.envmap_id);
+
+ ray_func = get_ray_color_ref;
+ }
+
+ dest_buffer = gimp_drawable_get_shadow_buffer (output_drawable_id);
+
+ has_alpha = gimp_drawable_has_alpha (output_drawable_id);
+
+ /* FIXME */
+ obpp = has_alpha ? 4 : 3; //gimp_drawable_bpp (output_drawable_id);
+
+ row = g_new (guchar, obpp * width);
+
+ gimp_progress_init (_("Lighting Effects"));
+
+ /* Init the first row */
+ if (mapvals.bump_mapped == TRUE && mapvals.bumpmap_id != -1 && height >= 2)
+ interpol_row (0, width, 0);
+
+ for (ycount = 0; ycount < height; ycount++)
+ {
+ if (mapvals.bump_mapped == TRUE && mapvals.bumpmap_id != -1)
+ precompute_normals (0, width, ycount);
+
+ index = 0;
+
+ for (xcount = 0; xcount < width; xcount++)
+ {
+ p = int_to_pos (xcount, ycount);
+ color = (* ray_func) (&p);
+
+ row[index++] = (guchar) (color.r * 255.0);
+ row[index++] = (guchar) (color.g * 255.0);
+ row[index++] = (guchar) (color.b * 255.0);
+
+ if (has_alpha)
+ row[index++] = (guchar) (color.a * 255.0);
+
+ progress_counter++;
+ }
+
+ gimp_progress_update ((gdouble) progress_counter /
+ (gdouble) maxcounter);
+
+ gegl_buffer_set (dest_buffer, GEGL_RECTANGLE (0, ycount, width, 1), 0,
+ has_alpha ?
+ babl_format ("R'G'B'A u8") : babl_format ("R'G'B' u8"),
+ row,
+ GEGL_AUTO_ROWSTRIDE);
+ }
+
+ gimp_progress_update (1.0);
+
+ g_free (row);
+
+ g_object_unref (dest_buffer);
+
+ gimp_drawable_merge_shadow (output_drawable_id, TRUE);
+ gimp_drawable_update (output_drawable_id, 0, 0, width, height);
+
+ if (new_image_id!=-1)
+ {
+ gimp_display_new (new_image_id);
+ gimp_displays_flush ();
+ }
+
+}
diff --git a/plug-ins/lighting/lighting-apply.h b/plug-ins/lighting/lighting-apply.h
new file mode 100644
index 0000000..304ef4a
--- /dev/null
+++ b/plug-ins/lighting/lighting-apply.h
@@ -0,0 +1,7 @@
+#ifndef __LIGHTING_APPLY_H__
+#define __LIGHTING_APPLY_H__
+
+void init_compute (void);
+void compute_image (void);
+
+#endif /* __LIGHTING_APPLY_H__ */
diff --git a/plug-ins/lighting/lighting-image.c b/plug-ins/lighting/lighting-image.c
new file mode 100644
index 0000000..e74ff98
--- /dev/null
+++ b/plug-ins/lighting/lighting-image.c
@@ -0,0 +1,407 @@
+/*************************************/
+/* GIMP image manipulation routines. */
+/*************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include <libgimp/gimp.h>
+
+#include "lighting-main.h"
+#include "lighting-image.h"
+#include "lighting-preview.h"
+#include "lighting-ui.h"
+
+
+gint32 input_drawable_id;
+gint32 output_drawable_id;
+GeglBuffer *source_buffer;
+GeglBuffer *dest_buffer;
+
+gint32 bump_drawable_id;
+GeglBuffer *bump_buffer;
+const Babl *bump_format;
+
+gint32 env_drawable_id;
+GeglBuffer *env_buffer;
+
+guchar *preview_rgb_data = NULL;
+gint preview_rgb_stride;
+cairo_surface_t *preview_surface = NULL;
+
+glong maxcounter;
+gint width, height;
+gint env_width, env_height;
+GimpRGB background;
+
+gint border_x1, border_y1, border_x2, border_y2;
+
+guchar sinemap[256], spheremap[256], logmap[256];
+
+/******************/
+/* Implementation */
+/******************/
+
+guchar
+peek_map (GeglBuffer *buffer,
+ const Babl *format,
+ gint x,
+ gint y)
+{
+ guchar data[4];
+ guchar ret_val;
+
+ gegl_buffer_sample (buffer, x, y, NULL, data, format,
+ GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
+
+ if (babl_format_get_bytes_per_pixel (format))
+ {
+ ret_val = data[0];
+ }
+ else
+ {
+ ret_val = (guchar)((float)((data[0] + data[1] + data[2])/3.0));
+ }
+
+ return ret_val;
+}
+
+GimpRGB
+peek (gint x,
+ gint y)
+{
+ GimpRGB color;
+
+ gegl_buffer_sample (source_buffer, x, y, NULL,
+ &color, babl_format ("R'G'B'A double"),
+ GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
+
+ if (! babl_format_has_alpha (gegl_buffer_get_format (source_buffer)))
+ color.a = 1.0;
+
+ return color;
+}
+
+GimpRGB
+peek_env_map (gint x,
+ gint y)
+{
+ GimpRGB color;
+
+ if (x < 0)
+ x = 0;
+ else if (x >= env_width)
+ x = env_width - 1;
+ if (y < 0)
+ y = 0;
+ else if (y >= env_height)
+ y = env_height - 1;
+
+ gegl_buffer_sample (env_buffer, x, y, NULL,
+ &color, babl_format ("R'G'B'A double"),
+ GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
+
+ color.a = 1.0;
+
+ return color;
+}
+
+void
+poke (gint x,
+ gint y,
+ GimpRGB *color)
+{
+ if (x < 0)
+ x = 0;
+ else if (x >= width)
+ x = width - 1;
+ if (y < 0)
+ y = 0;
+ else if (y >= height)
+ y = height - 1;
+
+ gegl_buffer_set (dest_buffer, GEGL_RECTANGLE (x, y, 1, 1), 0,
+ babl_format ("R'G'B'A double"), color,
+ GEGL_AUTO_ROWSTRIDE);
+}
+
+gint
+check_bounds (gint x,
+ gint y)
+{
+ if (x < border_x1 ||
+ y < border_y1 ||
+ x >= border_x2 ||
+ y >= border_y2)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+GimpVector3
+int_to_pos (gint x,
+ gint y)
+{
+ GimpVector3 pos;
+
+ if (width >= height)
+ {
+ pos.x = (gdouble) x / (gdouble) width;
+ pos.y = (gdouble) y / (gdouble) width;
+
+ pos.y += 0.5 * (1.0 - (gdouble) height / (gdouble) width);
+ }
+ else
+ {
+ pos.x = (gdouble) x / (gdouble) height;
+ pos.y = (gdouble) y / (gdouble) height;
+
+ pos.x += 0.5 * (1.0 - (gdouble) width / (gdouble) height);
+ }
+
+ pos.z = 0.0;
+ return pos;
+}
+
+GimpVector3
+int_to_posf (gdouble x,
+ gdouble y)
+{
+ GimpVector3 pos;
+
+ if (width >= height)
+ {
+ pos.x = x / (gdouble) width;
+ pos.y = y / (gdouble) width;
+
+ pos.y += 0.5 * (1.0 - (gdouble) height / (gdouble) width);
+ }
+ else
+ {
+ pos.x = x / (gdouble) height;
+ pos.y = y / (gdouble) height;
+
+ pos.x += 0.5 * (1.0 - (gdouble) width / (gdouble) height);
+ }
+
+ pos.z = 0.0;
+ return pos;
+}
+
+void
+pos_to_int (gdouble x,
+ gdouble y,
+ gint *scr_x,
+ gint *scr_y)
+{
+ if (width >= height)
+ {
+ y -= 0.5 * (1.0 - (gdouble) height / (gdouble) width);
+ *scr_x = RINT ((x * (gdouble) width));
+ *scr_y = RINT ((y * (gdouble) width));
+ }
+ else
+ {
+ x -= 0.5 * (1.0 - (gdouble) width / (gdouble) height);
+
+ *scr_x = RINT ((x * (gdouble) height));
+ *scr_y = RINT ((y *(gdouble) height));
+ }
+}
+
+void
+pos_to_float (gdouble x,
+ gdouble y,
+ gdouble *xf,
+ gdouble *yf)
+{
+ if (width >= height)
+ {
+ y -= 0.5 * (1.0 - (gdouble) height / (gdouble) width);
+
+ *xf = x * (gdouble) (width-1);
+ *yf = y * (gdouble) (width-1);
+ }
+ else
+ {
+ x -= 0.5 * (1.0 - (gdouble) width / (gdouble) height);
+
+ *xf = x * (gdouble) (height-1);
+ *yf = y * (gdouble) (height-1);
+ }
+}
+
+/**********************************************/
+/* Compute the image color at pos (u,v) using */
+/* Quartics bilinear interpolation stuff. */
+/**********************************************/
+
+GimpRGB
+get_image_color (gdouble u,
+ gdouble v,
+ gint *inside)
+{
+ gint x1, y1, x2, y2;
+ GimpRGB p[4];
+
+ x1 = RINT (u);
+ y1 = RINT (v);
+
+ if (check_bounds (x1, y1) == FALSE)
+ {
+ *inside = FALSE;
+ return background;
+ }
+
+ x2 = (x1 + 1);
+ y2 = (y1 + 1);
+
+ if (check_bounds (x2, y2) == FALSE)
+ {
+ *inside = TRUE;
+ return peek (x1, y1);
+ }
+
+ *inside = TRUE;
+ p[0] = peek (x1, y1);
+ p[1] = peek (x2, y1);
+ p[2] = peek (x1, y2);
+ p[3] = peek (x2, y2);
+
+ return gimp_bilinear_rgba (u, v, p);
+}
+
+gdouble
+get_map_value (GeglBuffer *buffer,
+ const Babl *format,
+ gdouble u,
+ gdouble v,
+ gint *inside)
+{
+ gint x1, y1, x2, y2;
+ gdouble p[4];
+
+ x1 = RINT (u);
+ y1 = RINT (v);
+
+ x2 = (x1 + 1);
+ y2 = (y1 + 1);
+
+ if (check_bounds (x2, y2) == FALSE)
+ {
+ *inside = TRUE;
+ return (gdouble) peek_map (buffer, format, x1, y1);
+ }
+
+ *inside = TRUE;
+ p[0] = (gdouble) peek_map (buffer, format, x1, y1);
+ p[1] = (gdouble) peek_map (buffer, format, x2, y1);
+ p[2] = (gdouble) peek_map (buffer, format, x1, y2);
+ p[3] = (gdouble) peek_map (buffer, format, x2, y2);
+
+ return gimp_bilinear (u, v, p);
+}
+
+static void
+compute_maps (void)
+{
+ gint x;
+ gdouble val, c, d;
+
+ /* Compute Sine, Log and Spherical transfer function maps */
+ /* ====================================================== */
+
+ c = 1.0 / 255.0;
+ d = 1.15 * 255.0;
+
+ for (x = 0; x < 256; x++)
+ {
+ sinemap[x] = (guchar) (255.0 * (0.5 * (sin ((G_PI * c * (gdouble) x) -
+ 0.5 * G_PI) +
+ 1.0)));
+ spheremap[x] = (guchar) (255.0 * (sqrt (sin (G_PI * (gdouble) x /
+ 512.0))));
+ val = (d * exp (-1.0 / (8.0 * c * ((gdouble) x + 5.0))));
+
+ if (val > 255.0)
+ val = 255.0;
+ logmap[x] = (guchar) val;
+ }
+}
+
+/****************************************/
+/* Allocate memory for temporary images */
+/****************************************/
+
+gint
+image_setup (gint32 drawable_id,
+ gint interactive)
+{
+ gint w, h;
+ gboolean ret;
+
+ compute_maps ();
+
+ /* Get some useful info on the input drawable */
+ /* ========================================== */
+
+ input_drawable_id = drawable_id;
+ output_drawable_id = drawable_id;
+
+ ret = gimp_drawable_mask_intersect (drawable_id,
+ &border_x1, &border_y1, &w, &h);
+
+ border_x2 = border_x1 + w;
+ border_y2 = border_y1 + h;
+
+ if (! ret)
+ return FALSE;
+
+ width = gimp_drawable_width (input_drawable_id);
+ height = gimp_drawable_height (input_drawable_id);
+
+ source_buffer = gimp_drawable_get_buffer (input_drawable_id);
+
+ maxcounter = (glong) width * (glong) height;
+
+ if (interactive)
+ {
+ preview_rgb_stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24,
+ PREVIEW_WIDTH);
+ preview_rgb_data = g_new0 (guchar, preview_rgb_stride * PREVIEW_HEIGHT);
+ preview_surface = cairo_image_surface_create_for_data (preview_rgb_data,
+ CAIRO_FORMAT_RGB24,
+ PREVIEW_WIDTH,
+ PREVIEW_HEIGHT,
+ preview_rgb_stride);
+ }
+
+ return TRUE;
+}
+
+void
+bumpmap_setup (gint32 bumpmap_id)
+{
+ if (bumpmap_id != -1 && ! bump_buffer)
+ {
+ bump_buffer = gimp_drawable_get_buffer (bumpmap_id);
+
+ if (gimp_drawable_is_rgb (bumpmap_id))
+ bump_format = babl_format ("R'G'B' u8");
+ else
+ bump_format = babl_format ("Y' u8"); /* FIXME */
+ }
+}
+
+void
+envmap_setup (gint32 envmap_id)
+{
+ if (envmap_id != -1 && ! env_buffer)
+ {
+ env_width = gimp_drawable_width (envmap_id);
+ env_height = gimp_drawable_height (envmap_id);
+
+ env_buffer = gimp_drawable_get_buffer (envmap_id);
+ }
+}
diff --git a/plug-ins/lighting/lighting-image.h b/plug-ins/lighting/lighting-image.h
new file mode 100644
index 0000000..817c948
--- /dev/null
+++ b/plug-ins/lighting/lighting-image.h
@@ -0,0 +1,69 @@
+#ifndef __LIGHTING_IMAGE_H__
+#define __LIGHTING_IMAGE_H__
+
+#include <libgimp/gimp.h>
+#include <libgimp/gimpui.h>
+
+extern gint32 input_drawable_id;
+extern gint32 output_drawable_id;
+extern GeglBuffer *source_buffer;
+extern GeglBuffer *dest_buffer;
+
+extern gint32 bump_drawable_id;
+extern GeglBuffer *bump_buffer;
+extern const Babl *bump_format;
+
+extern gint32 env_drawable_id;
+extern GeglBuffer *env_buffer;
+
+extern guchar *preview_rgb_data;
+extern gint preview_rgb_stride;
+extern cairo_surface_t *preview_surface;
+
+extern glong maxcounter;
+extern gint width,height,env_width,env_height;
+extern GimpRGB background;
+
+extern gint border_x1, border_y1, border_x2, border_y2;
+
+extern guchar sinemap[256], spheremap[256], logmap[256];
+
+guchar peek_map (GeglBuffer *buffer,
+ const Babl *format,
+ gint x,
+ gint y);
+GimpRGB peek (gint x,
+ gint y);
+GimpRGB peek_env_map (gint x,
+ gint y);
+void poke (gint x,
+ gint y,
+ GimpRGB *color);
+gint check_bounds (gint x,
+ gint y);
+GimpVector3 int_to_pos (gint x,
+ gint y);
+GimpVector3 int_to_posf (gdouble x,
+ gdouble y);
+void pos_to_int (gdouble x,
+ gdouble y,
+ gint *scr_x,
+ gint *scr_y);
+void pos_to_float (gdouble x,
+ gdouble y,
+ gdouble *xf,
+ gdouble *yf);
+GimpRGB get_image_color (gdouble u,
+ gdouble v,
+ gint *inside);
+gdouble get_map_value (GeglBuffer *buffer,
+ const Babl *format,
+ gdouble u,
+ gdouble v,
+ gint *inside);
+gint image_setup (gint32 drawable_id,
+ gint interactive);
+void bumpmap_setup (gint32 bumpmap_id);
+void envmap_setup (gint32 envmap_id);
+
+#endif /* __LIGHTING_IMAGE_H__ */
diff --git a/plug-ins/lighting/lighting-main.c b/plug-ins/lighting/lighting-main.c
new file mode 100644
index 0000000..f732b3c
--- /dev/null
+++ b/plug-ins/lighting/lighting-main.c
@@ -0,0 +1,330 @@
+/* Lighting Effects 0.2.2 -- image filter plug-in for GIMP
+ *
+ * Copyright (C) 1996-98 Tom Bech
+ * Copyright (C) 1996-98 Federico Mena Quintero
+ *
+ * E-mail: tomb@gimp.org (Tom) or quartic@gimp.org (Federico)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include <libgimp/gimp.h>
+
+#include "lighting-apply.h"
+#include "lighting-image.h"
+#include "lighting-main.h"
+#include "lighting-preview.h"
+#include "lighting-shade.h"
+#include "lighting-ui.h"
+
+#include "libgimp/stdplugins-intl.h"
+
+
+LightingValues mapvals;
+
+/******************/
+/* Implementation */
+/******************/
+
+/*************************************/
+/* Set parameters to standard values */
+/*************************************/
+
+static void
+set_default_settings (void)
+{
+ gint k;
+
+ mapvals.update_enabled = TRUE;
+ mapvals.light_selected = 0;
+ mapvals.light_isolated = FALSE;
+
+ gimp_vector3_set (&mapvals.viewpoint, 0.5, 0.5, 0.25);
+ gimp_vector3_set (&mapvals.planenormal, 0.0, 0.0, 1.0);
+
+ gimp_vector3_set (&mapvals.lightsource[0].position, -1.0, -1.0, 1.0);
+ gimp_vector3_set (&mapvals.lightsource[0].direction, -1.0, -1.0, 1.0);
+
+ gimp_rgba_set (&mapvals.lightsource[0].color, 1.0, 1.0, 1.0, 1.0);
+ mapvals.lightsource[0].intensity = 1.0;
+ mapvals.lightsource[0].type = POINT_LIGHT;
+ mapvals.lightsource[0].active = TRUE;
+
+ /* init lights 2 and 3 pos to upper left and below */
+ gimp_vector3_set (&mapvals.lightsource[1].position, 2.0, -1.0, 1.0);
+ gimp_vector3_set (&mapvals.lightsource[1].direction, 1.0, -1.0, 1.0);
+
+ gimp_vector3_set (&mapvals.lightsource[2].position, 1.0, 2.0, 1.0);
+ gimp_vector3_set (&mapvals.lightsource[2].direction, 0.0, 1.0, 1.0);
+
+ /* init any remaining lights to directly overhead */
+ for (k = 3; k < NUM_LIGHTS; k++)
+ {
+ gimp_vector3_set (&mapvals.lightsource[k].position, 0.0, 0.0, 1.0);
+ gimp_vector3_set (&mapvals.lightsource[k].direction, 0.0, 0.0, 1.0);
+ }
+
+ for (k = 1; k < NUM_LIGHTS; k++)
+ {
+ gimp_rgba_set (&mapvals.lightsource[k].color, 1.0, 1.0, 1.0, 1.0);
+ mapvals.lightsource[k].intensity = 1.0;
+ mapvals.lightsource[k].type = NO_LIGHT;
+ mapvals.lightsource[k].active = TRUE;
+ }
+
+ mapvals.material.ambient_int = 0.2;
+ mapvals.material.diffuse_int = 0.5;
+ mapvals.material.diffuse_ref = 0.4;
+ mapvals.material.specular_ref = 0.5;
+ mapvals.material.highlight = 27.0;
+ mapvals.material.metallic = FALSE;
+
+ mapvals.pixel_threshold = 0.25;
+ mapvals.max_depth = 3.0;
+ mapvals.preview_zoom_factor = 1.0;
+
+ mapvals.bumpmaptype = 0;
+ mapvals.bumpmin = 0.0;
+ mapvals.bumpmax = 0.1;
+
+ mapvals.antialiasing = FALSE;
+ mapvals.create_new_image = FALSE;
+ mapvals.transparent_background = FALSE;
+ mapvals.bump_mapped = FALSE;
+ mapvals.env_mapped = FALSE;
+ mapvals.ref_mapped = FALSE;
+ mapvals.previewquality = FALSE;
+ mapvals.interactive_preview = TRUE;
+
+ mapvals.bumpmap_id = -1;
+ mapvals.envmap_id = -1;
+}
+
+static void
+check_drawables (void)
+{
+ if (mapvals.bump_mapped)
+ {
+ if (mapvals.bumpmap_id != -1 &&
+ gimp_item_get_image (mapvals.bumpmap_id) == -1)
+ {
+ mapvals.bump_mapped = FALSE;
+ mapvals.bumpmap_id = -1;
+ }
+
+ if (gimp_drawable_is_indexed (mapvals.bumpmap_id) ||
+ (gimp_drawable_width (mapvals.drawable_id) !=
+ gimp_drawable_width (mapvals.bumpmap_id)) ||
+ (gimp_drawable_height (mapvals.drawable_id) !=
+ gimp_drawable_height (mapvals.bumpmap_id)))
+ {
+ mapvals.bump_mapped = FALSE;
+ mapvals.bumpmap_id = -1;
+ }
+ }
+
+ if (mapvals.env_mapped)
+ {
+ if (mapvals.envmap_id != -1 &&
+ gimp_item_get_image (mapvals.envmap_id) == -1)
+ {
+ mapvals.env_mapped = FALSE;
+ mapvals.envmap_id = -1;
+ }
+
+ if (gimp_drawable_is_gray (mapvals.envmap_id) ||
+ gimp_drawable_has_alpha (mapvals.envmap_id))
+ {
+ mapvals.env_mapped = FALSE;
+ mapvals.envmap_id = -1;
+ }
+ }
+}
+
+static void
+query (void)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" },
+ { GIMP_PDB_IMAGE, "image", "Input image" },
+ { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
+ { GIMP_PDB_DRAWABLE, "bumpdrawable", "Bumpmap drawable (set to 0 if disabled)" },
+ { GIMP_PDB_DRAWABLE, "envdrawable", "Environmentmap drawable (set to 0 if disabled)" },
+ { GIMP_PDB_INT32, "dobumpmap", "Enable bumpmapping (TRUE/FALSE)" },
+ { GIMP_PDB_INT32, "doenvmap", "Enable envmapping (TRUE/FALSE)" },
+ { GIMP_PDB_INT32, "bumpmaptype", "Type of mapping (0=linear,1=log, 2=sinusoidal, 3=spherical)" },
+ { GIMP_PDB_INT32, "lighttype", "Type of lightsource (0=point,1=directional,3=spot,4=none)" },
+ { GIMP_PDB_COLOR, "lightcolor", "Lightsource color (r,g,b)" },
+ { GIMP_PDB_FLOAT, "lightposition-x", "Lightsource position (x,y,z)" },
+ { GIMP_PDB_FLOAT, "lightposition-y", "Lightsource position (x,y,z)" },
+ { GIMP_PDB_FLOAT, "lightposition-z", "Lightsource position (x,y,z)" },
+ { GIMP_PDB_FLOAT, "lightdirection-x", "Lightsource direction [x,y,z]" },
+ { GIMP_PDB_FLOAT, "lightdirection-y", "Lightsource direction [x,y,z]" },
+ { GIMP_PDB_FLOAT, "lightdirection-z", "Lightsource direction [x,y,z]" },
+ { GIMP_PDB_FLOAT, "ambient-intensity", "Material ambient intensity (0..1)" },
+ { GIMP_PDB_FLOAT, "diffuse-intensity", "Material diffuse intensity (0..1)" },
+ { GIMP_PDB_FLOAT, "diffuse-reflectivity", "Material diffuse reflectivity (0..1)" },
+ { GIMP_PDB_FLOAT, "specular-reflectivity", "Material specular reflectivity (0..1)" },
+ { GIMP_PDB_FLOAT, "highlight", "Material highlight (0..->), note: it's exponential" },
+ { GIMP_PDB_INT32, "antialiasing", "Apply antialiasing (TRUE/FALSE)" },
+ { GIMP_PDB_INT32, "newimage", "Create a new image (TRUE/FALSE)" },
+ { GIMP_PDB_INT32, "transparentbackground", "Make background transparent (TRUE/FALSE)" }
+ };
+
+ gimp_install_procedure (PLUG_IN_PROC,
+ N_("Apply various lighting effects to an image"),
+ "No help yet",
+ "Tom Bech & Federico Mena Quintero",
+ "Tom Bech & Federico Mena Quintero",
+ "Version 0.2.0, March 15 1998",
+ N_("_Lighting Effects..."),
+ "RGB*",
+ GIMP_PLUGIN,
+ G_N_ELEMENTS (args), 0,
+ args, NULL);
+
+ gimp_plugin_menu_register (PLUG_IN_PROC,
+ "<Image>/Filters/Light and Shadow/Light");
+}
+
+static void
+run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+ GimpRunMode run_mode;
+ gint32 drawable_id;
+ GimpPDBStatusType status = GIMP_PDB_SUCCESS;
+
+ INIT_I18N ();
+ gegl_init (NULL, NULL);
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = status;
+
+ /* Set default values */
+ /* ================== */
+
+ set_default_settings ();
+
+ /* Possibly retrieve data */
+ /* ====================== */
+
+ gimp_get_data (PLUG_IN_PROC, &mapvals);
+
+ /* Get the specified drawable */
+ /* ========================== */
+
+ run_mode = param[0].data.d_int32;
+ drawable_id = param[2].data.d_drawable;
+
+ mapvals.drawable_id = drawable_id;
+
+ check_drawables ();
+
+ if (status == GIMP_PDB_SUCCESS)
+ {
+ /* Make sure that the drawable is RGBA or RGB color */
+ /* ================================================ */
+
+ if (gimp_drawable_is_rgb (drawable_id))
+ {
+ switch (run_mode)
+ {
+ case GIMP_RUN_INTERACTIVE:
+ if (main_dialog (drawable_id))
+ {
+ compute_image ();
+
+ gimp_set_data (PLUG_IN_PROC,
+ &mapvals, sizeof (LightingValues));
+ gimp_displays_flush ();
+ }
+ break;
+
+ case GIMP_RUN_WITH_LAST_VALS:
+ if (image_setup (drawable_id, FALSE))
+ compute_image ();
+ gimp_displays_flush ();
+ break;
+
+ case GIMP_RUN_NONINTERACTIVE:
+ if (nparams != 24)
+ {
+ status = GIMP_PDB_CALLING_ERROR;
+ }
+ else
+ {
+ mapvals.bumpmap_id = param[3].data.d_drawable;
+ mapvals.envmap_id = param[4].data.d_drawable;
+ mapvals.bump_mapped = (gint) param[5].data.d_int32;
+ mapvals.env_mapped = (gint) param[6].data.d_int32;
+ mapvals.bumpmaptype = (gint) param[7].data.d_int32;
+ mapvals.lightsource[0].type = (LightType) param[8].data.d_int32;
+ mapvals.lightsource[0].color = param[9].data.d_color;
+ mapvals.lightsource[0].position.x = param[10].data.d_float;
+ mapvals.lightsource[0].position.y = param[11].data.d_float;
+ mapvals.lightsource[0].position.z = param[12].data.d_float;
+ mapvals.lightsource[0].direction.x = param[13].data.d_float;
+ mapvals.lightsource[0].direction.y = param[14].data.d_float;
+ mapvals.lightsource[0].direction.z = param[15].data.d_float;
+ mapvals.material.ambient_int = param[16].data.d_float;
+ mapvals.material.diffuse_int = param[17].data.d_float;
+ mapvals.material.diffuse_ref = param[18].data.d_float;
+ mapvals.material.specular_ref = param[19].data.d_float;
+ mapvals.material.highlight = param[20].data.d_float;
+ mapvals.antialiasing = (gint) param[21].data.d_int32;
+ mapvals.create_new_image = (gint) param[22].data.d_int32;
+ mapvals.transparent_background = (gint) param[23].data.d_int32;
+
+ check_drawables ();
+ if (image_setup (drawable_id, FALSE))
+ compute_image ();
+ }
+ default:
+ break;
+ }
+ }
+ else
+ {
+ status = GIMP_PDB_EXECUTION_ERROR;
+ }
+ }
+
+ values[0].data.d_status = status;
+
+ g_free (xpostab);
+ g_free (ypostab);
+}
+
+const GimpPlugInInfo PLUG_IN_INFO =
+{
+ NULL, /* init_proc */
+ NULL, /* quit_proc */
+ query, /* query_proc */
+ run, /* run_proc */
+};
+
+MAIN ()
diff --git a/plug-ins/lighting/lighting-main.h b/plug-ins/lighting/lighting-main.h
new file mode 100644
index 0000000..f547b2d
--- /dev/null
+++ b/plug-ins/lighting/lighting-main.h
@@ -0,0 +1,104 @@
+#ifndef __LIGHTING_MAIN_H__
+#define __LIGHTING_MAIN_H__
+
+/* Defines and stuff */
+/* ================= */
+
+#define PLUG_IN_PROC "plug-in-lighting"
+#define PLUG_IN_BINARY "lighting"
+#define PLUG_IN_ROLE "gimp-lighting"
+
+#define TILE_CACHE_SIZE 16
+#define NUM_LIGHTS 6
+
+/* Typedefs */
+/* ======== */
+
+typedef enum
+{
+ POINT_LIGHT,
+ DIRECTIONAL_LIGHT,
+ SPOT_LIGHT,
+ NO_LIGHT
+} LightType;
+
+enum
+{
+ LINEAR_MAP,
+ LOGARITHMIC_MAP,
+ SINUSOIDAL_MAP,
+ SPHERICAL_MAP
+};
+
+enum
+{
+ IMAGE_BUMP,
+ WAVES_BUMP
+};
+
+typedef struct
+{
+ gdouble ambient_int;
+ gdouble diffuse_int;
+ gdouble diffuse_ref;
+ gdouble specular_ref;
+ gdouble highlight;
+ gboolean metallic;
+ GimpRGB color;
+} MaterialSettings;
+
+typedef struct
+{
+ LightType type;
+ GimpVector3 position;
+ GimpVector3 direction;
+ GimpRGB color;
+ gdouble intensity;
+ gboolean active;
+} LightSettings;
+
+typedef struct
+{
+ gint32 drawable_id;
+ gint32 bumpmap_id;
+ gint32 envmap_id;
+
+ /* Render variables */
+ /* ================ */
+
+ GimpVector3 viewpoint;
+ GimpVector3 planenormal;
+ LightSettings lightsource[NUM_LIGHTS];
+ MaterialSettings material;
+ MaterialSettings ref_material;
+
+ gdouble pixel_threshold;
+ gdouble bumpmax,bumpmin;
+ gint max_depth;
+ gint bumpmaptype;
+
+ /* Flags */
+ gint antialiasing;
+ gint create_new_image;
+ gint transparent_background;
+ gint bump_mapped;
+ gint env_mapped;
+ gint ref_mapped;
+ gint bumpstretch;
+ gint previewquality;
+ gboolean symbols;
+ gboolean interactive_preview;
+
+ /* Misc */
+ gboolean update_enabled;
+ gint light_selected;
+ gboolean light_isolated;
+ gdouble preview_zoom_factor;
+} LightingValues;
+
+/* Externally visible variables */
+/* ============================ */
+
+extern LightingValues mapvals;
+
+#endif /* __LIGHTING_MAIN_H__ */
diff --git a/plug-ins/lighting/lighting-preview.c b/plug-ins/lighting/lighting-preview.c
new file mode 100644
index 0000000..e4bbd26
--- /dev/null
+++ b/plug-ins/lighting/lighting-preview.c
@@ -0,0 +1,496 @@
+/*************************************************/
+/* Compute a preview image and preview wireframe */
+/*************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include <libgimp/gimp.h>
+#include <libgimpmath/gimpmath.h>
+
+#include "lighting-main.h"
+#include "lighting-ui.h"
+#include "lighting-image.h"
+#include "lighting-apply.h"
+#include "lighting-shade.h"
+
+#include "lighting-preview.h"
+
+
+#define LIGHT_SYMBOL_SIZE 8
+
+static gint handle_xpos = 0, handle_ypos = 0;
+
+/* g_free()'ed on exit */
+gdouble *xpostab = NULL;
+gdouble *ypostab = NULL;
+
+static gint xpostab_size = -1; /* if preview size change, do realloc */
+static gint ypostab_size = -1;
+
+static gboolean light_hit = FALSE;
+static gboolean left_button_pressed = FALSE;
+static guint preview_update_timer = 0;
+
+
+/* Protos */
+/* ====== */
+static gboolean
+interactive_preview_timer_callback ( gpointer data );
+
+static void
+compute_preview (gint startx, gint starty, gint w, gint h)
+{
+ gint xcnt, ycnt, f1, f2;
+ guchar r, g, b;
+ gdouble imagex, imagey;
+ gint32 index = 0;
+ GimpRGB color;
+ GimpRGB lightcheck, darkcheck;
+ GimpVector3 pos;
+ get_ray_func ray_func;
+
+ if (xpostab_size != w)
+ {
+ if (xpostab)
+ {
+ g_free (xpostab);
+ xpostab = NULL;
+ }
+ }
+
+ if (!xpostab)
+ {
+ xpostab = g_new (gdouble, w);
+ xpostab_size = w;
+ }
+
+ if (ypostab_size != h)
+ {
+ if (ypostab)
+ {
+ g_free (ypostab);
+ ypostab = NULL;
+ }
+ }
+
+ if (!ypostab)
+ {
+ ypostab = g_new (gdouble, h);
+ ypostab_size = h;
+ }
+
+ for (xcnt = 0; xcnt < w; xcnt++)
+ xpostab[xcnt] = (gdouble) width *((gdouble) xcnt / (gdouble) w);
+ for (ycnt = 0; ycnt < h; ycnt++)
+ ypostab[ycnt] = (gdouble) height *((gdouble) ycnt / (gdouble) h);
+
+ precompute_init (width, height);
+
+ gimp_rgba_set (&lightcheck,
+ GIMP_CHECK_LIGHT, GIMP_CHECK_LIGHT, GIMP_CHECK_LIGHT,
+ 1.0);
+ gimp_rgba_set (&darkcheck, GIMP_CHECK_DARK, GIMP_CHECK_DARK,
+ GIMP_CHECK_DARK, 1.0);
+
+ if (mapvals.bump_mapped == TRUE && mapvals.bumpmap_id != -1)
+ {
+ bumpmap_setup (mapvals.bumpmap_id);
+ }
+
+ imagey = 0;
+
+ if (mapvals.previewquality)
+ ray_func = get_ray_color;
+ else
+ ray_func = get_ray_color_no_bilinear;
+
+ if (mapvals.env_mapped == TRUE && mapvals.envmap_id != -1)
+ {
+ envmap_setup (mapvals.envmap_id);
+
+ if (mapvals.previewquality)
+ ray_func = get_ray_color_ref;
+ else
+ ray_func = get_ray_color_no_bilinear_ref;
+ }
+
+ cairo_surface_flush (preview_surface);
+
+ for (ycnt = 0; ycnt < PREVIEW_HEIGHT; ycnt++)
+ {
+ index = ycnt * preview_rgb_stride;
+ for (xcnt = 0; xcnt < PREVIEW_WIDTH; xcnt++)
+ {
+ if ((ycnt >= starty && ycnt < (starty + h)) &&
+ (xcnt >= startx && xcnt < (startx + w)))
+ {
+ imagex = xpostab[xcnt - startx];
+ imagey = ypostab[ycnt - starty];
+ pos = int_to_posf (imagex, imagey);
+
+ if (mapvals.bump_mapped == TRUE &&
+ mapvals.bumpmap_id != -1 &&
+ xcnt == startx)
+ {
+ pos_to_float (pos.x, pos.y, &imagex, &imagey);
+ precompute_normals (0, width, RINT (imagey));
+ }
+
+ color = (*ray_func) (&pos);
+
+ if (color.a < 1.0)
+ {
+ f1 = ((xcnt % 32) < 16);
+ f2 = ((ycnt % 32) < 16);
+ f1 = f1 ^ f2;
+
+ if (f1)
+ {
+ if (color.a == 0.0)
+ color = lightcheck;
+ else
+ gimp_rgb_composite (&color,
+ &lightcheck,
+ GIMP_RGB_COMPOSITE_BEHIND);
+ }
+ else
+ {
+ if (color.a == 0.0)
+ color = darkcheck;
+ else
+ gimp_rgb_composite (&color,
+ &darkcheck,
+ GIMP_RGB_COMPOSITE_BEHIND);
+ }
+ }
+
+ gimp_rgb_get_uchar (&color, &r, &g, &b);
+ GIMP_CAIRO_RGB24_SET_PIXEL((preview_rgb_data + index), r, g, b);
+ index += 4;
+ imagex++;
+ }
+ else
+ {
+ preview_rgb_data[index++] = 200;
+ preview_rgb_data[index++] = 200;
+ preview_rgb_data[index++] = 200;
+ index++;
+ }
+ }
+ }
+ cairo_surface_mark_dirty (preview_surface);
+}
+
+static void
+compute_preview_rectangle (gint * xp, gint * yp, gint * wid, gint * heig)
+{
+ gdouble x, y, w, h;
+
+ if (width >= height)
+ {
+ w = (PREVIEW_WIDTH - 50.0);
+ h = (gdouble) height *(w / (gdouble) width);
+
+ x = (PREVIEW_WIDTH - w) / 2.0;
+ y = (PREVIEW_HEIGHT - h) / 2.0;
+ }
+ else
+ {
+ h = (PREVIEW_HEIGHT - 50.0);
+ w = (gdouble) width *(h / (gdouble) height);
+ x = (PREVIEW_WIDTH - w) / 2.0;
+ y = (PREVIEW_HEIGHT - h) / 2.0;
+ }
+ *xp = RINT (x);
+ *yp = RINT (y);
+ *wid = RINT (w);
+ *heig = RINT (h);
+}
+
+/*************************************************/
+/* Check if the given position is within the */
+/* light marker. Return TRUE if so, FALSE if not */
+/*************************************************/
+
+static gboolean
+check_handle_hit (gint xpos, gint ypos)
+{
+ gint dx,dy,r;
+ gint k = mapvals.light_selected;
+
+ dx = handle_xpos - xpos;
+ dy = handle_ypos - ypos;
+
+
+ if (mapvals.lightsource[k].type == POINT_LIGHT ||
+ mapvals.lightsource[k].type == DIRECTIONAL_LIGHT)
+ {
+ r = sqrt (dx * dx + dy * dy) + 0.5;
+ if ((gint) r > 7)
+ {
+ return (FALSE);
+ }
+ else
+ {
+ return (TRUE);
+ }
+ }
+ return FALSE;
+}
+
+/****************************************/
+/* Draw a light symbol */
+/****************************************/
+
+
+static void
+draw_handles (void)
+{
+ gdouble dxpos, dypos;
+ gint startx, starty, pw, ph;
+ GimpVector3 viewpoint;
+ GimpVector3 light_position;
+ gint k = mapvals.light_selected;
+
+ gfloat length;
+ gfloat delta_x = 0.0;
+ gfloat delta_y = 0.0;
+
+ /* calculate handle position */
+ compute_preview_rectangle (&startx, &starty, &pw, &ph);
+ switch (mapvals.lightsource[k].type)
+ {
+ case NO_LIGHT:
+ return;
+ case POINT_LIGHT:
+ case SPOT_LIGHT:
+ /* swap z to reverse light position */
+ viewpoint = mapvals.viewpoint;
+ viewpoint.z = -viewpoint.z;
+ light_position = mapvals.lightsource[k].position;
+ gimp_vector_3d_to_2d (startx, starty, pw, ph, &dxpos, &dypos,
+ &viewpoint, &light_position);
+ handle_xpos = (gint) (dxpos + 0.5);
+ handle_ypos = (gint) (dypos + 0.5);
+ break;
+ case DIRECTIONAL_LIGHT:
+ light_position.x = light_position.y = 0.5;
+ light_position.z = 0;
+ viewpoint.z = -viewpoint.z;
+ gimp_vector_3d_to_2d (startx, starty, pw, ph, &dxpos, &dypos,
+ &viewpoint, &light_position);
+ length = PREVIEW_HEIGHT / 4;
+ delta_x = mapvals.lightsource[k].direction.x * length;
+ delta_y = mapvals.lightsource[k].direction.y * length;
+ handle_xpos = dxpos + delta_x;
+ handle_ypos = dypos + delta_y;
+ break;
+ }
+
+ if (mapvals.lightsource[k].type != NO_LIGHT)
+ {
+ GdkColor color;
+ cairo_t *cr;
+ cr = gdk_cairo_create (gtk_widget_get_window (previewarea));
+
+ cairo_set_line_width (cr, 1.0);
+
+ color.red = 0x0;
+ color.green = 0x4000;
+ color.blue = 0xFFFF;
+ gdk_cairo_set_source_color (cr, &color);
+
+ /* draw circle at light position */
+ switch (mapvals.lightsource[k].type)
+ {
+ case POINT_LIGHT:
+ case SPOT_LIGHT:
+ cairo_arc (cr, handle_xpos, handle_ypos,
+ LIGHT_SYMBOL_SIZE/2, 0, 2 * G_PI);
+ cairo_fill (cr);
+ break;
+ case DIRECTIONAL_LIGHT:
+ cairo_arc (cr, handle_xpos, handle_ypos,
+ LIGHT_SYMBOL_SIZE/2, 0, 2 * G_PI);
+ cairo_fill (cr);
+ cairo_move_to (cr, handle_xpos, handle_ypos);
+ cairo_line_to (cr, startx + pw/2, starty + ph/2);
+ cairo_stroke (cr);
+ break;
+ case NO_LIGHT:
+ break;
+ }
+ cairo_destroy (cr);
+ }
+}
+
+
+/*************************************************/
+/* Update light position given new screen coords */
+/*************************************************/
+
+void
+update_light (gint xpos, gint ypos)
+{
+ gint startx, starty, pw, ph;
+ GimpVector3 vp;
+ gint k = mapvals.light_selected;
+
+ compute_preview_rectangle (&startx, &starty, &pw, &ph);
+
+ vp = mapvals.viewpoint;
+ vp.z = -vp.z;
+
+ switch (mapvals.lightsource[k].type)
+ {
+ case NO_LIGHT:
+ break;
+ case POINT_LIGHT:
+ case SPOT_LIGHT:
+ gimp_vector_2d_to_3d (startx,
+ starty,
+ pw,
+ ph,
+ xpos, ypos, &vp, &mapvals.lightsource[k].position);
+ break;
+ case DIRECTIONAL_LIGHT:
+ gimp_vector_2d_to_3d (startx,
+ starty,
+ pw,
+ ph,
+ xpos, ypos, &vp, &mapvals.lightsource[k].direction);
+ break;
+ }
+}
+
+
+/******************************************************************/
+/* Draw preview image. if DoCompute is TRUE then recompute image. */
+/******************************************************************/
+
+void
+preview_compute (void)
+{
+ GdkDisplay *display = gtk_widget_get_display (previewarea);
+ GdkCursor *cursor;
+ gint startx, starty, pw, ph;
+
+ compute_preview_rectangle (&startx, &starty, &pw, &ph);
+
+ cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
+
+ gdk_window_set_cursor (gtk_widget_get_window (previewarea), cursor);
+ gdk_cursor_unref (cursor);
+
+ compute_preview (startx, starty, pw, ph);
+ cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
+ gdk_window_set_cursor (gtk_widget_get_window (previewarea), cursor);
+ gdk_cursor_unref (cursor);
+ gdk_flush ();
+}
+
+
+/******************************/
+/* Preview area event handler */
+/******************************/
+
+gboolean
+preview_events (GtkWidget *area,
+ GdkEvent *event)
+{
+ switch (event->type)
+ {
+ case GDK_ENTER_NOTIFY:
+ break;
+ case GDK_LEAVE_NOTIFY:
+ break;
+ case GDK_BUTTON_PRESS:
+ light_hit = check_handle_hit (event->button.x, event->button.y);
+ left_button_pressed = TRUE;
+ break;
+ case GDK_BUTTON_RELEASE:
+ left_button_pressed = FALSE;
+ break;
+ case GDK_MOTION_NOTIFY:
+ if (left_button_pressed == TRUE &&
+ light_hit == TRUE &&
+ mapvals.interactive_preview == TRUE )
+ {
+ gtk_widget_queue_draw (previewarea);
+ interactive_preview_callback(NULL);
+ update_light (event->motion.x, event->motion.y);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+gboolean
+preview_expose (GtkWidget *area,
+ GdkEventExpose *eevent)
+{
+ cairo_t *cr;
+
+ cr = gdk_cairo_create (eevent->window);
+
+ cairo_set_source_surface (cr, preview_surface, 0.0, 0.0);
+
+ cairo_paint (cr);
+
+ /* draw symbols if enabled in UI */
+ if (mapvals.interactive_preview)
+ {
+ draw_handles ();
+ }
+
+ cairo_destroy (cr);
+
+ return FALSE;
+}
+
+void
+interactive_preview_callback (GtkWidget *widget)
+{
+ if (preview_update_timer != 0)
+ g_source_remove (preview_update_timer);
+
+ preview_update_timer = g_timeout_add (100,
+ interactive_preview_timer_callback,
+ NULL);
+}
+
+static gboolean
+interactive_preview_timer_callback (gpointer data)
+{
+ gint k = mapvals.light_selected;
+
+ mapvals.update_enabled = FALSE; /* disable apply_settings() */
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_pos_x),
+ mapvals.lightsource[k].position.x);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_pos_y),
+ mapvals.lightsource[k].position.y);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_pos_z),
+ mapvals.lightsource[k].position.z);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_dir_x),
+ mapvals.lightsource[k].direction.x);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_dir_y),
+ mapvals.lightsource[k].direction.y);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_dir_z),
+ mapvals.lightsource[k].direction.z);
+
+ mapvals.update_enabled = TRUE;
+
+ preview_compute ();
+
+ gtk_widget_queue_draw (previewarea);
+
+ preview_update_timer = 0;
+
+ return FALSE;
+}
diff --git a/plug-ins/lighting/lighting-preview.h b/plug-ins/lighting/lighting-preview.h
new file mode 100644
index 0000000..881dacd
--- /dev/null
+++ b/plug-ins/lighting/lighting-preview.h
@@ -0,0 +1,38 @@
+/* Lighting Effects - A plug-in for GIMP
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __LIGHTING_PREVIEW_H__
+#define __LIGHTING_PREVIEW_H__
+
+#define PREVIEW_WIDTH 200
+#define PREVIEW_HEIGHT 200
+
+/* Externally visible variables */
+
+extern gdouble *xpostab, *ypostab;
+
+/* Externally visible functions */
+
+void preview_compute (void);
+void interactive_preview_callback (GtkWidget *widget);
+gboolean preview_events (GtkWidget *area,
+ GdkEvent *event);
+gboolean preview_expose (GtkWidget *area,
+ GdkEventExpose *eevent);
+void update_light (gint xpos,
+ gint ypos);
+
+#endif /* __LIGHTING_PREVIEW_H__ */
diff --git a/plug-ins/lighting/lighting-shade.c b/plug-ins/lighting/lighting-shade.c
new file mode 100644
index 0000000..70443d9
--- /dev/null
+++ b/plug-ins/lighting/lighting-shade.c
@@ -0,0 +1,838 @@
+/*****************/
+/* Shading stuff */
+/*****************/
+
+#include "config.h"
+
+#include <libgimp/gimp.h>
+
+#include "lighting-main.h"
+#include "lighting-image.h"
+#include "lighting-shade.h"
+
+
+static GimpVector3 *triangle_normals[2] = { NULL, NULL };
+static GimpVector3 *vertex_normals[3] = { NULL, NULL, NULL };
+static gdouble *heights[3] = { NULL, NULL, NULL };
+static gdouble xstep, ystep;
+static guchar *bumprow = NULL;
+
+static gint pre_w = -1;
+static gint pre_h = -1;
+
+/*****************/
+/* Phong shading */
+/*****************/
+
+static GimpRGB
+phong_shade (GimpVector3 *position,
+ GimpVector3 *viewpoint,
+ GimpVector3 *normal,
+ GimpVector3 *lightposition,
+ GimpRGB *diff_col,
+ GimpRGB *light_col,
+ LightType light_type)
+{
+ GimpRGB diffuse_color, specular_color;
+ gdouble nl, rv, dist;
+ GimpVector3 l, v, n, lnormal, h;
+
+ /* Compute ambient intensity */
+ /* ========================= */
+
+ n = *normal;
+
+ /* Compute (N*L) term of Phong's equation */
+ /* ====================================== */
+
+ if (light_type == POINT_LIGHT)
+ gimp_vector3_sub (&l, lightposition, position);
+ else
+ {
+ l = *lightposition;
+ gimp_vector3_normalize (&l);
+ }
+
+ dist = gimp_vector3_length (&l);
+
+ if (dist != 0.0)
+ gimp_vector3_mul (&l, 1.0 / dist);
+
+ nl = MAX (0., 2.0 * gimp_vector3_inner_product (&n, &l));
+
+ lnormal = l;
+ gimp_vector3_normalize (&lnormal);
+
+ if (nl >= 0.0)
+ {
+ /* Compute (R*V)^alpha term of Phong's equation */
+ /* ============================================ */
+
+ gimp_vector3_sub (&v, viewpoint, position);
+ gimp_vector3_normalize (&v);
+
+ gimp_vector3_add (&h, &lnormal, &v);
+ gimp_vector3_normalize (&h);
+
+ rv = MAX (0.01, gimp_vector3_inner_product (&n, &h));
+ rv = pow (rv, mapvals.material.highlight);
+ rv *= nl;
+
+ /* Compute diffuse and specular intensity contribution */
+ /* =================================================== */
+
+ diffuse_color = *light_col;
+ gimp_rgb_multiply (&diffuse_color, mapvals.material.diffuse_int);
+ diffuse_color.r *= diff_col->r;
+ diffuse_color.g *= diff_col->g;
+ diffuse_color.b *= diff_col->b;
+ gimp_rgb_multiply (&diffuse_color, nl);
+
+ specular_color = *light_col;
+ if (mapvals.material.metallic) /* for metals, specular color = diffuse color */
+ {
+ specular_color.r *= diff_col->r;
+ specular_color.g *= diff_col->g;
+ specular_color.b *= diff_col->b;
+ }
+ gimp_rgb_multiply (&specular_color, mapvals.material.specular_ref);
+ gimp_rgb_multiply (&specular_color, rv);
+
+ gimp_rgb_add (&diffuse_color, &specular_color);
+ gimp_rgb_clamp (&diffuse_color);
+ }
+
+ gimp_rgb_clamp (&diffuse_color);
+
+ return diffuse_color;
+}
+
+void
+precompute_init (gint w,
+ gint h)
+{
+ gint n;
+ gint bpp=1;
+
+ xstep = 1.0 / (gdouble) width;
+ ystep = 1.0 / (gdouble) height;
+
+ pre_w = w;
+ pre_h = h;
+
+ for (n = 0; n < 3; n++)
+ {
+ if (vertex_normals[n] != NULL)
+ g_free (vertex_normals[n]);
+
+ if (heights[n] != NULL)
+ g_free (heights[n]);
+
+ heights[n] = g_new (gdouble, w);
+ vertex_normals[n] = g_new (GimpVector3, w);
+ }
+
+ for (n = 0; n < 2; n++)
+ if (triangle_normals[n] != NULL)
+ g_free (triangle_normals[n]);
+
+ g_clear_pointer (&bumprow, g_free);
+
+ if (mapvals.bumpmap_id != -1)
+ {
+ bpp = gimp_drawable_bpp(mapvals.bumpmap_id);
+ }
+
+ bumprow = g_new (guchar, w * bpp);
+
+ triangle_normals[0] = g_new (GimpVector3, (w << 1) + 2);
+ triangle_normals[1] = g_new (GimpVector3, (w << 1) + 2);
+
+ for (n = 0; n < (w << 1) + 1; n++)
+ {
+ gimp_vector3_set (&triangle_normals[0][n], 0.0, 0.0, 1.0);
+ gimp_vector3_set (&triangle_normals[1][n], 0.0, 0.0, 1.0);
+ }
+
+ for (n = 0; n < w; n++)
+ {
+ gimp_vector3_set (&vertex_normals[0][n], 0.0, 0.0, 1.0);
+ gimp_vector3_set (&vertex_normals[1][n], 0.0, 0.0, 1.0);
+ gimp_vector3_set (&vertex_normals[2][n], 0.0, 0.0, 1.0);
+ heights[0][n] = 0.0;
+ heights[1][n] = 0.0;
+ heights[2][n] = 0.0;
+ }
+}
+
+
+/* Interpol linearly height[2] and triangle_normals[1]
+ * using the next row
+ */
+void
+interpol_row (gint x1,
+ gint x2,
+ gint y)
+{
+ GimpVector3 p1, p2, p3;
+ gint n, i;
+ guchar *map = NULL;
+ gint bpp = 1;
+ guchar *bumprow1 = NULL;
+ guchar *bumprow2 = NULL;
+
+ if (mapvals.bumpmap_id != -1)
+ {
+ bumpmap_setup (mapvals.bumpmap_id);
+
+ bpp = babl_format_get_bytes_per_pixel (bump_format);
+ }
+
+ bumprow1 = g_new0 (guchar, pre_w * bpp);
+ bumprow2 = g_new0 (guchar, pre_w * bpp);
+
+ gegl_buffer_get (bump_buffer, GEGL_RECTANGLE (x1, y, x2 - x1, 1), 1.0,
+ bump_format, bumprow1,
+ GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+
+ gegl_buffer_get (bump_buffer, GEGL_RECTANGLE (x1, y - 1, x2 - x1, 1), 1.0,
+ bump_format, bumprow2,
+ GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+
+ if (mapvals.bumpmaptype > 0)
+ {
+ switch (mapvals.bumpmaptype)
+ {
+ case 1:
+ map = logmap;
+ break;
+ case 2:
+ map = sinemap;
+ break;
+ default:
+ map = spheremap;
+ break;
+ }
+ }
+
+ for (n = 0; n < (x2 - x1); n++)
+ {
+ gdouble diff;
+ guchar mapval;
+ guchar mapval1, mapval2;
+
+ if (bpp>1)
+ {
+ mapval1 = (guchar)((float)((bumprow1[n * bpp] +bumprow1[n * bpp +1] + bumprow1[n * bpp + 2])/3.0 )) ;
+ mapval2 = (guchar)((float)((bumprow2[n * bpp] +bumprow2[n * bpp +1] + bumprow2[n * bpp + 2])/3.0 )) ;
+ }
+ else
+ {
+ mapval1 = bumprow1[n * bpp];
+ mapval2 = bumprow2[n * bpp];
+ }
+
+ diff = mapval1 - mapval2;
+ mapval = (guchar) CLAMP (mapval1 + diff, 0.0, 255.0);
+
+ if (mapvals.bumpmaptype > 0)
+ {
+ heights[1][n] = (gdouble) mapvals.bumpmax * (gdouble) map[mapval1] / 255.0;
+ heights[2][n] = (gdouble) mapvals.bumpmax * (gdouble) map[mapval] / 255.0;
+ }
+ else
+ {
+ heights[1][n] = (gdouble) mapvals.bumpmax * (gdouble) mapval1 / 255.0;
+ heights[2][n] = (gdouble) mapvals.bumpmax * (gdouble) mapval / 255.0;
+ }
+ }
+
+ i = 0;
+ for (n = 0; n < (x2 - x1 - 1); n++)
+ {
+ /* heights rows 1 and 2 are inverted */
+ p1.x = 0.0;
+ p1.y = ystep;
+ p1.z = heights[1][n] - heights[2][n];
+
+ p2.x = xstep;
+ p2.y = ystep;
+ p2.z = heights[1][n+1] - heights[2][n];
+
+ p3.x = xstep;
+ p3.y = 0.0;
+ p3.z = heights[2][n+1] - heights[2][n];
+
+ triangle_normals[1][i] = gimp_vector3_cross_product (&p2, &p1);
+ triangle_normals[1][i+1] = gimp_vector3_cross_product (&p3, &p2);
+
+ gimp_vector3_normalize (&triangle_normals[1][i]);
+ gimp_vector3_normalize (&triangle_normals[1][i+1]);
+
+ i += 2;
+ }
+
+ g_free (bumprow1);
+ g_free (bumprow2);
+}
+
+/********************************************/
+/* Compute triangle and then vertex normals */
+/********************************************/
+
+
+void
+precompute_normals (gint x1,
+ gint x2,
+ gint y)
+{
+ GimpVector3 *tmpv, p1, p2, p3, normal;
+ gdouble *tmpd;
+ gint n, i, nv;
+ guchar *map = NULL;
+ gint bpp = 1;
+ guchar mapval;
+
+
+ /* First, compute the heights */
+ /* ========================== */
+
+ tmpv = triangle_normals[0];
+ triangle_normals[0] = triangle_normals[1];
+ triangle_normals[1] = tmpv;
+
+ tmpv = vertex_normals[0];
+ vertex_normals[0] = vertex_normals[1];
+ vertex_normals[1] = vertex_normals[2];
+ vertex_normals[2] = tmpv;
+
+ tmpd = heights[0];
+ heights[0] = heights[1];
+ heights[1] = heights[2];
+ heights[2] = tmpd;
+
+ if (mapvals.bumpmap_id != -1)
+ {
+ bumpmap_setup (mapvals.bumpmap_id);
+
+ bpp = babl_format_get_bytes_per_pixel (bump_format);
+ }
+
+ gegl_buffer_get (bump_buffer, GEGL_RECTANGLE (x1, y, x2 - x1, 1), 1.0,
+ bump_format, bumprow,
+ GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+
+ if (mapvals.bumpmaptype > 0)
+ {
+ switch (mapvals.bumpmaptype)
+ {
+ case 1:
+ map = logmap;
+ break;
+ case 2:
+ map = sinemap;
+ break;
+ default:
+ map = spheremap;
+ break;
+ }
+
+ for (n = 0; n < (x2 - x1); n++)
+ {
+ if (bpp > 1)
+ {
+ mapval = (guchar)((float)((bumprow[n * bpp + 0] +
+ bumprow[n * bpp + 1] +
+ bumprow[n * bpp + 2]) /3.0));
+ }
+ else
+ {
+ mapval = bumprow[n * bpp];
+ }
+
+ heights[2][n] = (gdouble) mapvals.bumpmax * (gdouble) map[mapval] / 255.0;
+ }
+ }
+ else
+ {
+ for (n = 0; n < (x2 - x1); n++)
+ {
+ if (bpp>1)
+ {
+ mapval = (guchar)((float)((bumprow[n * bpp + 0] +
+ bumprow[n * bpp + 1] +
+ bumprow[n * bpp + 2]) / 3.0));
+ }
+ else
+ {
+ mapval = bumprow[n * bpp];
+ }
+
+ heights[2][n] = (gdouble) mapvals.bumpmax * (gdouble) mapval / 255.0;
+ }
+ }
+
+ /* Compute triangle normals */
+ /* ======================== */
+
+ i = 0;
+ for (n = 0; n < (x2 - x1 - 1); n++)
+ {
+ p1.x = 0.0;
+ p1.y = ystep;
+ p1.z = heights[2][n] - heights[1][n];
+
+ p2.x = xstep;
+ p2.y = ystep;
+ p2.z = heights[2][n+1] - heights[1][n];
+
+ p3.x = xstep;
+ p3.y = 0.0;
+ p3.z = heights[1][n+1] - heights[1][n];
+
+ triangle_normals[1][i] = gimp_vector3_cross_product (&p2, &p1);
+ triangle_normals[1][i+1] = gimp_vector3_cross_product (&p3, &p2);
+
+ gimp_vector3_normalize (&triangle_normals[1][i]);
+ gimp_vector3_normalize (&triangle_normals[1][i+1]);
+
+ i += 2;
+ }
+
+ /* Compute vertex normals */
+ /* ====================== */
+
+ i = 0;
+ gimp_vector3_set (&normal, 0.0, 0.0, 0.0);
+
+ for (n = 0; n < (x2 - x1 - 1); n++)
+ {
+ nv = 0;
+
+ if (n > 0)
+ {
+ if (y > 0)
+ {
+ gimp_vector3_add (&normal, &normal, &triangle_normals[0][i-1]);
+ gimp_vector3_add (&normal, &normal, &triangle_normals[0][i-2]);
+ nv += 2;
+ }
+
+ if (y < pre_h)
+ {
+ gimp_vector3_add (&normal, &normal, &triangle_normals[1][i-1]);
+ nv++;
+ }
+ }
+
+ if (n <pre_w)
+ {
+ if (y > 0)
+ {
+ gimp_vector3_add (&normal, &normal, &triangle_normals[0][i]);
+ gimp_vector3_add (&normal, &normal, &triangle_normals[0][i+1]);
+ nv += 2;
+ }
+
+ if (y < pre_h)
+ {
+ gimp_vector3_add (&normal, &normal, &triangle_normals[1][i]);
+ gimp_vector3_add (&normal, &normal, &triangle_normals[1][i+1]);
+ nv += 2;
+ }
+ }
+
+ gimp_vector3_mul (&normal, 1.0 / (gdouble) nv);
+ gimp_vector3_normalize (&normal);
+ vertex_normals[1][n] = normal;
+
+ i += 2;
+ }
+}
+
+/***********************************************************************/
+/* Compute the reflected ray given the normalized normal and ins. vec. */
+/***********************************************************************/
+
+static GimpVector3
+compute_reflected_ray (GimpVector3 *normal,
+ GimpVector3 *view)
+{
+ GimpVector3 ref;
+ gdouble nl;
+
+ nl = 2.0 * gimp_vector3_inner_product (normal, view);
+
+ ref = *normal;
+
+ gimp_vector3_mul (&ref, nl);
+ gimp_vector3_sub (&ref, &ref, view);
+
+ return ref;
+}
+
+/************************************************************************/
+/* Given the NorthPole, Equator and a third vector (normal) compute */
+/* the conversion from spherical coordinates to image space coordinates */
+/************************************************************************/
+
+static void
+sphere_to_image (GimpVector3 *normal,
+ gdouble *u,
+ gdouble *v)
+{
+ static gdouble alpha, fac;
+ static GimpVector3 cross_prod;
+ static GimpVector3 firstaxis = { 1.0, 0.0, 0.0 };
+ static GimpVector3 secondaxis = { 0.0, 1.0, 0.0 };
+
+ alpha = acos (-gimp_vector3_inner_product (&secondaxis, normal));
+
+ *v = alpha / G_PI;
+
+ if (*v==0.0 || *v==1.0)
+ {
+ *u = 0.0;
+ }
+ else
+ {
+ fac = gimp_vector3_inner_product (&firstaxis, normal) / sin (alpha);
+
+ /* Make sure that we map to -1.0..1.0 (take care of rounding errors) */
+ /* ================================================================= */
+
+ if (fac>1.0)
+ fac = 1.0;
+ else if (fac<-1.0)
+ fac = -1.0;
+
+ *u = acos (fac) / (2.0 * G_PI);
+
+ cross_prod = gimp_vector3_cross_product (&secondaxis, &firstaxis);
+
+ if (gimp_vector3_inner_product (&cross_prod, normal) < 0.0)
+ *u = 1.0 - *u;
+ }
+}
+
+/*********************************************************************/
+/* These routines computes the color of the surface at a given point */
+/*********************************************************************/
+
+GimpRGB
+get_ray_color (GimpVector3 *position)
+{
+ GimpRGB color;
+ GimpRGB color_int;
+ GimpRGB color_sum;
+ GimpRGB light_color;
+ gint x, f;
+ gdouble xf, yf;
+ GimpVector3 normal, *p;
+ gint k;
+
+ pos_to_float (position->x, position->y, &xf, &yf);
+
+ x = RINT (xf);
+
+ if (mapvals.transparent_background && heights[1][x] == 0)
+ {
+ gimp_rgb_set_alpha (&color_sum, 0.0);
+ }
+ else
+ {
+ color = get_image_color (xf, yf, &f);
+
+ color_sum = color;
+ gimp_rgb_multiply (&color_sum, mapvals.material.ambient_int);
+
+ for (k = 0; k < NUM_LIGHTS; k++)
+ {
+ if (!mapvals.lightsource[k].active
+ || mapvals.lightsource[k].type == NO_LIGHT)
+ continue;
+ else if (mapvals.lightsource[k].type == POINT_LIGHT)
+ p = &mapvals.lightsource[k].position;
+ else
+ p = &mapvals.lightsource[k].direction;
+
+ color_int = mapvals.lightsource[k].color;
+ gimp_rgb_multiply (&color_int, mapvals.lightsource[k].intensity);
+
+ if (mapvals.bump_mapped == FALSE || mapvals.bumpmap_id == -1)
+ {
+ light_color = phong_shade (position,
+ &mapvals.viewpoint,
+ &mapvals.planenormal,
+ p,
+ &color,
+ &color_int,
+ mapvals.lightsource[k].type);
+ }
+ else
+ {
+ normal = vertex_normals[1][(gint) RINT (xf)];
+
+ light_color = phong_shade (position,
+ &mapvals.viewpoint,
+ &normal,
+ p,
+ &color,
+ &color_int,
+ mapvals.lightsource[k].type);
+ }
+
+ gimp_rgb_add (&color_sum, &light_color);
+ }
+ }
+
+ gimp_rgb_clamp (&color_sum);
+ return color_sum;
+}
+
+GimpRGB
+get_ray_color_ref (GimpVector3 *position)
+{
+ GimpRGB color_sum;
+ GimpRGB color_int;
+ GimpRGB light_color;
+ GimpRGB color, env_color;
+ gint x, f;
+ gdouble xf, yf;
+ GimpVector3 normal, *p, v, r;
+ gint k;
+ gdouble tmpval;
+
+ pos_to_float (position->x, position->y, &xf, &yf);
+
+ x = RINT (xf);
+
+ if (mapvals.bump_mapped == FALSE || mapvals.bumpmap_id == -1)
+ normal = mapvals.planenormal;
+ else
+ normal = vertex_normals[1][(gint) RINT (xf)];
+ gimp_vector3_normalize (&normal);
+
+ if (mapvals.transparent_background && heights[1][x] == 0)
+ {
+ gimp_rgb_set_alpha (&color_sum, 0.0);
+ }
+ else
+ {
+ color = get_image_color (xf, yf, &f);
+ color_sum = color;
+ gimp_rgb_multiply (&color_sum, mapvals.material.ambient_int);
+
+ for (k = 0; k < NUM_LIGHTS; k++)
+ {
+ p = &mapvals.lightsource[k].direction;
+
+ if (!mapvals.lightsource[k].active
+ || mapvals.lightsource[k].type == NO_LIGHT)
+ continue;
+ else if (mapvals.lightsource[k].type == POINT_LIGHT)
+ p = &mapvals.lightsource[k].position;
+
+ color_int = mapvals.lightsource[k].color;
+ gimp_rgb_multiply (&color_int, mapvals.lightsource[k].intensity);
+
+ light_color = phong_shade (position,
+ &mapvals.viewpoint,
+ &normal,
+ p,
+ &color,
+ &color_int,
+ mapvals.lightsource[0].type);
+ }
+
+ gimp_vector3_sub (&v, &mapvals.viewpoint, position);
+ gimp_vector3_normalize (&v);
+
+ r = compute_reflected_ray (&normal, &v);
+
+ /* Get color in the direction of r */
+ /* =============================== */
+
+ sphere_to_image (&r, &xf, &yf);
+ env_color = peek_env_map (RINT (env_width * xf),
+ RINT (env_height * yf));
+
+ tmpval = mapvals.material.diffuse_int;
+ mapvals.material.diffuse_int = 0.;
+
+ light_color = phong_shade (position,
+ &mapvals.viewpoint,
+ &normal,
+ &r,
+ &color,
+ &env_color,
+ DIRECTIONAL_LIGHT);
+
+ mapvals.material.diffuse_int = tmpval;
+
+ gimp_rgb_add (&color_sum, &light_color);
+ }
+
+ gimp_rgb_clamp (&color_sum);
+ return color_sum;
+}
+
+GimpRGB
+get_ray_color_no_bilinear (GimpVector3 *position)
+{
+ GimpRGB color;
+ GimpRGB color_int;
+ GimpRGB color_sum;
+ GimpRGB light_color;
+ gint x;
+ gdouble xf, yf;
+ GimpVector3 normal, *p;
+ gint k;
+
+
+ pos_to_float (position->x, position->y, &xf, &yf);
+
+ x = RINT (xf);
+
+ if (mapvals.transparent_background && heights[1][x] == 0)
+ {
+ gimp_rgb_set_alpha (&color_sum, 0.0);
+ }
+ else
+ {
+ color = peek (x, RINT (yf));
+
+ color_sum = color;
+ gimp_rgb_multiply (&color_sum, mapvals.material.ambient_int);
+
+ for (k = 0; k < NUM_LIGHTS; k++)
+ {
+ p = &mapvals.lightsource[k].direction;
+
+ if (!mapvals.lightsource[k].active
+ || mapvals.lightsource[k].type == NO_LIGHT)
+ continue;
+ else if (mapvals.lightsource[k].type == POINT_LIGHT)
+ p = &mapvals.lightsource[k].position;
+
+ color_int = mapvals.lightsource[k].color;
+ gimp_rgb_multiply (&color_int, mapvals.lightsource[k].intensity);
+
+ if (mapvals.bump_mapped == FALSE || mapvals.bumpmap_id == -1)
+ {
+ light_color = phong_shade (position,
+ &mapvals.viewpoint,
+ &mapvals.planenormal,
+ p,
+ &color,
+ &color_int,
+ mapvals.lightsource[k].type);
+ }
+ else
+ {
+ normal = vertex_normals[1][x];
+
+ light_color = phong_shade (position,
+ &mapvals.viewpoint,
+ &normal,
+ p,
+ &color,
+ &color_int,
+ mapvals.lightsource[k].type);
+ }
+
+ gimp_rgb_add (&color_sum, &light_color);
+ }
+ }
+
+ gimp_rgb_clamp (&color_sum);
+ return color_sum;
+}
+
+GimpRGB
+get_ray_color_no_bilinear_ref (GimpVector3 *position)
+{
+ GimpRGB color_sum;
+ GimpRGB color_int;
+ GimpRGB light_color;
+ GimpRGB color, env_color;
+ gint x;
+ gdouble xf, yf;
+ GimpVector3 normal, *p, v, r;
+ gint k;
+ gdouble tmpval;
+
+ pos_to_float (position->x, position->y, &xf, &yf);
+
+ x = RINT (xf);
+
+ if (mapvals.bump_mapped == FALSE || mapvals.bumpmap_id == -1)
+ normal = mapvals.planenormal;
+ else
+ normal = vertex_normals[1][(gint) RINT (xf)];
+ gimp_vector3_normalize (&normal);
+
+ if (mapvals.transparent_background && heights[1][x] == 0)
+ {
+ gimp_rgb_set_alpha (&color_sum, 0.0);
+ }
+ else
+ {
+ color = peek (RINT (xf), RINT (yf));
+ color_sum = color;
+ gimp_rgb_multiply (&color_sum, mapvals.material.ambient_int);
+
+ for (k = 0; k < NUM_LIGHTS; k++)
+ {
+ p = &mapvals.lightsource[k].direction;
+
+ if (!mapvals.lightsource[k].active
+ || mapvals.lightsource[k].type == NO_LIGHT)
+ continue;
+ else if (mapvals.lightsource[k].type == POINT_LIGHT)
+ p = &mapvals.lightsource[k].position;
+
+ color_int = mapvals.lightsource[k].color;
+ gimp_rgb_multiply (&color_int, mapvals.lightsource[k].intensity);
+
+ light_color = phong_shade (position,
+ &mapvals.viewpoint,
+ &normal,
+ p,
+ &color,
+ &color_int,
+ mapvals.lightsource[0].type);
+ }
+
+ gimp_vector3_sub (&v, &mapvals.viewpoint, position);
+ gimp_vector3_normalize (&v);
+
+ r = compute_reflected_ray (&normal, &v);
+
+ /* Get color in the direction of r */
+ /* =============================== */
+
+ sphere_to_image (&r, &xf, &yf);
+ env_color = peek_env_map (RINT (env_width * xf),
+ RINT (env_height * yf));
+
+ tmpval = mapvals.material.diffuse_int;
+ mapvals.material.diffuse_int = 0.;
+
+ light_color = phong_shade (position,
+ &mapvals.viewpoint,
+ &normal,
+ &r,
+ &color,
+ &env_color,
+ DIRECTIONAL_LIGHT);
+
+ mapvals.material.diffuse_int = tmpval;
+
+ gimp_rgb_add (&color_sum, &light_color);
+ }
+
+ gimp_rgb_clamp (&color_sum);
+
+ return color_sum;
+}
diff --git a/plug-ins/lighting/lighting-shade.h b/plug-ins/lighting/lighting-shade.h
new file mode 100644
index 0000000..536df95
--- /dev/null
+++ b/plug-ins/lighting/lighting-shade.h
@@ -0,0 +1,20 @@
+#ifndef __LIGHTING_SHADE_H__
+#define __LIGHTING_SHADE_H__
+
+typedef GimpRGB (* get_ray_func) (GimpVector3 *vector);
+
+GimpRGB get_ray_color (GimpVector3 *position);
+GimpRGB get_ray_color_no_bilinear (GimpVector3 *position);
+GimpRGB get_ray_color_ref (GimpVector3 *position);
+GimpRGB get_ray_color_no_bilinear_ref (GimpVector3 *position);
+
+void precompute_init (gint w,
+ gint h);
+void precompute_normals (gint x1,
+ gint x2,
+ gint y);
+void interpol_row (gint x1,
+ gint x2,
+ gint y);
+
+#endif /* __LIGHTING_SHADE_H__ */
diff --git a/plug-ins/lighting/lighting-stock.c b/plug-ins/lighting/lighting-stock.c
new file mode 100644
index 0000000..0cc99b6
--- /dev/null
+++ b/plug-ins/lighting/lighting-stock.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "lighting-stock.h"
+
+#include "images/stock-pixbufs.h"
+
+
+static GtkIconFactory *lighting_icon_factory = NULL;
+
+static GtkStockItem lighting_stock_items[] =
+{
+ { STOCK_INTENSITY_AMBIENT_LOW, NULL, 0, 0, NULL },
+ { STOCK_INTENSITY_AMBIENT_HIGH, NULL, 0, 0, NULL },
+ { STOCK_INTENSITY_DIFFUSE_LOW, NULL, 0, 0, NULL },
+ { STOCK_INTENSITY_DIFFUSE_HIGH, NULL, 0, 0, NULL },
+ { STOCK_REFLECTIVITY_DIFFUSE_LOW, NULL, 0, 0, NULL },
+ { STOCK_REFLECTIVITY_DIFFUSE_HIGH, NULL, 0, 0, NULL },
+ { STOCK_REFLECTIVITY_SPECULAR_LOW, NULL, 0, 0, NULL },
+ { STOCK_REFLECTIVITY_SPECULAR_HIGH, NULL, 0, 0, NULL },
+ { STOCK_REFLECTIVITY_HIGHLIGHT_LOW, NULL, 0, 0, NULL },
+ { STOCK_REFLECTIVITY_HIGHLIGHT_HIGH, NULL, 0, 0, NULL }
+};
+
+
+static void
+add_stock_icon (const gchar *stock_id,
+ GtkIconSize size,
+ const guint8 *inline_data)
+{
+ GtkIconSource *source;
+ GtkIconSet *set;
+ GdkPixbuf *pixbuf;
+
+ source = gtk_icon_source_new ();
+
+ gtk_icon_source_set_size (source, size);
+ gtk_icon_source_set_size_wildcarded (source, FALSE);
+
+ pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
+
+ gtk_icon_source_set_pixbuf (source, pixbuf);
+ g_object_unref (pixbuf);
+
+ set = gtk_icon_set_new ();
+
+ gtk_icon_set_add_source (set, source);
+ gtk_icon_source_free (source);
+
+ gtk_icon_factory_add (lighting_icon_factory, stock_id, set);
+
+ gtk_icon_set_unref (set);
+}
+
+void
+lighting_stock_init (void)
+{
+ static gboolean initialized = FALSE;
+
+ if (initialized)
+ return;
+
+ lighting_icon_factory = gtk_icon_factory_new ();
+
+ add_stock_icon (STOCK_INTENSITY_AMBIENT_LOW, GTK_ICON_SIZE_BUTTON,
+ stock_intensity_ambient_low);
+ add_stock_icon (STOCK_INTENSITY_AMBIENT_HIGH, GTK_ICON_SIZE_BUTTON,
+ stock_intensity_ambient_high);
+ add_stock_icon (STOCK_INTENSITY_DIFFUSE_LOW, GTK_ICON_SIZE_BUTTON,
+ stock_intensity_diffuse_low);
+ add_stock_icon (STOCK_INTENSITY_DIFFUSE_HIGH, GTK_ICON_SIZE_BUTTON,
+ stock_intensity_diffuse_high);
+ add_stock_icon (STOCK_REFLECTIVITY_DIFFUSE_LOW, GTK_ICON_SIZE_BUTTON,
+ stock_reflectivity_diffuse_low);
+ add_stock_icon (STOCK_REFLECTIVITY_DIFFUSE_HIGH, GTK_ICON_SIZE_BUTTON,
+ stock_reflectivity_diffuse_high);
+ add_stock_icon (STOCK_REFLECTIVITY_SPECULAR_LOW, GTK_ICON_SIZE_BUTTON,
+ stock_reflectivity_specular_low);
+ add_stock_icon (STOCK_REFLECTIVITY_SPECULAR_HIGH, GTK_ICON_SIZE_BUTTON,
+ stock_reflectivity_specular_high);
+ add_stock_icon (STOCK_REFLECTIVITY_HIGHLIGHT_LOW, GTK_ICON_SIZE_BUTTON,
+ stock_reflectivity_highlight_low);
+ add_stock_icon (STOCK_REFLECTIVITY_HIGHLIGHT_HIGH, GTK_ICON_SIZE_BUTTON,
+ stock_reflectivity_highlight_high);
+
+ gtk_icon_factory_add_default (lighting_icon_factory);
+
+ gtk_stock_add_static (lighting_stock_items,
+ G_N_ELEMENTS (lighting_stock_items));
+
+ initialized = TRUE;
+}
diff --git a/plug-ins/lighting/lighting-stock.h b/plug-ins/lighting/lighting-stock.h
new file mode 100644
index 0000000..6447526
--- /dev/null
+++ b/plug-ins/lighting/lighting-stock.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __LIGHTING_STOCK_H__
+#define __LIGHTING_STOCK_H__
+
+
+#define STOCK_INTENSITY_AMBIENT_LOW "intensity-ambient-low"
+#define STOCK_INTENSITY_AMBIENT_HIGH "intensity-ambient-high"
+#define STOCK_INTENSITY_DIFFUSE_LOW "intensity-diffuse-low"
+#define STOCK_INTENSITY_DIFFUSE_HIGH "intensity-diffuse-high"
+#define STOCK_REFLECTIVITY_DIFFUSE_LOW "reflectivity-diffuse-low"
+#define STOCK_REFLECTIVITY_DIFFUSE_HIGH "reflectivity-diffuse-high"
+#define STOCK_REFLECTIVITY_SPECULAR_LOW "reflectivity-specular-low"
+#define STOCK_REFLECTIVITY_SPECULAR_HIGH "reflectivity-specular-high"
+#define STOCK_REFLECTIVITY_HIGHLIGHT_LOW "reflectivity-highlight-low"
+#define STOCK_REFLECTIVITY_HIGHLIGHT_HIGH "reflectivity-highlight-high"
+
+
+void lighting_stock_init (void);
+
+
+#endif /* __LIGHTING_STOCK_H__ */
diff --git a/plug-ins/lighting/lighting-ui.c b/plug-ins/lighting/lighting-ui.c
new file mode 100644
index 0000000..86b4e12
--- /dev/null
+++ b/plug-ins/lighting/lighting-ui.c
@@ -0,0 +1,1557 @@
+/* Lighting Effects - A plug-in for GIMP
+ *
+ * Dialog creation and updaters, callbacks and event-handlers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <errno.h>
+
+#include <glib/gstdio.h>
+
+#include <libgimp/gimp.h>
+#include <libgimp/gimpui.h>
+
+#include "lighting-ui.h"
+#include "lighting-main.h"
+#include "lighting-image.h"
+#include "lighting-apply.h"
+#include "lighting-preview.h"
+#include "lighting-stock.h"
+
+#include "libgimp/stdplugins-intl.h"
+
+
+extern LightingValues mapvals;
+
+static GtkWidget *appwin = NULL;
+static GtkNotebook *options_note_book = NULL;
+
+GtkWidget *previewarea = NULL;
+
+GtkWidget *spin_pos_x = NULL;
+GtkWidget *spin_pos_y = NULL;
+GtkWidget *spin_pos_z = NULL;
+GtkWidget *spin_dir_x = NULL;
+GtkWidget *spin_dir_y = NULL;
+GtkWidget *spin_dir_z = NULL;
+
+static GtkWidget *colorbutton;
+static GtkWidget *light_type_combo;
+static GtkWidget *lightselect_combo;
+static GtkWidget *spin_intensity;
+static GtkWidget *isolate_button;
+static gchar *lighting_effects_path = NULL;
+
+static void create_main_notebook (GtkWidget *container);
+
+static void toggle_update (GtkWidget *widget,
+ gpointer data);
+
+static void distance_update (GtkAdjustment *adj,
+ gpointer data);
+
+static gboolean bumpmap_constrain (gint32 image_id,
+ gint32 drawable_id,
+ gpointer data);
+static gboolean envmap_constrain (gint32 image_id,
+ gint32 drawable_id,
+ gpointer data);
+static void envmap_combo_callback (GtkWidget *widget,
+ gpointer data);
+static void save_lighting_preset (GtkWidget *widget,
+ gpointer data);
+static void save_preset_response (GtkFileChooser *chooser,
+ gint response_id,
+ gpointer data);
+static void load_lighting_preset (GtkWidget *widget,
+ gpointer data);
+static void load_preset_response (GtkFileChooser *chooser,
+ gint response_id,
+ gpointer data);
+static void lightselect_callback (GimpIntComboBox *combo,
+ gpointer data);
+static void apply_settings (GtkWidget *widget,
+ gpointer data);
+static void isolate_selected_light (GtkWidget *widget,
+ gpointer data);
+
+static GtkWidget * spin_button_new (GtkAdjustment **adjustment, /* return value */
+ gdouble value,
+ gdouble lower,
+ gdouble upper,
+ gdouble step_increment,
+ gdouble page_increment,
+ gdouble page_size,
+ gdouble climb_rate,
+ guint digits);
+
+/**********************/
+/* Std. toggle update */
+/**********************/
+
+static void
+toggle_update (GtkWidget *widget,
+ gpointer data)
+{
+ gimp_toggle_button_update (widget, data);
+
+ preview_compute ();
+ gtk_widget_queue_draw (previewarea);
+}
+
+
+static void
+distance_update (GtkAdjustment *adj,
+ gpointer data)
+{
+ mapvals.viewpoint.z = gtk_adjustment_get_value (adj);
+
+ preview_compute ();
+ gtk_widget_queue_draw (previewarea);
+}
+
+
+/*****************************************/
+/* Main window light type menu callback. */
+/*****************************************/
+
+static void
+apply_settings (GtkWidget *widget,
+ gpointer data)
+{
+ gint valid;
+ gint type;
+ gint k = mapvals.light_selected;
+
+ if (mapvals.update_enabled)
+ {
+ valid = gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (light_type_combo),
+ &type);
+ if (valid)
+ mapvals.lightsource[k].type = type;
+
+ gimp_color_button_get_color (GIMP_COLOR_BUTTON (colorbutton),
+ &mapvals.lightsource[k].color);
+
+ mapvals.lightsource[k].position.x
+ = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_pos_x));
+ mapvals.lightsource[k].position.y
+ = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_pos_y));
+ mapvals.lightsource[k].position.z
+ = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_pos_z));
+
+ mapvals.lightsource[k].direction.x
+ = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_dir_x));
+ mapvals.lightsource[k].direction.y
+ = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_dir_y));
+ mapvals.lightsource[k].direction.z
+ = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_dir_z));
+
+ mapvals.lightsource[k].intensity
+ = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_intensity));
+
+ interactive_preview_callback(NULL);
+ }
+
+ if (widget == light_type_combo)
+ {
+ switch (mapvals.lightsource[k].type)
+ {
+ case NO_LIGHT:
+ gtk_widget_set_sensitive (spin_pos_x, FALSE);
+ gtk_widget_set_sensitive (spin_pos_y, FALSE);
+ gtk_widget_set_sensitive (spin_pos_z, FALSE);
+ gtk_widget_set_sensitive (spin_dir_x, FALSE);
+ gtk_widget_set_sensitive (spin_dir_y, FALSE);
+ gtk_widget_set_sensitive (spin_dir_z, FALSE);
+ break;
+ case POINT_LIGHT:
+ gtk_widget_set_sensitive (spin_pos_x, TRUE);
+ gtk_widget_set_sensitive (spin_pos_y, TRUE);
+ gtk_widget_set_sensitive (spin_pos_z, TRUE);
+ gtk_widget_set_sensitive (spin_dir_x, FALSE);
+ gtk_widget_set_sensitive (spin_dir_y, FALSE);
+ gtk_widget_set_sensitive (spin_dir_z, FALSE);
+ break;
+ case DIRECTIONAL_LIGHT:
+ gtk_widget_set_sensitive (spin_pos_x, FALSE);
+ gtk_widget_set_sensitive (spin_pos_y, FALSE);
+ gtk_widget_set_sensitive (spin_pos_z, FALSE);
+ gtk_widget_set_sensitive (spin_dir_x, TRUE);
+ gtk_widget_set_sensitive (spin_dir_y, TRUE);
+ gtk_widget_set_sensitive (spin_dir_z, TRUE);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void
+mapmenu2_callback (GtkWidget *widget,
+ gpointer data)
+{
+ gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) data);
+
+ preview_compute ();
+ gtk_widget_queue_draw (previewarea);
+}
+
+/******************************************/
+/* Main window "Preview!" button callback */
+/******************************************/
+
+static void
+preview_callback (GtkWidget *widget)
+{
+ preview_compute ();
+ gtk_widget_queue_draw (previewarea);
+}
+
+
+
+
+/*********************************************/
+/* Main window "-" (zoom in) button callback */
+/*********************************************/
+/*
+static void
+zoomout_callback (GtkWidget *widget)
+{
+ mapvals.preview_zoom_factor *= 0.5;
+ draw_preview_image (TRUE);
+}
+*/
+/*********************************************/
+/* Main window "+" (zoom out) button callback */
+/*********************************************/
+/*
+static void
+zoomin_callback (GtkWidget *widget)
+{
+ mapvals.preview_zoom_factor *= 2.0;
+ draw_preview_image (TRUE);
+}
+*/
+/**********************************************/
+/* Main window "Apply" button callback. */
+/* Render to GIMP image, close down and exit. */
+/**********************************************/
+
+static gint
+bumpmap_constrain (gint32 image_id,
+ gint32 drawable_id,
+ gpointer data)
+{
+ return ((gimp_drawable_width (drawable_id) ==
+ gimp_drawable_width (mapvals.drawable_id)) &&
+ (gimp_drawable_height (drawable_id) ==
+ gimp_drawable_height (mapvals.drawable_id)));
+}
+
+static gint
+envmap_constrain (gint32 image_id,
+ gint32 drawable_id,
+ gpointer data)
+{
+ return (!gimp_drawable_is_gray (drawable_id) &&
+ !gimp_drawable_has_alpha (drawable_id));
+}
+
+static void
+envmap_combo_callback (GtkWidget *widget,
+ gpointer data)
+{
+ gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
+ &mapvals.envmap_id);
+
+ env_width = gimp_drawable_width (mapvals.envmap_id);
+ env_height = gimp_drawable_height (mapvals.envmap_id);
+}
+
+/***********************/
+/* Dialog constructors */
+/***********************/
+
+static GtkWidget *
+create_options_page (void)
+{
+ GtkWidget *page;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *toggle;
+ GtkWidget *table;
+ GtkAdjustment *adj;
+
+ page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (page), 12);
+
+ /* General options */
+
+ frame = gimp_frame_new (_("General Options"));
+ gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
+ toggle = gtk_check_button_new_with_mnemonic (_("T_ransparent background"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
+ mapvals.transparent_background);
+ gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (toggle_update),
+ &mapvals.transparent_background);
+ gtk_widget_show (toggle);
+
+ gimp_help_set_help_data (toggle,
+ _("Make destination image transparent where bump "
+ "height is zero"),NULL);
+
+ toggle = gtk_check_button_new_with_mnemonic (_("Cre_ate new image"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
+ mapvals.create_new_image);
+ gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (gimp_toggle_button_update),
+ &mapvals.create_new_image);
+ gtk_widget_show (toggle);
+
+ gimp_help_set_help_data (toggle,
+ _("Create a new image when applying filter"), NULL);
+
+ toggle = gtk_check_button_new_with_mnemonic (_("High _quality preview"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
+ mapvals.previewquality);
+ gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (toggle_update),
+ &mapvals.previewquality);
+ gtk_widget_show (toggle);
+
+ gimp_help_set_help_data (toggle,
+ _("Enable/disable high quality preview"), NULL);
+
+ table = gtk_table_new (1, 3, FALSE);
+ gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 12);
+ gtk_widget_show (table);
+
+ adj = (GtkAdjustment *)
+ gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
+ _("Distance:"), 100, 6,
+ mapvals.viewpoint.z,
+ 0.0, 2.0, 0.01, 0.05,
+ 3, TRUE, 0.0, 0.0,
+ "Distance of observer from surface",
+ "plug-in-lighting");
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (distance_update),
+ NULL);
+
+ gtk_widget_show (page);
+
+ return page;
+}
+
+/******************************/
+/* Create light settings page */
+/******************************/
+
+static GtkWidget *
+create_light_page (void)
+{
+ GtkWidget *page;
+ GtkWidget *frame;
+ GtkWidget *table;
+ GtkWidget *button;
+ GtkAdjustment *adj;
+ GtkWidget *label;
+ gint k = mapvals.light_selected;
+
+ page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (page), 12);
+
+ frame = gimp_frame_new (_("Light Settings"));
+ gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ table = gtk_table_new (8, 8, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ gtk_table_set_col_spacing (GTK_TABLE (table), 1, 12);
+ gtk_table_set_col_spacing (GTK_TABLE (table), 3, 12);
+
+ lightselect_combo = gimp_int_combo_box_new (_("Light 1"), 0,
+ _("Light 2"), 1,
+ _("Light 3"), 2,
+ _("Light 4"), 3,
+ _("Light 5"), 4,
+ _("Light 6"), 5,
+ NULL);
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (lightselect_combo), k);
+ gtk_table_attach_defaults (GTK_TABLE (table), lightselect_combo, 0, 2, 0, 1);
+ g_signal_connect (lightselect_combo, "changed",
+ G_CALLBACK (lightselect_callback), NULL);
+ gtk_widget_show (lightselect_combo);
+
+ /* row labels */
+ label = gtk_label_new (_("Type:"));
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
+ gtk_widget_show (label);
+
+ label = gtk_label_new (_("Color:"));
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
+ gtk_widget_show (label);
+
+ light_type_combo =
+ gimp_int_combo_box_new (C_("light-source", "None"), NO_LIGHT,
+ _("Directional"), DIRECTIONAL_LIGHT,
+ _("Point"), POINT_LIGHT,
+ /* _("Spot"), SPOT_LIGHT, */
+ NULL);
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (light_type_combo),
+ mapvals.lightsource[k].type);
+ gtk_table_attach_defaults (GTK_TABLE (table), light_type_combo,
+ 1, 2, 1, 2);
+ gtk_widget_show (light_type_combo);
+
+ g_signal_connect (light_type_combo, "changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (light_type_combo,
+ _("Type of light source to apply"), NULL);
+
+ colorbutton = gimp_color_button_new (_("Select lightsource color"),
+ 64, 16,
+ &mapvals.lightsource[k].color,
+ GIMP_COLOR_AREA_FLAT);
+ gimp_color_button_set_update (GIMP_COLOR_BUTTON (colorbutton), TRUE);
+ gtk_widget_show (colorbutton);
+ gtk_table_attach_defaults (GTK_TABLE (table),
+ colorbutton, 1, 2, 2, 3);
+
+ g_signal_connect (colorbutton, "color-changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (colorbutton,
+ _("Set light source color"), NULL);
+
+
+ spin_intensity = spin_button_new (&adj,
+ mapvals.lightsource[k].intensity,
+ 0.0, 100.0,
+ 0.01, 0.1, 0.0, 0.0, 2);
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
+ _("_Intensity:"), 0.0, 0.5,
+ spin_intensity, 1, TRUE);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (spin_intensity,
+ _("Light intensity"), NULL);
+
+
+ label = gtk_label_new (_("Position"));
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 0, 1);
+ gtk_widget_show (label);
+
+ spin_pos_x = spin_button_new (&adj,
+ mapvals.lightsource[k].position.x,
+ -100.0, 100.0,
+ 0.1, 1.0, 0.0, 0.0, 2);
+ gimp_table_attach_aligned (GTK_TABLE (table), 2, 1,
+ _("_X:"), 0.0, 0.5,
+ spin_pos_x, 1, TRUE);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (spin_pos_x,
+ _("Light source X position in XYZ space"), NULL);
+
+ spin_pos_y = spin_button_new (&adj,
+ mapvals.lightsource[k].position.y,
+ -100.0, 100.0,
+ 0.1, 1.0, 0.0, 0.0, 2);
+ gimp_table_attach_aligned (GTK_TABLE (table), 2, 2,
+ _("_Y:"), 0.0, 0.5,
+ spin_pos_y, 1, TRUE);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (spin_pos_y,
+ _("Light source Y position in XYZ space"), NULL);
+
+ spin_pos_z = spin_button_new (&adj,
+ mapvals.lightsource[k].position.z,
+ -100.0, 100.0,
+ 0.1, 1.0, 0.0, 0.0, 2);
+ gimp_table_attach_aligned (GTK_TABLE (table), 2, 3,
+ _("_Z:"), 0.0, 0.5,
+ spin_pos_z, 1, TRUE);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (spin_pos_z,
+ _("Light source Z position in XYZ space"), NULL);
+
+
+ label = gtk_label_new (_("Direction"));
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 5, 6, 0, 1);
+ gtk_widget_show (label);
+
+ spin_dir_x = spin_button_new (&adj,
+ mapvals.lightsource[k].direction.x,
+ -100.0, 100.0, 0.1, 1.0, 0.0, 0.0, 2);
+ gimp_table_attach_aligned (GTK_TABLE (table), 4, 1,
+ _("X:"), 0.0, 0.5,
+ spin_dir_x, 1, TRUE);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (spin_dir_x,
+ _("Light source X direction in XYZ space"), NULL);
+
+ spin_dir_y = spin_button_new (&adj,
+ mapvals.lightsource[k].direction.y,
+ -100.0, 100.0, 0.1, 1.0, 0.0, 0.0, 2);
+ gimp_table_attach_aligned (GTK_TABLE (table), 4, 2,
+ _("Y:"), 0.0, 0.5,
+ spin_dir_y, 1, TRUE);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (spin_dir_y,
+ _("Light source Y direction in XYZ space"), NULL);
+
+ spin_dir_z = spin_button_new (&adj,
+ mapvals.lightsource[k].direction.z,
+ -100.0, 100.0, 0.1, 1.0, 0.0, 0.0, 2);
+ gimp_table_attach_aligned (GTK_TABLE (table), 4, 3,
+ _("Z:"), 0.0, 0.5,
+ spin_dir_z, 1, TRUE);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (apply_settings),
+ NULL);
+
+ gimp_help_set_help_data (spin_dir_z,
+ _("Light source Z direction in XYZ space"),
+ NULL);
+
+ isolate_button = gtk_check_button_new_with_mnemonic (_("I_solate"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (isolate_button),
+ mapvals.light_isolated);
+ g_signal_connect (isolate_button, "toggled",
+ G_CALLBACK (isolate_selected_light),
+ NULL);
+ gtk_table_attach_defaults (GTK_TABLE (table), isolate_button, 0, 1, 5, 6);
+ gtk_widget_show (isolate_button);
+
+ label = gtk_label_new (_("Lighting preset:"));
+ gtk_label_set_xalign (GTK_LABEL (label), 1.0);
+ gtk_table_set_row_spacing (GTK_TABLE (table), 5, 12);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 6, 7);
+ gtk_widget_show (label);
+
+ button = gtk_button_new_with_mnemonic (_("_Save"));
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 4, 6, 7);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (save_lighting_preset),
+ NULL);
+ gtk_widget_show (button);
+
+ button = gtk_button_new_with_mnemonic (_("_Open"));
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 4, 6, 6, 7);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (load_lighting_preset),
+ NULL);
+ gtk_widget_show (button);
+
+ gtk_widget_show (page);
+
+ return page;
+}
+
+/*********************************/
+/* Create material settings page */
+/*********************************/
+
+static GtkWidget *
+create_material_page (void)
+{
+ GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ GtkWidget *page;
+ GtkWidget *frame;
+ GtkWidget *table;
+ GtkWidget *label;
+ GtkWidget *hbox;
+ GtkWidget *spinbutton;
+ GtkWidget *image;
+ GtkWidget *button;
+ GtkAdjustment *adj;
+
+ page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (page), 12);
+
+ frame = gimp_frame_new (_("Material Properties"));
+ gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_container_add (GTK_CONTAINER (frame), hbox);
+ gtk_widget_show (hbox);
+
+ table = gtk_table_new (5, 4, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
+ gtk_widget_show (table);
+
+ /* Ambient intensity */
+
+ image = gtk_image_new_from_stock (STOCK_INTENSITY_AMBIENT_LOW,
+ GTK_ICON_SIZE_BUTTON);
+ label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
+ _("_Glowing:"), 0.0, 0.5,
+ image, 1, FALSE);
+ gtk_size_group_add_widget (group, label);
+
+ spinbutton = spin_button_new (&adj, mapvals.material.ambient_int,
+ 0, G_MAXFLOAT, 0.01, 0.1, 0.0, 0.0, 2);
+ gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 0, 1,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (spinbutton);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (gimp_double_adjustment_update),
+ &mapvals.material.ambient_int);
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
+ gimp_help_set_help_data (spinbutton,
+ _("Amount of original color to show where no "
+ "direct light falls"), NULL);
+
+ image = gtk_image_new_from_stock (STOCK_INTENSITY_AMBIENT_HIGH,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_table_attach (GTK_TABLE (table), image, 3, 4, 0, 1,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ /* Diffuse intensity */
+
+ image = gtk_image_new_from_stock (STOCK_INTENSITY_DIFFUSE_LOW,
+ GTK_ICON_SIZE_BUTTON);
+ label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
+ _("_Bright:"), 0.0, 0.5,
+ image, 1, FALSE);
+ gtk_size_group_add_widget (group, label);
+
+ spinbutton = spin_button_new (&adj, mapvals.material.diffuse_int,
+ 0, G_MAXFLOAT, 0.01, 0.1, 0.0, 0.0, 2);
+ gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 1, 2,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (spinbutton);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (gimp_double_adjustment_update),
+ &mapvals.material.diffuse_int);
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
+ gimp_help_set_help_data (spinbutton,
+ _("Intensity of original color when lit by a light "
+ "source"), NULL);
+
+ image = gtk_image_new_from_stock (STOCK_INTENSITY_DIFFUSE_HIGH,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_table_attach (GTK_TABLE (table), image, 3, 4, 1, 2,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ /* Specular reflection */
+
+ image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_SPECULAR_LOW,
+ GTK_ICON_SIZE_BUTTON);
+ label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
+ _("_Shiny:"), 0.0, 0.5,
+ image, 1, FALSE);
+ gtk_size_group_add_widget (group, label);
+
+ spinbutton = spin_button_new (&adj, mapvals.material.specular_ref,
+ 0, G_MAXFLOAT, 0.01, 0.1, 0.0, 0.0, 2);
+ gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 2, 3,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (spinbutton);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (gimp_double_adjustment_update),
+ &mapvals.material.specular_ref);
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
+ gimp_help_set_help_data (spinbutton,
+ _("Controls how intense the highlights will be"),
+ NULL);
+
+ image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_SPECULAR_HIGH,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_table_attach (GTK_TABLE (table), image, 3, 4, 2, 3,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ /* Highlight */
+ image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_HIGHLIGHT_LOW,
+ GTK_ICON_SIZE_BUTTON);
+ label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
+ _("_Polished:"), 0.0, 0.5,
+ image, 1, FALSE);
+ gtk_size_group_add_widget (group, label);
+
+ spinbutton = spin_button_new (&adj, mapvals.material.highlight,
+ 0, G_MAXFLOAT, 0.01, 0.1, 0.0, 0.0, 2);
+ gtk_table_attach (GTK_TABLE (table), spinbutton, 2, 3, 3, 4,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (spinbutton);
+
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (gimp_double_adjustment_update),
+ &mapvals.material.highlight);
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
+ gimp_help_set_help_data (spinbutton,
+ _("Higher values makes the highlights more focused"),
+ NULL);
+
+ image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_HIGHLIGHT_HIGH,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_table_attach (GTK_TABLE (table), image, 3, 4, 3, 4,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ /* Metallic */
+ button = gtk_check_button_new_with_mnemonic (_("_Metallic"));
+ gtk_table_attach (GTK_TABLE (table), button, 0, 3, 4, 5,
+ GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ g_signal_connect (button, "toggled",
+ G_CALLBACK (gimp_toggle_button_update),
+ &mapvals.material.metallic);
+ g_signal_connect (button, "toggled",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gtk_widget_show (page);
+
+ return page;
+}
+
+/* Create Bump mapping page */
+
+static GtkWidget *
+create_bump_page (void)
+{
+ GtkWidget *page;
+ GtkWidget *toggle;
+ GtkWidget *frame;
+ GtkWidget *table;
+ GtkWidget *combo;
+ GtkWidget *spinbutton;
+ GtkAdjustment *adj;
+
+ page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (page), 12);
+
+ frame = gimp_frame_new (NULL);
+ gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ toggle = gtk_check_button_new_with_mnemonic (_("E_nable bump mapping"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
+ mapvals.bump_mapped);
+ gtk_frame_set_label_widget (GTK_FRAME (frame), toggle);
+ gtk_widget_show (toggle);
+
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (gimp_toggle_button_update),
+ &mapvals.bump_mapped);
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gimp_help_set_help_data (toggle,
+ _("Enable/disable bump-mapping (image depth)"),
+ NULL);
+
+ table = gtk_table_new (6, 2, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ g_object_bind_property (toggle, "active",
+ table, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
+ combo = gimp_drawable_combo_box_new (bumpmap_constrain, NULL);
+ gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), mapvals.bumpmap_id,
+ G_CALLBACK (gimp_int_combo_box_get_active),
+ &mapvals.bumpmap_id);
+
+ g_signal_connect (combo, "changed",
+ G_CALLBACK (mapmenu2_callback),
+ &mapvals.bumpmap_id);
+
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
+ _("Bumpm_ap image:"), 0.0, 0.5,
+ combo, 1, FALSE);
+
+ combo = gimp_int_combo_box_new (_("Linear"), LINEAR_MAP,
+ _("Logarithmic"), LOGARITHMIC_MAP,
+ _("Sinusoidal"), SINUSOIDAL_MAP,
+ _("Spherical"), SPHERICAL_MAP,
+ NULL);
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
+ mapvals.bumpmaptype);
+
+ g_signal_connect (combo, "changed",
+ G_CALLBACK (mapmenu2_callback),
+ &mapvals.bumpmaptype);
+
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
+ _("Cu_rve:"), 0.0, 0.5, combo, 1, FALSE);
+
+ spinbutton = spin_button_new (&adj, mapvals.bumpmax,
+ 0, G_MAXFLOAT, 0.01, 0.1, 0.0, 0.0, 2);
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
+ _("Ma_ximum height:"), 0.0, 0.5,
+ spinbutton, 1, TRUE);
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (gimp_double_adjustment_update),
+ &mapvals.bumpmax);
+ g_signal_connect (adj, "value-changed",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gimp_help_set_help_data (spinbutton,
+ _("Maximum height for bumps"),
+ NULL);
+
+ gtk_widget_show (page);
+
+ return page;
+}
+
+static GtkWidget *
+create_environment_page (void)
+{
+ GtkWidget *page;
+ GtkWidget *toggle;
+ GtkWidget *table;
+ GtkWidget *frame;
+ GtkWidget *combo;
+
+ page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (page), 12);
+
+ frame = gimp_frame_new (NULL);
+ gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ toggle = gtk_check_button_new_with_mnemonic (_("E_nable environment mapping"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
+ mapvals.env_mapped);
+ gtk_frame_set_label_widget (GTK_FRAME (frame), toggle);
+ gtk_widget_show (toggle);
+
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (gimp_toggle_button_update),
+ &mapvals.env_mapped);
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gimp_help_set_help_data (toggle,
+ _("Enable/disable environment-mapping (reflection)"),
+ NULL);
+
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ g_object_bind_property (toggle, "active",
+ table, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
+ combo = gimp_drawable_combo_box_new (envmap_constrain, NULL);
+ gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), mapvals.envmap_id,
+ G_CALLBACK (envmap_combo_callback),
+ NULL);
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
+ _("En_vironment image:"), 0.0, 0.5,
+ combo, 1, FALSE);
+
+ gimp_help_set_help_data (combo, _("Environment image to use"), NULL);
+
+ gtk_widget_show (page);
+
+ return page;
+}
+
+/*****************************/
+/* Create notebook and pages */
+/*****************************/
+
+static void
+create_main_notebook (GtkWidget *container)
+{
+ GtkWidget *page;
+
+ options_note_book = GTK_NOTEBOOK (gtk_notebook_new ());
+ gtk_container_add (GTK_CONTAINER (container),
+ GTK_WIDGET (options_note_book));
+
+ page = create_options_page ();
+ gtk_notebook_append_page (options_note_book, page,
+ gtk_label_new_with_mnemonic (_("Op_tions")));
+
+ page = create_light_page ();
+ gtk_notebook_append_page (options_note_book, page,
+ gtk_label_new_with_mnemonic (_("_Light")));
+
+ page = create_material_page ();
+ gtk_notebook_append_page (options_note_book, page,
+ gtk_label_new_with_mnemonic (_("_Material")));
+
+ page = create_bump_page ();
+ gtk_notebook_append_page (options_note_book, page,
+ gtk_label_new_with_mnemonic (_("_Bump Map")));
+
+ page = create_environment_page ();
+ gtk_notebook_append_page (options_note_book, page,
+ gtk_label_new_with_mnemonic (_("_Environment Map")));
+
+ /*
+ if (mapvals.bump_mapped == TRUE)
+ {
+ bump_page = create_bump_page ();
+ bump_page_pos = g_list_length (options_note_book->children);
+ gtk_notebook_append_page (options_note_book, bump_page,
+ gtk_label_new (_("Bumpmap")));
+ }
+
+ if (mapvals.env_mapped == TRUE)
+ {
+ env_page = create_environment_page ();
+ env_page_pos = g_list_length (options_note_book->children);
+ gtk_notebook_append_page (options_note_book, env_page,
+ gtk_label_new (_("Environment")));
+ }
+ */
+ gtk_widget_show (GTK_WIDGET (options_note_book));
+}
+
+/********************************/
+/* Create and show main dialog. */
+/********************************/
+
+gboolean
+main_dialog (gint32 drawable_id)
+{
+ GtkWidget *main_hbox;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *frame;
+ GtkWidget *button;
+ GtkWidget *toggle;
+ gchar *path;
+ gboolean run = FALSE;
+
+ /*
+ GtkWidget *image;
+ */
+
+ gimp_ui_init (PLUG_IN_BINARY, FALSE);
+
+ path = gimp_gimprc_query ("lighting-effects-path");
+ if (path)
+ {
+ lighting_effects_path = g_filename_from_utf8 (path, -1, NULL, NULL, NULL);
+ g_free (path);
+ }
+
+ lighting_stock_init ();
+
+ appwin = gimp_dialog_new (_("Lighting Effects"), PLUG_IN_ROLE,
+ NULL, 0,
+ gimp_standard_help_func, PLUG_IN_PROC,
+
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_OK"), GTK_RESPONSE_OK,
+
+ NULL);
+
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (appwin),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ -1);
+
+ gimp_window_set_transient (GTK_WINDOW (appwin));
+
+ main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (main_hbox), 12);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (appwin))),
+ main_hbox, FALSE, FALSE, 0);
+ gtk_widget_show (main_hbox);
+
+ /* Create the Preview */
+ /* ================== */
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (main_hbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show (vbox);
+
+ /* Add preview widget and various buttons to the first part */
+ /* ======================================================== */
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ gtk_widget_realize (appwin);
+
+ previewarea = gtk_drawing_area_new ();
+ gtk_widget_set_size_request (previewarea, PREVIEW_WIDTH, PREVIEW_HEIGHT);
+ gtk_widget_set_events (previewarea, (GDK_EXPOSURE_MASK |
+ GDK_BUTTON1_MOTION_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK));
+ g_signal_connect (previewarea, "event",
+ G_CALLBACK (preview_events),
+ previewarea);
+ g_signal_connect (previewarea, "expose-event",
+ G_CALLBACK (preview_expose),
+ previewarea);
+ gtk_container_add (GTK_CONTAINER (frame), previewarea);
+ gtk_widget_show (previewarea);
+
+ /* create preview options, frame and vbox */
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ button = gtk_button_new_with_mnemonic (_("_Update"));
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (preview_callback),
+ NULL);
+ gtk_widget_show (button);
+
+ gimp_help_set_help_data (button, _("Recompute preview image"), NULL);
+
+ toggle = gtk_check_button_new_with_mnemonic (_("I_nteractive"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
+ mapvals.interactive_preview);
+ gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (gimp_toggle_button_update),
+ &mapvals.interactive_preview);
+ g_signal_connect (toggle, "toggled",
+ G_CALLBACK (interactive_preview_callback),
+ NULL);
+
+ gtk_widget_show (toggle);
+
+ gimp_help_set_help_data (toggle,
+ _("Enable/disable real time preview of changes"),
+ NULL);
+
+ create_main_notebook (main_hbox);
+
+ gtk_widget_show (appwin);
+
+ {
+ GdkCursor *cursor;
+
+ cursor = gdk_cursor_new_for_display (gtk_widget_get_display (previewarea),
+ GDK_HAND2);
+ gdk_window_set_cursor (gtk_widget_get_window (previewarea), cursor);
+ gdk_cursor_unref (cursor);
+ }
+
+ if (image_setup (drawable_id, TRUE))
+ preview_compute ();
+
+ if (gimp_dialog_run (GIMP_DIALOG (appwin)) == GTK_RESPONSE_OK)
+ run = TRUE;
+
+ if (preview_rgb_data != NULL)
+ g_free (preview_rgb_data);
+
+ if (preview_surface != NULL)
+ cairo_surface_destroy (preview_surface);
+
+ gtk_widget_destroy (appwin);
+
+ return run;
+}
+
+
+static void
+save_lighting_preset (GtkWidget *widget,
+ gpointer data)
+{
+ static GtkWidget *window = NULL;
+
+ if (! window)
+ {
+ window =
+ gtk_file_chooser_dialog_new (_("Save Lighting Preset"),
+ GTK_WINDOW (appwin),
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Save"), GTK_RESPONSE_OK,
+
+ NULL);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (window),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ -1);
+
+ gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (window),
+ TRUE);
+
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed),
+ &window);
+ g_signal_connect (window, "response",
+ G_CALLBACK (save_preset_response),
+ NULL);
+ }
+
+ if (lighting_effects_path)
+ {
+ GList *list;
+ gchar *dir;
+
+ list = gimp_path_parse (lighting_effects_path, 256, FALSE, NULL);
+ dir = gimp_path_get_user_writable_dir (list);
+ gimp_path_free (list);
+
+ if (! dir)
+ dir = g_strdup (gimp_directory ());
+
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window), dir);
+
+ g_free (dir);
+ }
+ else
+ {
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window),
+ g_get_tmp_dir ());
+ }
+
+ gtk_window_present (GTK_WINDOW (window));
+}
+
+
+static void
+save_preset_response (GtkFileChooser *chooser,
+ gint response_id,
+ gpointer data)
+{
+ FILE *fp;
+ gint num_lights = 0;
+ gint k;
+ LightSettings *source;
+ gchar buffer1[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar buffer2[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar buffer3[G_ASCII_DTOSTR_BUF_SIZE];
+ gint blen = G_ASCII_DTOSTR_BUF_SIZE;
+
+ if (response_id == GTK_RESPONSE_OK)
+ {
+ gchar *filename = gtk_file_chooser_get_filename (chooser);
+
+ fp = g_fopen (filename, "wb");
+
+ if (!fp)
+ {
+ g_message (_("Could not open '%s' for writing: %s"),
+ filename, g_strerror (errno));
+ }
+ else
+ {
+ for (k = 0; k < NUM_LIGHTS; k++)
+ if (mapvals.lightsource[k].type != NO_LIGHT)
+ ++num_lights;
+
+ fprintf (fp, "Number of lights: %d\n", num_lights);
+
+ for (k = 0; k < NUM_LIGHTS; k++)
+ if (mapvals.lightsource[k].type != NO_LIGHT)
+ {
+ source = &mapvals.lightsource[k];
+
+ switch (source->type)
+ {
+ case POINT_LIGHT:
+ fprintf (fp, "Type: Point\n");
+ break;
+ case DIRECTIONAL_LIGHT:
+ fprintf (fp, "Type: Directional\n");
+ break;
+ case SPOT_LIGHT:
+ fprintf (fp, "Type: Spot\n");
+ break;
+ default:
+ g_warning ("Unknown light type: %d",
+ mapvals.lightsource[k].type);
+ continue;
+ }
+
+ fprintf (fp, "Position: %s %s %s\n",
+ g_ascii_dtostr (buffer1, blen, source->position.x),
+ g_ascii_dtostr (buffer2, blen, source->position.y),
+ g_ascii_dtostr (buffer3, blen, source->position.z));
+
+ fprintf (fp, "Direction: %s %s %s\n",
+ g_ascii_dtostr (buffer1, blen, source->direction.x),
+ g_ascii_dtostr (buffer2, blen, source->direction.y),
+ g_ascii_dtostr (buffer3, blen, source->direction.z));
+
+ fprintf (fp, "Color: %s %s %s\n",
+ g_ascii_dtostr (buffer1, blen, source->color.r),
+ g_ascii_dtostr (buffer2, blen, source->color.g),
+ g_ascii_dtostr (buffer3, blen, source->color.b));
+
+ fprintf (fp, "Intensity: %s\n",
+ g_ascii_dtostr (buffer1, blen, source->intensity));
+ }
+
+ fclose (fp);
+ }
+
+ g_free (filename);
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (chooser));
+}
+
+static void
+load_lighting_preset (GtkWidget *widget,
+ gpointer data)
+{
+ static GtkWidget *window = NULL;
+
+ if (! window)
+ {
+ window =
+ gtk_file_chooser_dialog_new (_("Load Lighting Preset"),
+ GTK_WINDOW (appwin),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Open"), GTK_RESPONSE_OK,
+
+ NULL);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (window),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ -1);
+
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed),
+ &window);
+ g_signal_connect (window, "response",
+ G_CALLBACK (load_preset_response),
+ NULL);
+ }
+
+ if (lighting_effects_path)
+ {
+ GList *list;
+ gchar *dir;
+
+ list = gimp_path_parse (lighting_effects_path, 256, FALSE, NULL);
+ dir = gimp_path_get_user_writable_dir (list);
+ gimp_path_free (list);
+
+ if (! dir)
+ dir = g_strdup (gimp_directory ());
+
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window), dir);
+
+ g_free (dir);
+ }
+ else
+ {
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window),
+ g_get_tmp_dir ());
+ }
+
+
+ gtk_window_present (GTK_WINDOW (window));
+}
+
+
+static void
+load_preset_response (GtkFileChooser *chooser,
+ gint response_id,
+ gpointer data)
+{
+ FILE *fp;
+ gint num_lights;
+ gint k;
+ LightSettings *source;
+ gchar buffer1[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar buffer2[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar buffer3[G_ASCII_DTOSTR_BUF_SIZE];
+ gchar type_label[21];
+ gchar *endptr;
+ gchar fmt_str[32];
+
+ if (response_id == GTK_RESPONSE_OK)
+ {
+ gchar *filename = gtk_file_chooser_get_filename (chooser);
+
+ fp = g_fopen (filename, "rb");
+
+ if (!fp)
+ {
+ g_message (_("Could not open '%s' for reading: %s"),
+ filename, g_strerror (errno));
+ }
+ else
+ {
+ fscanf (fp, "Number of lights: %d", &num_lights);
+
+ /* initialize lights to off */
+ for (k = 0; k < NUM_LIGHTS; k++)
+ mapvals.lightsource[k].type = NO_LIGHT;
+
+ for (k = 0; k < num_lights; k++)
+ {
+ source = &mapvals.lightsource[k];
+
+ fscanf (fp, " Type: %20s", type_label);
+
+ if (!strcmp (type_label, "Point"))
+ source->type = POINT_LIGHT;
+ else if (!strcmp (type_label, "Directional"))
+ source->type = DIRECTIONAL_LIGHT;
+ else if (!strcmp (type_label, "Spot"))
+ source->type = SPOT_LIGHT;
+ else
+ {
+ g_warning ("Unknown light type: %s", type_label);
+ fclose (fp);
+ return;
+ }
+
+ snprintf (fmt_str, sizeof (fmt_str),
+ " Position: %%%" G_GSIZE_FORMAT "s %%%" G_GSIZE_FORMAT "s %%%" G_GSIZE_FORMAT "s",
+ sizeof (buffer1) - 1,
+ sizeof (buffer2) - 1,
+ sizeof (buffer3) - 1);
+ fscanf (fp, fmt_str, buffer1, buffer2, buffer3);
+ source->position.x = g_ascii_strtod (buffer1, &endptr);
+ source->position.y = g_ascii_strtod (buffer2, &endptr);
+ source->position.z = g_ascii_strtod (buffer3, &endptr);
+
+ snprintf (fmt_str, sizeof (fmt_str),
+ " Direction: %%%" G_GSIZE_FORMAT "s %%%" G_GSIZE_FORMAT "s %%%" G_GSIZE_FORMAT "s",
+ sizeof (buffer1) - 1,
+ sizeof (buffer2) - 1,
+ sizeof (buffer3) - 1);
+ fscanf (fp, fmt_str, buffer1, buffer2, buffer3);
+ source->direction.x = g_ascii_strtod (buffer1, &endptr);
+ source->direction.y = g_ascii_strtod (buffer2, &endptr);
+ source->direction.z = g_ascii_strtod (buffer3, &endptr);
+
+ snprintf (fmt_str, sizeof (fmt_str),
+ " Color: %%%" G_GSIZE_FORMAT "s %%%" G_GSIZE_FORMAT "s %%%" G_GSIZE_FORMAT "s",
+ sizeof (buffer1) - 1,
+ sizeof (buffer2) - 1,
+ sizeof (buffer3) - 1);
+ fscanf (fp, fmt_str, buffer1, buffer2, buffer3);
+ source->color.r = g_ascii_strtod (buffer1, &endptr);
+ source->color.g = g_ascii_strtod (buffer2, &endptr);
+ source->color.b = g_ascii_strtod (buffer3, &endptr);
+ source->color.a = 1.0;
+
+ snprintf (fmt_str, sizeof (fmt_str),
+ " Intensity: %%%" G_GSIZE_FORMAT "s",
+ sizeof (buffer1) - 1);
+ fscanf (fp, fmt_str, buffer1);
+ source->intensity = g_ascii_strtod (buffer1, &endptr);
+
+ }
+
+ fclose (fp);
+ }
+
+ g_free (filename);
+
+ lightselect_callback (GIMP_INT_COMBO_BOX (lightselect_combo), NULL);
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (chooser));
+ interactive_preview_callback (GTK_WIDGET (chooser));
+}
+
+
+static void
+lightselect_callback (GimpIntComboBox *combo,
+ gpointer data)
+{
+ gint valid;
+ gint j, k;
+
+ valid = gimp_int_combo_box_get_active (combo, &k);
+
+ if (valid)
+ {
+ mapvals.update_enabled = FALSE; /* prevent apply_settings() */
+
+ mapvals.light_selected = k;
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (light_type_combo),
+ mapvals.lightsource[k].type);
+ gimp_color_button_set_color (GIMP_COLOR_BUTTON (colorbutton),
+ &mapvals.lightsource[k].color);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_pos_x),
+ mapvals.lightsource[k].position.x);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_pos_y),
+ mapvals.lightsource[k].position.y);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_pos_z),
+ mapvals.lightsource[k].position.z);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_dir_x),
+ mapvals.lightsource[k].direction.x);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_dir_y),
+ mapvals.lightsource[k].direction.y);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_dir_z),
+ mapvals.lightsource[k].direction.z);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON(spin_intensity),
+ mapvals.lightsource[k].intensity);
+
+ mapvals.update_enabled = TRUE;
+
+ /* if we are isolating a light, need to switch */
+ if (mapvals.light_isolated)
+ {
+ for (j = 0; j < NUM_LIGHTS; j++)
+ if (j == mapvals.light_selected)
+ mapvals.lightsource[j].active = TRUE;
+ else
+ mapvals.lightsource[j].active = FALSE;
+ }
+
+ interactive_preview_callback (NULL);
+ }
+}
+
+static void
+isolate_selected_light (GtkWidget *widget,
+ gpointer data)
+{
+ gint k;
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ {
+ mapvals.light_isolated = TRUE;
+
+ for (k = 0; k < NUM_LIGHTS; k++)
+ if (k == mapvals.light_selected)
+ mapvals.lightsource[k].active = TRUE;
+ else
+ mapvals.lightsource[k].active = FALSE;
+ }
+ else
+ {
+ mapvals.light_isolated = FALSE;
+
+ for (k = 0; k < NUM_LIGHTS; k++)
+ mapvals.lightsource[k].active = TRUE;
+ }
+
+ interactive_preview_callback (NULL);
+}
+
+static GtkWidget *
+spin_button_new (GtkAdjustment **adjustment, /* return value */
+ gdouble value,
+ gdouble lower,
+ gdouble upper,
+ gdouble step_increment,
+ gdouble page_increment,
+ gdouble page_size,
+ gdouble climb_rate,
+ guint digits)
+{
+ GtkWidget *spinbutton;
+
+ *adjustment = (GtkAdjustment *)
+ gtk_adjustment_new (value, lower, upper,
+ step_increment, page_increment, 0);
+
+ spinbutton = gimp_spin_button_new (GTK_ADJUSTMENT (*adjustment),
+ climb_rate, digits);
+
+ gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
+
+ return spinbutton;
+}
diff --git a/plug-ins/lighting/lighting-ui.h b/plug-ins/lighting/lighting-ui.h
new file mode 100644
index 0000000..ad0ffba
--- /dev/null
+++ b/plug-ins/lighting/lighting-ui.h
@@ -0,0 +1,21 @@
+#ifndef __LIGHTING_UI_H__
+#define __LIGHTING_UI_H__
+
+/* Externally visible variables */
+/* ============================ */
+
+extern GtkWidget *previewarea;
+
+extern GtkWidget *spin_pos_x;
+extern GtkWidget *spin_pos_y;
+extern GtkWidget *spin_pos_z;
+extern GtkWidget *spin_dir_x;
+extern GtkWidget *spin_dir_y;
+extern GtkWidget *spin_dir_z;
+
+/* Externally visible functions */
+/* ============================ */
+
+gboolean main_dialog (gint32 drawable_id);
+
+#endif /* __LIGHTING_UI_H__ */