Commit e0b1b07a authored by Manish Singh's avatar Manish Singh

adding Lighting plugin

* adding Lighting plugin

* updated despeckle, png, sgi, and sharpen

-Yosh
parent 9fa974dd
Sat Jun 6 16:12:20 PDT 1998 Manish Singh <yosh@gimp.org>
* adding Lighting plugin
* updated despeckle, png, sgi, and sharpen
Sat Jun 6 14:22:19 PDT 1998 Manish Singh <yosh@gimp.org>
* app/interface.c: changed it back, things work now
......
......@@ -562,6 +562,7 @@ plug-ins/screenshot/Makefile
plug-ins/sharpen/Makefile
plug-ins/psd/Makefile
plug-ins/gpc/Makefile
plug-ins/Lighting/Makefile
app/Makefile
docs/Makefile
data/Makefile
......
Makefile.in
Makefile
.deps
_libs
.libs
Lighting
Changes:
========
0.2.2: Fixed a bug in the preview code sometimes causing a SIGSEGV.
Thanks to Prabhanjan <prabham@india.s3.com> for reporting it.
0.2.1: Fixed a bug in the calculation of the normals. Thanks to
Simon Budig <Simon.Budig@unix-ag.org> for pointing this out.
0.2.0: Fixed crashes when rerunning after closing mapping images. Removed
GckNotebook and fixed gtk refcounting problems. Added non-interactive
(scripting) interface. First non-beta release.
0.1.1: Transparent background and RGBA support, various bug fixes and
minor speed ups. First beta version.
0.0.x: Many bug fixes. Moved it to "..filters/Light Effects/Lighting Effects"
0.0.1: First version for 0.99.x
## Process this file with automake to produce Makefile.in
pluginlibdir = $(gimpplugindir)/plug-ins
pluginlib_PROGRAMS = Lighting
Lighting_SOURCES = \
amb1.xpm amb2.xpm diffint1.xpm diffint2.xpm diffref1.xpm diffref2.xpm high1.xpm high2.xpm lighting_apply.c lighting_apply.h lighting_image.c lighting_image.h lighting_main.c lighting_main.h lighting_pixmaps.h lighting_preview.c lighting_preview.h lighting_shade.c lighting_shade.h lighting_ui.c lighting_ui.h specref1.xpm specref2.xpm
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/plug-ins/libgck \
-I$(includedir) \
$(X_CFLAGS)
LDADD = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la \
$(top_builddir)/plug-ins/libgck/gck/libgck.la \
$(X_LIBS) \
-lc
DEPS = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la \
$(top_builddir)/plug-ins/libgck/gck/libgck.la
Lighting_DEPENDENCIES = $(DEPS)
.PHONY: files
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done
@for subdir in $(SUBDIRS); do \
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
for file in $$files; do \
echo $$subdir/$$file; \
done; \
done
Lighting Effects 0.2.2 -- image filter plug-in for The GIMP program
===================================================================
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).
The 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 2 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 (see "COPYING" file); if not, write to the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
In other words, you can't sue us for whatever happens while using this ;)
Have fun,
Tom
The lighting plug-in "todo"-list:
=================================
* Supersampling/antialiasing
* Bilinear filtering of enviroment 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
/* XPM */
char * amb1_xpm[] = {
"32 32 53 1",
" c None",
". c #861786178617",
"X c #861782078617",
"o c #69A66DB669A6",
"O c #8E388E388E38",
"+ c #B6DAB2CAB6DA",
"@ c #BEFBBAEABEFB",
"# c #AEBAAEBAAEBA",
"$ c #9E799E799E79",
"% c #8E388A288E38",
"& c #618565956185",
"* c #30C234D330C2",
"= c #A699A699A699",
"- c #CF3CCF3CCF3C",
"; c #D75CD34CD75C",
": c #C71BC30BC71B",
"> c #DF7DDF7DDF7D",
", c #D75CD75CD75C",
"< c #CF3CCB2BCF3C",
"1 c #AEBAAAAAAEBA",
"2 c #965896589658",
"3 c #79E779E779E7",
"4 c #514455555144",
"5 c #18611C711861",
"6 c #E79DE38DE79D",
"7 c #E79DE79DE79D",
"8 c #DF7DDB6CDF7D",
"9 c #BEFBBEFBBEFB",
"0 c #9E799A699E79",
"q c #79E77DF779E7",
"w c #618561856185",
"e c #38E338E338E3",
"r c #000004100000",
"t c #EFBEEFBEEFBE",
"y c #FFFFFBEEFFFF",
"u c #410341034103",
"i c #08200C300820",
"p c #FFFFFFFFFFFF",
"a c #B6DAB6DAB6DA",
"s c #965892489658",
"d c #104014511040",
"f c #71C675D671C6",
"g c #596559655965",
"h c #104010401040",
"j c #000000000000",
"k c #514451445144",
"l c #30C230C230C2",
"z c #59655D755965",
"x c #410345144103",
"c c #208124922081",
"v c #49244D344924",
"b c #208120812081",
"n c #082008200820",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .Xo ",
" O+@@#$%&* ",
" =-;;-:+$.&* ",
" =;>>>,<@12345 ",
" O->6778-9#0qwer ",
" +;>7tyt-910X&ui ",
" @;>7ypy-a=sqwud ",
" .@-,8ty6:#$Ofgehj ",
" X#:<---:+=2Xoklij ",
" o$+@99a#=2.fzxcrj ",
" %$1#1=$2.f&v*dj ",
" &.200sOXf&kebrj ",
" *&3qXqfozvecnjj ",
" *4w&wgkx*bnjj ",
" 5euuelcdrjj ",
" ridhirjjj ",
" jjj ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
char * amb2_xpm[] = {
"32 32 23 1",
" c None",
". c #CF3CCF3CCF3C",
"X c #CF3CCB2BCF3C",
"o c #C71BC30BC71B",
"O c #D75CD75CD75C",
"+ c #DF7DDB6CDF7D",
"@ c #C71BC71BC71B",
"# c #AEBAAEBAAEBA",
"$ c #DF7DDF7DDF7D",
"% c #E79DE38DE79D",
"& c #D75CD34CD75C",
"* c #E79DE79DE79D",
"= c #AEBAAAAAAEBA",
"- c #EFBEEBADEFBE",
"; c #BEFBBEFBBEFB",
": c #A699A289A699",
"> c #F7DEF3CEF7DE",
", c #F7DEF7DEF7DE",
"< c #B6DAB2CAB6DA",
"1 c #FFFFFFFFFFFF",
"2 c #FFFFFBEEFFFF",
"3 c #B6DAB6DAB6DA",
"4 c #BEFBBAEABEFB",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..X ",
" oO+++O.@# ",
" X$%%$$+O&X# ",
" X%%*%%$$+&.@= ",
" o$%**-*%$+O.@;: ",
" O%**>,,%$+O.Xo< ",
" +%%-,12*+O&.Xo3 ",
" .+$%*,2,%+O&.@;3< ",
" .+$$%%*%+O&.X@;3< ",
" XO+$$$++OO&.@o43< ",
" .O+++OO&&.Xo;3< ",
" @&&OO&&..X@;43# ",
" #X.....X@o;43<: ",
" #@@XX@@o;43<: ",
" =;oo;;433<: ",
" :<3333<#: ",
" <<< ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
char * diffint1_xpm[] = {
"32 32 9 1",
" c None",
". c #514455555144",
"X c #514451445144",
"o c #49244D344924",
"O c #596559655965",
"+ c #492449244924",
"@ c #410345144103",
"# c #59655D755965",
"$ c #618561856185",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..X ",
" o.OO...X+ ",
" XOOOOOO..X+ ",
" XOOOOOOO...X+ ",
" oOOOOOOOOO..Xo@ ",
" .OOO###OO...XX+ ",
" OOOO#$#OO...XXo ",
" .OOOO###OO...XXoo ",
" ..OOOOOOO...XXooo ",
" X.OOOOOO....XXooo ",
" ...O......XXooo ",
" X........XXXoo+ ",
" +X.....XXXXooo@ ",
" +XXXXXXXoooo@ ",
" +oXXXooooo@ ",
" @+ooooo+@ ",
" ooo ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
char * diffint2_xpm[] = {
"32 32 45 1",
" c None",
". c #A699A699A699",
"X c #A699A289A699",
"o c #965896589658",
"O c #BEFBBEFBBEFB",
"+ c #CF3CCB2BCF3C",
"@ c #C71BC71BC71B",
"# c #C71BC30BC71B",
"$ c #B6DAB6DAB6DA",
"% c #8E388E388E38",
"& c #69A669A669A6",
"* c #D75CD75CD75C",
"= c #DF7DDB6CDF7D",
"- c #CF3CCF3CCF3C",
"; c #965892489658",
": c #DF7DDF7DDF7D",
"> c #E79DE38DE79D",
", c #D75CD34CD75C",
"< c #AEBAAEBAAEBA",
"1 c #9E799E799E79",
"2 c #861786178617",
"3 c #596559655965",
"4 c #E79DE79DE79D",
"5 c #B6DAB2CAB6DA",
"6 c #71C671C671C6",
"7 c #492449244924",
"8 c #F7DEF3CEF7DE",
"9 c #F7DEF7DEF7DE",
"0 c #71C675D671C6",
"q c #514455555144",
"w c #FFFFFFFFFFFF",
"e c #FFFFFBEEFFFF",
"r c #BEFBBAEABEFB",
"t c #EFBEEBADEFBE",
"y c #AEBAAAAAAEBA",
"u c #9E799A699E79",
"i c #8E388A288E38",
"p c #49244D344924",
"a c #861782078617",
"s c #69A66DB669A6",
"d c #79E779E779E7",
"f c #618565956185",
"g c #514451445144",
"h c #618561856185",
"j c #410345144103",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .Xo ",
" .O+@#$.%& ",
" $*==*-#$.;& ",
" $=:>:=,+O<123 ",
" .*:444:*+O5X%67 ",
" O=>4898*+O5X%0q ",
" +=:49we=@r<1%03 ",
" .@*=:8et-#$yui03p ",
" X#-,**=-#r<Xoasqp ",
" o$#+++@#r5.uidfgp ",
" .$OOOr$<.1%as3p ",
" %.<55<yXu%a0hg7 ",
" &;1XX1uoia0fgpj ",
" &2%%%iadshgpj ",
" 36000sf3gpj ",
" 7q33qgp7j ",
" ppp ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
char * diffref1_xpm[] = {
"32 32 11 1",
" c None",
". c #49244D344924",
"X c #410345144103",
"o c #492449244924",
"O c #514451445144",
"+ c #596559655965",
"@ c #79E779E779E7",
"# c #69A669A669A6",
"$ c #BEFBBAEABEFB",
"% c #8E388A288E38",
"& c #514455555144",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ... ",
" Xo.....oX ",
" X.........X ",
" X...........X ",
" X....OO.......X ",
" o...+@#O......o ",
" ...O@$%&....... ",
" ....O#%#O........ ",
" .....O&O......... ",
" ................. ",
" ............... ",
" o.............o ",
" X.............X ",
" X...........X ",
" X.........X ",
" Xo.....oX ",
" ... ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
char * diffref2_xpm[] = {
"32 32 40 1",
" c None",
". c #D75CD34CD75C",
"X c #CF3CCF3CCF3C",
"o c #BEFBBAEABEFB",
"O c #F7DEF3CEF7DE",
"+ c #F7DEF7DEF7DE",
"@ c #FFFFFBEEFFFF",
"# c #EFBEEBADEFBE",
"$ c #D75CD75CD75C",
"% c #B6DAB2CAB6DA",
"& c #79E779E779E7",
"* c #E79DE79DE79D",
"= c #FFFFFFFFFFFF",
"- c #EFBEEFBEEFBE",
"; c #E79DE38DE79D",
": c #C71BC71BC71B",
"> c #A699A289A699",
", c #618565956185",
"< c #AEBAAEBAAEBA",
"1 c #861786178617",
"2 c #492449244924",
"3 c #8E388E388E38",
"4 c #596559655965",
"5 c #CF3CCB2BCF3C",
"6 c #618561856185",
"7 c #DF7DDB6CDF7D",
"8 c #C71BC30BC71B",
"9 c #AEBAAAAAAEBA",
"0 c #8E388A288E38",
"q c #49244D344924",
"w c #9E799E799E79",
"e c #79E77DF779E7",
"r c #965892489658",
"t c #71C671C671C6",
"y c #514451445144",
"u c #9E799A699E79",
"i c #861782078617",
"p c #69A66DB669A6",
"a c #514455555144",
"s c #410345144103",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .Xo ",
" .O+@@#$%& ",
" *=====@-$%& ",
" *=======+;:>, ",
" .========+*X<12 ",
" O========+*X%34 ",
" +========O;5<36 ",
" .@=======@#78906q ",
" X@======@O;Xowe4q ",
" o#@====@O*$89rtyq ",
" $-+++O#;$:%ui6q ",
" %$;**;7X8%w0py2 ",
" &%:XX58o9u0taqs ",
" &><%<9wripaqs ",
" ,1330et6yqs ",
" 24664yq2s ",
" qqq ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
char * high1_xpm[] = {
"32 32 40 1",
" c None",
". c #D75CD34CD75C",
"X c #CF3CCF3CCF3C",
"o c #BEFBBAEABEFB",
"O c #F7DEF3CEF7DE",
"+ c #F7DEF7DEF7DE",
"@ c #FFFFFBEEFFFF",
"# c #EFBEEBADEFBE",
"$ c #D75CD75CD75C",
"% c #B6DAB2CAB6DA",
"& c #79E779E779E7",
"* c #E79DE79DE79D",
"= c #FFFFFFFFFFFF",
"- c #EFBEEFBEEFBE",
"; c #E79DE38DE79D",
": c #C71BC71BC71B",
"> c #A699A289A699",
", c #618565956185",
"< c #AEBAAEBAAEBA",
"1 c #861786178617",
"2 c #492449244924",
"3 c #8E388E388E38",
"4 c #596559655965",
"5 c #CF3CCB2BCF3C",
"6 c #618561856185",
"7 c #DF7DDB6CDF7D",
"8 c #C71BC30BC71B",
"9 c #AEBAAAAAAEBA",
"0 c #8E388A288E38",
"q c #49244D344924",
"w c #9E799E799E79",
"e c #79E77DF779E7",
"r c #965892489658",
"t c #71C671C671C6",
"y c #514451445144",
"u c #9E799A699E79",
"i c #861782078617",
"p c #69A66DB669A6",
"a c #514455555144",
"s c #410345144103",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .Xo ",
" .O+@@#$%& ",
" *=====@-$%& ",
" *=======+;:>, ",
" .========+*X<12 ",
" O========+*X%34 ",
" +========O;5<36 ",
" .@=======@#78906q ",
" X@======@O;Xowe4q ",
" o#@====@O*$89rtyq ",
" $-+++O#;$:%ui6q ",
" %$;**;7X8%w0py2 ",
" &%:XX58o9u0taqs ",
" &><%<9wripaqs ",
" ,1330et6yqs ",
" 24664yq2s ",
" qqq ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
char * high2_xpm[] = {
"32 32 43 1",
" c None",
". c #A699A699A699",
"X c #A699A289A699",
"o c #965896589658",
"O c #BEFBBEFBBEFB",
"+ c #CF3CCB2BCF3C",
"@ c #C71BC71BC71B",
"# c #C71BC30BC71B",
"$ c #B6DAB6DAB6DA",
"% c #8E388E388E38",
"& c #69A669A669A6",
"* c #D75CD75CD75C",
"= c #DF7DDB6CDF7D",
"- c #CF3CCF3CCF3C",
"; c #965892489658",
": c #DF7DDF7DDF7D",
"> c #E79DE38DE79D",
", c #D75CD34CD75C",
"< c #AEBAAEBAAEBA",
"1 c #9E799E799E79",
"2 c #861786178617",
"3 c #596559655965",
"4 c #E79DE79DE79D",
"5 c #B6DAB2CAB6DA",
"6 c #71C671C671C6",
"7 c #492449244924",
"8 c #F7DEF7DEF7DE",
"9 c #71C675D671C6",
"0 c #514455555144",
"q c #FFFFFFFFFFFF",
"w c #BEFBBAEABEFB",
"e c #F7DEF3CEF7DE",
"r c #AEBAAAAAAEBA",
"t c #9E799A699E79",
"y c #8E388A288E38",
"u c #49244D344924",
"i c #861782078617",
"p c #69A66DB669A6",
"a c #79E779E779E7",
"s c #618565956185",
"d c #514451445144",
"f c #618561856185",
"g c #410345144103",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .Xo ",
" .O+@#$.%& ",
" $*==*-#$.;& ",
" $=:>:=,+O<123 ",
" .*:>4>=*+O5X%67 ",
" O=>4>8:,+O5X%90 ",
" +=:>8qq-@w<1%93 ",
" .@*==:e=+#$rty93u ",
" X#-,*,*-#w<Xoip0u ",
" o$#+++@#w5.tyasdu ",
" .$OOOw$<.1%ip3u ",
" %.<55<rXt%i9fd7 ",
" &;1XX1toyi9sdug ",
" &2%%%yiapfdug ",
" 36999ps3dug ",
" 70330du7g ",
" uuu ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/******************************************************/
/* Apply mapping and shading on the whole input image */
/******************************************************/
#include "lighting_shade.h"
/*************/
/* Main loop */
/*************/
get_ray_func ray_func;
void init_compute(void)
{
}
void render(gdouble x,gdouble y,GckRGB *col)
{
GckVector3 pos;
pos=int_to_pos(x,y);
*col=(*ray_func)(&pos);
}
void show_progress(gint min,gint max,gint curr)
{
gimp_progress_update((gdouble)curr/(gdouble)max);
}
void compute_image(void)
{
gint xcount,ycount;
GckRGB color;
glong progress_counter=0;
GckVector3 p;
gint32 new_image_id=-1,new_layer_id=-1,index;
guchar *row = NULL, obpp;
gint has_alpha;
init_compute();
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,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,RGBA_IMAGE,100.0,NORMAL_MODE);
}
else
{
/* Create a "normal" layer */
/* ======================= */