├── Readme.md ├── Reference ├── 06-16-2003.jpg ├── choi.cpp ├── comparison.jpg ├── radiance │ ├── MANIFEST │ ├── README │ ├── doc │ │ ├── man │ │ │ ├── man1 │ │ │ │ ├── arch2rad.1 │ │ │ │ ├── bgraph.1 │ │ │ │ ├── calc.1 │ │ │ │ ├── cnt.1 │ │ │ │ ├── compamb.1 │ │ │ │ ├── cv.1 │ │ │ │ ├── dayfact.1 │ │ │ │ ├── dgraph.1 │ │ │ │ ├── ev.1 │ │ │ │ ├── falsecolor.1 │ │ │ │ ├── findglare.1 │ │ │ │ ├── gcomp.1 │ │ │ │ ├── genblinds.1 │ │ │ │ ├── genbox.1 │ │ │ │ ├── genclock.1 │ │ │ │ ├── genprism.1 │ │ │ │ ├── genrev.1 │ │ │ │ ├── gensky.1 │ │ │ │ ├── gensurf.1 │ │ │ │ ├── genworm.1 │ │ │ │ ├── getbbox.1 │ │ │ │ ├── getinfo.1 │ │ │ │ ├── glare.1 │ │ │ │ ├── glarendx.1 │ │ │ │ ├── glrad.1 │ │ │ │ ├── histo.1 │ │ │ │ ├── ies2rad.1 │ │ │ │ ├── igraph.1 │ │ │ │ ├── imagew.1 │ │ │ │ ├── impress.1 │ │ │ │ ├── lam.1 │ │ │ │ ├── lampcolor.1 │ │ │ │ ├── lookamb.1 │ │ │ │ ├── macbethcal.1 │ │ │ │ ├── meta2tga.1 │ │ │ │ ├── mgf2meta.1 │ │ │ │ ├── mgf2rad.1 │ │ │ │ ├── mkillum.1 │ │ │ │ ├── mx80.1 │ │ │ │ ├── neat.1 │ │ │ │ ├── normpat.1 │ │ │ │ ├── normtiff.1 │ │ │ │ ├── obj2mesh.1 │ │ │ │ ├── obj2rad.1 │ │ │ │ ├── objline.1 │ │ │ │ ├── objview.1 │ │ │ │ ├── oconv.1 │ │ │ │ ├── pcomb.1 │ │ │ │ ├── pcompos.1 │ │ │ │ ├── pcond.1 │ │ │ │ ├── pdfblur.1 │ │ │ │ ├── pexpand.1 │ │ │ │ ├── pextrem.1 │ │ │ │ ├── pfilt.1 │ │ │ │ ├── pflip.1 │ │ │ │ ├── phisto.1 │ │ │ │ ├── pinterp.1 │ │ │ │ ├── plotin.1 │ │ │ │ ├── pmblur.1 │ │ │ │ ├── protate.1 │ │ │ │ ├── psign.1 │ │ │ │ ├── psmeta.1 │ │ │ │ ├── psort.1 │ │ │ │ ├── pvalue.1 │ │ │ │ ├── ra_bn.1 │ │ │ │ ├── ra_gif.1 │ │ │ │ ├── ra_pict.1 │ │ │ │ ├── ra_ppm.1 │ │ │ │ ├── ra_pr.1 │ │ │ │ ├── ra_pr24.1 │ │ │ │ ├── ra_ps.1 │ │ │ │ ├── ra_rgbe.1 │ │ │ │ ├── ra_t16.1 │ │ │ │ ├── ra_t8.1 │ │ │ │ ├── ra_tiff.1 │ │ │ │ ├── ra_xyze.1 │ │ │ │ ├── rad.1 │ │ │ │ ├── rad2mgf.1 │ │ │ │ ├── raddepend.1 │ │ │ │ ├── ranimate.1 │ │ │ │ ├── ranimove.1 │ │ │ │ ├── rcalc.1 │ │ │ │ ├── replmarks.1 │ │ │ │ ├── rhcopy.1 │ │ │ │ ├── rhinfo.1 │ │ │ │ ├── rholo.1 │ │ │ │ ├── rhoptimize.1 │ │ │ │ ├── rhpict.1 │ │ │ │ ├── rpict.1 │ │ │ │ ├── rpiece.1 │ │ │ │ ├── rtrace.1 │ │ │ │ ├── rview.1 │ │ │ │ ├── t4014.1 │ │ │ │ ├── tabfunc.1 │ │ │ │ ├── thf2rad.1 │ │ │ │ ├── tmesh2rad.1 │ │ │ │ ├── total.1 │ │ │ │ ├── trad.1 │ │ │ │ ├── ttyimage.1 │ │ │ │ ├── vgaimage.1 │ │ │ │ ├── vwrays.1 │ │ │ │ ├── vwright.1 │ │ │ │ ├── x11meta.1 │ │ │ │ ├── xform.1 │ │ │ │ ├── xglaresrc.1 │ │ │ │ ├── ximage.1 │ │ │ │ └── xshowtrace.1 │ │ │ ├── man3 │ │ │ │ └── meta.3 │ │ │ └── man5 │ │ │ │ └── metafile.5 │ │ ├── materials.1 │ │ ├── notes │ │ │ ├── ReleaseNotes │ │ │ ├── compile_switches │ │ │ ├── filmspeed │ │ │ ├── gamma_corr │ │ │ ├── language.BNR │ │ │ ├── materials │ │ │ ├── parallel.txt │ │ │ ├── picture.format │ │ │ ├── rendering.note │ │ │ ├── rpict.options │ │ │ ├── secsrc.note │ │ │ └── translators │ │ ├── ray.1 │ │ └── ray.html │ ├── installib │ ├── makeall │ ├── noX11.help │ └── src │ │ ├── cal │ │ ├── Rmakefile │ │ ├── cal │ │ │ ├── Sharp.cal │ │ │ ├── agfa2.6.cal │ │ │ ├── bezier.cal │ │ │ ├── bezier2.cal │ │ │ ├── blackbody.cal │ │ │ ├── blinds.cal │ │ │ ├── cct.cal │ │ │ ├── cielab.cal │ │ │ ├── cieluv.cal │ │ │ ├── cieresp.cal │ │ │ ├── circle.cal │ │ │ ├── clamp.cal │ │ │ ├── clouds.cal │ │ │ ├── cmat.fmt │ │ │ ├── color.fmt │ │ │ ├── colorcal.csh │ │ │ ├── conv1.cal │ │ │ ├── conv2.cal │ │ │ ├── cri.cal │ │ │ ├── cubic.cal │ │ │ ├── denom.cal │ │ │ ├── errfile.fmt │ │ │ ├── ferwerda.cal │ │ │ ├── filt.cal │ │ │ ├── fog.cal │ │ │ ├── gauss.cal │ │ │ ├── gaussian.cal │ │ │ ├── glrsrc.cal │ │ │ ├── graypatch.cal │ │ │ ├── hermite.cal │ │ │ ├── illum.fmt │ │ │ ├── illumcal.csh │ │ │ ├── landscape.cal │ │ │ ├── lumdist.cal │ │ │ ├── macbeth.cal │ │ │ ├── mat3.cal │ │ │ ├── metals.cal │ │ │ ├── noise.cal │ │ │ ├── noise2.cal │ │ │ ├── noise3.cal │ │ │ ├── norm.cal │ │ │ ├── normcomp.cal │ │ │ ├── patch3w.cal │ │ │ ├── peerless.cal │ │ │ ├── picdiff.cal │ │ │ ├── printwarp.cal │ │ │ ├── quadratic.cal │ │ │ ├── reinhard.cal │ │ │ ├── reinhard.csh │ │ │ ├── rgb.cal │ │ │ ├── root.cal │ │ │ ├── screen.cal │ │ │ ├── sf.cal │ │ │ ├── sphsamp.cal │ │ │ ├── spline.cal │ │ │ ├── stdrefl.cal │ │ │ ├── sun.cal │ │ │ ├── suncal.fmt │ │ │ ├── test.cal │ │ │ ├── testimg.cal │ │ │ ├── trans.cal │ │ │ ├── trans2.cal │ │ │ ├── trix.dat │ │ │ ├── triy.dat │ │ │ ├── triz.dat │ │ │ ├── tumblin.cal │ │ │ ├── veil.cal │ │ │ ├── view.fmt │ │ │ ├── vl.cal │ │ │ ├── vonKries.cal │ │ │ ├── vwparab.cal │ │ │ ├── xyz_rgb.cal │ │ │ └── xyz_srgb.cal │ │ ├── calc.c │ │ ├── cnt.c │ │ ├── ev.c │ │ ├── histo.c │ │ ├── lam.c │ │ ├── neat.c │ │ ├── rcalc.c │ │ ├── tabfunc.c │ │ └── total.c │ │ ├── common │ │ ├── README │ │ ├── Rmakefile │ │ ├── addobjnotify.c │ │ ├── badarg.c │ │ ├── bcopy.c │ │ ├── biggerlib.c │ │ ├── bmalloc.c │ │ ├── calcomp.h │ │ ├── caldefn.c │ │ ├── calexpr.c │ │ ├── calfunc.c │ │ ├── calprnt.c │ │ ├── chanvalue.c │ │ ├── clip.c │ │ ├── color.c │ │ ├── color.h │ │ ├── colrops.c │ │ ├── cone.c │ │ ├── cone.h │ │ ├── copyright.h │ │ ├── dircode.c │ │ ├── ealloc.c │ │ ├── eputs.c │ │ ├── erf.c │ │ ├── error.c │ │ ├── expandarg.c │ │ ├── face.c │ │ ├── face.h │ │ ├── fdate.c │ │ ├── fgetline.c │ │ ├── fgetval.c │ │ ├── fgetword.c │ │ ├── fixargv0.c │ │ ├── font.c │ │ ├── font.h │ │ ├── fputword.c │ │ ├── free_os.c │ │ ├── frexp.c │ │ ├── fropen.c │ │ ├── fvect.c │ │ ├── fvect.h │ │ ├── fwrite.c │ │ ├── getlibpath.c │ │ ├── getpagesize.c │ │ ├── getpath.c │ │ ├── header.c │ │ ├── image.c │ │ ├── instance.c │ │ ├── instance.h │ │ ├── invmat4.c │ │ ├── lamps.c │ │ ├── linregr.c │ │ ├── linregr.h │ │ ├── loadvars.c │ │ ├── lookup.c │ │ ├── lookup.h │ │ ├── malloc.c │ │ ├── mat4.c │ │ ├── mat4.h │ │ ├── mesh.c │ │ ├── mesh.h │ │ ├── mktemp.c │ │ ├── modobject.c │ │ ├── multisamp.c │ │ ├── myhostname.c │ │ ├── object.h │ │ ├── objset.c │ │ ├── octree.c │ │ ├── octree.h │ │ ├── otypes.c │ │ ├── otypes.h │ │ ├── paths.h │ │ ├── peano.c │ │ ├── plocate.c │ │ ├── plocate.h │ │ ├── popen.c │ │ ├── portio.c │ │ ├── preadwrite.c │ │ ├── process.c │ │ ├── quit.c │ │ ├── radogl.h │ │ ├── random.c │ │ ├── random.h │ │ ├── readfargs.c │ │ ├── readmesh.c │ │ ├── readobj.c │ │ ├── readoct.c │ │ ├── resolu.c │ │ ├── resolu.h │ │ ├── rexpr.c │ │ ├── rgldomat.c │ │ ├── rglfile.c │ │ ├── rglinst.c │ │ ├── rglmat.c │ │ ├── rglsrc.c │ │ ├── rglsurf.c │ │ ├── savestr.c │ │ ├── savqstr.c │ │ ├── sceneio.c │ │ ├── selcall.h │ │ ├── spec_rgb.c │ │ ├── standard.h │ │ ├── strcmp.c │ │ ├── targa.h │ │ ├── tcos.c │ │ ├── tiff.h │ │ ├── tiffconf.h │ │ ├── tiffio.h │ │ ├── tiffvers.h │ │ ├── tmapcolrs.c │ │ ├── tmapluv.c │ │ ├── tmaptiff.c │ │ ├── tmaptiff.h │ │ ├── tmerrmsg.h │ │ ├── tmesh.c │ │ ├── tmesh.cal │ │ ├── tmesh.h │ │ ├── tmprivat.h │ │ ├── tonemap.c │ │ ├── tonemap.h │ │ ├── urand.c │ │ ├── urind.c │ │ ├── uvcode.h │ │ ├── vars.h │ │ ├── vfork.h │ │ ├── view.h │ │ ├── wordfile.c │ │ ├── words.c │ │ ├── wputs.c │ │ ├── x11findwind.c │ │ ├── xf.c │ │ └── zeroes.c │ │ ├── cv │ │ ├── README │ │ ├── Rmakefile │ │ ├── arch2rad.c │ │ ├── ies2rad.c │ │ ├── lamp.tab │ │ ├── lampcolor.c │ │ ├── mgf2meta.c │ │ ├── mgf2rad.c │ │ ├── mgflib │ │ │ ├── 3ds2mgf.c │ │ │ ├── CHANGES │ │ │ ├── Makefile │ │ │ ├── README │ │ │ ├── badarg.c │ │ │ ├── context.c │ │ │ ├── cvrgb.c │ │ │ ├── examp1.ies │ │ │ ├── examp1.mgf │ │ │ ├── face2tri.C │ │ │ ├── fig1+2.eps │ │ │ ├── fig3+4.eps │ │ │ ├── figures.ps │ │ │ ├── fvect.c │ │ │ ├── geom2mgf.c │ │ │ ├── iesnotes.txt │ │ │ ├── lookup.c │ │ │ ├── lookup.h │ │ │ ├── messages.h │ │ │ ├── mgf2inv.c │ │ │ ├── mgf2rad.c │ │ │ ├── mgfdoc.ps.Z │ │ │ ├── mgfdoc.tr │ │ │ ├── mgfilt.c │ │ │ ├── object.c │ │ │ ├── parser.c │ │ │ ├── parser.h │ │ │ ├── rad2mgf.c │ │ │ ├── rayopt.c │ │ │ ├── rayopt.h │ │ │ ├── readme.txt │ │ │ ├── spec.txt │ │ │ ├── translat.txt │ │ │ ├── vect.c │ │ │ ├── vect.h │ │ │ ├── words.c │ │ │ └── xf.c │ │ ├── nff2rad.c │ │ ├── obj2rad.c │ │ ├── rad2mgf.c │ │ ├── source.cal │ │ ├── thf2rad.c │ │ ├── tilt.cal │ │ ├── tmesh2rad.c │ │ ├── trans.c │ │ └── trans.h │ │ ├── gen │ │ ├── README │ │ ├── Rmakefile │ │ ├── clockface.hex │ │ ├── genbackg.csh │ │ ├── genbeads.c │ │ ├── genblinds.c │ │ ├── genbox.c │ │ ├── genbranch.c │ │ ├── gencat.c │ │ ├── genclock.c │ │ ├── genmarble.c │ │ ├── genpine.csh │ │ ├── genprism.c │ │ ├── genrev.c │ │ ├── gensky.c │ │ ├── gensurf.c │ │ ├── genwindow.csh │ │ ├── genworm.c │ │ ├── glaze.csh │ │ ├── glaze1.cal │ │ ├── glaze2.cal │ │ ├── hermite3.c │ │ ├── illum.cal │ │ ├── markpath.csh │ │ ├── mkillum.c │ │ ├── mkillum.h │ │ ├── mkillum2.c │ │ ├── mkillum3.c │ │ ├── replmarks.c │ │ ├── rev.cal │ │ ├── skybright.cal │ │ ├── sun.c │ │ ├── surf.cal │ │ └── xform.c │ │ ├── hd │ │ ├── README │ │ ├── Rmakefile │ │ ├── clumpbeams.c │ │ ├── genrhenv.c │ │ ├── genrhgrid.c │ │ ├── holo.c │ │ ├── holo.h │ │ ├── holofile.c │ │ ├── rhcopy.c │ │ ├── rhd_ctab.c │ │ ├── rhd_geom.c │ │ ├── rhd_glx.c │ │ ├── rhd_glx1.c │ │ ├── rhd_glx2.c │ │ ├── rhd_odraw.c │ │ ├── rhd_odraw.h │ │ ├── rhd_ogl.c │ │ ├── rhd_qtree.c │ │ ├── rhd_qtree.h │ │ ├── rhd_qtree2c.c │ │ ├── rhd_qtree2r.c │ │ ├── rhd_sample.h │ │ ├── rhd_x11.c │ │ ├── rhd_x11dbg.c │ │ ├── rhdisp.c │ │ ├── rhdisp.h │ │ ├── rhdisp2.c │ │ ├── rhdisp3.c │ │ ├── rhdobj.c │ │ ├── rhdobj.h │ │ ├── rhdriver.h │ │ ├── rhinfo.c │ │ ├── rholo.c │ │ ├── rholo.h │ │ ├── rholo2.c │ │ ├── rholo2l.c │ │ ├── rholo3.c │ │ ├── rholo4.c │ │ ├── rhoptimize.c │ │ ├── rhpict.c │ │ ├── rhpict2.c │ │ ├── sm.c │ │ ├── sm.h │ │ ├── sm_del.c │ │ ├── sm_flag.h │ │ ├── sm_geom.c │ │ ├── sm_geom.h │ │ ├── sm_list.c │ │ ├── sm_list.h │ │ ├── sm_ogl.c │ │ ├── sm_qtree.c │ │ ├── sm_qtree.h │ │ ├── sm_samp.c │ │ ├── sm_sets.c │ │ ├── sm_stree.c │ │ ├── sm_stree.h │ │ ├── sm_test.c │ │ ├── sm_usets.c │ │ ├── viewbeams.c │ │ └── x11icon.h │ │ ├── meta │ │ ├── Rmakefile │ │ ├── aed5.c │ │ ├── bgraph.c │ │ ├── cgraph.c │ │ ├── convect.c │ │ ├── cv.c │ │ ├── cvhfio.c │ │ ├── cvmaze.c │ │ ├── dgraph.c │ │ ├── ealloc.c │ │ ├── expand.c │ │ ├── gcalc.c │ │ ├── gcomp.c │ │ ├── genflake.c │ │ ├── gentree.c │ │ ├── hfio.c │ │ ├── igraph.c │ │ ├── imPcodes.h │ │ ├── imPfuncs.c │ │ ├── imPfuncs.h │ │ ├── imagew.c │ │ ├── implot.c │ │ ├── impress.c │ │ ├── lib4014 │ │ │ ├── Makefile │ │ │ ├── arc.c │ │ │ ├── box.c │ │ │ ├── circle.c │ │ │ ├── close.c │ │ │ ├── dot.c │ │ │ ├── erase.c │ │ │ ├── label.c │ │ │ ├── line.c │ │ │ ├── linemod.c │ │ │ ├── move.c │ │ │ ├── open.c │ │ │ ├── point.c │ │ │ ├── scale.c │ │ │ ├── space.c │ │ │ └── subr.c │ │ ├── mac.c │ │ ├── macplot.c │ │ ├── macplot.h │ │ ├── macprt.c │ │ ├── meta.h │ │ ├── meta2tga.c │ │ ├── metacalls.c │ │ ├── mfio.c │ │ ├── mgraph.c │ │ ├── mgraph.h │ │ ├── mgvars.c │ │ ├── mgvars.h │ │ ├── misc.c │ │ ├── mplot.c │ │ ├── mqdraw.c │ │ ├── mt160.c │ │ ├── mt160l.c │ │ ├── mtext.c │ │ ├── mx80.c │ │ ├── okimate.c │ │ ├── palloc.c │ │ ├── pexpand.c │ │ ├── plot.c │ │ ├── plot.h │ │ ├── plot4.c │ │ ├── plotin.c │ │ ├── plotout.c │ │ ├── primout.c │ │ ├── progname.c │ │ ├── psmeta.c │ │ ├── psort.c │ │ ├── psplot.c │ │ ├── random.h │ │ ├── rast.h │ │ ├── rplot.c │ │ ├── segment.c │ │ ├── sort.c │ │ ├── span.h │ │ ├── syscalls.c │ │ ├── targa.h │ │ ├── tbar.c │ │ ├── tcurve.c │ │ ├── tgraph.c │ │ ├── tgraph.h │ │ ├── tscat.c │ │ ├── x11plot.c │ │ ├── xmeta.c │ │ └── xplot.c │ │ ├── ot │ │ ├── README │ │ ├── Rmakefile │ │ ├── bbox.c │ │ ├── cvmesh.c │ │ ├── cvmesh.h │ │ ├── getbbox.c │ │ ├── init2otypes.c │ │ ├── initotypes.c │ │ ├── o_cone.c │ │ ├── o_face.c │ │ ├── o_instance.c │ │ ├── obj2mesh.c │ │ ├── oconv.c │ │ ├── readobj2.c │ │ ├── sphere.c │ │ ├── wfconv.c │ │ ├── writemesh.c │ │ └── writeoct.c │ │ ├── px │ │ ├── README │ │ ├── Rmakefile │ │ ├── aedimage.c │ │ ├── biq.c │ │ ├── brandom.c │ │ ├── ciq.c │ │ ├── ciq.h │ │ ├── closest.c │ │ ├── clrtab.c │ │ ├── colorscale.c │ │ ├── cut.c │ │ ├── d48c.c │ │ ├── falsecolor.csh │ │ ├── glimage.c │ │ ├── greyscale.c │ │ ├── hexbit.c │ │ ├── macbethcal.c │ │ ├── mt160r.c │ │ ├── mx3.c │ │ ├── mx3.h │ │ ├── neuclrtab.c │ │ ├── normpat.csh │ │ ├── normtiff.c │ │ ├── oki20.c │ │ ├── oki20c.c │ │ ├── pacuity.csh │ │ ├── paintjet.c │ │ ├── panim.c │ │ ├── pcomb.c │ │ ├── pcompos.c │ │ ├── pcond.c │ │ ├── pcond.h │ │ ├── pcond2.c │ │ ├── pcond3.c │ │ ├── pcond4.c │ │ ├── pcwarp.c │ │ ├── pdelta.csh │ │ ├── pdfblur.csh │ │ ├── pextrem.c │ │ ├── pf2.c │ │ ├── pf3.c │ │ ├── pfilt.c │ │ ├── pflip.c │ │ ├── phisteq.csh │ │ ├── phisto.csh │ │ ├── pic.h │ │ ├── pict.h │ │ ├── pinterp.c │ │ ├── pmap.h │ │ ├── pmapgen.c │ │ ├── pmblur.csh │ │ ├── protate.c │ │ ├── psign.c │ │ ├── psquish.csh │ │ ├── psum.c │ │ ├── pvalue.c │ │ ├── pveil.csh │ │ ├── ra_avs.c │ │ ├── ra_bn.c │ │ ├── ra_gif.c │ │ ├── ra_hexbit.c │ │ ├── ra_im.c │ │ ├── ra_pict.c │ │ ├── ra_pixar.c │ │ ├── ra_ppm.c │ │ ├── ra_pr.c │ │ ├── ra_pr24.c │ │ ├── ra_ps.c │ │ ├── ra_rgbe.c │ │ ├── ra_skel.c │ │ ├── ra_t16.c │ │ ├── ra_t8.c │ │ ├── ra_tiff.c │ │ ├── ra_xim.c │ │ ├── ra_xyze.c │ │ ├── rasterfile.h │ │ ├── scan.c │ │ ├── slide.c │ │ ├── t4027.c │ │ ├── tardev.h │ │ ├── ttyimage.c │ │ ├── vgaimage.c │ │ ├── vlpic.csh │ │ ├── warp3d.c │ │ ├── warp3d.h │ │ ├── x11icon.h │ │ ├── x11image.c │ │ ├── x11raster.c │ │ ├── x11raster.h │ │ ├── xdebugamb.c │ │ ├── ximage.c │ │ ├── xraster.c │ │ ├── xraster.h │ │ ├── xshowtrace.c │ │ └── xyzimage.csh │ │ ├── rt │ │ ├── README │ │ ├── Rmakefile │ │ ├── VERSION │ │ ├── Version.c │ │ ├── aed.c │ │ ├── ambcomp.c │ │ ├── ambient.c │ │ ├── ambient.h │ │ ├── ambio.c │ │ ├── aniso.c │ │ ├── colortab.c │ │ ├── data.c │ │ ├── data.h │ │ ├── devcomm.c │ │ ├── devmain.c │ │ ├── devtable.c │ │ ├── dielectric.c │ │ ├── driver.h │ │ ├── duphead.c │ │ ├── editline.c │ │ ├── fprism.c │ │ ├── freeobjmem.c │ │ ├── func.c │ │ ├── func.h │ │ ├── glass.c │ │ ├── initotypes.c │ │ ├── lookamb.c │ │ ├── m_alias.c │ │ ├── m_brdf.c │ │ ├── m_clip.c │ │ ├── m_direct.c │ │ ├── m_mirror.c │ │ ├── m_mist.c │ │ ├── msmouse.c │ │ ├── mx_data.c │ │ ├── mx_func.c │ │ ├── newsconstants.h │ │ ├── noise3.c │ │ ├── normal.c │ │ ├── o_cone.c │ │ ├── o_face.c │ │ ├── o_instance.c │ │ ├── o_mesh.c │ │ ├── otspecial.h │ │ ├── p_data.c │ │ ├── p_func.c │ │ ├── persist.c │ │ ├── preload.c │ │ ├── ray.h │ │ ├── raycalls.c │ │ ├── rayinit.cal │ │ ├── raypcalls.c │ │ ├── raytrace.c │ │ ├── renderopts.c │ │ ├── rpaint.h │ │ ├── rpict.c │ │ ├── rpmain.c │ │ ├── rtmain.c │ │ ├── rtrace.c │ │ ├── rv2.c │ │ ├── rv3.c │ │ ├── rview.c │ │ ├── rvmain.c │ │ ├── source.c │ │ ├── source.h │ │ ├── sphere.c │ │ ├── srcdraw.c │ │ ├── srcsamp.c │ │ ├── srcsupp.c │ │ ├── t_data.c │ │ ├── t_func.c │ │ ├── text.c │ │ ├── tty.c │ │ ├── verscript.ed │ │ ├── vga.c │ │ ├── virtuals.c │ │ ├── x11.c │ │ ├── x11icon.h │ │ ├── x11twind.c │ │ └── x11twind.h │ │ └── util │ │ ├── README │ │ ├── Rmakefile │ │ ├── compamb.csh │ │ ├── contour.c │ │ ├── dayfact.csh │ │ ├── debugcal.csh │ │ ├── do_action.tcl │ │ ├── do_file.tcl │ │ ├── do_options.tcl │ │ ├── do_results.tcl │ │ ├── do_results3.6.tcl │ │ ├── do_scene.tcl │ │ ├── do_scene3.6.tcl │ │ ├── do_views.tcl │ │ ├── do_views3.6.tcl │ │ ├── do_zone.tcl │ │ ├── file.hlp │ │ ├── findglare.c │ │ ├── genambpos.csh │ │ ├── getfile.tcl │ │ ├── getfile3.6.tcl │ │ ├── gethelp.tcl │ │ ├── gethelp3.6.tcl │ │ ├── getinfo.c │ │ ├── glare.csh │ │ ├── glare.h │ │ ├── glarendx.c │ │ ├── glaresrc.c │ │ ├── glareval.c │ │ ├── glrad.c │ │ ├── glradicon.h │ │ ├── help.hlp │ │ ├── help2roff.csh │ │ ├── ivpict.csh │ │ ├── ivprep.csh │ │ ├── makedist.c │ │ ├── netproc.c │ │ ├── netproc.h │ │ ├── objline.csh │ │ ├── objpict.csh │ │ ├── objview.csh │ │ ├── pranim.c │ │ ├── rad.c │ │ ├── raddepend.csh │ │ ├── ranimate.c │ │ ├── ranimove.c │ │ ├── ranimove.h │ │ ├── ranimove1.c │ │ ├── ranimove2.c │ │ ├── rlux.csh │ │ ├── rpiece.c │ │ ├── scanner.c │ │ ├── setscan.c │ │ ├── setscan.h │ │ ├── swaprasheader.c │ │ ├── t16anim.c │ │ ├── tclIndex │ │ ├── trad.hlp │ │ ├── trad.icon │ │ ├── trad.wsh │ │ ├── tradinstall.csh │ │ ├── util.tcl │ │ ├── vinfo.csh │ │ ├── vwrays.c │ │ ├── vwright.c │ │ └── xglaresrc.c ├── with_sss.jpg ├── with_sss_rotated.jpg ├── without_sss.jpg └── without_sss_rotated.jpg ├── Runtime ├── HDRLoader.dll ├── HDRLoaderD.dll ├── LWOLoader.dll ├── LWOLoaderD.dll ├── SDL.dll ├── SDLApp.dll ├── SDLAppD.dll ├── SHTest.exe ├── beethoven.lwo ├── diffuse_interreflected.shc ├── diffuse_shadowed.shc ├── diffuse_unshadowed.shc ├── getsdlapp.bat ├── rnl_probe.hdr └── room.lwo └── Source ├── Backup └── SHTest.sln ├── Backup1 └── SHTest.sln ├── BitArray.h ├── Main.cpp ├── SHRotMatrix.cpp ├── SHRotMatrix.h ├── SHRotate.cpp ├── SHRotate.h ├── SHRotateMatrix.h ├── SHTest.cpp ├── SHTest.h ├── SHTest.sln ├── SHTest.vcproj ├── SHTest.vcxproj ├── SHTest.vcxproj.filters └── Types.h /Reference/06-16-2003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Reference/06-16-2003.jpg -------------------------------------------------------------------------------- /Reference/comparison.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Reference/comparison.jpg -------------------------------------------------------------------------------- /Reference/radiance/MANIFEST: -------------------------------------------------------------------------------- 1 | MANIFEST This file 2 | README Instructions 3 | noX11.help Help file for installation without X11 4 | makeall Script for installing software 5 | installib Script for installing library files 6 | newuser Script for getting user information 7 | doc/man UNIX man pages 8 | doc/materials.1 Description of material reflectance models 9 | doc/notes Miscellaneous notes 10 | doc/ps PostScript versions of manuals 11 | doc/pdf Adobe PDF versions of manuals 12 | doc/ray.1 Reference manual (groff -ms format) 13 | doc/ray.html Reference manual (HTML format) 14 | lib Library files 15 | obj/alpha 3D alphanumeric characters 16 | obj/cabin Cabin in the woods (from user's manual) 17 | obj/misc Simple examples 18 | obj/office An office model 19 | obj/texture Example of textures and patterns 20 | obj/virtual Virtual light source example scene 21 | src/cal General calculation programs 22 | src/common Common source directory 23 | src/cv Converters from other input formats 24 | src/gen Object generator programs 25 | src/hd Holodeck rendering programs 26 | src/meta 2-dimensional graphics programs 27 | src/ot Octree converter 28 | src/px Picture display and processing programs 29 | src/rt Ray tracing programs 30 | src/util Utility programs 31 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/cnt.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH CNT 1 11/15/93 RADIANCE 3 | .SH NAME 4 | cnt - index counter 5 | .SH SYNOPSIS 6 | .B cnt 7 | N .. 8 | .SH DESCRIPTION 9 | .I Cnt 10 | counts from 0 to N-1, producing N lines of output. 11 | If multiple arguments are given, 12 | .I cnt 13 | produces a nested array of values where the final counter 14 | rotates fastest through its range. 15 | .I Cnt 16 | is most useful in conjunction with 17 | .I rcalc(1) 18 | to produce array values. 19 | .SH EXAMPLE 20 | To create a 3 by 5 array: 21 | .IP "" .2i 22 | cnt 3 5 23 | .SH AUTHOR 24 | Greg Ward 25 | .SH "SEE ALSO" 26 | lam(1), neat(1), rcalc(1), total(1) 27 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/cv.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH CV 1 6/24/98 RADIANCE 3 | .SH NAME 4 | cv - convert between metafile formats 5 | .SH SYNOPSIS 6 | .B cv 7 | [ 8 | \-r 9 | ][ 10 | file .. 11 | ] 12 | .SH DESCRIPTION 13 | .I Cv 14 | reads each human readable metafile 15 | .I file 16 | in sequence and converts it to a binary form. 17 | If the option 18 | .I \-r 19 | is specified, the reverse conversion is performed. 20 | .PP 21 | If no input files are specified, the standard input is read. 22 | .SH EXAMPLE 23 | To convert the binary file meta.bin to its human-readable equivalent, 24 | and put the result in meta.human 25 | .IP "" .2i 26 | cv -r meta.bin > meta.human 27 | .SH AUTHOR 28 | Greg Ward 29 | .SH "SEE ALSO" 30 | meta(3), metafile(5), pexpand(1), psort(1) 31 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/dayfact.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH DAYFACT 1 11/15/93 RADIANCE 3 | .SH NAME 4 | dayfact - compute illuminance and daylight factor on workplane 5 | .SH SYNOPSIS 6 | .B dayfact 7 | [ 8 | falsecolor options 9 | ] 10 | .SH DESCRIPTION 11 | .I Dayfact 12 | is an interactive script for computing workplane illuminance, 13 | and daylight factors and potential daylight savings using 14 | .I rtrace(1). 15 | The script 16 | .I falsecolor(1) 17 | is then used to draw contour lines on the resulting Radiance 18 | picture. 19 | .SH AUTHOR 20 | Greg Ward 21 | .SH ACKNOWLEDGEMENT 22 | Work on this program was initiated and sponsored by the LESO 23 | group at EPFL in Switzerland. 24 | .SH "SEE ALSO" 25 | falsecolor(1), glare(1), rtrace(1), ximage(1) 26 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/dgraph.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH DGRAPH 1 6/24/98 RADIANCE 3 | .SH NAME 4 | dgraph - do a set of graphs to a dumb terminal 5 | .SH SYNOPSIS 6 | .B dgraph 7 | [ 8 | .B -w width 9 | ][ 10 | .B -l length 11 | ][ 12 | .B +variable value .. 13 | ][ 14 | .B file .. 15 | ] 16 | .SH DESCRIPTION 17 | .I Dgraph 18 | reads each graph 19 | .I file 20 | in sequence and converts it to a character plot 21 | displayable on any ascii device. 22 | If no files are given, the standard input is read. 23 | .PP 24 | Across the top of the plot, the extrema are printed. 25 | This is the only indication of the axis size. 26 | Curves are represented with their respective letter ('A' for 27 | curve A, etc.) at each point. 28 | Where two or more curves cross, a number is shown instead. 29 | .PP 30 | The size of the output array can be specified as a 31 | certain 32 | .I width 33 | and 34 | .I length. 35 | The default size is 79 by 22. 36 | .PP 37 | Variables can be set explicitly with 38 | .I +variable value 39 | options. 40 | See bgraph(1) for details. 41 | .SH EXAMPLE 42 | To get a quick glimpse of the sine function from 0 to 4. 43 | .nf 44 | dgraph 45 | A(x)=sin(x) 46 | Anpoints=100 47 | xmin=0 48 | xmax=4 49 | ^D 50 | .fi 51 | .SH AUTHOR 52 | Greg Ward 53 | .SH BUGS 54 | There is no mechanism provided for undefining a variable. 55 | .SH "SEE ALSO" 56 | bgraph(1), calc(1), gcomp(1), igraph(1) 57 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/genbox.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH GENBOX 1 11/15/93 RADIANCE 3 | .SH NAME 4 | genbox - generate a RADIANCE description of a box 5 | .SH SYNOPSIS 6 | .B "genbox mat name xsiz ysiz zsiz" 7 | [ 8 | .B \-i 9 | ][ 10 | .B "\-r rad" 11 | | 12 | .B "\-b bev" 13 | ] 14 | .SH DESCRIPTION 15 | .I Genbox 16 | produces a RADIANCE scene description of a parallelepiped 17 | with one corner at the origin and the opposite corner at 18 | .I "(xsiz, ysiz, zsiz)." 19 | The sides of the box will be parallel to the three coordinate 20 | planes. 21 | The surfaces that make up the box will be modified by 22 | .I mat 23 | and their identifiers will begin with 24 | .I name. 25 | The 26 | .I \-i 27 | option can be used to produce a box with inward directed surface 28 | normals. 29 | The 30 | .I \-r 31 | option can be used to specify the radius for rounded edges. 32 | The 33 | .I \-b 34 | option can be used to specify the indentation for beveled edges. 35 | .SH EXAMPLE 36 | To produce a rectangular box made of wood with beveled edges: 37 | .IP "" .2i 38 | genbox wood box1 5 8 3 -b .5 > box1 39 | .SH AUTHOR 40 | Greg Ward 41 | .SH BUGS 42 | Because spheres and cylinders are used to construct boxes with 43 | rounded edges, a transparent box of this type appears quite messy. 44 | .SH "SEE ALSO" 45 | genrev(1), gensurf(1), genworm(1), rpict(1), rview(1), xform(1) 46 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/genworm.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH GENWORM 1 11/15/93 RADIANCE 3 | .SH NAME 4 | genworm - generate a RADIANCE description of a functional worm 5 | .SH SYNOPSIS 6 | .B "genworm mat name 'x(t)' 'y(t)' 'z(t)' 'r(t)' nseg" 7 | [ 8 | .B "\-e expr" 9 | ][ 10 | .B "\-f file" 11 | ] 12 | .SH DESCRIPTION 13 | .I Genworm 14 | produces a RADIANCE scene description of a 15 | worm defined by the parametric equations 16 | .I x(t), 17 | .I y(t), 18 | .I z(t), 19 | and 20 | .I r(t) 21 | (the radius). 22 | .I T 23 | will vary from 0 to 1 in steps of 24 | .I 1/nseg. 25 | The surface will be composed of 26 | .I nseg 27 | cones or cylinders and 28 | .I nseg+1 29 | spheres. 30 | The expressions are of the same type used in RADIANCE 31 | function files. 32 | Auxiliary expressions and/or files may be specified 33 | in any number of 34 | .I \-e 35 | and 36 | .I \-f 37 | options. 38 | .SH EXAMPLE 39 | To generate a banana: 40 | .IP "" .2i 41 | genworm yellow banana '0' '5*sin(t)' '5*cos(t)' '.4-(.5-t)*(.5-t)' 20 42 | .SH AUTHOR 43 | Greg Ward 44 | .SH BUGS 45 | Since the worm is constructed of intersecting surfaces, only 46 | opaque materials should be used with this object. 47 | Also, a worm cannot double back inside itself without making a mess. 48 | .SH "SEE ALSO" 49 | calc(1), genbox(1), genrev(1), gensurf(1), rpict(1), rview(1), xform(1) 50 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/getinfo.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH GETINFO 1 1/15/99 RADIANCE 3 | .SH NAME 4 | getinfo - get header information from a RADIANCE file 5 | .SH SYNOPSIS 6 | .B getinfo 7 | [ 8 | .B -d 9 | ][ 10 | .B "file .." 11 | ] 12 | .br 13 | .B getinfo 14 | - 15 | .SH DESCRIPTION 16 | .I Getinfo 17 | reads the header of each RADIANCE 18 | .I file 19 | and writes it to the standard output. 20 | Octree and picture files are in a binary format, which makes 21 | it difficult to determine their content. 22 | Therefore, a few lines of text are placed at the beginning 23 | of each file by the RADIANCE program that creates it. 24 | The end of the header information and the start of the 25 | data is indicated by an empty line. 26 | The 27 | .I \-d 28 | option can be used to print the dimensions of an octree or 29 | picture file instead. 30 | For an octree, 31 | .I "getinfo \-d" 32 | prints the bounding cube (xmin ymin zmin size). 33 | For a picture, 34 | .I "getinfo \-d" 35 | prints the y and x resolution (-Y yres +X xres). 36 | If no 37 | .I file 38 | is given, the standard input is read. 39 | .PP 40 | The second form of getinfo with a hyphen simply removes the header 41 | and copies the body of the file from the standard 42 | input to the standard output. 43 | .SH EXAMPLE 44 | To print the header information from scene1.oct and scene2.pic: 45 | .IP "" .2i 46 | getinfo scene1.oct scene2.pic 47 | .SH AUTHOR 48 | Greg Ward 49 | .SH "SEE ALSO" 50 | oconv(1), pfilt(1), rhinfo(1), rpict(1), rview(1) 51 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/glare.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH GLARE 1 5/2/95 RADIANCE 3 | .SH NAME 4 | glare - perform glare and visual comfort calculations 5 | .SH SYNOPSIS 6 | .B glare 7 | [ 8 | .B glarefile 9 | [ 10 | .B picture 11 | [ 12 | .B octree 13 | ] 14 | ] 15 | ] 16 | .SH DESCRIPTION 17 | .I Glare 18 | is an interactive script for executing programs used to locate 19 | glare sources and compute glare indices and visual comfort probability. 20 | If no 21 | .I glarefile 22 | is given, the program prompts the user for a one. 23 | If the file does not exist, 24 | .I glare 25 | asks the user some questions about the scene in question then runs 26 | .I findglare(1) 27 | to compute values to store in the file. 28 | .I Glare 29 | then presents the user a menu of available glare index calculations. 30 | After choosing a calculation, 31 | .I glare 32 | offers to store the result (usually not useful) or plot the information 33 | (but only for multiple glare angles). 34 | .PP 35 | If you are creating a new 36 | .I glarefile, 37 | it usually works best to start with a displayed image for reference 38 | during the interrogation. 39 | .SH AUTHOR 40 | Greg Ward 41 | .SH ACKNOWLEDGEMENT 42 | Work on this program was initiated and sponsored by the LESO 43 | group at EPFL in Switzerland. 44 | .SH "SEE ALSO" 45 | dayfact(1), findglare(1), glarendx(1), igraph(1), 46 | rpict(1), xglaresrc(1), ximage(1) 47 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/igraph.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH IGRAPH 1 6/24/98 RADIANCE 3 | .SH NAME 4 | igraph - interactive graphing program 5 | .SH DESCRIPTION 6 | .I Igraph 7 | is a crude interactive program for creating line and scatter 8 | plots. 9 | Provisions for reading and writing graph files as well 10 | as changing variables and getting output are provided from 11 | a menu. 12 | .PP 13 | Graph files and variables are as described in bgraph(1). 14 | .SH AUTHOR 15 | Greg Ward 16 | .SH BUGS 17 | There is no mechanism provided for undefining a variable. 18 | .SH "SEE ALSO" 19 | bgraph(1), calc(1), impress(1), 20 | metafile(5), mx80(1), mt160l(1), t4014(1) 21 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/imagew.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH IMAGEW 1 6/24/98 RADIANCE 3 | .SH NAME 4 | imagew - output metafile to Apple Imagewriter 5 | .SH SYNOPSIS 6 | .B imagew 7 | [ 8 | .B \-c | \-r 9 | ] 10 | file .. 11 | .SH DESCRIPTION 12 | .I Imagew 13 | reads each metafile 14 | .I file 15 | in sequence and converts it to output suitable for the Apple 16 | Imagewriter dot-matrix printer. 17 | If the option 18 | .I c 19 | is specified, the input files are only conditioned for output, ie. 20 | expanded and sorted (see pexpand and psort). This is useful if many 21 | copies of the same output is desired. 22 | If the option 23 | .I r 24 | is instead specified, the input is assumed already to be conditioned. 25 | If no input files are specified, the standard input is read. 26 | .TP 10n 27 | .BR \-c 28 | Condition the input only. 29 | .TP 30 | .BR \-r 31 | Input is already conditioned, output only. 32 | .SH EXAMPLE 33 | To print the plot file example.plt: 34 | .IP "" .2i 35 | bgraph example.plt | output imagew 36 | .SH FILES 37 | see pexpand(1) and psort(1) 38 | .SH AUTHOR 39 | Greg Ward 40 | .SH "SEE ALSO" 41 | bgraph(1), cv(1), igraph(1), impress(1), mx80(1), output(1), 42 | pexpand(1), psort(1) 43 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/impress.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH IMPRESS 1 6/24/98 RADIANCE 3 | .SH NAME 4 | impress - convert metafile to imPress language for imagen 5 | .SH SYNOPSIS 6 | .B impress 7 | [ 8 | .B \-c | \-r 9 | ] 10 | file .. 11 | .SH DESCRIPTION 12 | .I Impress 13 | reads each metafile 14 | .I file 15 | in sequence and converts it to output suitable for the imagen 16 | line of printers. 17 | If the option 18 | .I c 19 | is specified, the input files are only conditioned for output, ie. 20 | expanded (see pexpand). 21 | This is useful if many copies of the same output is desired. 22 | If the option 23 | .I r 24 | is instead specified, the input is assumed already to be conditioned. 25 | If no input files are specified, the standard input is read. 26 | .TP 10n 27 | .BR \-c 28 | Condition the input only. 29 | .TP 30 | .BR \-r 31 | Input is already conditioned, output only. 32 | .SH EXAMPLE 33 | To print the plot file example.plt to the Impress printer ip4: 34 | .IP "" .2i 35 | bgraph example.plt | impress | lpr -P ip4 36 | .SH FILES 37 | see pexpand(1) 38 | .SH AUTHORS 39 | William LeFebvre and Greg Ward 40 | .SH "SEE ALSO" 41 | bgraph(1), igraph(1), imagew(1), mx80(1), t4014(1) 42 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/lam.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH LAM 1 7/8/97 RADIANCE 3 | .SH NAME 4 | lam - laminate lines of multiple files 5 | .SH SYNOPSIS 6 | .B lam 7 | [ 8 | .B \-tC 9 | ] 10 | input1 input2 .. 11 | .SH DESCRIPTION 12 | .I Lam 13 | simply joins lines from multiple inputs, separating them with 14 | the given tab character (TAB by default). 15 | An input is either a stream or a command. 16 | Commands are given in quotes, and begin with an exclamantion point ('!'). 17 | If the inputs do not have the same number of lines, then 18 | shorter files will stop contributing to the output as they 19 | run out. 20 | .PP 21 | A hyphen ('-') by itself can be used to indicate the standard 22 | input. 23 | .SH EXAMPLE 24 | To join files output1 and output2, separated by a comma: 25 | .IP "" .2i 26 | lam -t, output1 output2 27 | .PP 28 | To join a file with line numbers (starting at 0) and its reverse: 29 | .IP "" .2i 30 | cnt `wc -l < lam.c` | lam - -t: lam.c -t\| '\!tail -r lam.c' 31 | .SH AUTHOR 32 | Greg Ward 33 | .SH "SEE ALSO" 34 | cnt(1), neat(1), rcalc(1), tabfunc(1), total(1) 35 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/lampcolor.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH LAMPCOLOR 1 11/15/93 RADIANCE 3 | .SH NAME 4 | lampcolor - compute spectral radiance for diffuse emitter 5 | .SH SYNOPSIS 6 | .B lampcolor 7 | [ 8 | lamptable 9 | ] 10 | .SH DESCRIPTION 11 | .I Lampcolor 12 | is an interactive program for computing the appropriate color 13 | for a diffuse emitter. 14 | From the total lumen output and a simple description of the fixture 15 | geometry, the radiance for a diffuse fixture is calculated. 16 | Since most light fixtures are not really diffuse, the preferred 17 | method is to use luminaire distribution data (see 18 | .I ies2rad(1)). 19 | .PP 20 | A table of lamp colors and depreciation factors is used to get 21 | the color for a specific lamp type. 22 | If "white" is specified, the lamp will be uncolored. 23 | This is probably preferable for scenes with only a single variety 24 | of lamp in order to produce color-balanced images. 25 | .SH ENVIRONMENT 26 | RAYPATH Directories to check for lamp table 27 | .SH FILES 28 | lamp.tab Default lamp lookup table 29 | .SH AUTHOR 30 | Greg Ward 31 | .SH ACKNOWLEDGEMENT 32 | Work on this program was initiated and sponsored by the LESO 33 | group at EPFL in Switzerland. 34 | .SH "SEE ALSO" 35 | ies2rad(1) 36 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/mx80.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH MX80 1 6/24/98 RADIANCE 3 | .SH NAME 4 | mx80 - output metafile to Epson mx-80 5 | .SH SYNOPSIS 6 | .B mx80 7 | [ 8 | .B \-c | \-r 9 | ] 10 | file .. 11 | .SH DESCRIPTION 12 | .I Mx80 13 | reads each metafile 14 | .I file 15 | in sequence and converts it to output suitable for the Epson line 16 | of printers, specifically the mx-80 and fx-80. 17 | If the option 18 | .I c 19 | is specified, the input files are only conditioned for output, ie. 20 | expanded and sorted (see pexpand and psort). This is useful if many 21 | copies of the same output is desired. 22 | If the option 23 | .I r 24 | is instead specified, the input is assumed already to be conditioned. 25 | If no input files are specified, the standard input is read. 26 | .TP 10n 27 | .BR \-c 28 | Condition the input only. 29 | .TP 30 | .BR \-r 31 | Input is already conditioned, output only. 32 | .SH EXAMPLE 33 | To print the plot file test.plt: 34 | .IP "" .2i 35 | bgraph test.plt | output mx80 36 | .SH FILES 37 | see pexpand(1) and psort(1) 38 | .SH AUTHOR 39 | Greg Ward 40 | .SH BUGS 41 | Currently, different character widths and densities are not supported. 42 | .SH "SEE ALSO" 43 | bgraph(1), cv(1), igraph(1), impress(1), output(1), 44 | pexpand(1), psort(1) 45 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/objview.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH OBJVIEW 1 6/10/98 RADIANCE 3 | .SH NAME 4 | objview - view RADIANCE object(s) 5 | .SH SYNOPSIS 6 | .B objview 7 | [ 8 | .B "\-u updirection" 9 | ][ 10 | rad options 11 | ] 12 | input .. 13 | .br 14 | .B objview 15 | [ 16 | .B \-g 17 | ][ 18 | .B "\-u updirection" 19 | ][ 20 | glrad options 21 | ] 22 | input .. 23 | .SH DESCRIPTION 24 | .I Objview 25 | renders a RADIANCE object interactively using 26 | .I rad(1) 27 | or 28 | .I glrad(1). 29 | This program is merely a shell script that adds some light 30 | sources to a scene then calls 31 | .I rad(1) 32 | or 33 | .I glrad(1) 34 | to make an octree and view the scene interactively. 35 | .PP 36 | If the default up vector (+Z) is inappropriate 37 | for this object, then specify a different one using the 38 | .I \-u 39 | option to 40 | .I objview. 41 | .PP 42 | Any number of material and scene files may be given, 43 | but no in-line commands or standard input. 44 | .SH AUTHOR 45 | Greg Ward Larson 46 | .SH "SEE ALSO" 47 | glrad(1), oconv(1), rad(1), rview(1) 48 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/pexpand.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH PEXPAND 1 6/24/98 RADIANCE 3 | .SH NAME 4 | pexpand - expand requested commands in metafile 5 | .SH SYNOPSIS 6 | .B pexpand 7 | [ 8 | .B +/\-EPDOCSURIlrtmvsp 9 | ] 10 | file .. 11 | .SH DESCRIPTION 12 | .I Pexpand 13 | reads each metafile 14 | .I file 15 | in sequence and expands any commands specified in a '+' option, 16 | and deletes any commands specified in a '-' option. 17 | This is necessary because most drivers will not support many 18 | metafile commands such as 'v' (vector string) and 'O', 'C', and 's' 19 | (segments). 20 | .I Pexpand 21 | will expand '+' instances into the corresponding primitives which 22 | are supported, and delete all '-' instances. 23 | .PP 24 | Certain commands are currently considered basic, and must be supported 25 | by all drivers. 26 | The commands 'D', 'E', 'S', 'U', 'R', 'l', 'r', and 't' are 27 | basic (see metafile(5)). 28 | .PP 29 | If no input files are specified, the standard input is read. 30 | .TP 10n 31 | .BR +EPDOCSURIlrtmvsp 32 | Expand the requested command(s). 33 | .TP 34 | .BR \-EPDOCSURIlrtmvsp 35 | Delete the requested command(s). 36 | .SH EXAMPLE 37 | To expand vector strings and segements, and delete pauses from "meta": 38 | .IP "" .2i 39 | pexpand +vOCs -P meta 40 | .SH FILES 41 | /usr/lib/meta/vchars.mta (see metafile(5)) 42 | .SH AUTHOR 43 | Greg Ward 44 | .SH "SEE ALSO" 45 | metafile(5), psort(1) 46 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/pextrem.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH PEXTREM 1 11/15/93 RADIANCE 3 | .SH NAME 4 | pextrem - find minimum and maximum values in RADIANCE picture 5 | .SH SYNOPSIS 6 | .B pextrem 7 | [ 8 | .B \-o 9 | ] 10 | [ 11 | picture 12 | ] 13 | .SH DESCRIPTION 14 | .I Pextrem 15 | locates the minimum and maximum values for the input 16 | .I picture, 17 | and prints their pixel locations and color values. 18 | The first line printed contains the x and y pixel location 19 | (x measured from the left margin, y measured from the bottom), 20 | followed by the red, green and blue values. 21 | The second line printed contains the same information for the 22 | maximum value. 23 | .PP 24 | The 25 | .I \-o 26 | option prints the original (radiance) values, undoing any exposure 27 | or color correction done on the picture. 28 | .PP 29 | If no input 30 | .I picture 31 | is given, the standard input is read. 32 | .SH AUTHOR 33 | Greg Ward 34 | .SH BUGS 35 | The luminance value is used for comparison of pixels, although in 36 | certain anomolous cases (ie. highly saturated colors) it is possible that 37 | .I pextrem 38 | will not pick the absolute minimum or maximum luminance value. 39 | This is because a fast integer-space comparison is used. 40 | A more reliable floating-point comparison would be slower by 41 | an order of magnitude. 42 | .SH "SEE ALSO" 43 | falsecolor(1), getinfo(1), pcomb(1), pcompos(1), pextrem(1), pfilt(1), 44 | pflip(1), protate(1), psign(1), rpict(1), ximage(1) 45 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/pflip.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH PFLIP 1 11/15/93 RADIANCE 3 | .SH NAME 4 | pflip - flip a RADIANCE picture. 5 | .SH SYNOPSIS 6 | .B pflip 7 | [ 8 | .B \-h 9 | ][ 10 | .B \-v 11 | ][ 12 | .B \-c 13 | ] 14 | .B input 15 | [ 16 | .B output 17 | ] 18 | .SH DESCRIPTION 19 | .I Pflip 20 | flips a RADIANCE picture horizontally and/or vertically. 21 | The 22 | .I \-h 23 | option results in a horizontal exchange, 24 | and the 25 | .I \-v 26 | option results in a vertical exchange. 27 | Both options may be applied. 28 | .PP 29 | The 30 | .I \-c 31 | option indicates that the action is to correct an improper original 32 | image orientation, thus the recorded scanline ordering should not 33 | be changed. 34 | .SH AUTHOR 35 | Greg Ward 36 | .SH "SEE ALSO" 37 | getinfo(1), pcompos(1), pfilt(1), protate(1), psign(1), rpict(1) 38 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/phisto.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH PHISTO 1 3/12/98 RADIANCE 3 | .SH NAME 4 | phisto - compute a luminance histogram from one or more RADIANCE pictures 5 | .SH SYNOPSIS 6 | .B phisto 7 | .B "picture .." 8 | .SH DESCRIPTION 9 | .I Phisto 10 | is a script that calls 11 | .I pfilt(1), 12 | .I rcalc(1) 13 | and 14 | .I histo(1) 15 | to compute a histogram of log luminance values for foveal samples in 16 | the given picture files. 17 | A foveal sample covers approximately 1 degree, though this script does 18 | not use this exact area. 19 | The minimum and maximum values are determined, and 100 histogram bins 20 | are uniformly divided between these extrema. 21 | Foveal samples less than 1e-7 candelas/sq.meter are silently ignored. 22 | If no picture is named on the command line, the standard input is read. 23 | .PP 24 | The primary function of this script is to precompute histograms for the 25 | .I pcond(1) 26 | program, which may then be used to compute multiple, identical exposures. 27 | This is especially useful for animations and image comparisons. 28 | .SH EXAMPLE 29 | .PP 30 | To compute two identical tone mappings for image1.pic and image2.pic: 31 | .IP "" .2i 32 | phisto image1.pic image2.pic > both.histo 33 | .br 34 | pcond -I -h image1.pic < both.histo > image1m.pic 35 | .br 36 | pcond -I -h image2.pic < both.histo > image2m.pic 37 | .SH AUTHOR 38 | Greg Ward Larson 39 | .SH "SEE ALSO" 40 | histo(1), pcond(1), pfilt(1), pvalue(1), rcalc(1), total(1) 41 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/plotin.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH PLOTIN 1 6/24/98 RADIANCE 3 | .SH NAME 4 | plotin - convert plot(5) to metafile(5) primitives 5 | .SH SYNOPSIS 6 | .B plotin 7 | file .. 8 | .SH DESCRIPTION 9 | .I Plotin 10 | reads each plot(5) 11 | .I file 12 | in sequence and converts it to output suitable for use by 13 | the metafile filters. 14 | If no input files are specified, the standard input is read. 15 | .SH EXAMPLE 16 | To plot the graph example.grf to the imagen: 17 | .IP "" .2i 18 | graph < example.grf | plotin | impress | ipr 19 | .SH FILES 20 | see pexpand(1) 21 | .SH AUTHOR 22 | Greg Ward 23 | .SH "SEE ALSO" 24 | graph(1G), metafile(5), plot(1), plot(5), plotout(1) 25 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/protate.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH PROTATE 1 10/27/98 RADIANCE 3 | .SH NAME 4 | protate - rotate a RADIANCE picture. 5 | .SH SYNOPSIS 6 | .B protate 7 | [ 8 | .B \-c 9 | ][ 10 | .B \-r 11 | ] 12 | .B input 13 | [ 14 | .B output 15 | ] 16 | .SH DESCRIPTION 17 | .I Protate 18 | rotates a RADIANCE picture 90 degrees. 19 | This is useful for output on hardcopy devices with aspect ratios opposite 20 | to the input picture. 21 | By default, the image is rotated clockwise. 22 | The 23 | .I \-r 24 | option may be used to rotate the image counter-clockwise instead. 25 | .PP 26 | The 27 | .I \-c 28 | option indicates that the action is to correct an improper original 29 | image orientation, thus the recorded scanline ordering should not 30 | be changed. 31 | .SH NOTES 32 | To rotate an image 180 degrees, use 33 | .I pflip(1) 34 | with both the 35 | .I -h 36 | and 37 | .I -v 38 | options. 39 | .SH AUTHOR 40 | Greg Ward 41 | .SH "SEE ALSO" 42 | getinfo(1), pcompos(1), pfilt(1), pflip(1), psign(1), rpict(1) 43 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/psmeta.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH PSMETA 1 6/24/98 RADIANCE 3 | .SH NAME 4 | psmeta - convert metafile to PostScript 5 | .SH SYNOPSIS 6 | .B psmeta 7 | file .. 8 | .SH DESCRIPTION 9 | .I Psmeta 10 | reads each metafile 11 | .I file 12 | in sequence and converts it to PostScript output suitable for a standard 13 | letter-size page. 14 | The file produced may also be read into programs that can 15 | handle Encapsulated PostScript. 16 | If no input files are specified, the standard input is read. 17 | .SH EXAMPLE 18 | To print the plot file example.plt to the ap5 printer: 19 | .IP "" .2i 20 | bgraph example.plt | psmeta | lpr -P ap5 21 | .SH AUTHOR 22 | Greg Ward 23 | .SH "SEE ALSO" 24 | bgraph(1), igraph(1), imagew(1), lpr(1), mx80(1), t4014(1) 25 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/psort.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH PSORT 1 6/24/98 RADIANCE 3 | .SH NAME 4 | psort - sort primitives in metafile as requested 5 | .SH SYNOPSIS 6 | .B psort 7 | [ 8 | .B +/\-x 9 | ][ 10 | .B +/\-y 11 | ][ 12 | .B +/\-X 13 | ][ 14 | .B +/\-Y 15 | ] 16 | file .. 17 | .SH DESCRIPTION 18 | .I Psort 19 | reads each metafile 20 | .I file 21 | in sequence and sorts primitives between globals according to 22 | the option specification. 23 | Lower case options mean the corresponding minimum, upper case 24 | indicates the maximum value. 25 | A '+' before the option means sort in order of increasing 26 | values, '-' means decreasing. 27 | The order the options appear on the command line is the order 28 | in which the extrema are examined. 29 | For example, the options 30 | .I \-Y +x 31 | would mean "sort on decreasing ymax, then increasing xmin values". 32 | .PP 33 | If no input files are specified, the standard input is read. 34 | .SH EXAMPLE 35 | To sort the file "meta" in order of increasing xmax, then 36 | decreasing ymin: 37 | .IP "" .2i 38 | psort +X -y meta 39 | .SH FILES 40 | /usr/tmp/psXXXXa /usr/tmp/psXXXXb 41 | .SH BUGS 42 | Aborting the program will sometimes leave files in /usr/tmp. 43 | .SH AUTHOR 44 | Greg Ward 45 | .SH "SEE ALSO" 46 | metafile(5), pexpand(1) 47 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/ra_bn.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH RA_BN 1 11/15/93 RADIANCE 3 | .SH NAME 4 | ra_bn - convert RADIANCE picture to/from Barneyscan image 5 | .SH SYNOPSIS 6 | .B ra_bn 7 | [ 8 | .B "\-g gamma" 9 | ][ 10 | .B "\-e +/-stops" 11 | ] 12 | { 13 | .B input|- 14 | } 15 | [ 16 | .B output 17 | ] 18 | .br 19 | .B ra_bn 20 | .B \-r 21 | [ 22 | .B "\-g gamma" 23 | ][ 24 | .B "\-e +/-stops" 25 | ] 26 | .B input 27 | [ 28 | .B output 29 | ] 30 | .SH DESCRIPTION 31 | .I Ra_bn 32 | converts between RADIANCE and Barneyscan native RGB image files. 33 | Since Barneyscan images are stored in three files, one for each 34 | color component, only the root file name is given and the program 35 | appends the suffixes "red", "grn" and "blu". 36 | The 37 | .I \-g 38 | option specifies the exponent used in gamma correction; 39 | the default value is 2.0. 40 | An exponent of 1.0 turns gamma correction off. 41 | The 42 | .I \-e 43 | option specifies an exposure compensation in f-stops (powers of two). 44 | Only integer stops are allowed, for efficiency. 45 | The 46 | .I \-r 47 | option invokes a reverse conversion, from a Barneyscan image 48 | to a RADIANCE picture. 49 | .SH AUTHORS 50 | Greg Ward 51 | .SH "SEE ALSO" 52 | pfilt(1), ra_ppm(1), ra_pr(1), ra_pr24(1), ra_t8(1), ra_t16(1), 53 | ra_tiff(1), ximage(1) 54 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/ra_pr24.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH RA_PR24 1 11/15/93 RADIANCE 3 | .SH NAME 4 | ra_pr24 - convert RADIANCE picture to/from 24-bit rasterfile 5 | .SH SYNOPSIS 6 | .B ra_pr24 7 | [ 8 | .B \-r 9 | | 10 | .B \-rgb 11 | ][ 12 | .B "\-g gamma" 13 | ][ 14 | .B "\-e +/-stops" 15 | ] 16 | [ 17 | .B input 18 | [ 19 | .B output 20 | ] 21 | ] 22 | .SH DESCRIPTION 23 | .I Ra_pr24 24 | converts between RADIANCE and 24-bit pixrect rasterfile formats. 25 | The 26 | .I \-g 27 | option specifies the exponent used in gamma correction; 28 | the default value is 2.2. 29 | An exponent of 1 turns gamma correction off. 30 | The 31 | .I \-e 32 | option specifies an exposure compensation in f-stops (powers of two). 33 | Only integer stops are allowed, for efficiency. 34 | The 35 | .I \-r 36 | option invokes a reverse conversion, from a 24-bit rasterfile to 37 | a RADIANCE picture. 38 | If the 39 | .I \-rgb 40 | option is used, the output rasterfile will be in RGB byte-ordering 41 | rather than the more standard (for Sun) BGR ordering. 42 | Byte ordering is determined automatically for the reverse 43 | conversion. 44 | If the output file is missing, the standard output is used. 45 | If the input file is missing as well, the standard input is used. 46 | .SH AUTHOR 47 | Greg Ward 48 | .SH BUGS 49 | Only standard 24-bit color rasterfiles are read or written. 50 | .SH "SEE ALSO" 51 | pfilt(1), ra_bn(1), ra_ppm(1), ra_pr(1), ra_t8(1), ra_t16(1), 52 | ra_tiff(1), ximage(1) 53 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/raddepend.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH RADDEPEND 1 4/15/94 RADIANCE 3 | .SH NAME 4 | raddepend - find RADIANCE scene dependencies 5 | .SH SYNOPSIS 6 | .B raddepend 7 | file .. 8 | .SH DESCRIPTION 9 | .I Raddepend 10 | uses 11 | .I getbbox(1) 12 | to expand scene file arguments and find file dependencies for 13 | .I make(1) 14 | or 15 | .I rad(1). 16 | .I Raddepend 17 | looks only in the current directory, 18 | so dependencies hidden elsewhere in the filesystem will not be found 19 | or named. 20 | .PP 21 | The output is the name of files, one per line, that were accessed 22 | during the expansion of the input file arguments. 23 | The file arguments are excluded from the list. 24 | If no input files are given, the standard input is read. 25 | .SH AUTHOR 26 | Greg Ward 27 | .SH BUGS 28 | On some older NFS systems, the file access dates are not updated 29 | promptly. 30 | As a result, 31 | .I raddepend 32 | may not be 100% reliable on these systems. 33 | If the output seems to be missing essential files, this is 34 | no doubt why. 35 | The only fix is to put in a longer sleep time between the 36 | .I getbbox 37 | call and the final 38 | .I ls(1). 39 | .SH "SEE ALSO" 40 | make(1), oconv(1), rad(1), xform(1) 41 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/rhinfo.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH RHINFO 1 1/15/99 RADIANCE 3 | .SH NAME 4 | rhinfo - print information about a RADIANCE holodeck file 5 | .SH SYNOPSIS 6 | .B "rhinfo input.hdk" 7 | .SH DESCRIPTION 8 | .I Rhinfo 9 | reads the RADIANCE holodeck file 10 | .I input.hdk 11 | and writes out the header and section information, including 12 | the grid sizes, number of beams and a histogram of samples/beam 13 | for each section. 14 | .SH EXAMPLE 15 | To print the header and section information from scene1.hdk: 16 | .IP "" .2i 17 | rhinfo scene1.hdk 18 | .SH AUTHOR 19 | Greg Ward Larson 20 | .SH ACKNOWLEDGMENT 21 | This work was supported by Silicon Graphics, Inc. 22 | .SH "SEE ALSO" 23 | getinfo(1), rhcopy(1), rholo(1), rhoptimize(1) 24 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/t4014.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH T4014 1 6/24/98 RADIANCE 3 | .SH NAME 4 | t4014 - output metafile to Tektronix t4014 graphics terminal 5 | .SH SYNOPSIS 6 | .B t4014 7 | [ 8 | .B \-c | \-r 9 | ] 10 | file .. 11 | .SH DESCRIPTION 12 | .I t4014 13 | reads each metafile 14 | .I file 15 | in sequence and converts it to output suitable for the Tektronix 16 | t4014 and 4016 graphics terminals. 17 | If the option 18 | .I c 19 | is specified, the input files are only conditioned for output, ie. 20 | expanded and sorted (see pexpand and psort). This is useful if many 21 | copies of the same output is desired. 22 | If the option 23 | .I r 24 | is instead specified, the input is assumed already to be conditioned. 25 | If no input files are specified, the standard input is read. 26 | .TP 10n 27 | .BR \-c 28 | Condition the input only. 29 | .TP 30 | .BR \-r 31 | Input is already conditioned, output only. 32 | .SH EXAMPLE 33 | To display the plot example.plt: 34 | .IP "" .2i 35 | bgraph example.plt | t4014 36 | .SH FILES 37 | see pexpand(1) 38 | .SH AUTHOR 39 | Greg Ward 40 | .SH BUGS 41 | Area fill is noticably lacking. Line textures fail on most 42 | 4014 emulators. 43 | .SH "SEE ALSO" 44 | bgraph(1), cv(1), igraph(1), pexpand(1) 45 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/thf2rad.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH THF2RAD 1 11/15/93 RADIANCE 3 | .SH NAME 4 | thf2rad - convert GDS things file to RADIANCE description 5 | .SH SYNOPSIS 6 | .B thf2rad 7 | [ 8 | .B "\-n name" 9 | ][ 10 | .B "\-r rad" 11 | ] 12 | [ 13 | .B input .. 14 | ] 15 | .SH DESCRIPTION 16 | .I Thf2rad 17 | converts one or more GDS things files to a RADIANCE scene description. 18 | The material names for the surfaces will be those assigned in GDS. 19 | The 20 | .I \-n 21 | option may be used to give a name prefix to all the surfaces. 22 | The 23 | .I \-r 24 | option may be used to specify a radius for line segments. 25 | By default, this value is zero, which means that lines will be ignored. 26 | By setting it to some positive value, cylinders of the given radius 27 | will represent lines. 28 | .SH EXAMPLE 29 | To translate two things files into one RADIANCE file with the prefix "gds": 30 | .IP "" .2i 31 | thf2rad -n gds building1.thf building2.thf > building1+2.rad 32 | .PP 33 | To create an octree directly from a things file, giving lines a radius 34 | of .1: 35 | .IP "" .2i 36 | oconv source.rad materials.rad '\\!thf2rad -r .1 building1.thf' > building1.oct 37 | .SH AUTHOR 38 | Greg Ward and Charles Ehrlich 39 | .SH "SEE ALSO" 40 | arch2rad(1), ies2rad(1), oconv(1), xform(1) 41 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/ttyimage.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH TTYIMAGE 1 10/9/97 RADIANCE 3 | .SH NAME 4 | ttyimage - RADIANCE driver for dumb ASCII terminal 5 | .SH SYNOPSIS 6 | .B ttyimage 7 | [ 8 | .B "\-c resolu" 9 | ][ 10 | .B \-r 11 | ] 12 | [ 13 | .B pixfile 14 | ] 15 | .SH DESCRIPTION 16 | .I Ttyimage 17 | takes the RADIANCE picture file 18 | .I pixfile 19 | and displays it on a dumb terminal. 20 | If no 21 | .I pixfile 22 | is given, the standard input is read. 23 | .SH AUTHOR 24 | Greg Ward 25 | .SH "SEE ALSO" 26 | pfilt(1), rpict(1), ximage(1) 27 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/x11meta.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH X11META 1 3 | .SH NAME 4 | x11meta - output metafile graphics to X11 5 | .SH SYNOPSIS 6 | .B x11meta 7 | [ 8 | .B \-c | \-r 9 | ] 10 | file .. 11 | .SH DESCRIPTION 12 | .I X11meta 13 | reads each metafile 14 | .I file 15 | in sequence and sends it to the default X window system. 16 | If the option 17 | .I c 18 | is specified, the input files are only conditioned for output, ie. 19 | expanded and sorted (see pexpand and psort). 20 | If the option 21 | .I r 22 | is instead specified, the input is assumed already to be conditioned. 23 | If no input files are specified, the standard input is read. 24 | .TP 10n 25 | .BR \-c 26 | Condition the input only. 27 | .TP 28 | .BR \-r 29 | Input is already conditioned, output only. 30 | .SH EXAMPLE 31 | To plot the chart example.bar: 32 | .IP "" .2i 33 | bgraph example.plt | x11meta 34 | .SH FILES 35 | see pexpand(1) and psort(1) 36 | .SH AUTHOR 37 | Greg Ward 38 | .SH "SEE ALSO" 39 | bgraph(1), cv(1), igraph(1), metafile(5), pexpand(1), psmeta(1), psort(1) 40 | -------------------------------------------------------------------------------- /Reference/radiance/doc/man/man1/xshowtrace.1: -------------------------------------------------------------------------------- 1 | .\" RCSid "$Id" 2 | .TH XSHOWTRACE 1 11/15/93 RADIANCE 3 | .SH NAME 4 | xshowtrace - interactively show rays traced on RADIANCE image under X11 5 | .SH SYNOPSIS 6 | .B xshowtrace 7 | [ 8 | .B \-s 9 | ][ 10 | .B "rtrace options" 11 | ] 12 | .B octree 13 | .B picture 14 | .SH DESCRIPTION 15 | .I Xshowtrace 16 | takes a RADIANCE octree and a picture file 17 | and displays it on an X11 window server using 18 | .I ximage(1). 19 | The picture should have been created from a previous 20 | .I rpict(1) 21 | or 22 | .I rview(1) 23 | calculation using the given octree. 24 | Once the image is displayed, the user can use the 't' command of 25 | .I ximage 26 | to select points on the image to display the ray tree. 27 | .I Rtrace 28 | then produces a ray tree, which 29 | .I xshowtrace 30 | will display (in red on a color screen). 31 | The 32 | .I \-s 33 | option slows the display of each ray traced to make it easier to 34 | follow the process. 35 | .SH AUTHOR 36 | Greg Ward 37 | .SH BUGS 38 | If the pointer is moved between the time 't' is pressed and 39 | .I xshowtrace 40 | starts drawing rays, the rays will be displaced. 41 | .SH "SEE ALSO" 42 | oconv(1), rpict(1), rtrace(1), rview(1), ximage(1) 43 | -------------------------------------------------------------------------------- /Reference/radiance/doc/notes/filmspeed: -------------------------------------------------------------------------------- 1 | Francis found the appropriate equation for film exposure in the IES 2 | handbook. There isn't an exact relation, but the following formula 3 | can be used to get an approximate answer for 35mm photography: 4 | 5 | Radiance EXPOSURE = K * T * S / f^2 6 | 7 | where: 8 | T = exposure time (in seconds) 9 | S = film speed (ISO ASA) 10 | f = f-stop 11 | K = 2.81 (conversion factor 179*PI/200) 12 | 13 | This came from the IES Lighting Handbook, 1987 Application Volume, section 11, 14 | page 24. 15 | 16 | So, if you were trying to produce an image as it would appear shot at 17 | 1/60 sec. on ISO ASA 100 (DIN 21) film at f-4, you would apply pfilt 18 | thusly: 19 | 20 | pfilt -1 -e `ev "2.81*1/60*100/4^2"` raw.pic > fin.pic 21 | -------------------------------------------------------------------------------- /Reference/radiance/doc/ray.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Reference/radiance/doc/ray.html -------------------------------------------------------------------------------- /Reference/radiance/installib: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid $Id: installib,v 1.1 2003/02/28 20:06:51 greg Exp $ 3 | # 4 | # Install library files 5 | # 6 | again2: 7 | echo -n "Where do you want the library files [/usr/local/lib/ray]? " 8 | set ldir=$< 9 | (echo $ldir) >/dev/null 10 | if ( $status ) goto again2 11 | set ldir=$ldir 12 | if ( "$ldir" == "" ) then 13 | set ldir=/usr/local/lib/ray 14 | else if ( "$ldir" !~ /* ) then 15 | echo "Directory must be relative to root, please reenter" 16 | goto again2 17 | endif 18 | if ( $ldir != $cwd/lib ) then 19 | if ( ! -d $ldir ) then 20 | mkdir $ldir 21 | if ( $status ) then 22 | echo "Cannot create directory, please reenter" 23 | goto again2 24 | endif 25 | endif 26 | set d1=(`ls -id lib`) 27 | set d2=(`ls -id $ldir`) 28 | if ($d1[1] != $d2[1]) then 29 | echo -n "Install library files now [n]? " 30 | if ( "$<" =~ [yY]* ) then 31 | echo -n "Copying library files to $ldir... " 32 | (cd lib ; tar -cf - *) | (cd $ldir ; tar -xf -) 33 | echo "Done." 34 | endif 35 | endif 36 | unset d1 d2 37 | endif 38 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/Rmakefile: -------------------------------------------------------------------------------- 1 | # RCSid: $Id: Rmakefile,v 1.1 2003/02/22 02:07:20 greg Exp $ 2 | # 3 | # Compiles for calc, rcalc, ev, and utilities 4 | # 5 | 6 | OPT = -O 7 | 8 | CC = cc 9 | 10 | MACH = -DIEEE 11 | 12 | DEFS = -DBIGGERLIB 13 | 14 | CFLAGS = $(OPT) $(MACH) $(DEFS) -I../common -L../lib 15 | 16 | MLIB = -lm 17 | 18 | INSTDIR = /usr/local/bin 19 | 20 | PROGS = calc ev rcalc total cnt neat lam tabfunc histo 21 | 22 | all: $(PROGS) 23 | 24 | install: $(PROGS) 25 | cp $(PROGS) $(INSTDIR) 26 | 27 | clean: 28 | set nonomatch; rm -f *.o $(PROGS) 29 | 30 | calc: calc.o 31 | $(CC) $(CFLAGS) -o calc calc.o -lrt $(MLIB) 32 | 33 | ev: ev.o 34 | $(CC) $(CFLAGS) -o ev ev.o -lrt $(MLIB) 35 | 36 | rcalc: rcalc.o 37 | $(CC) $(CFLAGS) -o rcalc rcalc.o -lrt $(MLIB) 38 | 39 | total: total.o 40 | $(CC) $(CFLAGS) -o total total.o $(MLIB) 41 | 42 | cnt: cnt.o 43 | $(CC) $(CFLAGS) -o cnt cnt.o 44 | 45 | neat: neat.o 46 | $(CC) $(CFLAGS) -o neat neat.o 47 | 48 | lam: lam.o 49 | $(CC) $(CFLAGS) -o lam lam.o 50 | 51 | tabfunc: tabfunc.o 52 | $(CC) $(CFLAGS) -o tabfunc tabfunc.o -lrt $(MLIB) 53 | 54 | histo: histo.o 55 | $(CC) $(CFLAGS) -o histo histo.o $(MLIB) 56 | 57 | calc.o ev.o rcalc.o: ../common/calcomp.h 58 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/agfa2.6.cal: -------------------------------------------------------------------------------- 1 | { 2 | Color correction file computed by: 3 | macbethcal -d agfa2.6.dbg -c agfa2.6.xyY agfa2.6.cal 4 | 5 | Usage: pcomb -f agfa2.6.cal uncorrected.pic > corrected.pic 6 | Or: pcond [options] -f agfa2.6.cal orig.pic > output.pic 7 | } 8 | rxa(i) : select(i,0.0231834,0.0680975,0.176347,0.368894,0.666109,0.919236); 9 | rya(i) : select(i,0.0309326,0.0889489,0.201031,0.361486,0.602564,0.919236); 10 | rfi(n) = if(n-4.5, 5, if(rxa(n+1)-r, n, rfi(n+1))); 11 | rndx = rfi(1); 12 | ro = ((rxa(rndx+1)-r)*rya(rndx) + (r-rxa(rndx))*rya(rndx+1)) / 13 | (rxa(rndx+1) - rxa(rndx)) ; 14 | gxa(i) : select(i,0.00820829,0.0412285,0.129904,0.296412,0.613869,0.919034); 15 | gya(i) : select(i,0.0308484,0.0876956,0.200415,0.366194,0.606247,0.919034); 16 | gfi(n) = if(n-4.5, 5, if(gxa(n+1)-g, n, gfi(n+1))); 17 | gndx = gfi(1); 18 | go = ((gxa(gndx+1)-g)*gya(gndx) + (g-gxa(gndx))*gya(gndx+1)) / 19 | (gxa(gndx+1) - gxa(gndx)) ; 20 | bxa(i) : select(i,0.00406972,0.030506,0.104717,0.264075,0.578293,0.884932); 21 | bya(i) : select(i,0.0303486,0.0852925,0.19516,0.360336,0.597103,0.884932); 22 | bfi(n) = if(n-4.5, 5, if(bxa(n+1)-b, n, bfi(n+1))); 23 | bndx = bfi(1); 24 | bo = ((bxa(bndx+1)-b)*bya(bndx) + (b-bxa(bndx))*bya(bndx+1)) / 25 | (bxa(bndx+1) - bxa(bndx)) ; 26 | r1 = ri(1); g1 = gi(1); b1 = bi(1); 27 | r = 1.30657*r1 + -0.583798*g1 + 0.294035*b1 ; 28 | g = 0.0504641*r1 + 1.07507*g1 + -0.116423*b1 ; 29 | b = 0.126498*r1 + -0.0730158*g1 + 0.97992*b1 ; 30 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/bezier.cal: -------------------------------------------------------------------------------- 1 | { 2 | Cubic Bezier Interpolating Function 3 | 4 | 02Mar90 5 | } 6 | bezier(p1, p2, p3, p4, t) = p1 * (1+t*(-3+t*(3-t))) + 7 | p2 * 3*t*(1+t*(-2+t)) + 8 | p3 * 3*t*t*(1-t) + 9 | p4 * t*t*t ; 10 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/bezier2.cal: -------------------------------------------------------------------------------- 1 | { 2 | Bicubic Bezier Patch 3 | 4 | 02Mar90 5 | 6 | Define Px(i,j), Py(i,j), Pz(i,j) 7 | } 8 | 9 | x(s,t) = bezier(P2x(s,1), P2x(s,2), P2x(s,3), P2x(s,4), t); 10 | y(s,t) = bezier(P2y(s,1), P2y(s,2), P2y(s,3), P2y(s,4), t); 11 | z(s,t) = bezier(P2z(s,1), P2z(s,2), P2z(s,3), P2z(s,4), t); 12 | 13 | P2x(s,j) = bezier(Px(1,j), Px(2,j), Px(3,j), Px(4,j), s); 14 | P2y(s,j) = bezier(Py(1,j), Py(2,j), Py(3,j), Py(4,j), s); 15 | P2z(s,j) = bezier(Pz(1,j), Pz(2,j), Pz(3,j), Pz(4,j), s); 16 | 17 | bezier(p1, p2, p3, p4, t) = p1 * (1+t*(-3+t*(3-t))) + 18 | p2 * 3*t*(1+t*(-2+t)) + 19 | p3 * 3*t*t*(1-t) + 20 | p4 * t*t*t ; 21 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/blackbody.cal: -------------------------------------------------------------------------------- 1 | { 2 | Plank's formula for black body radiation spectrum 3 | } 4 | 5 | { Required constants } 6 | 7 | k : 8.617e-5; { Boltzmann constant (eV/K) } 8 | h : 4.136e-15; { Plank constant (eV-sec) } 9 | e : 1.602e-19; { elemetary charge (Coulombs) } 10 | c : 2.998e8; { speed of light (m/sec) } 11 | 12 | { 13 | The following distribution is in units of Joules/meter^4, 14 | i.e., energy per radiating volume per wavelength 15 | lmb (lambda) is expected in nm (10^-9 meter) 16 | and T must be given in degrees Kelvin 17 | } 18 | 19 | u(lmd,T) : 8*PI*h*e*c*(lmd*1e-9)^-5 / (exp(h*c/(lmd*1e-9*k*T)) - 1); -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/blinds.cal: -------------------------------------------------------------------------------- 1 | { 2 | Compute Venetian Blinds angle to exclude direct sun. 3 | 4 | 3/19/93 5 | 6 | Formula by Kostantinos Papamichael, 7 | Translated by Greg Ward and Saba Rofchaei 8 | } 9 | { 10 | Input variables are solar altitude and azimuth in degrees: 11 | 12 | SALT - solar altitude (degrees) 13 | SAZI - solar azimuth (degrees from South, West is positive) 14 | } 15 | 16 | L = .625; {slat's width} 17 | D = .45833; {distance between slats} 18 | ORIENT = 0.0; { Window orientation } 19 | DEGREE : PI/180.0; 20 | 21 | tan_lambda = tan(SALT*DEGREE) / cos((SAZI+ORIENT)*DEGREE); 22 | lambda = atan(tan_lambda) / DEGREE; 23 | a = tan_lambda*tan_lambda + 1.0; 24 | b = -2.0*(D/L); 25 | c = (D/L)*(D/L) - tan_lambda*tan_lambda; 26 | 27 | det = sqrt(b*b - 4.0*a*c); 28 | 29 | {calculating slats' angle corresponding to solar position} 30 | POS1 = asin((-b+det)/(2.0*a)) / DEGREE; 31 | POS2 = asin((-b-det)/(2.0*a)) / DEGREE; 32 | 33 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/cielab.cal: -------------------------------------------------------------------------------- 1 | { 2 | Compute Lab color space and color differences from XYZ primaries. 3 | 4 | 5/25/02 G.Ward 5 | } 6 | Xw = 1; Yw = 1; Zw = 1; { default white } 7 | sq(x) : x*x; 8 | Ls(Yi) : if(Yi/Yw - .01, 116*(Yi/Yw)^(1/3) - 16, 903.3*Yi/Yw); 9 | as(Xi,Yi,Zi) : 500*((Xi/Xw)^(1/3) - (Yi/Yw)^(1/3)); 10 | bs(Xi,Yi,Zi) : 200*((Yi/Yw)^(1/3) - (Zi/Zw)^(1/3)); 11 | 12 | { CIE 1976 Lab delta E formula } 13 | dE76(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq(Ls(Y1)-Ls(Y2)) 14 | + sq(as(X1,Y1,Z1)-as(X2,Y2,Z2)) 15 | + sq(bs(X1,Y1,Z1)-bs(X2,Y2,Z2)) ); 16 | 17 | { CIE 1994 Lab delta E formula } 18 | kL = 1; kC = 1; kH = 1; { viewing factors } 19 | Cs(Xi,Yi,Zi) : sqrt( sq(as(Xi,Yi,Zi)) + sq(bs(Xi,Yi,Zi)) ); 20 | C1s(X1,Y1,Z1,X2,Y2,Z2) : sqrt(Cs(X1,Y1,Z1)*Cs(X2,Y2,Z2)); 21 | dHs(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq(as(X1,Y1,Z1)-as(X2,Y2,Z2)) 22 | + sq(bs(X1,Y1,Z1)-bs(X2,Y2,Z2)) 23 | - sq(Cs(X1,Y1,Z1)-Cs(X2,Y2,Z2)) ); 24 | dE94(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq((Ls(X1,Y1,Z1)-Ls(X2,Y2,Z2))/kL) 25 | + sq( (Cs(X1,Y1,Z1)-Cs(X2,Y2,Z2)) / 26 | (kC*(1+.048*C1s(X1,Y1,Z1,X2,Y2,Z2))) ) 27 | + sq( dHs(X1,Y1,Z1,X2,Y2,Z2) / 28 | (kH*(1+.014*C1s(X1,Y1,Z1,X2,Y2,Z2))) ) ) 29 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/cieluv.cal: -------------------------------------------------------------------------------- 1 | { 2 | Compute Luv color space and color differences from XYZ primaries. 3 | 4 | 5/4/98 G.W.Larson 5 | } 6 | Xw = 1; Yw = 1; Zw = 1; { default white } 7 | sq(x) : x*x; 8 | up(Xi,Yi,Zi) : 4*Xi/(Xi + 15*Yi + 3*Zi); 9 | vp(Xi,Yi,Zi) : 9*Yi/(Xi + 15*Yi + 3*Zi); 10 | Ls(Yi) : if(Yi/Yw - .01, 116*(Yi/Yw)^(1/3) - 16, 903.3*Yi/Yw); 11 | us(Xi,Yi,Zi) : 13*Ls(Yi)*(up(Xi,Yi,Zi) - up(Xw,Yw,Zw)); 12 | vs(Xi,Yi,Zi) : 13*Ls(Yi)*(vp(Xi,Yi,Zi) - vp(Xw,Yw,Zw)); 13 | dE(X1,Y1,Z1,X2,Y2,Z2) : sqrt(sq(Ls(Y1)-Ls(Y2)) + sq(us(X1,Y1,Z1)-us(X2,Y2,Z2)) 14 | + sq(vs(X1,Y1,Z1)-vs(X2,Y2,Z2))); 15 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/circle.cal: -------------------------------------------------------------------------------- 1 | { 2 | Calculate center and radius of circle based on three 3 | points in the plane. 4 | 5 | Beware colinear points and points parallel to y-axis. 6 | 7 | 6/4/2002 Greg Ward 8 | solution due to Paul Bourke 9 | 10 | Inputs: 11 | 12 | x1,y1,x2,y2,x3,y3 - points on circle 13 | 14 | Outputs: 15 | 16 | xc, yc, r - center and radius 17 | } 18 | sq(x) : x*x; 19 | 20 | ma = (y2-y1)/(x2-x1); 21 | mb = (y3-y2)/(x3-x2); 22 | 23 | xc = (ma*mb*(y1-y3) + mb*(x1+x2) - ma*(x2+x3)) / (2*(mb-ma)); 24 | 25 | yc = ((x1+x2)/2 - xc)/ma + (y1+y2)/2; 26 | 27 | r = sqrt(sq(x2-xc) + sq(y2-yc)); 28 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/clamp.cal: -------------------------------------------------------------------------------- 1 | { 2 | Map values from 0 to inf softly from 0 to 1 3 | } 4 | clamp(x) = x/2 * (sqrt(x*x+4) - x); 5 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/clouds.cal: -------------------------------------------------------------------------------- 1 | { 2 | Compute fractal clouds over image 3 | 4 | Greg Ward 11/1/95 5 | 6 | Needs also noise2.cal 7 | 8 | Usage: 9 | pcomb -f noise2.cal -f clouds.cal planet.pic > cloudy.pic 10 | 11 | Typically, this will be used to add clouds to Earth.pic or 12 | bigEarth.pic in the standard library distribution. 13 | } 14 | 15 | { Modify the following two constants to your liking: } 16 | 17 | cover_frac : 0.65; { average cloud cover (non-clear fraction) } 18 | 19 | cloud_refl : 0.7; { average cloud reflectance (always white) } 20 | 21 | { Leave the rest alone. } 22 | 23 | PI : 3.14159265358979323846; 24 | 25 | clouds(u,v,s) = if(s-.5, noise2(sin(2*PI/xmax*x)+13.5,sin(2*PI/ymax*y)-10.3), 26 | noise2(u/s,v/s)*s + clouds(u,v,2*s)); 27 | 28 | minres : if(xmax-ymax, ymax, xmax); 29 | 30 | clamp(x) : if(x, if(x-1, 1, x), 0); 31 | 32 | coef = clamp( 1 + 33 | (.5/sqrt(cover_frac)) * (clouds(x/minres, y/minres, 10/minres) - 1) 34 | ) ; 35 | 36 | cv = coef * cloud_refl; 37 | pv = 1 - coef; 38 | 39 | ro = cv + pv*ri(1); 40 | go = cv + pv*gi(1); 41 | bo = cv + pv*bi(1); 42 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/cmat.fmt: -------------------------------------------------------------------------------- 1 | XYZ2RGB: 2 | ${XYZ2RGB(0,0)} ${XYZ2RGB(1,0)} ${XYZ2RGB(2,0)} 3 | ${XYZ2RGB(0,1)} ${XYZ2RGB(1,1)} ${XYZ2RGB(2,1)} 4 | ${XYZ2RGB(0,2)} ${XYZ2RGB(1,2)} ${XYZ2RGB(2,2)} 5 | 6 | RGB2XYZ: 7 | ${RGB2XYZ(0,0)} ${RGB2XYZ(1,0)} ${RGB2XYZ(2,0)} 8 | ${RGB2XYZ(0,1)} ${RGB2XYZ(1,1)} ${RGB2XYZ(2,1)} 9 | ${RGB2XYZ(0,2)} ${RGB2XYZ(1,2)} ${RGB2XYZ(2,2)} 10 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/color.fmt: -------------------------------------------------------------------------------- 1 | Reflectance: ${ Y } 2 | (x,y): (${ x },${ y }) 3 | (u,v): (${ u },${ v }) 4 | 5 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/colorcal.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: colorcal.csh,v 1.1 2003/02/22 02:07:21 greg Exp $ 3 | # 4 | # Compute CIE chromaticities from spectral reflectance data 5 | # 6 | if ( $#argv < 1 ) goto userr 7 | set cal = . 8 | if ( $argv[1] == "-i" ) then 9 | if ( $#argv < 3 ) goto userr 10 | shift argv 11 | set illum=$argv[1] 12 | shift argv 13 | foreach r ( $argv[*] ) 14 | tabfunc -i rf < $r > /tmp/rf$$.cal 15 | rcalc -f $cal/cieresp.cal -f /tmp/rf$$.cal \ 16 | -e 'r=rf($1);ty=$2*triy($1)' \ 17 | -e '$1=ty;$2=$2*r*trix($1);$3=r*ty' \ 18 | -e '$4=$2*r*triz($1)' \ 19 | -e 'cond=if($1-359,831-$1,-1)' \ 20 | $illum | total -m >> /tmp/rc$$.dat 21 | end 22 | rm -f /tmp/rf$$.cal 23 | else 24 | foreach r ( $argv[*] ) 25 | rcalc -f $cal/cieresp.cal -e 'ty=triy($1);$1=ty' \ 26 | -e '$2=$2*trix($1);$3=$2*ty;$4=$2*triz($1)' \ 27 | -e 'cond=if($1-359,831-$1,-1)' $r \ 28 | | total -m >> /tmp/rc$$.dat 29 | end 30 | endif 31 | rcalc -e 'X=$2/$1;Y=$3/$1;Z=$4/$1' \ 32 | -e 'x=X/(X+Y+Z);y=Y/(X+Y+Z);u=4*X/(X+15*Y+3*Z);v=9*Y/(X+15*Y+3*Z)' \ 33 | -o $cal/color.fmt /tmp/rc$$.dat 34 | rm -f /tmp/rc$$.dat 35 | exit 0 36 | userr: 37 | echo "Usage: $0 [-i illum.dat] refl.dat .." 38 | exit 1 39 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/cubic.cal: -------------------------------------------------------------------------------- 1 | { 2 | Cubic Basis Functions 3 | } 4 | 5 | bezier(p1, p2, p3, p4, t) = p1 * (1+t*(-3+t*(3-t))) + 6 | p2 * 3*t*(1+t*(-2+t)) + 7 | p3 * 3*t*t*(1-t) + 8 | p4 * t*t*t ; 9 | 10 | hermite(p0, p1, r0, r1, t) = p0 * ((2*t-3)*t*t+1) + 11 | p1 * (-2*t+3)*t*t + 12 | r0 * (((t-2)*t+1)*t) + 13 | r1 * ((t-1)*t*t); 14 | 15 | bspline(pp, p0, p1, pn, t) = pp * (1/6+t*(-1/2+t*(1/2-1/6*t))) + 16 | p0 * (2/3+t*t*(-1+1/2*t)) + 17 | p1 * (1/6+t*(1/2+t*(1/2-1/2*t))) + 18 | pn * (1/6*t*t*t) ; 19 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/denom.cal: -------------------------------------------------------------------------------- 1 | frac(x,e) : x - floor(x+e); 2 | sq(x) : x * x; 3 | 4 | denom(x,e) : if( e-frac(x,e), 1, if( e-frac(1/x,e), floor(1/x+e), 5 | denom(frac(1/frac(1/x,e),e),e/sq(x)/sq(frac(1/x,e))) + 6 | floor(1/x+e)*denom(frac(1/x,e),e/sq(x)) ) ); 7 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/errfile.fmt: -------------------------------------------------------------------------------- 1 | rpict: ${nrs} rays, ${pct}% done after ${hrs} CPU hours 2 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/filt.cal: -------------------------------------------------------------------------------- 1 | { 2 | Filter Kernal set-up for pcomb. 3 | 4 | 5/22/92 Greg Ward 5 | 6 | Usage: 7 | pcomb -x xres -y yres -f kern.cal -f filt.cal input.pic > output.pic 8 | 9 | The file "kern.cal" must define the constant function kern(x,y), which 10 | describes how the kernal behaves as a function of offset in x and y 11 | (measured in fractional pixels in the destination image). 12 | } 13 | hmag : xres/xmax; 14 | vmag : yres/ymax; 15 | step : (hmag+vmag)/8; 16 | hsum(xmin,xmax,y) : if(step/2+xmin-xmax, 0, 17 | kern(xmin+step/2,y) + hsum(xmin+step,xmax,y)); 18 | sum(xmin,ymin,xmax,ymax) : if(step/2+ymin-ymax, 0, 19 | hsum(xmin,xmax,ymin+step/2) + sum(xmin,ymin+step,xmax,ymax)); 20 | k(ox,oy) : sum(ox-hmag/2,oy-vmag/2,ox+hmag/2,oy+vmag/2); 21 | K00 : k(-1,-1); K01 : k(-1, 0); K02 : k(-1, 1); 22 | K10 : k( 0,-1); K11 : k( 0, 0); K12 : k( 0, 1); 23 | K20 : k( 1,-1); K21 : k( 1, 0); K22 : k( 1, 1); 24 | sumtotal : K00+K01+K02+K10+K11+K12+K20+K21+K22; 25 | 26 | f(p) = ( K00*p(1,-1,-1) + K01*p(1,-1, 0) + K02*p(1,-1, 1) + 27 | K10*p(1, 0,-1) + K11*p(1, 0, 0) + K12*p(1, 0, 1) + 28 | K20*p(1, 1,-1) + K21*p(1, 1, 0) + K22*p(1, 1, 1) ) / sumtotal; 29 | 30 | ro = f(ri); 31 | go = f(gi); 32 | bo = f(bi); 33 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/fog.cal: -------------------------------------------------------------------------------- 1 | { 2 | BAD fog simulation effect using a converted z-file, eg: 3 | 4 | pvalue -r -df -b -h `getinfo -d < scene.pic` scene.z | \ 5 | pcomb -e VIS:20 -f fog.cal scene.pic - > foggy.pic 6 | 7 | The constant VIS must be set to the visibility distance, 8 | ie. the distance at which half the contrast is lost. 9 | 10 | Substitute a local brightness model for fog_v to improve 11 | the effect. 12 | } 13 | 14 | dist = gi(2); { distance given by second file } 15 | 16 | fog_v : .5; { fog particles are uniform grey } 17 | 18 | prob = 1 - 2^-(dist/VIS); { probability of intercepting fog particle } 19 | 20 | fog(v) = prob*fog_v + (1-prob)*v; 21 | 22 | ro = fog(ri(1)); 23 | go = fog(gi(1)); 24 | bo = fog(bi(1)); 25 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/gaussian.cal: -------------------------------------------------------------------------------- 1 | { 2 | Kernel for Gaussian filter 3 | } 4 | kern(x,y) : exp(-(x*x+y*y)/.25); 5 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/glrsrc.cal: -------------------------------------------------------------------------------- 1 | SDx(x):select(x,-0.08,0.1); 2 | SDy(x):select(x,0.996795,0.994987); 3 | SDz(x):select(x,0,0); 4 | I(x):select(x,9.039907,7.036084); 5 | N:I(0); 6 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/graypatch.cal: -------------------------------------------------------------------------------- 1 | { 2 | Generate script of 11x8 sample set of gray patches 3 | on 2000x1600 pixel canvas. 4 | Input is column and row number (starting from 0) 5 | } 6 | col = $1; { input position } 7 | row = $2; 8 | 9 | mingray = 0; { reassign if desired } 10 | 11 | GAMMA : 2.2; 12 | NCOLS : 11; 13 | NROWS : 8; 14 | XRES : 2000; 15 | YRES : 1600; 16 | MARGIN : 5; 17 | xpatch : floor((XRES-MARGIN)/NCOLS) - MARGIN; 18 | ypatch : floor((YRES-MARGIN)/NROWS) - MARGIN; 19 | textheight : floor(ypatch/7); 20 | xpos = MARGIN + col*(xpatch + MARGIN); 21 | ypos = MARGIN + row*(ypatch + MARGIN); 22 | patchgray = mingray + row*NCOLS + col; 23 | patchvalue = ((patchgray+.5)/256)^GAMMA; 24 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/hermite.cal: -------------------------------------------------------------------------------- 1 | hermite(p0,p1,r0,r1,t) = p0 * ((2*t-3)*t*t+1) + 2 | p1 * (-2*t+3)*t*t + 3 | r0 * (((t-2)*t+1)*t) + 4 | r1 * ((t-1)*t*t); 5 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/illum.fmt: -------------------------------------------------------------------------------- 1 | Photopic: ${ Lp } Scotopic: ${ Ls } S/P: ${Ls/Lp} 2 | (x,y): (${x_k},${y_k}) 3 | (x10,y10): (${x10_k},${y10_k}) 4 | (u,v): (${u_k},${v_k}) 5 | Correlated Color Temperature: ${cct} Kelvin 6 | Color Rendering Index: ${cri} 7 | 8 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/illumcal.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: illumcal.csh,v 1.1 2003/02/22 02:07:21 greg Exp $ 3 | # 4 | # Compute color characteristics of light sources 5 | # 6 | # Each input file should contain evenly-spaced pairs of wavelength (nm) and 7 | # power values (watts/nm), one per line. 8 | # 9 | if ( $#argv < 1 ) then 10 | echo Usage: $0 illum.dat .. 11 | exit 1 12 | endif 13 | set cal = . 14 | foreach illum ($*) 15 | set spc=(`sed -e 1d -e 's/^[ ]*\([1-9][0-9]*\)[ ].*$/\1/' -e 3q $illum`) 16 | rcalc -f $cal/cieresp.cal -f $cal/stdrefl.cal -e "intvl=abs($spc[2]-$spc[1])" \ 17 | -f $cal/conv1.cal $illum | total >> /tmp/il$$.dat 18 | end 19 | rcalc -f $cal/conv2.cal -f $cal/cct.cal -f $cal/cri.cal \ 20 | -o $cal/illum.fmt /tmp/il$$.dat 21 | rm -f /tmp/il$$.dat 22 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/landscape.cal: -------------------------------------------------------------------------------- 1 | { 2 | A set of randomly located points at known positions to be 3 | interpolated by gensurf. 4 | } 5 | { The following are our known point values } 6 | point(i,j) = select( i*3+j+1, 7 | 2, 1, 5, { x0, y0, z0 } 8 | 3.7, 1, 1, 9 | 4.2, 2.5, 2, 10 | 3,7, 2.5, 4, 11 | 2, 2.5, 3, 12 | 2, 3.5, 2 13 | ); 14 | 15 | Npoints = 6; { Number of points in above } 16 | 17 | sq(x) : x*x; 18 | 19 | Recip(x) : if( x, 1/x, 1e10 ); 20 | 21 | Sum(f,x,y,n) = if(n-.5, f(x,y,n-1)+Sum(f,x,y,n-1), 0); 22 | 23 | weight(x,y,i) = Recip(sq(x-point(i,0)) + sq(y-point(i,1))); 24 | 25 | wval(x,y,i) = weight(x,y,i) * point(i,2); 26 | 27 | sheight(x,y) = Sum(wval,x,y,Npoints) / Sum(weight,x,y,Npoints); 28 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/lumdist.cal: -------------------------------------------------------------------------------- 1 | { 2 | Conversion from zonal lumens to watts/steradian 3 | } 4 | 5 | lum2watt(t0,t1,l) = l / 683 / (omega(t1)-omega(t0)) ; 6 | 7 | omega(d) = 2*PI * (1-cos(d*PI/180)) ; 8 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/mat3.cal: -------------------------------------------------------------------------------- 1 | { 2 | 3x3 Matrix operations 3 | } 4 | 5 | MatDot(A,B,i,j) : A(i,0)*B(0,j) + A(i,1)*B(1,j) + A(i,2)*B(2,j); 6 | 7 | i3(i) : if(i-2.5, i-3, i); 8 | 9 | MinorDet(M,i,j) : M(i3(i+1),i3(j+1))*M(i3(i+2),i3(j+2)) - 10 | M(i3(i+1),i3(j+2))*M(i3(i+2),i3(j+1)); 11 | 12 | Det(M) : M(0,0)*MinorDet(M,0,0) + 13 | M(0,1)*MinorDet(M,0,1) + 14 | M(0,2)*MinorDet(M,0,2); 15 | 16 | Inv(M,i,j) : MinorDet(M,j,i) / Det(M); 17 | 18 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/noise.cal: -------------------------------------------------------------------------------- 1 | frac(x)=x-floor(x); 2 | 3 | hermite(p0,p1,r0,r1,t) = p0 * ((2*t-3)*t*t+1) + 4 | p1 * (-2*t+3)*t*t + 5 | r0 * (((t-2)*t+1)*t) + 6 | r1 * ((t-1)*t*t); 7 | 8 | rand2a(x) = 1-2*rand(.69692*x); 9 | rand2b(x) = 1-2*rand(.05393*x); 10 | 11 | noise(x,y) = noise_1(floor(x),frac(x),ceil(x)); 12 | 13 | noise_1(xl,xd,xu) = hermite( 14 | rand2a(xl), 15 | rand2a(xu), 16 | rand2b(xl), 17 | rand2b(xu), 18 | xd); 19 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/noise2.cal: -------------------------------------------------------------------------------- 1 | frac(x)=x-floor(x); 2 | 3 | hermite(p0,p1,r0,r1,t) = p0 * ((2*t-3)*t*t+1) + 4 | p1 * (-2*t+3)*t*t + 5 | r0 * (((t-2)*t+1)*t) + 6 | r1 * ((t-1)*t*t); 7 | 8 | rand2a(x,y) = 1-2*rand(.69692*x+.35084*y); 9 | rand2b(x,y) = 1-2*rand(.05393*x+.96196*y); 10 | rand2c(x,y) = 1-2*rand(.04234*x+.46180*y); 11 | 12 | noise2(x,y) = noise_2( floor(x),frac(x),ceil(x), 13 | floor(y),frac(y),ceil(y) ); 14 | 15 | noise_2(xl,xd,xu,yl,yd,yu) = 16 | hermite( 17 | hermite(rand2c(xl,yl), 18 | rand2c(xu,yl), 19 | rand2a(xl,yl), 20 | rand2a(xu,yl), 21 | xd), 22 | hermite(rand2c(xl,yu), 23 | rand2c(xu,yu), 24 | rand2a(xl,yu), 25 | rand2a(xu,yu), 26 | xd), 27 | (1-xd)*rand2b(xl,yl)+ 28 | xd*rand2b(xu,yl), 29 | (1-xd)*rand2b(xl,yu)+ 30 | xd*rand2b(xu,yu), 31 | yd); 32 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/norm.cal: -------------------------------------------------------------------------------- 1 | { 2 | Normal Distribution Functions 3 | 4 | 10/20/87 5 | 6 | Z(u) - normal probability density function 7 | 8 | Q(u) - Z(u) integrated from u to infinity 9 | 10 | u(p) - u for known value p = Q(u) 11 | } 12 | 13 | NORMF : 1/sqrt(2*PI) ; 14 | 15 | Z(u) = NORMF * exp(-u*u/2) ; 16 | 17 | Q(u) = if( u, Q1(u), 1-Q1(-u) ) ; 18 | 19 | Q1(u) = Z(u) * Q2(1/(1+.2316419*u)) ; 20 | 21 | Q2(t) = t*(.31938153+t*(-.356563782+t*(1.781477937+ 22 | t*(-1.821255978+t*1.330274429)))) ; 23 | 24 | u(p) = if( .5-p, u1(p), -u1(1-p) ) ; 25 | 26 | u1(p) = u2(sqrt(log(1/p/p))) ; 27 | 28 | u2(t) = t - (2.515517+t*(.802853+t*.010328))/ 29 | (1+t*(1.432788+t*(.189269+t*.001308))) ; 30 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/normcomp.cal: -------------------------------------------------------------------------------- 1 | { 2 | Compute overlap between two normal distribution functions, 3 | defined by mean1, mean2, stdev1 and stdev2. 4 | 5 | 2/10/95 Greg Ward 6 | 7 | relies on gauss.cal and norm.cal 8 | } 9 | min(a,b) : if(a-b, b, a); 10 | max(a,b) : if(a-b, a, b); 11 | 12 | Z1(u) = Z((u - mean1)/stdev1) / stdev1; 13 | Z2(u) = Z((u - mean2)/stdev2) / stdev2; 14 | 15 | f(u) = min(Z1(u),Z2(u)); 16 | 17 | xmin = min(mean1-3*stdev1, mean2-3*stdev2); 18 | xmax = max(mean1+3*stdev1, mean2+3*stdev2); 19 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/patch3w.cal: -------------------------------------------------------------------------------- 1 | { 2 | Uniform Rational Patch 3 | 4 | 02Mar90 5 | 6 | Define Px(i,j), Py(i,j), Pz(i,j) and W(i,j), nrows, ncols 7 | } 8 | { default basis functions } 9 | br(a,b,c,d,s) = b3(a,b,c,d,s); 10 | bc(a,b,c,d,t) = b3(a,b,c,d,t); 11 | b3(a,b,c,d,p) = bezier(a,b,c,d,p); 12 | { default patch interpolation } 13 | rint = interpolate; 14 | cint = interpolate; 15 | interpolate = 1; 16 | 17 | x(s,t) = patch(s,t,Px); 18 | y(s,t) = patch(s,t,Py); 19 | z(s,t) = patch(s,t,Pz); 20 | 21 | patch(s,t,p) = bc(P2(s,c0(t)+1,p), P2(s,c0(t)+2,p), 22 | P2(s,c0(t)+3,p), P2(s,c0(t)+4,p), cf(t)) / 23 | bc(W2(s,c0(t)+1), W2(s,c0(t)+2), 24 | W2(s,c0(t)+3), W2(s,c0(t)+4), cf(t)) ; 25 | 26 | P2(s,j,p) = br(W(1+r0(s),j)*p(1+r0(s),j), W(2+r0(s),j)*p(2+r0(s),j), 27 | W(3+r0(s),j)*p(3+r0(s),j), W(4+r0(s),j)*p(4+r0(s),j), rf(s)) ; 28 | 29 | W2(s,j) = br(W(1+r0(s),j), W(2+r0(s),j), W(3+r0(s),j), W(4+r0(s),j), rf(s)) ; 30 | 31 | r0(s) = rmult*floor(clamp(s)*npr); 32 | rf(s) = s*npr - floor(clamp(s)*npr); 33 | c0(t) = cmult*floor(clamp(t)*npc); 34 | cf(t) = t*npc - floor(clamp(t)*npc); 35 | 36 | rmult = if(rint, 4, 1); 37 | cmult = if(cint, 4, 1); 38 | npr = if(rint, nrows/4, nrows-3); 39 | npc = if(cint, ncols/4, ncols-3); 40 | 41 | clamp(p) = if(p, if(1-p, p, .9999999), .0000001); 42 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/peerless.cal: -------------------------------------------------------------------------------- 1 | { 2 | Peerless' brightness mapping function 3 | 4 | Mapping of Luminance to Brightness for CRT display. 5 | Hand this file to pcomb(1) with the -f option. 6 | The picture file should have been run previously through 7 | the automatic exposure procedure of pfilt(1), and 8 | pcomb should also be given -o option. Like so: 9 | 10 | pfilt input.pic | pcomb -f peerless.cal -o - > output.pic 11 | 12 | } 13 | La_w : 0.5/le(1) * WE; 14 | Lmax_v : 120; 15 | La_v : Lmax_v/2; 16 | b(La) : .338*La^.034; 17 | k(La) : -1.5*log10(La) + 6.1; 18 | B_w(L) : k(La_w) * L^b(La_w); 19 | L_w(B) : (B/k(La_w))^(1/b(La_w)); 20 | B_v(L) : k(La_v) * L^b(La_v); 21 | L_v(B) : (B/k(La_v))^(1/b(La_v)); 22 | Bmax_w : B_w(3*La_w); 23 | Bmax_v : B_v(Lmax_v); 24 | 25 | lum_w = li(1)*WE; 26 | 27 | lum_v = L_v(Bmax_v/Bmax_w*B_w(lum_w)); 28 | 29 | mult = WE/Lmax_v*lum_v/lum_w; 30 | 31 | ro = mult*ri(1); 32 | go = mult*gi(1); 33 | bo = mult*bi(1); 34 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/picdiff.cal: -------------------------------------------------------------------------------- 1 | { 2 | Compute difference between luminance of two images. 3 | Display towards red where first image is brighter, 4 | and towards blue where second image is brighter. 5 | 6 | 29 August 1991 7 | } 8 | l1=li(1); l2=li(2); 9 | avg=(l1+l2)/2; 10 | dif=(l1-l2)/2; 11 | ro=avg+dif; 12 | go=avg-dif*dif/2; 13 | bo=avg-dif; 14 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/printwarp.cal: -------------------------------------------------------------------------------- 1 | { 2 | Warp response function for printing to avoid 3 | contrast loss at low end. 4 | 5 | 9/12/97 GWL 6 | } 7 | PrintPivot: .05; { print pivot point } 8 | OrigPivot: .025; { original pivot point } 9 | 10 | map(v) = if( v - OrigPivot, 11 | (v-OrigPivot)*((1-PrintPivot)/(1-OrigPivot)) + PrintPivot, 12 | v*(PrintPivot/OrigPivot) ); 13 | 14 | ro = map(ri(1)); 15 | go = map(gi(1)); 16 | bo = map(bi(1)); 17 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/quadratic.cal: -------------------------------------------------------------------------------- 1 | { 2 | quadratic.cal - solve quadratic equation: 3 | 4 | Ax^2 + Bx + C = 0 5 | } 6 | 7 | determ = B*B - 4*A*C; 8 | 9 | root1 = (-B + sqrt(determ))/2/A; 10 | 11 | root2 = (-B - sqrt(determ))/2/A; 12 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/reinhard.cal: -------------------------------------------------------------------------------- 1 | { 2 | Erik Reinhard's simple global tone-operator 3 | } 4 | { Lwht = 1e10; { set on command line } } 5 | { Lavg = .5; { set on command line } } 6 | { a : 0.18; { set on command line } } 7 | Lwhite : a/Lavg*Lwht; 8 | L = a/Lavg*li(1); 9 | sq(x) : x*x; 10 | Ld = L*(1+L/sq(Lwhite))/(1+L); 11 | mult = Ld/li(1); 12 | ro = ri(1)*mult; 13 | go = gi(1)*mult; 14 | bo = bi(1)*mult; 15 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/reinhard.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # 3 | # Apply Reinhard's simple tone operator 4 | # 5 | if ($#argv != 3) then 6 | echo Usage: $0 key input.hdr output.tif 7 | exit 1 8 | endif 9 | set lavg=`pvalue -h -H -b -d $argv[2]:q | total -p -m` 10 | set lmax=`pextrem $argv[2]:q | sed -n '2s/^[1-9][0-9]* [1-9][0-9]* [^ ]* \([^ ]*\) .*$/\1/p'` 11 | pcomb -e "Lavg:$lavg;Lwht:$lmax;a:$argv[1]" -f reinhard.cal $argv[2]:q \ 12 | | ra_tiff - $argv[3]:q 13 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/rgb.cal: -------------------------------------------------------------------------------- 1 | red(x, y) : 1.73*x - 0.48*y - 0.26*(1 - x - y) ; 2 | green(x, y) : -0.81*x + 1.65*y - 0.02*(1 - x - y) ; 3 | blue(x, y) : 0.08*x - 0.17*y + 1.28*(1 - x - y) ; 4 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/root.cal: -------------------------------------------------------------------------------- 1 | { 2 | root.cal - calculate zeroes of functions using Newton's method. 3 | 4 | 2/3/88 5 | } 6 | 7 | FTINY : 1e-12; 8 | 9 | root(f, x0) = root2(f, x0, x0-f(x0)/lim(f1(f,x0)), nit); 10 | 11 | root2(f, x0, x1, i) = if(i, 12 | if(err-abs(x1-x0), 13 | x1, 14 | root2(f,x1,x1-f(x1)/lim(f1(f,x1)),i-1)), 15 | 0); 16 | 17 | abs(x) = if(x, x, -x); 18 | lim(x) = if(x, max(x,err), -max(-x,err)); 19 | max(a,b) = if(a-b, a, b); 20 | 21 | f1(f,x) = (f(x+FTINY)-f(x-FTINY))/FTINY/2; { numerical derivative } 22 | 23 | err = 1e-6; 24 | nit = 100; 25 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/screen.cal: -------------------------------------------------------------------------------- 1 | { 2 | Uses gensurf to compute CRT geometry based on spherical assumption. 3 | 4 | Author: 5 | Greg Ward 11/13/95 6 | 7 | Input: 8 | w: screen width (total) 9 | h: screen height (total) 10 | d: displacement from center tangent at max. right or left 11 | 12 | Usage: 13 | gensurf mat name 'x(s,t)' 'y(s,t)' 'z(s,t)' N M -s \ 14 | -e 'w:{width};h:{height};d:{depth}' -f screen.cal 15 | 16 | Output is oriented vertically, with the lower left corner at 17 | (x,y,z)=(0,0,0), the lower right at (w,0,0), the upper right 18 | at (w,0,h), and the screen bulge in the negative y direction. 19 | Surface normals face negative y, also. 20 | } 21 | { compute sphere radius } 22 | r : d/2 + w*w/8/d; 23 | { compute x and z } 24 | x(s,t) = w*s; 25 | z(s,t) = h*t; 26 | 27 | sq(x) : x*x; 28 | { compute maximum depth (y) value } 29 | dmax : sqrt(r*r - sq(w/2) - sq(h/2)); 30 | { compute y } 31 | y(s,t) = dmax - sqrt(r*r - sq(w*s-w/2) - sq(h*t-h/2)); 32 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/sf.cal: -------------------------------------------------------------------------------- 1 | { 2 | Calculation of contrast-based scalefactor 3 | 4 | 8/17/93 5 | 6 | Input: ex = picture exposure 7 | or: Lwa = world adaptation luminance 8 | Output: sf = scalefactor for display 9 | adj = corresponding exposure adjustment 10 | 11 | Optional Inputs: Ldmax = maximum display luminance 12 | Lda = display adaptation luminance 13 | } 14 | Lwa = WE*.5/ex; 15 | Ldmax = 120; 16 | Lda = Ldmax/2; 17 | 18 | sf = ((1.219 + Lda^.4)/(1.219 + Lwa^.4))^2.5 / Ldmax; 19 | 20 | adj = WE*sf/ex; 21 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/sphsamp.cal: -------------------------------------------------------------------------------- 1 | { 2 | Uniform sampling of sphere 3 | 4 | Define: 5 | N - total number of samples 6 | i - sample number 7 | 8 | Output: 9 | theta - polar angle (degrees) 10 | phi - azimuthal angle (degrees) 11 | Dx - X-component of direction vector 12 | Dy - Y-component of direction vector 13 | Dz - Z-component of direction vector 14 | } 15 | 16 | DEGREE : PI/180; 17 | bound(a,x,b) : if(a-x, a, if(x-b, b, x)); 18 | Acos(x) : acos(bound(-1,x,1)); 19 | Sqrt(x) : if(x, sqrt(x), 0); 20 | 21 | nalt = floor(sqrt(2/PI*N) + .5); 22 | nazi = floor(PI/2*nalt + .5); 23 | 24 | cond = nalt*nazi-.9999 - i; 25 | 26 | ialt = floor(i/nazi); 27 | iazi = i - ialt*nazi; 28 | 29 | ralt = (ialt + rand(i*.328+.112))/nalt; 30 | razi = (iazi + rand(i*-.731+.318))/nazi; 31 | 32 | rtheta = Acos(Dz); 33 | rphi = 2*PI*razi; 34 | Dxy = Sqrt(1 - Dz*Dz); 35 | theta = rtheta/DEGREE; 36 | phi = rphi/DEGREE; 37 | Dx = Dxy*cos(rphi); 38 | Dy = Dxy*sin(rphi); 39 | Dz = 1 - 2*ralt; 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/spline.cal: -------------------------------------------------------------------------------- 1 | { 2 | Calculation of view parameters for walk-throughs. 3 | Uses Catmull-Rom spline. 4 | 5 | 09Feb90 Greg Ward 6 | 7 | Define: 8 | T(i) - time between keyframe i and i-1 9 | Input: 10 | t - time 11 | Output: 12 | s(f) - spline value for f at t where f(i) is value at T(i) 13 | } 14 | 15 | 16 | or(a,b) : if(a, a, b); 17 | min(a,b) : if(a-b, b, a); 18 | max(a,b) : if(a-b, a, b); 19 | 20 | hermite(p0,p1,r0,r1,t) : p0 * ((2*t-3)*t*t+1) + 21 | p1 * (-2*t+3)*t*t + 22 | r0 * (((t-2)*t+1)*t) + 23 | r1 * ((t-1)*t*t); 24 | Ttot : sum(T,T(0)); 25 | 26 | sum(f,n) : if(n-.5, f(n)+sum(f,n-1), 0); 27 | 28 | tfrac = (t-sum(T,below))/T(above); 29 | 30 | upper(s,i) = if(or(i-T(0)+.5,s+T(i)-t), i, upper(s+T(i),i+1)); 31 | 32 | below = above-1; 33 | above = max(upper(0,1),2); 34 | below2 = max(below-1,1); 35 | above2 = min(above+1,T(0)); 36 | 37 | s(f) = hermite(f(below), f(above), 38 | (f(above)-f(below2))/2, (f(above2)-f(below))/2, 39 | tfrac); 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/sun.cal: -------------------------------------------------------------------------------- 1 | {* 2 | * SOLAR CALCULATIONS 3 | * 4 | * 7/25/84 5 | * 10/10/86 6 | * 7 | *} 8 | 9 | RLAT = 0.66; {* Site latitude (radians) *} 10 | 11 | RLON = 2.13; {* Site longitude (radians) *} 12 | 13 | RSM = 120 * PI/180; {* Standard meridian (radians) *} 14 | 15 | 16 | stadj(jd) {* solar time adjustment (hours) *} 17 | { jd is days into year } 18 | = 19 | 0.170 * sin( 4*PI/373 * (jd - 80) ) - 20 | 0.129 * sin( 2*PI/355 * (jd - 8 ) ) + 21 | 12*(RSM-RLON)/PI 22 | ; 23 | 24 | 25 | sdec(jd) {* solar declination angle (radians) *} 26 | { jd is days into year } 27 | = 28 | 0.4093 * sin( 2*PI/368 * (jd - 81) ) 29 | ; 30 | 31 | 32 | salt(sd, st) {* solar altitude (radians) *} 33 | { sd is solar declination, st is solar time (hours) } 34 | = 35 | asin( sin(RLAT) * sin(sd) - cos(RLAT) * cos(sd) * 36 | cos(st*PI/12) ) 37 | ; 38 | 39 | 40 | sazi(sd, st) {* the solar azimuth (radians) *} 41 | { sd is solar declination, st is solar time (hours) } 42 | = 43 | -atan2( cos(sd) * sin(st*PI/12), 44 | -cos(RLAT)*sin(sd) - 45 | sin(RLAT)*cos(sd)*cos(st*PI/12) ) 46 | ; 47 | 48 | 49 | SAZI = sazi(SDEC, STIME) * 180/PI; 50 | 51 | SALT = salt(SDEC, STIME) * 180/PI; 52 | 53 | SDEC = sdec(JDATE); 54 | 55 | STIME = TIME + stadj(JDATE); 56 | 57 | JDATE = DAY + select(MONTH,0,31,59,90,120,151,181,212,243,273,304,334); 58 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/suncal.fmt: -------------------------------------------------------------------------------- 1 | Julian Date: ${JDATE} days 2 | Solar Time: ${STIME} hours 3 | Solar Altitude: ${ SALT} degrees 4 | Solar Azimuth: ${ SAZI} degrees 5 | 6 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/test.cal: -------------------------------------------------------------------------------- 1 | inrng(a,b,e)=if(a-b+e,b-a+e,-1); 2 | sqt(x,g,e)=if(inrng(x,g*g,e),g,sqt(x,g*2*x/(x+g*g),e)); 3 | fac(n)=if(n-.5,n*fac(n-1),1); 4 | or(a,b)=if(a,1,b); 5 | and(a,b)=if(a,b,-1); 6 | not(a)=if(a,-1,1); 7 | sum(a,s,n)=if(n-.5,f(a)+sum(a+s,s,n-1),0); 8 | integ(a,b,n)=sum(a+(b-a)/n/2,(b-a)/n,n)*(b-a)/n; 9 | pi=3.141592653589793; 10 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/testimg.cal: -------------------------------------------------------------------------------- 1 | { 2 | Create a calibration image using pcomb. 3 | Run through log scales in each primary and grey from 1/100 to 1. 4 | Creates eight rows of 10 color squares each. 5 | First two rows are greyscale. 6 | Next rows run through red, green, blue, magenta, yellow and cyan. 7 | } 8 | xres : 512; { settable x resolution } 9 | yres : xres * .8; { for square patches } 10 | gap : xres/128; { gap between patches } 11 | pwidth : (xres-gap)/10 - gap; { patch width } 12 | pheight : (yres-gap)/8 - gap; { patch height } 13 | gapgrey : 1; { value for gap pixels } 14 | minv : 0.01; { minimum value } 15 | scale(x) : minv^(1-x); 16 | or(a,b) : if( a, a, b ); 17 | and(a,b) : if( a, b, a ); 18 | mod(n,d) : n - floor(n/d)*d; 19 | 20 | ingap = if(or(gap-mod(x,pwidth+gap),gap-mod(y,pheight+gap)), 1, -1); 21 | 22 | ro = if(ingap, gapgrey, redval); 23 | go = if(ingap, gapgrey, grnval); 24 | bo = if(ingap, gapgrey, bluval); 25 | 26 | { Patches are numbered starting from 0 at the lower left, incr. right then up } 27 | 28 | n = floor(x/(pwidth+gap)) + 10*floor(y/(pheight+gap)); 29 | 30 | redval = if(19.5-n, scale(n/19), 31 | select(floor((n-10)/10), scale((n-20)/9), 0, 0, 32 | scale((n-50)/9), scale((n-60)/9), 0)); 33 | grnval = if(19.5-n, scale(n/19), 34 | select(floor((n-10)/10), 0, scale((n-30)/9), 0, 35 | 0, scale((n-60)/9), scale((n-70)/9))); 36 | bluval = if(19.5-n, scale(n/19), 37 | select(floor((n-10)/10), 0, 0, scale((n-40)/9), 38 | scale((n-50)/9), 0, scale((n-70)/9))); 39 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/trans.cal: -------------------------------------------------------------------------------- 1 | sq(x) : x*x; 2 | n = 1.52; { index of refraction } 3 | rn = sq((1-n)/(1+n)); { reflectivity at normal incidence } 4 | tn(Tn) = (sqrt(sq(sq(1-rn))+4*sq(rn*Tn))-sq(1-rn)) / 2/rn/rn/Tn; 5 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/trans2.cal: -------------------------------------------------------------------------------- 1 | { 2 | These formulas compute the index of refraction and 3 | normal transmission for a pane of glass given the 4 | measured normal transmittance and reflectance values, 5 | Tn and Rn, respectively. 6 | 7 | These formulas are approximate -- the exact solution 8 | involves a quartic equation and seemed more trouble 9 | than it was worth. If you know the index of refraction, 10 | you are better off with the formula in trans.cal. 11 | 12 | Oct. 2002 Greg Ward 13 | } 14 | { formula for normal transmission } 15 | tn = Tn / (1 - Rn); 16 | F = Rn / (1 + tn*tn); 17 | n = (1 + sqrt(F)) / (1 - sqrt(F)); 18 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/trix.dat: -------------------------------------------------------------------------------- 1 | 380 0.0014 2 | 390 0.0042 3 | 400 0.0143 4 | 410 0.0435 5 | 420 0.1344 6 | 430 0.2839 7 | 440 0.3483 8 | 450 0.3362 9 | 460 0.2908 10 | 470 0.1954 11 | 480 0.0956 12 | 490 0.032 13 | 500 0.0049 14 | 510 0.0093 15 | 520 0.0633 16 | 530 0.1655 17 | 540 0.2904 18 | 550 0.4334 19 | 560 0.5945 20 | 570 0.7621 21 | 580 0.9163 22 | 590 1.0263 23 | 600 1.0622 24 | 610 1.0026 25 | 620 0.8544 26 | 630 0.6424 27 | 640 0.4479 28 | 650 0.2835 29 | 660 0.1649 30 | 670 0.0874 31 | 680 0.0468 32 | 690 0.0227 33 | 700 0.0114 34 | 710 0.0058 35 | 720 0.0029 36 | 730 0.0014 37 | 740 0.0007 38 | 750 0.0003 39 | 760 0.0002 40 | 770 0.0001 41 | 780 0 42 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/triy.dat: -------------------------------------------------------------------------------- 1 | 380 0 2 | 390 0.0001 3 | 400 0.0004 4 | 410 0.0012 5 | 420 0.004 6 | 430 0.0116 7 | 440 0.023 8 | 450 0.038 9 | 460 0.06 10 | 470 0.091 11 | 480 0.139 12 | 490 0.208 13 | 500 0.323 14 | 510 0.503 15 | 520 0.71 16 | 530 0.862 17 | 540 0.954 18 | 550 0.995 19 | 560 0.995 20 | 570 0.952 21 | 580 0.87 22 | 590 0.757 23 | 600 0.631 24 | 610 0.503 25 | 620 0.381 26 | 630 0.265 27 | 640 0.175 28 | 650 0.107 29 | 660 0.061 30 | 670 0.032 31 | 680 0.017 32 | 690 0.0082 33 | 700 0.0041 34 | 710 0.0021 35 | 720 0.001 36 | 730 0.0005 37 | 740 0.0002 38 | 750 0.0001 39 | 760 0.0001 40 | 770 0 41 | 780 0 42 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/triz.dat: -------------------------------------------------------------------------------- 1 | 380 0.0065 2 | 390 0.0201 3 | 400 0.0679 4 | 410 0.2074 5 | 420 0.6456 6 | 430 1.3856 7 | 440 1.7471 8 | 450 1.7721 9 | 460 1.6692 10 | 470 1.2876 11 | 480 0.813 12 | 490 0.4652 13 | 500 0.272 14 | 510 0.1582 15 | 520 0.0782 16 | 530 0.0422 17 | 540 0.0203 18 | 550 0.0087 19 | 560 0.0039 20 | 570 0.0021 21 | 580 0.0017 22 | 590 0.0011 23 | 600 0.0008 24 | 610 0.0003 25 | 620 0.0002 26 | 630 0 27 | 640 0 28 | 650 0 29 | 660 0 30 | 670 0 31 | 680 0 32 | 690 0 33 | 700 0 34 | 710 0 35 | 720 0 36 | 730 0 37 | 740 0 38 | 750 0 39 | 760 0 40 | 770 0 41 | 780 0 42 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/tumblin.cal: -------------------------------------------------------------------------------- 1 | { 2 | Mapping of Luminance to Brightness for CRT display. 3 | Hand this file to pcomb(1) with the -f option. 4 | The picture file should have been run previously through 5 | the automatic exposure procedure of pfilt(1), and 6 | pcomb should not be given -o option. Like so: 7 | 8 | pfilt input.pic | pcomb -f tumblin.cal - > output.pic 9 | 10 | Formulas adapted from Stevens by Tumblin and Rushmeier. 11 | 12 | 29 May 1993 13 | } 14 | PI : 3.14159265358979323846; { Hmm, looks familiar... } 15 | LAMBERT : 1e4/PI/WE; { Number of watts/sr/m2 in a Lambert } 16 | DL : .027; { Maximum display luminance (Lamberts) } 17 | AL : .5/le(1)*10^.84/LAMBERT; { Adaptation luminance (from exposure) } 18 | 19 | sq(x) : x*x; 20 | aa(v) : .4*log10(v) + 2.92; 21 | bb(v) : -.4*sq(log10(v)) + -2.584*log10(v) + 2.0208; 22 | 23 | power : aa(AL)/aa(DL); 24 | 25 | mult = li(1)^(power-1) * 26 | ( LAMBERT^-power/DL * 10^((bb(AL)-bb(DL))/aa(DL)) / le(1) ); 27 | 28 | ro = mult*ri(1); 29 | go = mult*gi(1); 30 | bo = mult*bi(1); 31 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/view.fmt: -------------------------------------------------------------------------------- 1 | VIEW= -vt$(vt) -vp ${vpx} ${vpy} ${vpz} -vd ${vdx} ${vdy} ${vdz} -vu ${vux} ${vuy} ${vuz} -vh ${vh} -vv ${vv} -vo ${vo} -va ${va} -vs ${vs} -vl ${vl} 2 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/vl.cal: -------------------------------------------------------------------------------- 1 | { 2 | Calculate VL (visibility level) 3 | 4 | 5/26/94 5 | 6 | Taken from Bailey, Clear, Berman paper, JIES Summer 1993 7 | } 8 | 9 | { User must set: 10 | 11 | L Adaptation luminance in cd/m^2 12 | dL Difference in luminance between background and foreground 13 | S Target size in minutes of arc 14 | 15 | Function computes: 16 | 17 | dLt Visible luminance threshold 18 | Sr Size below which Ricco's law applies 19 | VL Visibility level 20 | } 21 | 22 | sq(x) : x*x; 23 | 24 | fit(a1,a2,n) = a1 * (L^(1/n) + a2)^(n/2); 25 | 26 | A = fit(.40743,1.6074,2.8723); 27 | B = fit(.0840155,.43369,1.7188); 28 | 29 | Sr = (4 + 2*L)/(1 + L); 30 | 31 | dLt = if(Sr-S, sq(A/S), sq((B*(S-Sr)+A)/S)); 32 | 33 | VL = dL / dLt; 34 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cal/vwparab.cal: -------------------------------------------------------------------------------- 1 | { 2 | Generate rays for a parabolic view projection -- 3 | i.e., a round image that when projected downwards 4 | in parallel onto a parabolic reflector results in 5 | a panoramic view from the paraboloid's focal point. 6 | 7 | The forward view direction corresponding to the top 8 | of the image is always +Y, and the up direction is 9 | always +Z. 10 | 11 | 9/8/98 Greg Ward Larson 12 | 13 | Inputs: 14 | maxalt : Maximum altitude (in degrees) 15 | x, y = Image position, (0,0)->(1,0) is LL->LR 16 | 17 | Outputs: 18 | dx, dy, dz = Direction vector for image point (x,y) 19 | 20 | Typical command line: 21 | cnt 1024 1024 | rcalc -e maxalt:25 \ 22 | -e 'x=($2+.5)/1024;y=1-($1+.5)/1024' -f vwparab.cal \ 23 | -e '$1=25.5;$2=12;$3=5;$4=dx;$5=dy;$6=dz' \ 24 | | rtrace @electric.opt -fac -x 1024 -y 1024 \ 25 | electric.oct > pan.pic 26 | } 27 | amax : PI/180*maxalt; 28 | F0 : .5/cos(amax) - .5*tan(amax); { dist. btwn. parabola and directrix } 29 | xr = 2*x - 1; 30 | yr = 2*y - 1; 31 | r2 = xr*xr + yr*yr; 32 | r = sqrt(r2); { never actually needed } 33 | z = r2/(4*F0) + F0; 34 | zo = r2/(4*F0) - F0; 35 | sin_alt = zo/z; 36 | cos_alt = r/z; 37 | dx = xr/z; { same as xr/r*cos_alt } 38 | dy = yr/z; { same as yr/r*cos_alt } 39 | dz = zo/z; { same as sin_alt } 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/cnt.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: cnt.c,v 1.1 2003/02/22 02:07:20 greg Exp $"; 3 | #endif 4 | /* 5 | * cnt.c - simple counting program. 6 | * 7 | * 2/1/88 8 | */ 9 | 10 | #include 11 | 12 | 13 | int n[50]; 14 | char buf[256]; 15 | 16 | 17 | main(argc, argv) 18 | int argc; 19 | char *argv[]; 20 | { 21 | int a; 22 | 23 | argv++; argc--; 24 | for (a = 0; a < argc; a++) 25 | n[a] = atoi(argv[a]); 26 | n[a] = 0; 27 | loop(n, buf); 28 | 29 | exit(0); 30 | } 31 | 32 | 33 | char * 34 | tack(b, i) 35 | register char *b; 36 | register int i; 37 | { 38 | register char *cp; 39 | char *res; 40 | 41 | *b++ = '\t'; 42 | cp = b; 43 | if (i == 0) 44 | *cp++ = '0'; 45 | else 46 | do { 47 | *cp++ = i%10 + '0'; 48 | i /= 10; 49 | } while (i); 50 | res = cp--; 51 | #define c i 52 | while (cp > b) { /* reverse string */ 53 | c = *cp; 54 | *cp-- = *b; 55 | *b++ = c; 56 | } 57 | #undef c 58 | return(res); 59 | } 60 | 61 | 62 | loop(n, b) 63 | int *n; 64 | char *b; 65 | { 66 | int i; 67 | 68 | if (n[0] == 0) { 69 | *b = '\0'; 70 | puts(buf); 71 | return; 72 | } 73 | for (i = 0; i < n[0]; i++) 74 | loop(n+1, tack(b, i)); 75 | } 76 | -------------------------------------------------------------------------------- /Reference/radiance/src/cal/ev.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: ev.c,v 1.1 2003/02/22 02:07:20 greg Exp $"; 3 | #endif 4 | /* 5 | * ev.c - program to evaluate expression arguments 6 | * 7 | * 1/29/87 8 | */ 9 | 10 | #include 11 | 12 | #include "calcomp.h" 13 | 14 | 15 | main(argc, argv) 16 | int argc; 17 | char *argv[]; 18 | { 19 | extern int errno; 20 | int i; 21 | 22 | esupport |= E_FUNCTION; 23 | esupport &= ~(E_VARIABLE|E_INCHAN|E_OUTCHAN|E_RCONST); 24 | 25 | #ifdef BIGGERLIB 26 | biggerlib(); 27 | #endif 28 | 29 | errno = 0; 30 | for (i = 1; i < argc; i++) 31 | printf("%.9g\n", eval(argv[i])); 32 | 33 | quit(errno ? 2 : 0); 34 | } 35 | 36 | 37 | void 38 | eputs(msg) 39 | char *msg; 40 | { 41 | fputs(msg, stderr); 42 | } 43 | 44 | 45 | void 46 | wputs(msg) 47 | char *msg; 48 | { 49 | eputs(msg); 50 | } 51 | 52 | 53 | void 54 | quit(code) 55 | int code; 56 | { 57 | exit(code); 58 | } 59 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/addobjnotify.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: addobjnotify.c,v 3.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Dummy declaration of addobjnotify[] 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | void (*addobjnotify[1])() = {0}; 11 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/badarg.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: badarg.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Check argument list against format string. 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include 13 | 14 | #define NULL 0 15 | 16 | int 17 | badarg(ac, av, fl) /* check argument list */ 18 | int ac; 19 | register char **av; 20 | register char *fl; 21 | { 22 | register int i; 23 | 24 | if (fl == NULL) 25 | fl = ""; /* no arguments? */ 26 | for (i = 1; *fl; i++,av++,fl++) { 27 | if (i > ac || *av == NULL) 28 | return(-1); 29 | switch (*fl) { 30 | case 's': /* string */ 31 | if (**av == '\0' || isspace(**av)) 32 | return(i); 33 | break; 34 | case 'i': /* integer */ 35 | if (!isintd(*av, " \t\r\n")) 36 | return(i); 37 | break; 38 | case 'f': /* float */ 39 | if (!isfltd(*av, " \t\r\n")) 40 | return(i); 41 | break; 42 | default: /* bad call! */ 43 | return(-1); 44 | } 45 | } 46 | return(0); /* all's well */ 47 | } 48 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/bcopy.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: bcopy.c,v 1.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * bcopy.c - substitutes for library routines. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | 11 | bcopy(src, dest, nbytes) 12 | register char *src, *dest; 13 | register int nbytes; 14 | { 15 | while (nbytes-- > 0) 16 | *dest++ = *src++; 17 | } 18 | 19 | 20 | bzero(b, nbytes) 21 | register char *b; 22 | register int nbytes; 23 | { 24 | while (nbytes-- > 0) 25 | *b++ = 0; 26 | } 27 | 28 | 29 | int 30 | bcmp(b1, b2, nbytes) 31 | register unsigned char *b1, *b2; 32 | register int nbytes; 33 | { 34 | while (nbytes-- > 0) 35 | if (*b1++ - *b2++) 36 | return(*--b1 - *--b2); 37 | return(0); 38 | } 39 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/chanvalue.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: chanvalue.c,v 3.1 2003/02/22 02:07:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Dummy definition of chanvalue() for calcomp routines. 6 | */ 7 | 8 | double 9 | chanvalue(int n) 10 | { 11 | eputs("Call to unsupported chanvalue routine\n"); 12 | quit(1); 13 | } 14 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/cone.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: cone.h,v 2.3 2003/02/25 02:47:21 greg Exp $ */ 2 | /* 3 | * cone.h - header file for cones (cones, cylinders, rings, cups, tubes). 4 | * 5 | * Storage of arguments in the cone structure is a little strange. 6 | * To save space, we use an index into the real arguments of the 7 | * object structure through ca. The indices are for the axis 8 | * endpoints and radii: p0, p1, r0 and r1. 9 | * 10 | * 2/12/86 11 | */ 12 | 13 | #include "copyright.h" 14 | 15 | typedef struct cone { 16 | FLOAT *ca; /* cone arguments (o->oargs.farg) */ 17 | char p0, p1; /* indices for endpoints */ 18 | char r0, r1; /* indices for radii */ 19 | FVECT ad; /* axis direction vector */ 20 | FLOAT al; /* axis length */ 21 | FLOAT sl; /* side length */ 22 | FLOAT (*tm)[4]; /* pointer to transformation matrix */ 23 | } CONE; 24 | 25 | #define CO_R0(co) ((co)->ca[(co)->r0]) 26 | #define CO_R1(co) ((co)->ca[(co)->r1]) 27 | #define CO_P0(co) ((co)->ca+(co)->p0) 28 | #define CO_P1(co) ((co)->ca+(co)->p1) 29 | 30 | #ifdef NOPROTO 31 | 32 | extern CONE *getcone(); 33 | extern void freecone(); 34 | extern void conexform(); 35 | 36 | #else 37 | 38 | extern CONE *getcone(OBJREC *o, int getxf); 39 | extern void freecone(OBJREC *o); 40 | extern void conexform(CONE *co); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/eputs.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: eputs.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Default error output function. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #include 11 | 12 | void 13 | eputs(s) /* error message */ 14 | char *s; 15 | { 16 | fputs(s, stderr); 17 | } 18 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/error.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: error.c,v 2.7 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * error.c - standard error reporting function 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include "standard.h" 13 | 14 | extern char *strerror(); 15 | /* global list of error actions */ 16 | struct erract erract[NERRS] = ERRACT_INIT; 17 | 18 | char errmsg[512]; /* global error message buffer */ 19 | 20 | 21 | void 22 | error(etype, emsg) /* report error, quit if necessary */ 23 | int etype; 24 | char *emsg; 25 | { 26 | register struct erract *ep; 27 | 28 | if (etype < 0 | etype >= NERRS) 29 | return; 30 | ep = erract + etype; 31 | if (ep->pf != NULL) { 32 | if (ep->pre[0]) (*ep->pf)(ep->pre); 33 | if (emsg != NULL && emsg[0]) (*ep->pf)(emsg); 34 | if (etype == SYSTEM && errno > 0) { 35 | (*ep->pf)(": "); 36 | (*ep->pf)(strerror(errno)); 37 | } 38 | (*ep->pf)("\n"); 39 | } 40 | if (!ep->ec) /* non-fatal */ 41 | return; 42 | if (ep->ec < 0) /* dump core */ 43 | abort(); 44 | quit(ep->ec); /* quit calls exit after cleanup */ 45 | } 46 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/face.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: face.h,v 2.3 2003/02/25 02:47:21 greg Exp $ */ 2 | /* 3 | * face.h - header for routines using polygonal faces. 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | #define VERTEX(f,n) ((f)->va + 3*(n)) 9 | 10 | typedef struct { /* a polygonal face */ 11 | FVECT norm; /* the plane's unit normal */ 12 | FLOAT offset; /* plane equation: DOT(norm, v) == offset */ 13 | FLOAT area; /* area of face */ 14 | FLOAT *va; /* vertex array (o->oargs.farg) */ 15 | short nv; /* # of vertices */ 16 | short ax; /* axis closest to normal */ 17 | } FACE; 18 | 19 | #ifdef NOPROTO 20 | 21 | extern FACE *getface(); 22 | extern void freeface(); 23 | extern int inface(); 24 | 25 | #else 26 | 27 | extern FACE *getface(OBJREC *o); 28 | extern void freeface(OBJREC *o); 29 | extern int inface(FVECT p, FACE *f); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/fdate.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: fdate.c,v 2.6 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Return file date (UNIX seconds as returned by time(2) call) 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include 13 | #include 14 | 15 | 16 | time_t 17 | fdate(fname) /* get file date */ 18 | char *fname; 19 | { 20 | struct stat sbuf; 21 | 22 | if (stat(fname, &sbuf) == -1) 23 | return(0); 24 | 25 | return(sbuf.st_mtime); 26 | } 27 | 28 | 29 | int 30 | setfdate(fname, ftim) /* set file date */ 31 | char *fname; 32 | long ftim; 33 | { 34 | time_t ftm[2]; 35 | 36 | ftm[0] = ftm[1] = ftim; 37 | 38 | return(utime(fname, ftm)); 39 | } 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/fgetline.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: fgetline.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * fgetline.c - read line with escaped newlines. 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include 13 | 14 | 15 | char * 16 | fgetline(s, n, fp) /* read in line with escapes, elide final newline */ 17 | char *s; 18 | int n; 19 | register FILE *fp; 20 | { 21 | register char *cp = s; 22 | register int c = EOF; 23 | 24 | while (--n > 0 && (c = getc(fp)) != EOF) { 25 | if (c == '\r') 26 | continue; 27 | if (c == '\n' && (cp == s || cp[-1] != '\\')) 28 | break; 29 | *cp++ = c; 30 | } 31 | if (cp == s && c == EOF) 32 | return(NULL); 33 | *cp = '\0'; 34 | return(s); 35 | } 36 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/fgetword.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: fgetword.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Read white space separated words from stream 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include 13 | 14 | #include 15 | 16 | 17 | char * 18 | fgetword(s, n, fp) /* get (quoted) word up to n-1 characters */ 19 | char *s; 20 | int n; 21 | register FILE *fp; 22 | { 23 | int quote = '\0'; 24 | register char *cp; 25 | register int c; 26 | /* skip initial white space */ 27 | do 28 | c = getc(fp); 29 | while (isspace(c)); 30 | /* check for quote */ 31 | if ((c == '"' | c == '\'')) { 32 | quote = c; 33 | c = getc(fp); 34 | } 35 | /* check for end of file */ 36 | if (c == EOF) 37 | return(NULL); 38 | /* get actual word */ 39 | cp = s; 40 | do { 41 | if (--n <= 0) /* check length limit */ 42 | break; 43 | *cp++ = c; 44 | c = getc(fp); 45 | } while (c != EOF && !(quote ? c==quote : isspace(c))); 46 | *cp = '\0'; 47 | if ((c != EOF & !quote)) /* replace space */ 48 | ungetc(c, fp); 49 | return(s); 50 | } 51 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/fixargv0.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: fixargv0.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Fix argv[0] for DOS environments 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | 13 | char * 14 | fixargv0(av0) /* extract command name from full path */ 15 | char *av0; 16 | { 17 | register char *cp = av0; 18 | 19 | while (*cp) cp++; /* start from end */ 20 | while (cp-- > av0) 21 | switch (*cp) { /* fix up command name */ 22 | case '.': /* remove extension */ 23 | *cp = '\0'; 24 | continue; 25 | case '\\': /* remove directory */ 26 | return(cp+1); 27 | default: /* convert to lower case */ 28 | *cp = tolower(*cp); 29 | continue; 30 | } 31 | return(av0); 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/font.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: font.h,v 2.5 2003/02/25 02:47:21 greg Exp $ */ 2 | /* 3 | * Header file for font handling routines 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | typedef unsigned char GORD; 9 | 10 | typedef struct { 11 | short nverts; /* number of vertices */ 12 | GORD left, right, top, bottom; /* glyph extent */ 13 | /* followed by vertex list */ 14 | } GLYPH; 15 | 16 | #define gvlist(g) ((GORD *)((g)+1)) 17 | 18 | typedef struct font { 19 | int nref; /* number of references */ 20 | GLYPH *fg[256]; /* font glyphs */ 21 | short mwidth, mheight; /* mean glyph width and height */ 22 | char *name; /* font file name */ 23 | struct font *next; /* next font in list */ 24 | } FONT; 25 | 26 | extern int retainfonts; /* retain loaded fonts? */ 27 | 28 | #ifdef NOPROTO 29 | 30 | extern FONT *getfont(); 31 | extern void freefont(); 32 | extern int uniftext(); 33 | extern int squeeztext(); 34 | extern int proptext(); 35 | 36 | #else 37 | 38 | extern FONT *getfont(char *fname); 39 | extern void freefont(FONT *f); 40 | extern int uniftext(short *sp, char *tp, FONT *f); 41 | extern int squeeztext(short *sp, char *tp, FONT *f, int cis); 42 | extern int proptext(short *sp, char *tp, FONT *f, int cis, int nsi); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/fputword.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: fputword.c,v 3.2 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Read white space separated words from stream 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include 13 | 14 | #include 15 | 16 | 17 | void 18 | fputword(s, fp) /* put (quoted) word to file stream */ 19 | char *s; 20 | FILE *fp; 21 | { 22 | register char *cp; 23 | /* check if quoting needed */ 24 | for (cp = s; *cp; cp++) 25 | if (isspace(*cp)) { 26 | int quote; 27 | if (index(s, '"')) 28 | quote = '\''; 29 | else 30 | quote = '"'; 31 | fputc(quote, fp); 32 | fputs(s, fp); 33 | fputc(quote, fp); 34 | return; 35 | } 36 | /* output sans quotes */ 37 | fputs(s, fp); 38 | } 39 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/free_os.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: free_os.c,v 3.2 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Free memory associated with object(s) 6 | * 7 | * External symbols declared in object.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include "standard.h" 13 | #include "octree.h" 14 | #include "object.h" 15 | #include "otypes.h" 16 | #include "face.h" 17 | #include "cone.h" 18 | #include "instance.h" 19 | 20 | 21 | int 22 | free_os(op) /* free unneeded memory for object */ 23 | register OBJREC *op; 24 | { 25 | if (op->os == NULL) 26 | return(0); 27 | switch (op->otype) { 28 | case OBJ_FACE: /* polygon */ 29 | freeface(op); 30 | return(1); 31 | case OBJ_CONE: /* cone */ 32 | case OBJ_RING: /* disk */ 33 | case OBJ_CYLINDER: /* cylinder */ 34 | case OBJ_CUP: /* inverted cone */ 35 | case OBJ_TUBE: /* inverted cylinder */ 36 | freecone(op); 37 | return(1); 38 | case OBJ_INSTANCE: /* octree instance */ 39 | freeinstance(op); 40 | return(1); 41 | } 42 | /* don't really know */ 43 | free((void *)op->os); 44 | op->os = NULL; 45 | return(1); 46 | } 47 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/frexp.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: frexp.c,v 1.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | #include "copyright.h" 5 | 6 | frexp(x, ip) /* call it paranoia, I've seen the lib version */ 7 | register double x; 8 | int *ip; 9 | { 10 | int neg; 11 | register int i; 12 | 13 | if (neg = (x < 0.0)) 14 | x = -x; 15 | else if (x == 0.0) { 16 | *ip = 0; 17 | return(0.0); 18 | } 19 | if (x < 0.5) 20 | for (i = 0; x < 0.5; i--) 21 | x *= 2.0; 22 | else 23 | for (i = 0; x >= 1.0; i++) 24 | x /= 2.0; 25 | *ip = i; 26 | if (neg) 27 | return(-x); 28 | else 29 | return(x); 30 | } 31 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/fropen.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: fropen.c,v 2.9 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Find and open a Radiance library file. 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include 13 | 14 | #include "paths.h" 15 | 16 | 17 | FILE * 18 | frlibopen(fname) /* find file and open for reading */ 19 | register char *fname; 20 | { 21 | extern char *strcpy(), *getlibpath(); 22 | FILE *fp; 23 | char pname[MAXPATH]; 24 | register char *sp, *cp; 25 | 26 | if (fname == NULL) 27 | return(NULL); 28 | 29 | if (ISDIRSEP(fname[0]) || fname[0] == '.') /* absolute path */ 30 | return(fopen(fname, "r")); 31 | /* check search path */ 32 | sp = getlibpath(); 33 | do { 34 | cp = pname; 35 | while (*sp && (*cp = *sp++) != PATHSEP) 36 | cp++; 37 | if (cp > pname && !ISDIRSEP(cp[-1])) 38 | *cp++ = DIRSEP; 39 | strcpy(cp, fname); 40 | if ((fp = fopen(pname, "r")) != NULL) 41 | return(fp); /* got it! */ 42 | } while (*sp); 43 | /* not found */ 44 | return(NULL); 45 | } 46 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/fwrite.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: fwrite.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | #include "copyright.h" 5 | 6 | #include 7 | 8 | 9 | int 10 | fwrite(ptr, size, count, fp) /* system version is broken (*sigh*) */ 11 | register char *ptr; 12 | int size, count; 13 | register FILE *fp; 14 | { 15 | register long n = size*count; 16 | 17 | while (n--) 18 | putc(*ptr++, fp); 19 | 20 | return(ferror(fp) ? 0 : count); 21 | } 22 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/getlibpath.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: getlibpath.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Return Radiance library search path 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include 13 | 14 | #include "paths.h" 15 | 16 | 17 | char * 18 | getlibpath() 19 | { 20 | static char *libpath = NULL; 21 | 22 | if (libpath == NULL) 23 | if ((libpath = getenv(ULIBVAR)) == NULL) 24 | libpath = DEFPATH; 25 | 26 | return(libpath); 27 | } 28 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/getpagesize.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: getpagesize.c,v 2.5 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Return system page size for non-BSD machine. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #ifndef BSD 11 | 12 | #if defined(_AUX_SOURCE) /* Apple's A/UX */ 13 | 14 | #include 15 | int 16 | getpagesize() /* use var structure to get page size */ 17 | { 18 | struct var v; 19 | uvar(&v); 20 | return(1 << v.v_pageshift); 21 | } 22 | 23 | #else 24 | #if defined(hpux) /* Hewlett Packard's HPUX */ 25 | 26 | #include 27 | int 28 | getpagesize() 29 | { 30 | return(NBPG_PA83); /* This is supposed to be ok for PA-RISC 1.0, but 31 | I don't know about 1.1 (i.e. Snakes) */ 32 | } 33 | 34 | #else 35 | #if defined(sparc) 36 | 37 | #include 38 | int getpagesize() 39 | { 40 | return (int)sysconf(_SC_PAGESIZE); 41 | } 42 | #else /* Unknown version of UNIX */ 43 | #ifndef PAGESIZE 44 | #define PAGESIZE 8192 /* Guess on the high side */ 45 | #endif 46 | int 47 | getpagesize() 48 | { 49 | return(PAGESIZE); 50 | } 51 | 52 | #endif 53 | #endif 54 | #endif 55 | 56 | #endif /* !BSD */ 57 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/instance.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: instance.h,v 2.4 2003/02/25 02:47:21 greg Exp $ */ 2 | /* 3 | * instance.h - header file for routines using octree objects. 4 | * 5 | * Include after object.h and octree.h 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | typedef struct scene { 11 | char *name; /* octree name */ 12 | int nref; /* number of references */ 13 | int ldflags; /* what was loaded */ 14 | CUBE scube; /* scene cube */ 15 | OBJECT firstobj, nobjs; /* first object and count */ 16 | struct scene *next; /* next in list */ 17 | } SCENE; /* loaded octree */ 18 | 19 | typedef struct { 20 | FULLXF x; /* forward and backward transforms */ 21 | SCENE *obj; /* loaded object */ 22 | } INSTANCE; /* instance of octree */ 23 | 24 | #ifdef NOPROTO 25 | 26 | extern SCENE *getscene(); 27 | extern INSTANCE *getinstance(); 28 | extern void freescene(); 29 | extern void freeinstance(); 30 | 31 | #else 32 | 33 | extern SCENE *getscene(char *sname, int flags); 34 | extern INSTANCE *getinstance(OBJREC *o, int flags); 35 | extern void freescene(SCENE *sc); 36 | extern void freeinstance(OBJREC *o); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/linregr.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: linregr.c,v 2.4 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Basic linear regression calculation. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #include 11 | 12 | #include "linregr.h" 13 | 14 | 15 | void 16 | lrclear(l) /* initialize sum */ 17 | register LRSUM *l; 18 | { 19 | l->xs = l->ys = l->xxs = l->yys = l->xys = 0.0; 20 | l->n = 0; 21 | } 22 | 23 | 24 | int 25 | flrpoint(x, y, l) /* add point (x,y) to sum */ 26 | double x, y; 27 | register LRSUM *l; 28 | { 29 | l->xs += x; 30 | l->ys += y; 31 | l->xxs += x*x; 32 | l->yys += y*y; 33 | l->xys += x*y; 34 | return(++l->n); 35 | } 36 | 37 | 38 | int 39 | lrfit(r, l) /* compute linear regression */ 40 | register LRLIN *r; 41 | register LRSUM *l; 42 | { 43 | double nxvar, nyvar; 44 | 45 | if (l->n < 2) 46 | return(-1); 47 | nxvar = l->xxs - l->xs*l->xs/l->n; 48 | nyvar = l->yys - l->ys*l->ys/l->n; 49 | if (nxvar == 0.0 || nyvar == 0.0) 50 | return(-1); 51 | r->slope = (l->xys - l->xs*l->ys/l->n) / nxvar; 52 | r->intercept = (l->ys - r->slope*l->xs) / l->n; 53 | r->correlation = r->slope*sqrt(nxvar/nyvar); 54 | return(0); 55 | } 56 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/linregr.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: linregr.h,v 2.4 2003/02/25 02:47:21 greg Exp $ */ 2 | /* 3 | * Header file for linear regression calculation. 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | typedef struct { 9 | double xs, ys, xxs, yys, xys; 10 | int n; 11 | } LRSUM; 12 | 13 | typedef struct { 14 | double slope, intercept, correlation; 15 | } LRLIN; 16 | 17 | #define lrpoint(x,y,l) ((l)->xs+=(x),(l)->ys+=(y),(l)->xxs+=(x)*(x), \ 18 | (l)->yys+=(y)*(y),(l)->xys+=(x)*(y),++(l)->n) 19 | 20 | #define lrxavg(l) ((l)->xs/(l)->n) 21 | #define lryavg(l) ((l)->ys/(l)->n) 22 | #define lrxvar(l) (((l)->xxs-(l)->xs*(l)->xs/(l)->n)/(l)->n) 23 | #define lryvar(l) (((l)->yys-(l)->ys*(l)->ys/(l)->n)/(l)->n) 24 | #define lrxdev(l) sqrt(((l)->xxs-(l)->xs*(l)->xs/(l)->n)/((l)->n-1)) 25 | #define lrydev(l) sqrt(((l)->yys-(l)->ys*(l)->ys/(l)->n)/((l)->n-1)) 26 | 27 | #ifdef NOPROTO 28 | 29 | extern void lrclear(); 30 | extern int flrpoint(); 31 | extern int lrfit(); 32 | 33 | #else 34 | 35 | extern void lrclear(LRSUM *l); 36 | extern int flrpoint(double x, double y, LRSUM *l); 37 | extern int lrfit(LRLIN *r, LRSUM *l); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/mat4.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: mat4.h,v 2.5 2003/02/25 02:47:21 greg Exp $ */ 2 | /* 3 | * Definitions for 4x4 matrix operations 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | #include "fvect.h" 9 | 10 | typedef FLOAT MAT4[4][4]; 11 | 12 | #ifdef BSD 13 | #define copymat4(m4a,m4b) bcopy((char *)m4b,(char *)m4a,sizeof(MAT4)) 14 | #else 15 | #define copymat4(m4a,m4b) (void)memcpy((char *)m4a,(char *)m4b,sizeof(MAT4)) 16 | #endif 17 | 18 | #define MAT4IDENT { {1.,0.,0.,0.}, {0.,1.,0.,0.}, \ 19 | {0.,0.,1.,0.}, {0.,0.,0.,1.} } 20 | 21 | extern MAT4 m4ident; 22 | 23 | #define setident4(m4) copymat4(m4, m4ident) 24 | 25 | #ifdef NOPROTO 26 | 27 | extern void multmat4(); 28 | extern void multv3(); 29 | extern void multp3(); 30 | extern int invmat4(); 31 | 32 | #else 33 | 34 | extern void multmat4(MAT4 m4a, MAT4 m4b, MAT4 m4c); 35 | extern void multv3(FVECT v3a, FVECT v3b, MAT4 m4); 36 | extern void multp3(FVECT p3a, FVECT p3b, MAT4 m4); 37 | extern int invmat4(MAT4 inverse, MAT4 mat); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/mktemp.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: mktemp.c,v 2.4 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Replacement mktemp(3) function for systems without 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #define NULL 0 11 | 12 | 13 | char * 14 | mktemp(template) /* make a unique filename from template */ 15 | char *template; 16 | { 17 | register char *tb, *te, *p; 18 | int pid; 19 | /* find string of 6 (opt) X's */ 20 | for (te = template; *te; te++) 21 | ; 22 | while (te > template && te[-1] != 'X') 23 | te--; 24 | if (te == template) 25 | return(template); /* no X's! */ 26 | for (tb = te; tb > template && tb[-1] == 'X'; tb--) 27 | ; 28 | if (te-tb > 6) /* only need 6 chars */ 29 | tb = te-6; 30 | pid = getpid(); /* 5 (opt) chars of pid */ 31 | for (p = te-2; p >= tb; p--) { 32 | *p = pid%10 + '0'; 33 | pid /= 10; 34 | } 35 | p = te-1; /* final character */ 36 | for (*p = 'a'; *p <= 'z'; (*p)++) 37 | if (access(template, 0) == -1) 38 | return(template); /* found unique name */ 39 | return(NULL); /* failure! */ 40 | } 41 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/multisamp.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: multisamp.c,v 2.4 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Binary space partitioning curve for multidimensional sampling. 6 | * 7 | * Written by Christophe Schlick 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include "random.h" 13 | 14 | void 15 | multisamp(t, n, r) /* convert 1-dimensional sample to N dimensions */ 16 | double t[]; /* returned N-dimensional vector */ 17 | register int n; /* number of dimensions */ 18 | double r; /* 1-dimensional sample [0,1) */ 19 | { 20 | int j; 21 | register int i, k; 22 | int ti[8]; 23 | double s; 24 | 25 | i = n; 26 | while (i-- > 0) 27 | ti[i] = 0; 28 | j = 8; 29 | while (j--) { 30 | k = s = r*(1< 0) 34 | ti[i] += ti[i] + ((k>>i) & 1); 35 | } 36 | i = n; 37 | while (i-- > 0) 38 | t[i] = 1./256. * (ti[i] + frandom()); 39 | } 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/myhostname.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: myhostname.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Query system for host name 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #ifndef BSD 11 | 12 | #include 13 | 14 | char * 15 | myhostname() 16 | { 17 | static struct utsname nambuf; 18 | 19 | if (!nambuf.nodename[0]) 20 | uname(&nambuf); 21 | return(nambuf.nodename); 22 | } 23 | 24 | #else 25 | 26 | char * 27 | myhostname() 28 | { 29 | static char hostname[65]; 30 | 31 | if (!hostname[0]) 32 | gethostname(hostname, sizeof(hostname)); 33 | return(hostname); 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/otypes.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: otypes.c,v 2.4 2003/03/10 17:13:29 greg Exp $"; 3 | #endif 4 | /* 5 | * Object type lookup and error reporting 6 | * 7 | * External symbols declared in object.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #include "standard.h" 13 | 14 | #include "object.h" 15 | 16 | #include "otypes.h" 17 | 18 | 19 | int 20 | otype(ofname) /* get object function number from its name */ 21 | register char *ofname; 22 | { 23 | register int i; 24 | 25 | for (i = 0; i < NUMOTYPE; i++) 26 | if (!strcmp(ofun[i].funame, ofname)) 27 | return(i); 28 | 29 | return(-1); /* not found */ 30 | } 31 | 32 | 33 | void 34 | objerror(o, etyp, msg) /* report error related to object */ 35 | OBJREC *o; 36 | int etyp; 37 | char *msg; 38 | { 39 | char msgbuf[128]; 40 | 41 | sprintf(msgbuf, "%s for %s \"%s\"", 42 | msg, ofun[o->otype].funame, 43 | o->oname!=NULL ? o->oname : "(NULL)"); 44 | error(etyp, msgbuf); 45 | } 46 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/peano.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: peano.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Generate an N-dimensional Peano space-filling curve 6 | * on the interval [0,1). 7 | */ 8 | 9 | #include "copyright.h" 10 | 11 | extern double floor(); 12 | 13 | 14 | static double 15 | peanoC(n, t, e) /* compute Peano coordinate */ 16 | int n; 17 | double t, e; 18 | { 19 | register int i; 20 | double d; 21 | 22 | if (e >= 1./3.) 23 | return(t); 24 | d = 0.; 25 | while (t-d >= 1./3.) 26 | d += 1./3.; 27 | i = n; 28 | while (--i > 0) 29 | t *= 3.; 30 | t = 3.*(t - floor(t)); 31 | i = 0; 32 | while (t >= 1.) { 33 | t -= 1.; 34 | i ^= 1; 35 | } 36 | t = peanoC(n, t, 3.*e); 37 | if (i) 38 | t = 1. - t; 39 | return(d + t/3.); 40 | } 41 | 42 | 43 | peano(p, n, t, e) /* compute Peano point */ 44 | register double p[]; 45 | int n; 46 | double t, e; 47 | { 48 | register int i; 49 | register int neg = 0; 50 | 51 | i = n; 52 | while (i-- > 0) { 53 | p[i] = peanoC(n, t, e); 54 | if (neg) 55 | p[i] = 1. - p[i]; 56 | t *= 3.; 57 | while (t >= 1.) { 58 | t -= 1.; 59 | neg ^= 1; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/plocate.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: plocate.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * plocate.c - routine to locate 3D vector w.r.t. box. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #include "fvect.h" 11 | 12 | #include "plocate.h" 13 | 14 | 15 | int 16 | plocate(p, min, max) /* return location of p w.r.t. min & max */ 17 | register FVECT p; 18 | FVECT min, max; 19 | { 20 | register int loc = 0; 21 | 22 | if (p[0] < min[0] - EPSILON) 23 | loc |= XPOS & BELOW; 24 | else if (p[0] > max[0] + EPSILON) 25 | loc |= XPOS & ABOVE; 26 | if (p[1] < min[1] - EPSILON) 27 | loc |= YPOS & BELOW; 28 | else if (p[1] > max[1] + EPSILON) 29 | loc |= YPOS & ABOVE; 30 | if (p[2] < min[2] - EPSILON) 31 | loc |= ZPOS & BELOW; 32 | else if (p[2] > max[2] + EPSILON) 33 | loc |= ZPOS & ABOVE; 34 | 35 | return(loc); 36 | } 37 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/plocate.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: plocate.h,v 2.4 2003/02/25 02:47:21 greg Exp $ */ 2 | /* 3 | * plocate.h - header for 3D vector location. 4 | * 5 | * Include after fvect.h 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #define EPSILON FTINY /* acceptable location error */ 11 | 12 | #define XPOS 03 /* x position mask */ 13 | #define YPOS 014 /* y position mask */ 14 | #define ZPOS 060 /* z position mask */ 15 | 16 | #define position(i) (3<<((i)<<1)) /* macro version */ 17 | 18 | #define BELOW 025 /* below bits */ 19 | #define ABOVE 052 /* above bits */ 20 | 21 | #ifdef NOPROTO 22 | 23 | extern int clip(); 24 | 25 | extern int plocate(); 26 | 27 | #else 28 | 29 | extern int clip(FLOAT *ep1, FLOAT *ep2, FVECT min, FVECT max); 30 | 31 | extern int plocate(FVECT p, FVECT min, FVECT max); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/preadwrite.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: preadwrite.c,v 3.1 2003/02/22 02:07:22 greg Exp $"; 3 | #endif 4 | /* 5 | * Substitute routines for pread(2) and pwrite(2) 6 | */ 7 | 8 | extern off_t lseek(); 9 | 10 | 11 | int 12 | pread(fd, buf, siz, offs) /* read buffer from an open file */ 13 | int fd; 14 | char *buf; 15 | unsigned int siz; 16 | long pos; 17 | { 18 | if (lseek(fd, (off_t)offs, 0) != offs) 19 | return(-1); 20 | return(read(fd, buf, siz)); 21 | /* technically, we should reset pointer here */ 22 | } 23 | 24 | 25 | int 26 | pwrite(fd, buf, siz, offs) /* write buffer to an open file */ 27 | int fd; 28 | char *buf; 29 | unsigned int siz; 30 | long pos; 31 | { 32 | if (lseek(fd, (off_t)offs, 0) != offs) 33 | return(-1); 34 | return(write(fd, buf, siz)); 35 | /* technically, we should reset pointer here */ 36 | } 37 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/quit.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: quit.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; 3 | #endif 4 | /* 5 | * Default program quit routine. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | void 11 | quit(code) /* quit program */ 12 | int code; 13 | { 14 | exit(code); 15 | } 16 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/selcall.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: selcall.h,v 3.5 2003/02/25 02:47:22 greg Exp $ */ 2 | /* 3 | * header file for select call compatibility 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | #include 9 | #include 10 | #ifdef INCL_SEL_H 11 | #include 12 | #endif 13 | 14 | #ifndef FD_SETSIZE 15 | #include 16 | #define FD_SETSIZE NOFILE /* maximum # select file descriptors */ 17 | #endif 18 | #ifndef FD_SET 19 | #ifndef NFDBITS 20 | #define NFDBITS (8*sizeof(int)) /* number of bits per fd_mask */ 21 | #endif 22 | #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) 23 | #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) 24 | #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) 25 | #ifdef BSD 26 | #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) 27 | #else 28 | #define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/strcmp.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: strcmp.c,v 2.3 2003/02/25 02:47:22 greg Exp $"; 3 | #endif 4 | /* 5 | * String comparison routine optimized for use with savestr.c 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | 11 | int 12 | strcmp(s1, s2) /* check for s1==s2 */ 13 | register char *s1, *s2; 14 | { 15 | if (s1 == s2) 16 | return(0); 17 | 18 | while (*s1 == *s2++) 19 | if (!*s1++) 20 | return(0); 21 | 22 | return(*s1 - *--s2); 23 | } 24 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/targa.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: targa.h,v 2.3 2003/02/25 02:47:22 greg Exp $ */ 2 | /* 3 | * tardev.h - header file for reading and writing Targa format files. 4 | */ 5 | #include "copyright.h" 6 | 7 | /* header structure adapted from tardev.h */ 8 | struct hdStruct { 9 | char textSize; /* size of info. line ( < 256) */ 10 | char mapType; /* color map type */ 11 | char dataType; /* data type */ 12 | int mapOrig; /* first color index */ 13 | int mapLength; /* length of file map */ 14 | char CMapBits; /* bits per map entry */ 15 | int XOffset; /* picture offset */ 16 | int YOffset; 17 | int x; /* picture size */ 18 | int y; 19 | int dataBits; /* bits per pixel */ 20 | int imType; /* image descriptor byte */ 21 | }; 22 | 23 | #define IM_NODATA 0 /* no data included */ 24 | #define IM_CMAP 1 /* color-mapped */ 25 | #define IM_RGB 2 /* straight RGB */ 26 | #define IM_MONO 3 /* straight monochrome */ 27 | #define IM_CCMAP 9 /* compressed color-mapped */ 28 | #define IM_CRGB 10 /* compressed RGB */ 29 | #define IM_CMONO 11 /* compressed monochrome */ 30 | 31 | /* color map types */ 32 | #define CM_NOMAP 0 /* no color map */ 33 | #define CM_HASMAP 1 /* has color map */ 34 | 35 | #define bits_bytes(n) (((n)+7)>>3) /* number of bits to number of bytes */ 36 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/tcos.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: tcos.c,v 3.3 2003/02/25 02:47:22 greg Exp $"; 3 | #endif 4 | /* 5 | * Table-based cosine approximation. 6 | * 7 | * Use doubles in table even though we're not nearly that accurate just 8 | * to avoid conversion and guarantee that tsin(x)^2 + tcos(x)^2 == 1. 9 | * 10 | * No interpolation in this version. 11 | * 12 | * External symbols declared in standard.h 13 | */ 14 | 15 | #include "copyright.h" 16 | 17 | #include 18 | 19 | #ifndef NCOSENTRY 20 | #define NCOSENTRY 256 21 | #endif 22 | 23 | #ifdef M_PI 24 | #define PI ((double)M_PI) 25 | #else 26 | #define PI 3.14159265358979323846 27 | #endif 28 | 29 | 30 | double 31 | tcos(x) /* approximate cosine */ 32 | register double x; 33 | { 34 | static double costab[NCOSENTRY+1]; 35 | register int i; 36 | 37 | if (costab[0] < 0.5) /* initialize table */ 38 | for (i = 0; i <= NCOSENTRY; i++) 39 | costab[i] = cos((PI/2./NCOSENTRY)*i); 40 | /* normalize angle */ 41 | if (x < 0.) 42 | x = -x; 43 | i = (NCOSENTRY*2./PI) * x + 0.5; 44 | if (i >= 4*NCOSENTRY) 45 | i %= 4*NCOSENTRY; 46 | switch (i / NCOSENTRY) { 47 | case 0: 48 | return(costab[i]); 49 | case 1: 50 | return(-costab[(2*NCOSENTRY)-i]); 51 | case 2: 52 | return(-costab[i-(2*NCOSENTRY)]); 53 | case 3: 54 | return(costab[(4*NCOSENTRY)-i]); 55 | } 56 | return(0.); /* should never be reached */ 57 | } 58 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/tiffvers.h: -------------------------------------------------------------------------------- 1 | #define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.5.6 beta\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." 2 | /* 3 | * This define can be used in code that requires 4 | * compilation-related definitions specific to a 5 | * version or versions of the library. Runtime 6 | * version checking should be done based on the 7 | * string returned by TIFFGetVersion. 8 | */ 9 | #define TIFFLIB_VERSION 20010801 10 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/tmaptiff.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: tmaptiff.h,v 3.2 2003/02/25 02:47:22 greg Exp $ */ 2 | /* 3 | * tmaptiff.h 4 | * 5 | * Header file for TIFF tone-mapping routines. 6 | * Include after "tiffio.h" and "tonemap.h". 7 | * 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #ifdef NOPROTO 17 | 18 | extern int tmCvL16(); 19 | extern int tmCvLuv24(); 20 | extern int tmCvLuv32(); 21 | extern int tmLoadTIFF(); 22 | extern int tmMapTIFF(); 23 | 24 | #else 25 | 26 | extern int tmCvL16(TMbright *ls, uint16 *luvs, int len); 27 | extern int tmCvLuv24(TMbright *ls, BYTE *cs, uint32 *luvs, int len); 28 | extern int tmCvLuv32(TMbright *ls, BYTE *cs, uint32 *luvs, int len); 29 | extern int tmLoadTIFF(TMbright **lpp, BYTE **cpp, int *xp, int *yp, 30 | char *fname, TIFF *tp); 31 | extern int tmMapTIFF(BYTE **psp, int *xp, int *yp, int flags, 32 | RGBPRIMP monpri, double gamval, 33 | double Lddyn, double Ldmax, 34 | char *fname, TIFF *tp); 35 | 36 | #endif 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/tmerrmsg.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: tmerrmsg.h,v 3.4 2003/02/25 02:47:22 greg Exp $ */ 2 | /* 3 | * Error messages for tone mapping functions. 4 | * Included exclusively in "tonemap.c". 5 | * English version. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | char *tmErrorMessage[] = { 11 | "no error", 12 | "out of memory", 13 | "illegal argument value", 14 | "invalid tone mapping", 15 | "cannot compute tone mapping", 16 | "file cannot be opened or is the wrong type", 17 | "code consistency error 1", 18 | "code consistency error 2", 19 | }; 20 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/tmesh.cal: -------------------------------------------------------------------------------- 1 | { RCSid: $Id: tmesh.cal,v 2.1 2003/03/10 19:38:19 greg Exp $ } 2 | { 3 | Interpolate triangle-mesh values using barycentric coordinates. 4 | 5 | A1 = Major axis (0==X, 1==Y, 2==Z) 6 | A2 through A10 = Surface normal perturbation matrix 7 | or: 8 | A2 through A7 = Lookup in 2-dimensional pattern or texture 9 | } 10 | { Get dominant coordinates } 11 | bu = select(arg(1)+1, Py, Pz, Px); 12 | bv = select(arg(1)+1, Pz, Px, Py); 13 | { Compute variables } 14 | v1 = bu*arg( 2) + bv*arg( 3) + arg( 4); 15 | v2 = bu*arg( 5) + bv*arg( 6) + arg( 7); 16 | v3 = bu*arg( 8) + bv*arg( 9) + arg(10); 17 | { Surface normal perturbation } 18 | nf = 1/sqrt(v1*v1 + v2*v2 + v3*v3); 19 | dx = v1*nf - Nx; 20 | dy = v2*nf - Ny; 21 | dz = v3*nf - Nz; 22 | { Lookup table index } 23 | u = v1; 24 | v = v2; 25 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/tmesh.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: tmesh.h,v 2.3 2003/03/12 04:59:04 greg Exp $ */ 2 | /* 3 | * Header file for triangle mesh routines using barycentric coordinates 4 | */ 5 | 6 | #define TCALNAME "tmesh.cal" /* the name of our auxiliary file */ 7 | 8 | typedef struct { 9 | int ax; /* major axis */ 10 | FLOAT tm[2][3]; /* transformation */ 11 | } BARYCCM; 12 | 13 | #ifndef COSTOL 14 | #define COSTOL 0.999995 /* cosine of tolerance for smoothing */ 15 | #endif 16 | 17 | /* flat_tri() return values */ 18 | #define ISBENT 0 /* is not flat */ 19 | #define ISFLAT 1 /* is flat */ 20 | #define RVBENT 2 /* reversed and not flat */ 21 | #define RVFLAT 3 /* reversed and flat */ 22 | #define DEGEN -1 /* degenerate (zero area) */ 23 | 24 | #ifdef NOPROTO 25 | 26 | int flat_tri(); 27 | int comp_baryc(); 28 | void eval_baryc(); 29 | int get_baryc(); 30 | void put_baryc(); 31 | 32 | #else 33 | 34 | int flat_tri(FVECT v1, FVECT v2, FVECT v3, 35 | FVECT n1, FVECT n2, FVECT n3); 36 | int comp_baryc(BARYCCM *bcm, FVECT v1, FVECT v2, FVECT v3); 37 | void eval_baryc(FLOAT wt[3], FVECT p, BARYCCM *bcm); 38 | int get_baryc(FLOAT wt[3], FVECT p, FVECT v1, FVECT v2, FVECT v3); 39 | void put_baryc(BARYCCM *bcm, FLOAT com[][3], int n); 40 | 41 | #endif /* NOPROTO */ 42 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/vfork.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: vfork.h,v 2.4 2003/02/25 02:47:22 greg Exp $ */ 2 | /* 3 | * Header for routines using vfork() system call. 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | 9 | #if !defined(BSD) || defined(sparc) 10 | 11 | #define vfork fork 12 | 13 | #endif 14 | 15 | extern int vfork(); 16 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/wputs.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: wputs.c,v 3.4 2003/02/25 02:47:22 greg Exp $"; 3 | #endif 4 | /* 5 | * Default warning output function. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | int nowarn = 0; /* don't print warnings? */ 11 | 12 | void 13 | wputs(s) 14 | char *s; 15 | { 16 | if (!nowarn) 17 | eputs(s); 18 | } 19 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/x11findwind.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: x11findwind.c,v 2.5 2003/02/25 02:47:22 greg Exp $"; 3 | #endif 4 | /* 5 | * find a window by its name under X 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #include 11 | #include 12 | 13 | 14 | Window 15 | xfindwind(dpy, win, name, depth) 16 | Display *dpy; 17 | Window win; 18 | char *name; 19 | int depth; 20 | { 21 | char *nr; 22 | Window rr, pr, *cl; 23 | Window wr; 24 | unsigned int nc; 25 | register int i; 26 | 27 | if (depth == 0) /* negative depths search all */ 28 | return(None); 29 | if (!XQueryTree(dpy, win, &rr, &pr, &cl, &nc) || nc == 0) 30 | return(None); 31 | wr = None; /* breadth first search */ 32 | for (i = 0; wr == None && i < nc; i++) 33 | if (XFetchName(dpy, cl[i], &nr)) { 34 | if (!strcmp(nr, name)) 35 | wr = cl[i]; 36 | free(nr); 37 | } 38 | for (i = 0; wr == None && i < nc; i++) 39 | wr = xfindwind(dpy, cl[i], name, depth-1); 40 | XFree((char *)cl); 41 | return(wr); 42 | } 43 | -------------------------------------------------------------------------------- /Reference/radiance/src/common/zeroes.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: zeroes.c,v 2.4 2003/02/25 02:47:22 greg Exp $"; 3 | #endif 4 | /* 5 | * zeroes.c - compute roots for various equations. 6 | * 7 | * External symbols declared in standard.h 8 | */ 9 | 10 | #include "copyright.h" 11 | 12 | 13 | #include 14 | 15 | #include "fvect.h" 16 | 17 | 18 | int 19 | quadratic(r, a, b, c) /* find real roots of quadratic equation */ 20 | double *r; /* roots in ascending order */ 21 | double a, b, c; 22 | { 23 | double disc; 24 | int first; 25 | 26 | if (a < -FTINY) 27 | first = 1; 28 | else if (a > FTINY) 29 | first = 0; 30 | else if (fabs(b) > FTINY) { /* solve linearly */ 31 | r[0] = -c/b; 32 | return(1); 33 | } else 34 | return(0); /* equation is c == 0 ! */ 35 | 36 | b *= 0.5; /* simplifies formula */ 37 | 38 | disc = b*b - a*c; /* discriminant */ 39 | 40 | if (disc < -FTINY*FTINY) /* no real roots */ 41 | return(0); 42 | 43 | if (disc <= FTINY*FTINY) { /* double root */ 44 | r[0] = -b/a; 45 | return(1); 46 | } 47 | 48 | disc = sqrt(disc); 49 | 50 | r[first] = (-b - disc)/a; 51 | r[1-first] = (-b + disc)/a; 52 | 53 | return(2); 54 | } 55 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/README: -------------------------------------------------------------------------------- 1 | MODEL CONVERTER PROGRAMS 2 | SCCSid "@(#)README 2.6 8/25/95 LBL" 3 | 4 | This directory contains translator programs between other scene modeling 5 | languages and Radiance. 6 | 7 | tmesh.h triangle mesh (barycentric coordinate) definitions 8 | trans.h translator definitions 9 | arch2rad.c convert Architrion file to Radiance 10 | ies2rad.c convert IES luminaire data to Radiance description 11 | lamp.tab default lookup table associating lamp types with colors 12 | lampcolor.c program to convert lamp color from table and compute radiance 13 | mgf2meta.c program to convert from MGF language to metafile 2-d graphics 14 | mgf2rad.c convert Material and Geometry Format to Radiance scene 15 | nff2rad.c convert Neutral File Format input to Radiance scene description 16 | obj2rad.c convert from Wavefront's .obj format to Radiance 17 | rad2mgf.c convert from Radiance to MGF language 18 | thf2rad.c convert GDS things file to Radiance scene description 19 | thf2rad2.c modified thf2rad with different cylinder end caps 20 | tmesh.c triangle mesh (barycentric coordinate) routines 21 | tmesh2rad.c converts from non-standard triangle mesh to Radiance 22 | trans.c translator utilities 23 | source.cal function file for light sources from ies2rad 24 | tilt.cal computes tilt factor for ies2rad 25 | tmesh.cal interpolates triangle surface normal using barycentric mapping 26 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/mgflib/CHANGES: -------------------------------------------------------------------------------- 1 | LIST OF CHANGES SINCE 1.0 RELEASE 2 | 3 | Modified setspectrum() in context.c to allow negative spectral values, 4 | so that complimentary color systems will work with cmix. 5 | 6 | Added test and error condition for input line too long ( > 4096 bytes). 7 | 8 | Changed mgfilt so as to expand any included files for version conformance. 9 | 10 | Fixed minor bug in parser.c e_include() function where it didn't close the 11 | input file if the transform had an error. 12 | 13 | Added error for closing hierarchical context that was never opened. 14 | 15 | Created cvrgb.c module for converting to programmer-defined RGB color space. 16 | 17 | Created mgf2inv translator from MGF to Inventor 1.0, 2.0 and VRML 1.0 formats. 18 | 19 | Modified 3ds2pov program to produce MGF output also. 20 | 21 | ======================================================================== 22 | CHANGES SINCE 1.1 RELEASE 23 | 24 | Added fh entity for faces with holes and cleaned up prototype 25 | declarations using suggestions by Philippe Bekaert. 26 | 27 | Fixed header on VRML 1.0 output of mgf2inv. 28 | 29 | Added Philippe Bekaert's performance improvements to lu_hash() and lu_find(). 30 | 31 | Added client data pointers to context structures (vertex, color, material). 32 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/mgflib/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for MGF parser library 3 | # 4 | # Use -DNOPROTO flag to get back K&R compatibility. 5 | # Use -DBSD flag if your UNIX has a strong BSD flavor. 6 | # Use '-DMEM_PTR=char *' if your malloc return type is not 'void *'. 7 | MACH = 8 | OPT = -O 9 | CFLAGS = $(MACH) $(OPT) 10 | CC = cc 11 | 12 | OBJS = parser.o context.o xf.o object.o lookup.o badarg.o \ 13 | words.o fvect.o 14 | 15 | all: libmgf.a mgfilt mgf2inv 16 | 17 | mgfilt: libmgf.a mgfilt.o 18 | $(CC) $(CFLAGS) -o mgfilt mgfilt.o libmgf.a -lm 19 | 20 | libmgf.a: $(OBJS) 21 | ar rc libmgf.a $(OBJS) 22 | -ranlib libmgf.a 23 | 24 | mgf2inv: libmgf.a mgf2inv.o cvrgb.o 25 | $(CC) $(CFLAGS) -o mgf2inv mgf2inv.o cvrgb.o libmgf.a -lm 26 | 27 | 3ds2mgf: 3ds2mgf.o rayopt.o vect.o 28 | $(CC) $(CFLAGS) -o 3ds2mgf 3ds2mgf.o rayopt.o vect.o -lm 29 | 30 | clean: 31 | set nonomatch ; rm -f *.o libmgf.a mgfilt mgf2inv 3ds2mgf 32 | 33 | parser.o context.o xf.o object.o fvect.o mgf2inv.o cvrgb.o: parser.h 34 | 35 | parser.o context.o lookup.o: lookup.h 36 | 37 | parser.o: messages.h 38 | 39 | mgfilt.o: parser.h 40 | 41 | 3ds2mgf.o rayopt.o: rayopt.h 42 | 43 | 3ds2mgf.o rayopt.o vect.o: vect.h 44 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/mgflib/badarg.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: badarg.c,v 1.2 2003/02/28 20:11:29 greg Exp $"; 3 | #endif 4 | /* 5 | * Check argument list against format string. 6 | */ 7 | 8 | #include 9 | 10 | #define NULL 0 11 | 12 | int 13 | badarg(ac, av, fl) /* check argument list */ 14 | int ac; 15 | register char **av; 16 | register char *fl; 17 | { 18 | register int i; 19 | 20 | if (fl == NULL) 21 | fl = ""; /* no arguments? */ 22 | for (i = 1; *fl; i++,av++,fl++) { 23 | if (i > ac || *av == NULL) 24 | return(-1); 25 | switch (*fl) { 26 | case 's': /* string */ 27 | if (**av == '\0' || isspace(**av)) 28 | return(i); 29 | break; 30 | case 'i': /* integer */ 31 | if (!isintd(*av, " \t\r\n")) 32 | return(i); 33 | break; 34 | case 'f': /* float */ 35 | if (!isfltd(*av, " \t\r\n")) 36 | return(i); 37 | break; 38 | default: /* bad call! */ 39 | return(-1); 40 | } 41 | } 42 | return(0); /* all's well */ 43 | } 44 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/mgflib/fvect.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: fvect.c,v 1.4 2003/02/28 20:11:29 greg Exp $"; 3 | #endif 4 | /* 5 | * Routines for 3-d vectors 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include "parser.h" 12 | 13 | 14 | double 15 | normalize(v) /* normalize a vector, return old magnitude */ 16 | register FVECT v; 17 | { 18 | static double len; 19 | 20 | len = DOT(v, v); 21 | 22 | if (len <= 0.0) 23 | return(0.0); 24 | 25 | if (len <= 1.0+FTINY && len >= 1.0-FTINY) 26 | len = 0.5 + 0.5*len; /* first order approximation */ 27 | else 28 | len = sqrt(len); 29 | 30 | v[0] /= len; 31 | v[1] /= len; 32 | v[2] /= len; 33 | 34 | return(len); 35 | } 36 | 37 | 38 | void 39 | fcross(vres, v1, v2) /* vres = v1 X v2 */ 40 | register FVECT vres, v1, v2; 41 | { 42 | vres[0] = v1[1]*v2[2] - v1[2]*v2[1]; 43 | vres[1] = v1[2]*v2[0] - v1[0]*v2[2]; 44 | vres[2] = v1[0]*v2[1] - v1[1]*v2[0]; 45 | } 46 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/mgflib/iesnotes.txt: -------------------------------------------------------------------------------- 1 | Enclosing IES File Notes 2 | RCSid "$Id: iesnotes.txt,v 1.2 2003/02/28 20:19:26 greg Exp $" 3 | 4 | The following notes describe how MGF data is to be referred to by 5 | an enclosing IES luminaire file, and these notes are in a state of flux. 6 | 7 | The basic method for specifying an MGF geometry file within an IES 8 | file is a single line immediately preceeding the TILT= line, which reads: 9 | 10 | GEOM=file.mgf 11 | 12 | where "file.mgf" is replaced by the name of the relevant MGF file. 13 | 14 | IES data file contains simplified geometry, which must completely 15 | enclose the detailed geometry specified by the "GEOM=file.mgf" line. 16 | This detailed geometry file is always in meters, whatever the units of 17 | the enclosing IES file, and must have its origin at the center of the 18 | simplified geometry. The X-axis corresponds to the 0-180 degree plane, 19 | the Y-axis corresponds to the 90-270 degree plane, and the Z-axis 20 | corresponds to the up direction. (This is a right-handed coordinate 21 | system.) 22 | 23 | The emission values in the MGF file will be multiplied by the usual 24 | IES luminaire factors, i.e. the tilt factors (if any), the candela 25 | multiplier, the ballast factor and the ballast lamp factor. Thus, 26 | the MGF file emissions should correspond to those of the as-tested 27 | luminaire configuration. 28 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/mgflib/messages.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: messages.h,v 1.5 2003/02/28 20:11:29 greg Exp $ */ 2 | /* 3 | * Various messages, English version 4 | */ 5 | 6 | /* The following goes into the mg_err array, defined in parser.h */ 7 | 8 | #define MG_ERRLIST {"No error",\ 9 | "Unknown entity",\ 10 | "Wrong number of arguments",\ 11 | "Wrong argument type",\ 12 | "Illegal argument value",\ 13 | "Undefined reference",\ 14 | "Cannot open input file",\ 15 | "Error in included file",\ 16 | "Out of memory",\ 17 | "Seek failure",\ 18 | "Illegal material specification",\ 19 | "Input line too long",\ 20 | "Unmatched context close",\ 21 | } 22 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/mgflib/mgfdoc.ps.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Reference/radiance/src/cv/mgflib/mgfdoc.ps.Z -------------------------------------------------------------------------------- /Reference/radiance/src/cv/tilt.cal: -------------------------------------------------------------------------------- 1 | { RCSid: $Id: tilt.cal,v 2.3 2003/02/22 02:07:23 greg Exp $ } 2 | { 3 | tilt.cal - tilt data for IES luminaires 4 | } 5 | 6 | tilt_ang = Acos(Kz) / DEGREE; 7 | tilt_xang = if(Jy*Jy-FTINY, Asin(Jy/sqrt(Jy*Jy+Jz*Jz))/DEGREE, 0); 8 | 9 | tilt_ang2 = tri(tilt_ang, 90); 10 | tilt_xang2 = tri(tilt_xang, 90); 11 | -------------------------------------------------------------------------------- /Reference/radiance/src/cv/trans.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: trans.h,v 2.2 2003/02/22 02:07:23 greg Exp $ */ 2 | /* 3 | * Translator definitions 4 | * 5 | * Greg Ward 6 | */ 7 | 8 | #define MAXSTR 128 /* maximum input string length */ 9 | 10 | #define VOIDID "void" /* null modifier */ 11 | 12 | /* qualifier list */ 13 | typedef struct { 14 | int nquals; /* number of qualifiers */ 15 | char **qual; /* qualifier array */ 16 | } QLIST; 17 | /* identifier */ 18 | typedef struct { 19 | char *name; /* string, NULL if number */ 20 | int number; 21 | } ID; 22 | /* identifier list */ 23 | typedef struct { 24 | int nids; /* number of ids */ 25 | ID *id; /* id array */ 26 | } IDLIST; 27 | /* identifier range */ 28 | typedef struct { 29 | char *nam; /* string, NULL if range */ 30 | int min, max; /* accepted range */ 31 | } IDMATCH; 32 | /* mapping rule */ 33 | typedef struct rule { 34 | char *mnam; /* material name */ 35 | long qflg; /* qualifier condition flags */ 36 | struct rule *next; /* next rule in mapping */ 37 | /* followed by the IDMATCH array */ 38 | } RULEHD; 39 | /* useful macros */ 40 | #define doneid(idp) if ((idp)->name != NULL) freestr((idp)->name) 41 | #define FL(qn) (1L<<(qn)) 42 | #define rulsiz(nq) (sizeof(RULEHD)+(nq)*sizeof(IDMATCH)) 43 | #define idm(rp) ((IDMATCH *)((rp)+1)) 44 | 45 | char *savestr(); 46 | RULEHD *getmapping(); 47 | -------------------------------------------------------------------------------- /Reference/radiance/src/gen/README: -------------------------------------------------------------------------------- 1 | GENERATOR PROGRAMS 2 | SCCSid "@(#)README 2.3 8/25/95 LBL" 3 | 4 | This directory contains programs for generating and transforming 5 | Radiance scene descriptions. 6 | 7 | mkillum.h common definitions for mkillum 8 | genbeads.c generate a string of spheres using Hermite curve 9 | genblinds.c make some curved or flat venetian blinds 10 | genbox.c generate a parallelepiped 11 | genbranch.c generate a tree branch 12 | gencat.c generate a catenary of marks (use with replmarks) 13 | genclock.c generate a clock showing a specified time 14 | genmarble.c generate a marble with air bubbles 15 | genprism.c generate a prism 16 | genrev.c program to generate functions of rotation about z 17 | gensky.c program to generate sky functions 18 | gensurf.c program to generate functional surfaces 19 | genworm.c program to generate worms (strings with varying thickness) 20 | hermite3.c routines for 3D hermite curves 21 | mkillum.c make illum sources for optimizing rendering process 22 | mkillum2.c routines to do the actual calculation for mkillum 23 | mkillum3.c routines to print mkillum objects 24 | replmarks.c replace markers with objects or instances 25 | sun.c solar postion calculations 26 | xform.c program to transform object files 27 | illum.cal function file for mkillum output 28 | rev.cal function file for smoothing option of genrev 29 | skybright.cal function file for gensky output 30 | surf.cal function file for gensurf smoothing 31 | -------------------------------------------------------------------------------- /Reference/radiance/src/gen/glaze2.cal: -------------------------------------------------------------------------------- 1 | { RCSid: $Id: glaze2.cal,v 2.1 2003/02/22 02:07:23 greg Exp $ } 2 | { 3 | glaze2.cal - double-pane fritted and low-E glazings 4 | 5 | Uses BRTDfunc type to get correct behavior. 6 | Oct. 2002 Greg Ward 7 | 8 | We only provide support functions for the nasty expressions 9 | spat out for dual-glazings by glaze.csh. 10 | } 11 | { Fresnel approximation } 12 | fresne = exp(-6*abs(Rdot)) - exp(-6); 13 | fr(r) = r + fresne*(1 - r); 14 | ft(t) = t*(1 - fresne); 15 | { glass reflectance and transmittance } 16 | rclr = fr(0.076); 17 | tclr = ft(0.883); 18 | { combined double-pane reflectance } 19 | cr(rf,t,rb) : rf + t*t*rb; 20 | -------------------------------------------------------------------------------- /Reference/radiance/src/gen/illum.cal: -------------------------------------------------------------------------------- 1 | { RCSid: $Id: illum.cal,v 2.8 2003/02/22 02:07:23 greg Exp $ } 2 | { 3 | Coordinate computations for mkillum output. 4 | 5 | There are no arguments for the spherical case: 6 | 7 | il_alt - Altitude (1 to -1) for spherical coordinates 8 | il_azi - Azimuth (0 to 2*PI) for sphere 9 | 10 | For the hemispherical case, A1-A9 are the unit vectors for the 11 | hemisphere's coordinate system: 12 | 13 | il_alth - Altitude (1 to 0) for hemispherical coordinates 14 | il_azih - Azimuth (0 to 2*PI) for hemisphere 15 | } 16 | 17 | norm_rad(r) : if( r, r, r+2*PI ); 18 | 19 | il_alt = Dz; 20 | il_azi = norm_rad(Atan2(Dy, Dx)); 21 | 22 | il_alth = sq(-Dx*A7-Dy*A8-Dz*A9); 23 | il_azih = norm_rad(Atan2(-Dx*A4-Dy*A5-Dz*A6, -Dx*A1-Dy*A2-Dz*A3)); 24 | -------------------------------------------------------------------------------- /Reference/radiance/src/gen/mkillum.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: mkillum.h,v 2.2 2003/02/22 02:07:24 greg Exp $ */ 2 | /* 3 | * Common definitions for mkillum 4 | */ 5 | 6 | #include "standard.h" 7 | 8 | #include "object.h" 9 | 10 | #include "otypes.h" 11 | 12 | /* illum flags */ 13 | #define IL_LIGHT 0x1 /* light rather than illum */ 14 | #define IL_COLDST 0x2 /* use color distribution */ 15 | #define IL_COLAVG 0x4 /* use average color */ 16 | #define IL_DATCLB 0x8 /* OK to clobber data file */ 17 | 18 | struct illum_args { 19 | int flags; /* flags from list above */ 20 | char matname[MAXSTR]; /* illum material name */ 21 | char datafile[MAXSTR]; /* distribution data file name */ 22 | int dfnum; /* data file number */ 23 | char altmat[MAXSTR]; /* alternate material name */ 24 | int sampdens; /* point sample density */ 25 | int nsamps; /* # of samples in each direction */ 26 | float minbrt; /* minimum average brightness */ 27 | float col[3]; /* computed average color */ 28 | }; /* illum options */ 29 | 30 | struct rtproc { 31 | int pd[3]; /* rtrace pipe descriptors */ 32 | float *buf; /* rtrace i/o buffer */ 33 | int bsiz; /* maximum rays for rtrace buffer */ 34 | float **dest; /* destination for each ray result */ 35 | int nrays; /* current length of rtrace buffer */ 36 | }; /* rtrace process */ 37 | -------------------------------------------------------------------------------- /Reference/radiance/src/gen/rev.cal: -------------------------------------------------------------------------------- 1 | { RCSid: $Id: rev.cal,v 2.3 2003/02/22 02:07:24 greg Exp $ } 2 | { 3 | Phong normal interpolation for surfaces of revolution about z. 4 | 5 | 11/7/88 6 | 7 | (A1,A2) = (Mz,Bz) 8 | (A3,A4) = (Mr,Br) 9 | } 10 | 11 | rev_dr = rev_rad*A3 + A4; 12 | rev_rad = sqrt(Px*Px + Py*Py); 13 | 14 | rev_dx = rev_dr * Px/rev_rad; 15 | rev_dy = rev_dr * Py/rev_rad; 16 | rev_dz = Pz*A1 + A2; 17 | -------------------------------------------------------------------------------- /Reference/radiance/src/gen/skybright.cal: -------------------------------------------------------------------------------- 1 | { RCSid: $Id: skybright.cal,v 2.7 2003/02/22 02:07:24 greg Exp $ } 2 | { 3 | Sky brightness function for sunny and cloudy skies. 4 | 5 | Additional arguments required for calculation of skybright: 6 | 7 | A1 - 1 for CIE clear, 2 for CIE overcast, 8 | 3 for uniform, 4 for CIE intermediate 9 | A2 - zenith brightness 10 | A3 - ground plane brightness 11 | A4 - normalization factor based on sun direction 12 | A5,A6,A7 - sun direction 13 | } 14 | 15 | cosgamma = Dx*A5 + Dy*A6 + Dz*A7; 16 | 17 | gamma = Acos(cosgamma); { angle from sun to this point in sky } 18 | 19 | zt = Acos(A7); { angle from zenith to sun } 20 | 21 | eta = Acos(Dz); { angle from zenith to this point in sky } 22 | 23 | wmean(a, x, b, y) : (a*x + b*y) / (a + b); 24 | 25 | skybr = wmean((Dz+1.01)^10, 26 | select(A1, sunnysky, cloudysky, unifsky, intersky), 27 | (Dz+1.01)^-10, A3); 28 | 29 | sunnysky = A2 * (.91 + 10*exp(-3*gamma) + .45*cosgamma*cosgamma) 30 | * if( Dz - .01, 1.0 - exp(-.32/Dz), 1.0) / A4; 31 | 32 | cloudysky = A2 * (1 + 2*Dz)/3; 33 | 34 | unifsky = A2; 35 | 36 | intersky = A2 * ( (1.35*sin(5.631-3.59*eta)+3.12)*sin(4.396-2.6*zt) 37 | + 6.37 - eta ) / 2.326 * 38 | exp(gamma*-.563*((2.629-eta)*(1.562-zt)+.812)) / A4; 39 | -------------------------------------------------------------------------------- /Reference/radiance/src/gen/surf.cal: -------------------------------------------------------------------------------- 1 | { RCSid: $Id: surf.cal,v 2.3 2003/02/22 02:07:24 greg Exp $ } 2 | { 3 | surf.cal - calculation of interpolated surface normal 4 | 5 | A1 - dominant axis (we use the other two) 6 | A2 A3 A4 \ 7 | A5 A6 A7 \ normal perturbation vector matrix 8 | A8 A9 A10 / multiplied by [u*v u v 1] for perturbation 9 | A11 A12 A13 / 10 | } 11 | 12 | surf_u = select(arg(1)+1, Py, Pz, Px); 13 | surf_v = select(arg(1)+1, Pz, Px, Py); 14 | 15 | surf_dx = surf_u*surf_v*arg(2) + surf_u*arg(5) + surf_v*arg(8) + arg(11); 16 | surf_dy = surf_u*surf_v*arg(3) + surf_u*arg(6) + surf_v*arg(9) + arg(12); 17 | surf_dz = surf_u*surf_v*arg(4) + surf_u*arg(7) + surf_v*arg(10) + arg(13); 18 | -------------------------------------------------------------------------------- /Reference/radiance/src/hd/sm_flag.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: sm_flag.h,v 3.2 2003/02/22 02:07:25 greg Exp $ */ 2 | /* sm_flag.h */ 3 | 4 | /* 32 bit FLAGS */ 5 | #define F_OFFSET(t) ((t)>>5) 6 | #define F_BIT(t) ((t)&0x1f) 7 | #define F_OP(f,t,op) ((f)[F_OFFSET(t)] op (0x1<>5)*sizeof(int4)) 12 | -------------------------------------------------------------------------------- /Reference/radiance/src/hd/sm_list.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: sm_list.h,v 3.6 2003/02/22 02:07:25 greg Exp $ */ 2 | /* 3 | * list.h 4 | * Linked list data structure and routines 5 | */ 6 | 7 | #ifndef TRUE 8 | #define TRUE 1 9 | #define FALSE 0 10 | #endif 11 | 12 | typedef struct _LIST { 13 | int d; 14 | struct _LIST *next; 15 | }LIST; 16 | 17 | 18 | #define LIST_NEXT(l) ((l)->next) 19 | #define LIST_DATA(l) ((l)->d) 20 | #define SET_LIST_NEXT(l,d) ((l)->next = (d)) 21 | #define SET_LIST_DATA(l,id) ((l)->d = (int)(id)) 22 | 23 | /* 24 | LIST *new_list(void); 25 | LIST *free_list(LIST *l); 26 | LIST *append_list(LIST *a, LIST *b); 27 | 28 | int pop_data(LIST **l); 29 | LIST *add_data_to_circular_list(LIST *l,LIST **end,int d) 30 | int remove_from_list(int d,LIST **list) 31 | */ 32 | LIST *new_list(); 33 | LIST *free_list(); 34 | LIST *append_list(); 35 | int pop_data(); 36 | LIST *push_data(); 37 | LIST *add_data_to_circular_list(); 38 | int remove_from_list(); 39 | LIST *add_data(); 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/cv.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: cv.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | /* 5 | * Human-readable file I/O conversion program 6 | * 7 | * cc -o ../cv cv.c mfio.o cvhfio.o syscalls.o misc.o 8 | */ 9 | 10 | 11 | #include "meta.h" 12 | 13 | 14 | 15 | char *progname; 16 | 17 | 18 | main(argc, argv) 19 | 20 | int argc; 21 | char **argv; 22 | 23 | { 24 | FILE *fp; 25 | PRIMITIVE curp; 26 | short htom = TRUE; 27 | 28 | #ifdef CPM 29 | fixargs("cv", &argc, &argv); 30 | #endif 31 | 32 | progname = *argv++; 33 | argc--; 34 | 35 | if (argc && **argv == '-') { 36 | htom = FALSE; 37 | argv++; 38 | argc--; 39 | } 40 | 41 | if (argc) 42 | for (; argc; argc--, argv++) { 43 | fp = efopen(*argv, "r"); 44 | if (htom) 45 | while (scanp(&curp, fp)) { 46 | writep(&curp, stdout); 47 | fargs(&curp); 48 | } 49 | else 50 | while (readp(&curp, fp)) { 51 | printp(&curp, stdout); 52 | fargs(&curp); 53 | } 54 | fclose(fp); 55 | } 56 | else 57 | if (htom) 58 | while (scanp(&curp, stdin)) { 59 | writep(&curp, stdout); 60 | fargs(&curp); 61 | } 62 | else 63 | while (readp(&curp, stdin)) { 64 | printp(&curp, stdout); 65 | fargs(&curp); 66 | } 67 | 68 | if (htom) 69 | writeof(stdout); 70 | 71 | return(0); 72 | } 73 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/cvhfio.c: -------------------------------------------------------------------------------- 1 | #define readp scanp 2 | 3 | #define writep printp 4 | 5 | #define writeof printeof 6 | 7 | #include "hfio.c" 8 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | CFLAGS= -O 3 | INSTDIR=/usr/local/lib 4 | 5 | OBJS= arc.o box.o circle.o close.o dot.o erase.o label.o \ 6 | line.o linemod.o move.o open.o point.o space.o subr.o 7 | 8 | lib4014.a: ${OBJS} 9 | ar rc lib4014.a ${OBJS} 10 | -ranlib lib4014.a 11 | 12 | install: lib4014.a 13 | cp lib4014.a $(INSTDIR) 14 | 15 | clean: 16 | rm -f $(OBJS) lib4014.a 17 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/box.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: box.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)box.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | box(x0, y0, x1, y1) 9 | { 10 | move(x0, y0); 11 | cont(x0, y1); 12 | cont(x1, y1); 13 | cont(x1, y0); 14 | cont(x0, y0); 15 | move(x1, y1); 16 | } 17 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/circle.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: circle.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)circle.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | circle(x,y,r){ 9 | arc(x,y,x+r,y,x+r,y); 10 | } 11 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/close.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: close.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)close.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | #include 9 | closevt(){ 10 | putch(037); 11 | putch(030); 12 | fflush(stdout); 13 | } 14 | closepl(){ 15 | putch(037); 16 | putch(030); 17 | fflush(stdout); 18 | } 19 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/dot.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: dot.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)dot.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | dot(){ 9 | } 10 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/erase.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: erase.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)erase.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | #include 9 | 10 | extern int ohiy; 11 | extern int ohix; 12 | extern int oloy; 13 | extern int oextra; 14 | erase(){ 15 | putch(033); 16 | putch(014); 17 | fflush(stdout); 18 | ohiy= -1; 19 | ohix = -1; 20 | oextra = -1; 21 | oloy = -1; 22 | sleep(2); 23 | } 24 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/label.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: label.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)label.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | #define N 0104 9 | #define E 0101 10 | #define NE 0105 11 | #define S 0110 12 | #define W 0102 13 | #define SW 0112 14 | /* arrange by incremental plotting that an initial 15 | * character such as +, X, *, etc will fall 16 | * right on the point, and undo it so that further 17 | * labels will fall properly in place 18 | */ 19 | char lbl_mv[] = { 20 | 036,040,S,S,S,S,S,S,SW,SW,SW,SW,SW,SW,SW,SW,SW,SW,037,0 21 | }; 22 | char lbl_umv[] = { 23 | 036,040,N,N,N,N,N,N,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,037,0 24 | }; 25 | label(s) 26 | char *s; 27 | { 28 | register i,c; 29 | for(i=0; c=lbl_mv[i]; i++) 30 | putch(c); 31 | for(i=0; c=s[i]; i++) 32 | putch(c); 33 | for(i=0; c=lbl_umv[i]; i++) 34 | putch(c); 35 | } 36 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/line.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: line.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)line.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | line(x0,y0,x1,y1){ 9 | move(x0,y0); 10 | cont(x1,y1); 11 | } 12 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/linemod.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: linemod.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)linemod.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | linemod(s) 9 | char *s; 10 | { 11 | char c; 12 | putch(033); 13 | switch(s[0]){ 14 | case 'l': 15 | c = 'd'; 16 | break; 17 | case 'd': 18 | if(s[3] != 'd')c='a'; 19 | else c='b'; 20 | break; 21 | case 's': 22 | if(s[5] != '\0')c='c'; 23 | else c='`'; 24 | } 25 | putch(c); 26 | } 27 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/move.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: move.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)move.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | move(xi,yi){ 9 | putch(035); 10 | cont(xi,yi); 11 | } 12 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/open.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: open.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)open.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | openvt () 9 | { 10 | } 11 | openpl(){ 12 | } 13 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/point.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: point.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)point.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | point(xi,yi){ 9 | move(xi,yi); 10 | cont(xi,yi); 11 | } 12 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/scale.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: scale.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)scale.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | extern float scalex; 9 | extern float scaley; 10 | extern int scaleflag; 11 | scale(i,x,y) 12 | char i; 13 | float x,y; 14 | { 15 | switch(i) { 16 | default: 17 | return; 18 | case 'c': 19 | x *= 2.54; 20 | y *= 2.54; 21 | case 'i': 22 | x /= 200; 23 | y /= 200; 24 | case 'u': 25 | scalex = 1/x; 26 | scaley = 1/y; 27 | } 28 | scaleflag = 1; 29 | } 30 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/space.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: space.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)space.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | extern float botx; 9 | extern float boty; 10 | extern float obotx; 11 | extern float oboty; 12 | extern float scalex; 13 | extern float scaley; 14 | extern int scaleflag; 15 | space(x0,y0,x1,y1){ 16 | botx = 0.; 17 | boty = 0.; 18 | obotx = x0; 19 | oboty = y0; 20 | if(scaleflag) 21 | return; 22 | scalex = 3120./(x1-x0); 23 | scaley = 3120./(y1-y0); 24 | } 25 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/lib4014/subr.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: subr.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | #ifndef lint 5 | static char sccsid[] = "@(#)subr.c 4.1 (Berkeley) 6/27/83"; 6 | #endif 7 | 8 | #include 9 | float obotx = 0.; 10 | float oboty = 0.; 11 | float botx = 0.; 12 | float boty = 0.; 13 | float scalex = 1.; 14 | float scaley = 1.; 15 | int scaleflag; 16 | 17 | int oloy = -1; 18 | int ohiy = -1; 19 | int ohix = -1; 20 | int oextra = -1; 21 | cont(x,y){ 22 | int hix,hiy,lox,loy,extra; 23 | int n; 24 | x = (x-obotx)*scalex + botx; 25 | y = (y-oboty)*scaley + boty; 26 | hix=(x>>7) & 037; 27 | hiy=(y>>7) & 037; 28 | lox = (x>>2)&037; 29 | loy=(y>>2)&037; 30 | extra=x&03+(y<<2)&014; 31 | n = (abs(hix-ohix) + abs(hiy-ohiy) + 6) / 12; 32 | if(hiy != ohiy){ 33 | putch(hiy|040); 34 | ohiy=hiy; 35 | } 36 | if(hix != ohix){ 37 | if(extra != oextra){ 38 | putch(extra|0140); 39 | oextra=extra; 40 | } 41 | putch(loy|0140); 42 | putch(hix|040); 43 | ohix=hix; 44 | oloy=loy; 45 | } 46 | else{ 47 | if(extra != oextra){ 48 | putch(extra|0140); 49 | putch(loy|0140); 50 | oextra=extra; 51 | oloy=loy; 52 | } 53 | else if(loy != oloy){ 54 | putch(loy|0140); 55 | oloy=loy; 56 | } 57 | } 58 | putch(lox|0100); 59 | while(n--) 60 | putch(0); 61 | } 62 | 63 | putch(c){ 64 | putc(c,stdout); 65 | } 66 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/macplot.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: macplot.h,v 1.1 2003/02/22 02:07:26 greg Exp $ */ 2 | /* 3 | * Definitions for MacIntosh plotting routines 4 | */ 5 | 6 | #undef TRUE 7 | 8 | #undef FALSE 9 | 10 | #include 11 | 12 | 13 | #define mapx(x) CONV(x, dxsize) 14 | 15 | #define mapy(y) (dysize - 1 - CONV(y, dysize)) 16 | 17 | 18 | extern int pati[]; 19 | 20 | extern Pattern macpat[]; /* fill patterns */ 21 | 22 | extern dxsize, dysize; /* plot dimensions */ 23 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/pexpand.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: pexpand.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | /* 5 | * Program to expand meta-file commands 6 | * 7 | * cc pexpand.c expand.o mfio.o segment.o palloc.o syscalls.o misc.o 8 | */ 9 | 10 | 11 | #include "meta.h" 12 | 13 | 14 | 15 | char *progname; 16 | 17 | int maxalloc = 0; /* no limit */ 18 | 19 | 20 | 21 | main(argc, argv) 22 | 23 | int argc; 24 | char **argv; 25 | 26 | { 27 | FILE *fp; 28 | int i; 29 | char *cp; 30 | int com; 31 | short exlist[NCOMMANDS]; /* 1==expand, 0==pass, -1==discard */ 32 | 33 | #ifdef CPM 34 | fixargs("pexpand", &argc, &argv); 35 | #endif 36 | 37 | progname = *argv++; 38 | argc--; 39 | 40 | for (i = 0; i < NCOMMANDS; i++) 41 | exlist[i] = 0; 42 | 43 | while (argc && (**argv == '+' || **argv == '-')) { 44 | i = (**argv == '+') ? 1 : -1; 45 | for (cp = *argv+1; *cp ; cp++) { 46 | if ((com = comndx(*cp)) == -1 || *cp == PEOF) { 47 | sprintf(errmsg, "unknown option '%c'", *cp); 48 | error(WARNING, errmsg); 49 | } 50 | else 51 | exlist[com] = i; 52 | } 53 | argv++; 54 | argc--; 55 | } 56 | 57 | if (argc) 58 | while (argc) { 59 | fp = efopen(*argv, "r"); 60 | expand(fp, exlist); 61 | fclose(fp); 62 | argv++; 63 | argc--; 64 | } 65 | else 66 | expand(stdin, exlist); 67 | 68 | writeof(stdout); 69 | 70 | return(0); 71 | } 72 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/plot.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: plot.h,v 1.1 2003/02/22 02:07:26 greg Exp $ */ 2 | /* 3 | * Definitions for plotting routines 4 | */ 5 | 6 | 7 | #define NPATS 9 /* number of fill patterns */ 8 | 9 | #define PATSIZE 16 /* pattern size (square) */ 10 | 11 | 12 | extern int dxsize, dysize; /* device size */ 13 | 14 | extern int pati[]; 15 | 16 | extern unsigned char pattern[][PATSIZE/8][PATSIZE]; /* fill patterns */ 17 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/progname.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: progname.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | /* 5 | * progname.c - definition of progname for library. 6 | * 7 | * 2/24/86 8 | */ 9 | 10 | 11 | char *progname = "meta"; 12 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/random.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: random.h,v 1.1 2003/02/22 02:07:26 greg Exp $ */ 2 | /* 3 | * random.h - header file for random(3) function. 4 | * 5 | * 10/1/85 6 | */ 7 | 8 | extern long random(); 9 | 10 | #define frandom() (random()/2147483648.0) 11 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/rast.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: rast.h,v 1.1 2003/02/22 02:07:26 greg Exp $ */ 2 | /* 3 | * Structures for line segment output to raster files 4 | */ 5 | 6 | #define NUMSCANS 16 /* number of scanlines per block */ 7 | 8 | typedef struct { /* raster scanline block */ 9 | unsigned char *cols[NUMSCANS]; 10 | int ybot, ytop; /* ybot is scan[0] */ 11 | int xleft, xright; 12 | int width; 13 | } SCANBLOCK; 14 | 15 | extern int ydown; /* y going down? */ 16 | 17 | extern int minwidth; /* minimum line width */ 18 | 19 | extern SCANBLOCK outblock; /* output span */ 20 | 21 | #define IBLK 0 /* index for black */ 22 | #define IRED 1 23 | #define IGRN 2 24 | #define IBLU 3 25 | #define IYEL 4 26 | #define IMAG 5 27 | #define ICYN 6 28 | #define IWHT 7 29 | 30 | #define pixtog(x,y,c) { register unsigned char \ 31 | *cp = outblock.cols[(y)-outblock.ybot]+(x); \ 32 | *cp = ((~*cp ^ (c)<<3)&070) | (*cp&07); } 33 | 34 | #define pixmix(x,y,c) (outblock.cols[(y)-outblock.ybot][x] &= 070|(c)) 35 | 36 | #define someabove(p,y) (CONV((p)->xy[YMX],dysize) > (y)) 37 | #define somebelow(p,y) (CONV((p)->xy[YMN],dysize) < (y)) 38 | 39 | #define inthis(p) (ydown ? someabove(p,outblock.ybot-1) : \ 40 | somebelow(p,outblock.ytop+1)) 41 | #define innext(p) (ydown ? somebelow(p,outblock.ybot) : \ 42 | someabove(p,outblock.ytop)) 43 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/span.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: span.h,v 1.1 2003/02/22 02:07:26 greg Exp $ */ 2 | /* 3 | * Structures for line segment output to dot matrix printers 4 | */ 5 | 6 | 7 | #define MAXSPAN 5120 /* maximum span size in bytes */ 8 | 9 | 10 | 11 | 12 | struct span { /* line of printer output */ 13 | int xleft, xright, ybot, ytop; 14 | char cols[MAXSPAN]; 15 | char tcols[MAXSPAN]; 16 | }; 17 | 18 | 19 | 20 | 21 | extern int linwidt, linhite, /* line size */ 22 | nrows; /* # of rows */ 23 | 24 | extern int minwidth; /* minimum line width */ 25 | 26 | extern struct span outspan; /* output span */ 27 | 28 | extern int spanmin, spanmax; /* current span dimensions */ 29 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/syscalls.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: syscalls.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | /* 5 | * System calls for meta-file routines 6 | */ 7 | 8 | 9 | #include "meta.h" 10 | 11 | 12 | 13 | 14 | 15 | FILE * 16 | efopen(fname, mode) /* open a file, report errors */ 17 | 18 | char *fname, *mode; 19 | 20 | { 21 | register FILE *fp; 22 | FILE *fopen(); 23 | 24 | if ((fp = fopen(fname, mode)) == NULL) { 25 | sprintf(errmsg, "cannot open file \"%s\", mode \"%s\"", fname, mode); 26 | error(USER, errmsg); 27 | } 28 | 29 | return(fp); 30 | } 31 | 32 | 33 | 34 | FILE * 35 | mfopen(fname, mode) /* open a program metafile */ 36 | 37 | char *fname; 38 | char *mode; 39 | 40 | { 41 | char *mdir, stemp[MAXFNAME]; 42 | #if UNIX || MAC 43 | char *getenv(); 44 | 45 | if ((mdir = getenv("MDIR")) == NULL) 46 | #endif 47 | mdir = MDIR; 48 | sprintf(stemp, "%s%s", mdir, fname); 49 | 50 | return(efopen(stemp, mode)); 51 | } 52 | 53 | 54 | 55 | #ifdef CPM 56 | getpid() /* for CP/M, get user number */ 57 | 58 | { 59 | 60 | return(getusr()); 61 | } 62 | #endif 63 | 64 | 65 | 66 | #ifdef MAC 67 | getpid() /* dummy value for MacIntosh */ 68 | 69 | { 70 | 71 | return(0); 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /Reference/radiance/src/meta/targa.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: targa.h,v 1.1 2003/02/22 02:07:26 greg Exp $ */ 2 | /* 3 | * tardev.h - header file for reading and writing Targa format files. 4 | * 5 | * 8/25/88 6 | */ 7 | /* header structure adapted from tardev.h */ 8 | struct hdStruct { 9 | char textSize; /* size of info. line ( < 256) */ 10 | char mapType; /* color map type */ 11 | char dataType; /* data type */ 12 | int mapOrig; /* first color index */ 13 | int mapLength; /* length of file map */ 14 | char CMapBits; /* bits per map entry */ 15 | int XOffset; /* picture offset */ 16 | int YOffset; 17 | int x; /* picture size */ 18 | int y; 19 | int dataBits; /* bits per pixel */ 20 | int imType; /* image descriptor byte */ 21 | }; 22 | 23 | #define IM_NODATA 0 /* no data included */ 24 | #define IM_CMAP 1 /* color-mapped */ 25 | #define IM_RGB 2 /* straight RGB */ 26 | #define IM_MONO 3 /* straight monochrome */ 27 | #define IM_CCMAP 9 /* compressed color-mapped */ 28 | #define IM_CRGB 10 /* compressed RGB */ 29 | #define IM_CMONO 11 /* compressed monochrome */ 30 | 31 | /* color map types */ 32 | #define CM_NOMAP 0 /* no color map */ 33 | #define CM_HASMAP 1 /* has color map */ 34 | 35 | #define bits_bytes(n) (((n)+7)>>3) /* number of bits to number of bytes */ 36 | -------------------------------------------------------------------------------- /Reference/radiance/src/ot/README: -------------------------------------------------------------------------------- 1 | OCTREE GENERATOR 2 | SCCSid "@(#)README 2.3 8/25/95 LBL" 3 | 4 | This directory contains the octree generation program "oconv" and the 5 | bounding box sidekick "getbbox". 6 | 7 | bbox.c routines for bounding box computation 8 | getbbox.c compute bounding box for scene files 9 | init2otypes.c initialize ofun[] list for bounding box checker 10 | initotypes.c initialize ofun[] list for octree generator 11 | malloc.c memory allocation routines 12 | o_cone.c routines for intersecting cubes with cones 13 | o_face.c routines for creating octrees for polygonal faces 14 | o_instance.c routines for creating octrees for other octrees 15 | oconv.c main program for object to octree conversion 16 | readfargs.c allocate, read and free object arguments 17 | readobj2.c routines for reading in object descriptions 18 | sphere.c routines for creating octrees for spheres 19 | writeoct.c routines for writing octree information to stdout 20 | -------------------------------------------------------------------------------- /Reference/radiance/src/ot/cvmesh.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: cvmesh.h,v 2.2 2003/03/14 21:27:46 greg Exp $ */ 2 | /* 3 | * Header for Radiance triangle mesh conversion 4 | * 5 | * Include after standard.h 6 | */ 7 | 8 | #include "octree.h" 9 | #include "object.h" 10 | #include "mesh.h" 11 | 12 | extern MESH *ourmesh; /* global mesh pointer */ 13 | 14 | extern FVECT meshbounds[2]; /* mesh bounding box */ 15 | 16 | #ifdef NOPROTO 17 | 18 | extern MESH *cvinit(); 19 | extern int cvpoly(); 20 | extern int cvtri(); 21 | extern void cvmeshbounds(); 22 | extern MESH *cvmesh(); 23 | void wfreadobj(); 24 | 25 | #else 26 | 27 | extern MESH *cvinit(char *nm); 28 | extern int cvpoly(OBJECT mo, int n, FVECT *vp, 29 | FVECT *vn, FLOAT (*vc)[2]); 30 | extern int cvtri(OBJECT mo, FVECT vp1, FVECT vp2, FVECT vp3, 31 | FVECT vn1, FVECT vn2, FVECT vn3, 32 | FLOAT vc1[2], FLOAT vc2[2], FLOAT vc3[2]); 33 | extern void cvmeshbounds(void); 34 | extern MESH *cvmesh(void); 35 | /* defined in wfconv.c */ 36 | void wfreadobj(char *objfn); 37 | 38 | 39 | #endif /* NOPROTO */ 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/ot/init2otypes.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: init2otypes.c,v 2.2 2003/02/22 02:07:26 greg Exp $"; 3 | #endif 4 | /* 5 | * Initialize ofun[] list for bounding box checker 6 | */ 7 | 8 | #include "standard.h" 9 | 10 | #include "octree.h" 11 | 12 | #include "otypes.h" 13 | 14 | FUN ofun[NUMOTYPE] = INIT_OTYPE; 15 | 16 | 17 | o_default() /* default action is no intersection */ 18 | { 19 | return(O_MISS); 20 | } 21 | -------------------------------------------------------------------------------- /Reference/radiance/src/ot/initotypes.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: initotypes.c,v 2.3 2003/03/11 17:08:55 greg Exp $"; 3 | #endif 4 | /* 5 | * Initialize ofun[] list for octree generator 6 | */ 7 | 8 | #include "standard.h" 9 | 10 | #include "octree.h" 11 | 12 | #include "otypes.h" 13 | 14 | extern int o_sphere(); 15 | extern int o_face(); 16 | extern int o_cone(); 17 | extern int o_instance(); 18 | extern int o_mesh(); 19 | 20 | FUN ofun[NUMOTYPE] = INIT_OTYPE; 21 | 22 | 23 | initotypes() /* initialize ofun array */ 24 | { 25 | ofun[OBJ_SPHERE].funp = 26 | ofun[OBJ_BUBBLE].funp = o_sphere; 27 | ofun[OBJ_FACE].funp = o_face; 28 | ofun[OBJ_CONE].funp = 29 | ofun[OBJ_CUP].funp = 30 | ofun[OBJ_CYLINDER].funp = 31 | ofun[OBJ_TUBE].funp = 32 | ofun[OBJ_RING].funp = o_cone; 33 | ofun[OBJ_INSTANCE].funp = o_instance; 34 | ofun[OBJ_MESH].funp = o_mesh; 35 | } 36 | 37 | 38 | o_default() /* default action is no intersection */ 39 | { 40 | return(O_MISS); 41 | } 42 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/brandom.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: brandom.c,v 1.2 2003/02/22 02:07:27 greg Exp $"; 3 | #endif 4 | /* 5 | * brandom.c - blue noise function. 6 | * 7 | * 11/8/87 8 | */ 9 | 10 | #include "random.h" 11 | 12 | 13 | double 14 | brandom(l) /* blue noise function */ 15 | int l; /* length between 1 and 8 */ 16 | { 17 | static float his[8] = {.5,.5,.5,.5,.5,.5,.5,.5}; 18 | static double avg = .5; 19 | static int x = 0; 20 | double y = frandom(); 21 | 22 | if (avg < .5) 23 | y = 1 - 2*y*avg; 24 | else 25 | y = 2*y*(1 - avg); 26 | /* update */ 27 | avg += (y - his[x])/l; 28 | his[x] = y; 29 | if (++x >= l) x = 0; 30 | 31 | return(y); 32 | } 33 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/ciq.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: ciq.h,v 2.2 2003/02/22 02:07:27 greg Exp $ */ 2 | #include 3 | #include "pic.h" 4 | 5 | #define red(i) ((i)>>7&0xf8|4) /* 5 bits red, 5 bits green, 5 bits blue */ 6 | #define gre(i) ((i)>>2&0xf8|4) 7 | #define blu(i) ((i)<<3&0xf8|4) 8 | #define len 32768 9 | 10 | extern int hist[len]; /* list of frequencies or pixelvalues for coded color */ 11 | 12 | extern colormap color; /* quantization colormap */ 13 | extern int n; /* number of colors in it */ 14 | 15 | #define linealloc(xdim) (pixel *)emalloc(sizeof(pixel)*xdim) 16 | #define line3alloc(xdim) (rgbpixel *)emalloc(sizeof(rgbpixel)*xdim) 17 | 18 | extern char *emalloc(); 19 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/hexbit.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: hexbit.c,v 3.1 2003/02/22 02:07:27 greg Exp $"; 3 | #endif 4 | /* 5 | * Convert from Radiance picture to bitmap usable by hexbit4x1.fnt 6 | * 7 | * pipe input from "pvalue -h -b -di [picture]" 8 | */ 9 | 10 | #include 11 | 12 | main() 13 | { 14 | int xres, yres; 15 | int i, j, i1,i2,i3,i4; 16 | 17 | if (scanf("-Y %d +X %d\n", &yres, &xres) != 2) 18 | exit(1); 19 | for (i = 0; i < yres; i++) { 20 | for (j = 0; j < xres/4; j++) { 21 | if (scanf("%d\n%d\n%d\n%d\n", &i1, &i2, &i3, &i4) != 4) 22 | exit(1); 23 | printf("%01X", (i1<128)<<3|(i2<128)<<2|(i3<128)<<1|(i4<128)); 24 | } 25 | for (j = xres%4; j--; ) /* should get it, but too lazy */ 26 | scanf("%*d\n"); 27 | putchar('\n'); 28 | } 29 | exit(0); 30 | } 31 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/mx3.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: mx3.h,v 2.2 2003/02/22 02:07:27 greg Exp $ */ 2 | #ifndef MX3_HDR 3 | #define MX3_HDR 4 | 5 | #define mx3_copy(a, b) bcopy(a, b, 3*3*sizeof(double)) 6 | 7 | /* FLOAT VERSIONS */ 8 | float mx3f_adjoint(/* a, b */); 9 | void mx3f_mul(/* a, b, c */); 10 | void mx3f_print(/* str, a */); 11 | void mx3f_translate_mat(/* tx, ty, a */); 12 | void mx3f_translate(/* a, tx, ty */); 13 | void mx3f_scale_mat(/* sx, sy, a */); 14 | void mx3f_scale(/* a, sx, sy */); 15 | void mx3f_transform(/* p, a, q */); 16 | float mx3f_transform_div(/* p, a, q */); 17 | #define mx3f_copy(a, b) bcopy(a, b, 3*3*sizeof(float)) 18 | 19 | /* DOUBLE VERSIONS */ 20 | double mx3d_adjoint(/* a, b */); 21 | void mx3d_mul(/* a, b, c */); 22 | void mx3d_print(/* str, a */); 23 | void mx3d_translate_mat(/* tx, ty, a */); 24 | void mx3d_translate(/* a, tx, ty */); 25 | void mx3d_scale_mat(/* sx, sy, a */); 26 | void mx3d_scale(/* a, sx, sy */); 27 | void mx3d_transform(/* p, a, q */); 28 | double mx3d_transform_div(/* p, a, q */); 29 | #define mx3d_copy(a, b) bcopy(a, b, 3*3*sizeof(double)) 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/pdfblur.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: pdfblur.csh,v 2.5 2003/02/22 02:07:27 greg Exp $ 3 | # 4 | # Generate views for depth-of-field blurring on picture 5 | # 6 | if ($#argv != 4) then 7 | echo "Usage: $0 aperture distance nsamp viewfile" >/dev/tty 8 | exit 1 9 | endif 10 | set a = "$1" 11 | set d = "$2" 12 | set n = "$3" 13 | set vf = "$4" 14 | cnt $n | rcalc -e `vwright i < $vf` \ 15 | -e "M:$n/5+1;a:$a/2;d:$d;N:$n;" -e 'tmax:PI*a*(M+1)' \ 16 | -e 't=tmax/N*($1+rand($1))' \ 17 | -e 'theta=2*M*PI/(M-1)*(M-sqrt(M*M-(M-1)/(PI*a)*t))' \ 18 | -e 'r=a*(1-(M-1)/(2*M*M*PI)*theta)' \ 19 | -e 'rcost=r*cos(theta);rsint=r*sin(theta)' \ 20 | -e 'opx=ipx+rcost*ihx+rsint*ivx' \ 21 | -e 'opy=ipy+rcost*ihy+rsint*ivy' \ 22 | -e 'opz=ipz+rcost*ihz+rsint*ivz' \ 23 | -e 'os=is-rcost/(d*ihn);ol=il-rsint/(d*ivn)' \ 24 | -o 'VIEW= -vp ${opx} ${opy} ${opz} -vs ${os} -vl ${ol}' 25 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/phisto.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: phisto.csh,v 3.3 2003/02/22 02:07:27 greg Exp $ 3 | # 4 | # Compute foveal histogram for picture set 5 | # 6 | set tf=/usr/tmp/ph$$ 7 | onintr quit 8 | if ( $#argv == 0 ) then 9 | pfilt -1 -x 128 -y 128 -p 1 \ 10 | | pvalue -o -h -H -d -b > $tf.dat 11 | else 12 | rm -f $tf.dat 13 | foreach i ( $* ) 14 | pfilt -1 -x 128 -y 128 -p 1 $i \ 15 | | pvalue -o -h -H -d -b >> $tf.dat 16 | if ( $status ) exit 1 17 | end 18 | endif 19 | set Lmin=`total -l $tf.dat | rcalc -e 'L=$1*179;$1=if(L-1e-7,log10(L)-.01,-7)'` 20 | set Lmax=`total -u $tf.dat | rcalc -e '$1=log10($1*179)+.01'` 21 | rcalc -e 'L=$1*179;cond=L-1e-7;$1=log10(L)' $tf.dat \ 22 | | histo $Lmin $Lmax 100 23 | quit: 24 | rm -f $tf.dat 25 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/pic.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: pic.h,v 2.2 2003/02/22 02:07:27 greg Exp $ */ 2 | /* the following three structures are used by ciq */ 3 | 4 | typedef int colormap[3][256]; 5 | 6 | typedef unsigned char pixel; 7 | 8 | typedef struct { 9 | pixel r,g,b; 10 | } rgbpixel; 11 | 12 | #define rgb_bright(p) (int)((77L*(p)->r+151L*(p)->g+28L*(p)->b)/256) 13 | 14 | /* image resolution */ 15 | extern int xmax,ymax; 16 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/pict.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: pict.h,v 2.3 2003/02/22 02:07:27 greg Exp $ */ 2 | /* 3 | Header file for ra_pict.h 4 | */ 5 | 6 | #define HEADER_SIZE 512 7 | #define PICT_picVersion 0x0011 8 | #define PICT_reservedHeader 0x0C00 9 | #define PICT_clipRgn 0x0001 10 | #define PICT_EndOfPicture 0x00FF 11 | #define PICT_PackBitsRect 0x0098 12 | #define PICT_Pack32BitsRect 0x009A 13 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/pmap.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: pmap.h,v 2.2 2003/02/22 02:07:27 greg Exp $ */ 2 | /* Pmap return codes */ 3 | #define PMAP_BAD -1 4 | #define PMAP_LINEAR 0 5 | #define PMAP_PERSP 1 6 | 7 | /* |a b| 8 | * |c d| 9 | */ 10 | #define DET2(a,b, c,d) ((a)*(d) - (b)*(c)) 11 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/pmblur.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: pmblur.csh,v 2.2 2003/02/22 02:07:27 greg Exp $ 3 | # 4 | # Generate views for motion blurring on picture 5 | # 6 | if ($#argv != 4) then 7 | echo "Usage: $0 speed nsamp v0file v1file" >/dev/tty 8 | exit 1 9 | endif 10 | set s = "$1" 11 | set n = "$2" 12 | set vc = "$3" 13 | set vn = "$4" 14 | cnt $n | rcalc -e `vwright C < $vc` -e `vwright N < $vn` \ 15 | -e "t=$s/$n"'*($1+rand($1))' \ 16 | -e 'opx=(1-t)*Cpx+t*Npx;opy=(1-t)*Cpy+t*Npy;opz=(1-t)*Cpz+t*Npz' \ 17 | -e 'odx=(1-t)*Cdx+t*Ndx;ody=(1-t)*Cdy+t*Ndy;odz=(1-t)*Cdz+t*Ndz' \ 18 | -e 'oux=(1-t)*Cux+t*Nux;ouy=(1-t)*Cuy+t*Nuy;ouz=(1-t)*Cuz+t*Nuz' \ 19 | -e 'oh=(1-t)*Ch+t*Nh;ov=(1-t)*Cv+t*Nv' \ 20 | -o 'VIEW= -vp ${opx} ${opy} ${opz} -vd ${odx} ${ody} ${odz} -vu ${oux} ${ouy} ${ouz} -vh ${oh} -vv ${ov}' 21 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/pveil.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: pveil.csh,v 3.2 2003/02/22 02:07:27 greg Exp $ 3 | # 4 | # Add veiling glare to picture 5 | # 6 | if ($#argv != 1) then 7 | echo "Usage: $0 input.pic > output.pic" 8 | exit 1 9 | endif 10 | set ifile=$1 11 | set td=/usr/tmp 12 | set gf=$td/av$$.gs 13 | set cf=$td/av$$.cal 14 | set tf=($gf $cf) 15 | onintr quit 16 | findglare -r 400 -c -p $ifile \ 17 | | sed -e '1,/^BEGIN glare source$/d' -e '/^END glare source$/,$d' \ 18 | > $gf 19 | if ( -z $gf ) then 20 | cat $ifile 21 | goto quit 22 | endif 23 | ( rcalc -e '$1=recno;$2=$1;$3=$2;$4=$3;$5=$4*$5' $gf \ 24 | | tabfunc SDx SDy SDz I ; cat ) > $cf << '_EOF_' 25 | N : I(0); 26 | K : 9.2; { should be 9.6e-3/PI*(180/PI)^2 == 10.03 ? } 27 | bound(a,x,b) : if(a-x, a, if(x-b, b, x)); 28 | Acos(x) : acos(bound(-1,x,1)); 29 | sq(x) : x*x; 30 | mul(ct) : if(ct-cos(.5*PI/180), K/sq(.5), K/sq(180/PI)*ct/sq(Acos(ct))); 31 | Dx1 = Dx(1); Dy1 = Dy(1); Dz1 = Dz(1); { minor optimization } 32 | cosa(i) = SDx(i)*Dx1 + SDy(i)*Dy1 + SDz(i)*Dz1; 33 | sum(i) = if(i-.5, mul(cosa(i))*I(i)+sum(i-1), 0); 34 | veil = le(1)/WE * sum(N); 35 | ro = ri(1) + veil; 36 | go = gi(1) + veil; 37 | bo = bi(1) + veil; 38 | '_EOF_' 39 | getinfo < $ifile | egrep '^((VIEW|EXPOSURE|PIXASPECT|PRIMARIES|COLORCORR)=|[^ ]*(rpict|rview|pinterp) )' 40 | pcomb -f $cf $ifile 41 | quit: 42 | rm -f $tf 43 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/ra_im.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: ra_im.c,v 2.2 2003/02/22 02:07:27 greg Exp $"; 3 | #endif 4 | /* 5 | * ra_im.c - convert Radiance picture to imagetools raw format. 6 | * 7 | * 9/16/88 8 | */ 9 | 10 | #include 11 | 12 | 13 | #define PCOMM "pvalue -h -b -db" 14 | 15 | #define MINVAL 1 16 | #define MAXVAL 252 17 | 18 | extern FILE *popen(), *freopen(); 19 | 20 | 21 | main(argc, argv) 22 | int argc; 23 | char *argv[]; 24 | { 25 | register int c; 26 | register FILE *fp; 27 | 28 | if (argc > 3) { 29 | fputs("Usage: ", stderr); 30 | fputs(argv[0], stderr); 31 | fputs(" [infile [outfile]]\n", stderr); 32 | exit(1); 33 | } 34 | if (argc > 1 && freopen(argv[1], "r", stdin) == NULL) { 35 | perror(argv[1]); 36 | exit(1); 37 | } 38 | if (argc > 2 && freopen(argv[2], "w", stdout) == NULL) { 39 | perror(argv[2]); 40 | exit(1); 41 | } 42 | if ((fp = popen(PCOMM, "r")) == NULL) { 43 | perror(argv[0]); 44 | exit(1); 45 | } 46 | while ((c = getc(fp)) != EOF) { 47 | if (c < MINVAL) 48 | putc(MINVAL, stdout); 49 | else if (c > MAXVAL) 50 | putc(MAXVAL, stdout); 51 | else 52 | putc(c, stdout); 53 | } 54 | exit(pclose(fp)); 55 | } 56 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/scan.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: scan.c,v 1.4 2003/02/22 02:07:28 greg Exp $"; 3 | #endif 4 | /* 5 | * writescan.c - fortran interface to picture output routines. 6 | * 7 | * 4/26/88 8 | */ 9 | 10 | #include 11 | 12 | 13 | static FILE *outfp; /* output file pointer */ 14 | static char outfile[128]; /* output file name */ 15 | 16 | 17 | initscan_(fname, width, height) /* initialize output file */ 18 | char *fname; 19 | int *width, *height; 20 | { 21 | extern char *strcpy(); 22 | 23 | if (fname == NULL || fname[0] == '\0') { 24 | outfp = stdout; 25 | strcpy(outfile, ""); 26 | } else { 27 | if ((outfp = fopen(fname, "w")) == NULL) { 28 | perror(fname); 29 | exit(1); 30 | } 31 | strcpy(outfile, fname); 32 | } 33 | fprintf(outfp, "%dx%d picture\n\n-Y %d +X %d\n", 34 | *width, *height, *height, *width); 35 | } 36 | 37 | 38 | writescan_(scan, width) /* output scanline */ 39 | float *scan; 40 | int *width; 41 | { 42 | if (fwritescan(scan, *width, outfp) < 0) { 43 | perror(outfile); 44 | exit(1); 45 | } 46 | } 47 | 48 | 49 | donescan_() /* clean up */ 50 | { 51 | if (fclose(outfp) < 0) { 52 | perror(outfile); 53 | exit(1); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/x11raster.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: x11raster.h,v 2.2 2003/02/22 02:07:28 greg Exp $ */ 2 | /* 3 | * x11raster.h - header file for X routines using images. 4 | * 5 | * 3/1/90 6 | */ 7 | 8 | typedef struct { 9 | Display *disp; /* the display */ 10 | int screen; /* the screen */ 11 | Visual *visual; /* pointer to visual used */ 12 | XImage *image; /* the X image */ 13 | GC gc; /* private graphics context */ 14 | int ncolors; /* number of colors */ 15 | XColor *cdefs; /* color definitions */ 16 | short *pmap; /* inverse pixel mapping */ 17 | unsigned long *pixels; /* allocated table entries */ 18 | Colormap cmap; /* installed color map */ 19 | Pixmap pm; /* storage on server side */ 20 | } XRASTER; 21 | 22 | extern Colormap newcmap(); 23 | 24 | extern unsigned long *map_rcolors(); 25 | 26 | extern Pixmap make_rpixmap(); 27 | 28 | extern XRASTER *make_raster(); 29 | 30 | #define put_raster(d,xdst,ydst,xr) patch_raster(d,0,0,xdst,ydst, \ 31 | (xr)->image->width,(xr)->image->height,xr) 32 | -------------------------------------------------------------------------------- /Reference/radiance/src/px/xraster.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: xraster.h,v 3.2 2003/02/25 02:47:22 greg Exp $ */ 2 | /* 3 | * xraster.h - header file for X routines using images. 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | typedef struct { 9 | int width, height; /* image size */ 10 | int ncolors; /* number of colors */ 11 | union { 12 | unsigned short *m; /* monochrome */ 13 | unsigned char *bz; /* color */ 14 | } data; /* storage on our side */ 15 | Pixmap pm; /* storage on server side */ 16 | Color *cdefs; /* color definitions */ 17 | int *pmap; /* inverse pixel mapping */ 18 | int *pixels; /* allocated table entries */ 19 | } XRASTER; 20 | 21 | extern int *map_rcolors(); 22 | 23 | extern Pixmap make_rpixmap(); 24 | -------------------------------------------------------------------------------- /Reference/radiance/src/rt/VERSION: -------------------------------------------------------------------------------- 1 | RADIANCE 3.5 2 | -------------------------------------------------------------------------------- /Reference/radiance/src/rt/Version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This is the official release file for Radiance version 3.5 3 | */ 4 | 5 | char VersionID[]="RADIANCE 3.5 official LBNL release March 14 2003"; 6 | -------------------------------------------------------------------------------- /Reference/radiance/src/rt/data.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: data.h,v 2.5 2003/02/25 02:47:22 greg Exp $ */ 2 | /* 3 | * Header for data file loading and computation routines. 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | #define MAXDDIM 5 /* maximum data dimensions */ 9 | 10 | #define DATATYPE float /* single precision to save space */ 11 | #define DATATY 'f' /* format for DATATYPE */ 12 | 13 | typedef struct datarray { 14 | char *name; /* name of our data */ 15 | short type; /* DATATY, RED, GRN or BLU */ 16 | short nd; /* number of dimensions */ 17 | struct { 18 | DATATYPE org, siz; /* coordinate domain */ 19 | int ne; /* number of elements */ 20 | DATATYPE *p; /* point locations */ 21 | } dim[MAXDDIM]; /* dimension specifications */ 22 | union { 23 | DATATYPE *d; /* float data */ 24 | COLR *c; /* RGB data */ 25 | } arr; /* the data */ 26 | struct datarray *next; /* next array in list */ 27 | } DATARRAY; /* a data array */ 28 | 29 | #ifdef NOPROTO 30 | 31 | extern DATARRAY *getdata(); 32 | extern DATARRAY *getpict(); 33 | extern void freedata(); 34 | extern double datavalue(); 35 | 36 | #else 37 | 38 | extern DATARRAY *getdata(char *dname); 39 | extern DATARRAY *getpict(char *pname); 40 | extern void freedata(DATARRAY *dta); 41 | extern double datavalue(DATARRAY *dp, double *pt); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Reference/radiance/src/rt/devtable.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: devtable.c,v 2.5 2003/02/25 02:47:22 greg Exp $"; 3 | #endif 4 | /* 5 | * devtable.c - device table for rview. 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #include "color.h" 11 | 12 | #include "driver.h" 13 | 14 | char dev_default[] = "x11"; 15 | 16 | extern struct driver *x11_init(); 17 | 18 | struct device devtable[] = { /* supported devices */ 19 | {"slave", "Slave driver", slave_init}, 20 | {"x11", "X11 color or greyscale display", x11_init}, 21 | {"x11d", "X11 display using stdin/stdout", x11_init}, 22 | {0} /* terminator */ 23 | }; 24 | -------------------------------------------------------------------------------- /Reference/radiance/src/rt/func.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: func.h,v 2.3 2003/02/25 02:47:22 greg Exp $ */ 2 | /* 3 | * Header file for modifiers using function files. 4 | * 5 | * Include after ray.h 6 | */ 7 | 8 | #include "copyright.h" 9 | 10 | #include "calcomp.h" 11 | 12 | #define MAXEXPR 9 /* maximum expressions in modifier */ 13 | 14 | typedef struct { 15 | EPNODE *ep[MAXEXPR+1]; /* NULL-terminated expression list */ 16 | char *ctx; /* context (from file name) */ 17 | XF *f, *b; /* forward and backward transforms */ 18 | } MFUNC; /* material function */ 19 | 20 | extern XF unitxf; /* identity transform */ 21 | extern XF funcxf; /* current transform */ 22 | 23 | #ifdef NOPROTO 24 | 25 | extern MFUNC *getfunc(); 26 | extern void freefunc(); 27 | extern int setfunc(); 28 | extern void loadfunc(); 29 | 30 | #else 31 | 32 | extern MFUNC *getfunc(OBJREC *m, int ff, unsigned int ef, int dofwd); 33 | extern void freefunc(OBJREC *m); 34 | extern int setfunc(OBJREC *m, RAY *r); 35 | extern void loadfunc(char *fname); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Reference/radiance/src/rt/newsconstants.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: newsconstants.h,v 2.2 2003/02/22 02:07:28 greg Exp $ */ 2 | #define textareaheight 150 3 | #define textbottom 10 4 | #define thefont /Times-Bold 5 | #define fontheight 18 6 | #define textbackgroundRED .85 7 | #define textbackgroundGREEN .85 8 | #define textbackgroundBLUE .75 9 | #define textcursor (|) 10 | #define textshadowgray .85 11 | #define gammacorrection 1.0 12 | 13 | #define inputbuffer nws_inputbuffer 14 | #define pos nws_pos 15 | #define gamma nws_gamma 16 | 17 | #define painter nws_painter 18 | #define printer nws_printer 19 | #define getinput nws_getinput 20 | #define initcanvas cps_initcanvas 21 | #define box cps_box 22 | #define cleanup cps_cleanup 23 | #define printout cps_printout 24 | #define linefeed cps_linefeed 25 | #define getclick cps_getclick 26 | #define isready cps_isready 27 | #define startcomin cps_startcomin 28 | #define endcomin cps_endcomin 29 | #define getkey cps_getkey 30 | #define delete cps_delete 31 | 32 | -------------------------------------------------------------------------------- /Reference/radiance/src/rt/otspecial.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: otspecial.h,v 2.3 2003/02/25 02:47:23 greg Exp $ */ 2 | /* 3 | * Special type flags for objects used in rendering. 4 | * Depends on definitions in otypes.h 5 | */ 6 | 7 | #include "copyright.h" 8 | 9 | /* flag for materials to ignore during irradiance comp. */ 10 | #define T_IRR_IGN T_SP1 11 | 12 | #define irr_ignore(t) (ofun[t].flags & T_IRR_IGN) 13 | -------------------------------------------------------------------------------- /Reference/radiance/src/rt/verscript.ed: -------------------------------------------------------------------------------- 1 | 1s/^/char VersionID[]="/ 2 | 2s/^/ lastmod / 3 | 3s/^/ by / 4 | 4s/^/ on / 5 | 1,$j 6 | 1s/$/";/ 7 | 1i 8 | /* 9 | * This file was created automatically during make. 10 | */ 11 | 12 | . 13 | w 14 | q 15 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/compamb.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: compamb.csh,v 3.5 2003/02/22 02:07:30 greg Exp $ 3 | # 4 | # Compute best ambient value for a scene and append to rad input file 5 | # 6 | while ( $#argv > 1 ) 7 | switch ( $argv[1] ) 8 | case -e: 9 | set doexpos 10 | breaksw 11 | case -c: 12 | set docolor 13 | breaksw 14 | default: 15 | goto userr 16 | endsw 17 | shift argv 18 | end 19 | userr: 20 | if ( $#argv != 1 ) then 21 | echo Usage: $0 [-e][-c] rad_input_file 22 | exit 1 23 | endif 24 | onintr quit 25 | set tf=/usr/tmp/ca$$ 26 | set oct=`rad -w -s -e -v 0 $argv[1] QUA=High AMB=$tf.amb OPT=$tf.opt | sed -n 's/^OCTREE= //p'` 27 | rad -n -s -V $argv[1] \ 28 | | rpict @$tf.opt -av 0 0 0 -aw 16 -dv- -S 1 -x 16 -y 16 -ps 1 $oct \ 29 | | ra_rgbe - '\!pvalue -h -H -d' > $tf.dat 30 | echo \# Rad input file modified by $0 `date` >> $argv[1] 31 | if ( $?doexpos ) then 32 | (echo -n 'EXPOSURE= '; \ 33 | total -u $tf.dat | rcalc -e '$1=2/(.265*$1+.670*$2+.065*$3)') \ 34 | >> $argv[1] 35 | endif 36 | lookamb -h -d $tf.amb | rcalc -e '$1=$10;$2=$11;$3=$12' >> $tf.dat 37 | set lavg=`rcalc -e '$1=lum;lum=.265*$1+.670*$2+.065*$3;cond=lum-1e-5' $tf.dat | total -m -p` 38 | if ( $?docolor ) then 39 | set cavg=(`total -m $tf.dat`) 40 | set av=(`rcalc -n -e "r=$cavg[1];g=$cavg[2];b=$cavg[3];sf=$lavg/(.265*r+.670*g+.065*b)" -e '$1=sf*r;$2=sf*g;$3=sf*b'`) 41 | else 42 | set av=($lavg $lavg $lavg) 43 | endif 44 | echo "render= -av $av" >> $argv[1] 45 | quit: 46 | exec rm -f $tf.{amb,opt,dat} 47 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/debugcal.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: debugcal.csh,v 2.6 2003/02/22 02:07:30 greg Exp $ 3 | # 4 | # Script to debug cal files for Radiance 5 | # 6 | # Takes octree and rcalc options as arguments. 7 | # One of the rcalc options should be -f calfile. 8 | # Note that the real arguments A1, A2, etc must also be given. 9 | # Input is a ray origin and direction, such as that produced by ximage. 10 | # 11 | if ( $#argv < 2 ) then 12 | echo "Usage: $0 octree [rcalc options]" 13 | exit 1 14 | endif 15 | if ( ! $?RAYPATH ) then 16 | set RAYPATH=.:/usr/local/lib/ray 17 | endif 18 | set initfile= 19 | foreach d (`echo $RAYPATH | sed 's/:/ /g'`) 20 | if ( -r $d/rayinit.cal ) then 21 | set initfile="-f $d/rayinit.cal" 22 | break 23 | endif 24 | end 25 | 26 | rtrace -h- -x 1 -odNplL $1 | rcalc -u -e 'Dx=$1;Dy=$2;Dz=$3' \ 27 | -e 'Nx=$4;Ny=$5;Nz=$6;Px=$7;Py=$8;Pz=$9' \ 28 | -e 'T=$10;Ts=$11' -e 'S:1;Tx:0;Ty:0;Tz:0' \ 29 | -e 'Ix:1;Iy:0;Iz:0;Jx:0;Jy:1;Jz:0;Kx:0;Ky:0;Kz:1' \ 30 | -e 'Rdot=-Dx*Nx-Dy*Ny-Dz*Nz' -e 'RdotP=Rdot' \ 31 | -e 'NxP=Nx;NyP=Ny;NzP=Nz' -e 'CrP=A1;CgP=A2;CbP=A3' \ 32 | -e 'DxA:0;DyA:0;DzA:0' \ 33 | $initfile $argv[2-]:q 34 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/help2roff.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: help2roff.csh,v 3.1 2003/02/22 02:07:30 greg Exp $ 3 | # Convert Tcl/Tk help file (used by gethelp.tcl) to troff/nroff format 4 | # for printing. 5 | # 6 | 7 | cat << _EOF_ 8 | .ds RH "$1:r help 9 | .TL 10 | `head -1 $1` 11 | .LP 12 | _EOF_ 13 | exec sed -e 1d \ 14 | -e 's/^\.\([a-zA-Z][a-zA-Z0-9]*\)\.\([a-zA-Z][a-zA-Z0-9]*\)$/.B "\1 \2"/' $1 15 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/ivpict.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: ivpict.csh,v 2.2 2003/02/22 02:07:30 greg Exp $ 3 | # 4 | # Render requested Instant View 5 | # 6 | if ( $#argv < 1 ) then 7 | echo Usage: $0 directory '[options]' 8 | exit 1 9 | endif 10 | set dir=$argv[1] 11 | set opt="$argv[2-]" 12 | exec pinterp $opt $dir/pvw_{x,X,y,Y,z,Z}l.{pic,z} 13 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/ivprep.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -fe 2 | # RCSid: $Id: ivprep.csh,v 2.2 2003/02/22 02:07:30 greg Exp $ 3 | # 4 | # Prepare Instant View directory 5 | # 6 | if ( $#argv != 1 && $#argv != 2 ) then 7 | echo Usage: $0 radfile '[directory]' 8 | exit 1 9 | endif 10 | set radfile=$1 11 | if ( $#argv == 2 ) then 12 | set dir=$2 13 | else 14 | set dir=$radfile:r.ivd 15 | endif 16 | if ( ! -d $dir ) then 17 | mkdir $dir 18 | endif 19 | foreach vw ( xl Xl yl Yl zl Zl ) 20 | rad -w -v $vw $radfile PIC=$dir/pvw QUA=L RES=768 \ 21 | "render=-z $dir/pvw_$vw.z -pj 0" 22 | end 23 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/netproc.h: -------------------------------------------------------------------------------- 1 | /* RCSid $Id: netproc.h,v 2.4 2003/02/25 02:47:24 greg Exp $ */ 2 | /* 3 | * Header file for network processing routines 4 | */ 5 | 6 | #include "copyright.h" 7 | 8 | typedef struct { 9 | char *com; /* command (stored on client side) */ 10 | int pid; /* process ID */ 11 | int efd; /* standard error file descriptor */ 12 | char *errs; /* error output */ 13 | int elen; /* error output length */ 14 | int (*cf)(); /* completion callback function */ 15 | } PROC; /* process slot */ 16 | 17 | /* Callback function cf above passed process server, slot number and status */ 18 | 19 | typedef struct pserver { 20 | struct pserver *next; /* next process server in main list */ 21 | char hostname[64]; /* remote host ID */ 22 | char directory[128]; /* remote execution directory */ 23 | char username[32]; /* remote user ID */ 24 | short nprocs; /* number of allocated process slots */ 25 | PROC proc[1]; /* process slot(s) (must be last in struct) */ 26 | } PSERVER; /* process server */ 27 | 28 | extern PSERVER *pslist; /* global process server list */ 29 | 30 | extern PSERVER *addpserver(), *findjob(); 31 | 32 | extern char *myhostname(); 33 | 34 | #define LHOSTNAME "localhost" /* accepted name for local host */ 35 | 36 | #define pserverOK(ps) (wait4job(ps, startjob(ps, "true", NULL)) == 0) 37 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/objline.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: objline.csh,v 2.3 2003/02/22 02:07:30 greg Exp $ 3 | # Create four standard views of scene and present as line drawings 4 | # 5 | set oblqxf="-rz 45 -ry 45" 6 | set d=/usr/tmp/ol$$ 7 | onintr quit 8 | mkdir $d 9 | if ($#argv) then 10 | set origf="" 11 | set oblqf="" 12 | foreach f ($argv) 13 | xform -e $f > $d/$f.orig 14 | rad2mgf $d/$f.orig > $d/$f:r.orig.mgf 15 | set origf=($origf $f:r.orig.mgf) 16 | echo i $f:r.orig.mgf $oblqxf > $d/$f:r.oblq.mgf 17 | set oblqf=($oblqf $f:r.oblq.mgf) 18 | end 19 | else 20 | set origf=stdin.orig.mgf 21 | set oblqf=stdin.oblq.mgf 22 | xform -e > $d/stdin.orig 23 | rad2mgf $d/stdin.orig > $d/stdin.orig.mgf 24 | echo i stdin.orig.mgf $oblqxf > $d/stdin.oblq.mgf 25 | endif 26 | cd $d 27 | set rce='xm=($1+$2)/2;ym=($3+$4)/2;zm=($5+$6)/2;\ 28 | max(a,b):if(a-b,a,b);r=max(max($2-$1,$4-$3),$6-$5)*.52;\ 29 | $1=xm-r;$2=xm+r;$3=ym-r;$4=ym+r;$5=zm-r;$6=zm+r' 30 | set origdim=`getbbox -h *.orig | rcalc -e $rce:q` 31 | set oblqdim=`xform $oblqxf *.orig | getbbox -h | rcalc -e $rce:q` 32 | mgf2meta -t .005 x $origdim $origf > x.mta 33 | mgf2meta -t .005 y $origdim $origf > y.mta 34 | mgf2meta -t .005 z $origdim $origf > z.mta 35 | mgf2meta -t .005 x $oblqdim $oblqf > o.mta 36 | plot4 {x,y,z,o}.mta 37 | quit: 38 | cd 39 | exec rm -rf $d 40 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/objpict.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: objpict.csh,v 2.2 2003/02/22 02:07:30 greg Exp $ 3 | # 4 | # Make a nice multi-view picture of an object 5 | # Standard input is description made to fit in unit cube in positive quadrant 6 | # 7 | set objdir=/usr/local/lib/ray/lib 8 | set tmpdir=/usr/tmp 9 | set xres=250 10 | set yres=250 11 | set rpict="rpict -av .2 .2 .2 -x $xres -y $yres $*" 12 | set octree=$tmpdir/op$$.oct 13 | set pict1=$tmpdir/op$$a.pic 14 | set pict2=$tmpdir/op$$b.pic 15 | set pict3=$tmpdir/op$$c.pic 16 | set pict4=$tmpdir/op$$d.pic 17 | set tmpfiles="$octree $pict1 $pict2 $pict3 $pict4" 18 | onintr quit 19 | set vw1="-vtl -vp 2 .5 .5 -vd -1 0 0 -vh 1 -vv 1" 20 | set vw2="-vtl -vp .5 2 .5 -vd 0 -1 0 -vh 1 -vv 1" 21 | set vw3="-vtl -vp .5 .5 2 -vd 0 0 -1 -vu -1 0 0 -vh 1 -vv 1" 22 | set vw4="-vp 3 3 3 -vd -1 -1 -1 -vh 20 -vv 20" 23 | 24 | oconv $objdir/testroom - > $octree 25 | $rpict $vw1 $octree > $pict1 26 | $rpict $vw2 $octree > $pict2 27 | $rpict $vw3 $octree > $pict3 28 | $rpict $vw4 $octree > $pict4 29 | pcompos $pict3 0 $yres $pict4 $xres $yres $pict1 0 0 $pict2 $xres 0 30 | 31 | quit: 32 | rm -f $tmpfiles 33 | exit 0 34 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/raddepend.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: raddepend.csh,v 2.7 2003/02/22 02:07:30 greg Exp $ 3 | # 4 | # Find scene dependencies in this directory 5 | # 6 | set es=1 7 | onintr quit 8 | rm -f EMPTY 9 | echo -n > EMPTY 10 | sleep 2 11 | ( ls $* | sed -e 's~/~\\/~g' -e 's@^@/^@' -e 's@$@$/d@' ; echo '/^EMPTY$/,$d' ) > /tmp/sed$$ 12 | getbbox -w $* >/dev/null 13 | set es=$status 14 | if ( $es == 0 ) then 15 | sync 16 | sleep 2 17 | ls -tuL | sed -f /tmp/sed$$ | sort 18 | endif 19 | quit: 20 | rm -f /tmp/sed$$ EMPTY 21 | exit $es 22 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/rlux.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: rlux.csh,v 2.5 2003/02/22 02:07:30 greg Exp $ 3 | # 4 | # Compute illuminance from ray origin and direction 5 | # 6 | if ( $#argv < 1 ) then 7 | echo "Usage: $0 [rtrace args] octree" 8 | exit 1 9 | endif 10 | rtrace -i+ -dv- -h- -x 1 $argv[*]:q | rcalc -e '$1=47.4*$1+120*$2+11.6*$3' -u 11 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/setscan.c: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static const char RCSid[] = "$Id: setscan.c,v 2.2 2003/02/22 02:07:30 greg Exp $"; 3 | #endif 4 | /* 5 | * Convert angle ranges of the form a-b:s,c to discrete values 6 | */ 7 | 8 | #include 9 | 10 | #include "setscan.h" 11 | 12 | 13 | setscan(ang, arg) /* set up scan according to arg */ 14 | register ANGLE *ang; 15 | register char *arg; 16 | { 17 | int state = ','; 18 | int start, finish, step; 19 | 20 | while (state) { 21 | switch (state) { 22 | case ',': 23 | start = atoi(arg); 24 | finish = start; 25 | step = 1; 26 | break; 27 | case '-': 28 | finish = atoi(arg); 29 | if (finish < start) 30 | return(-1); 31 | break; 32 | case ':': 33 | step = atoi(arg); 34 | break; 35 | default: 36 | return(-1); 37 | } 38 | if (!isdigit(*arg)) 39 | return(-1); 40 | do 41 | arg++; 42 | while (isdigit(*arg)); 43 | state = *arg++; 44 | if (!state || state == ',') 45 | while (start <= finish) { 46 | *ang++ = start; 47 | start += step; 48 | } 49 | } 50 | *ang = AEND; 51 | return(0); 52 | } 53 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/setscan.h: -------------------------------------------------------------------------------- 1 | /* RCSid: $Id: setscan.h,v 2.2 2003/02/22 02:07:30 greg Exp $ */ 2 | /* 3 | * Defines for programs using setscan() 4 | */ 5 | 6 | #define ANGLE short 7 | #define AEND (-1) 8 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/tradinstall.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -fe 2 | # RCSid: $Id: tradinstall.csh,v 2.7 2003/02/22 02:07:30 greg Exp $ 3 | # Install correct version of trad for wish or wish4.0 4 | # 5 | set instdir = $1 6 | set libdir = $2 7 | 8 | set TLIBFILES = ( *[a-z].tcl *.hlp trad.icon tclIndex ) 9 | 10 | set TDIFFS = (`ls | sed -n 's/3\.6\.tcl$//p'`) 11 | 12 | set WISHCOMS = ( wish4.{3,2,1,0} wish8.0 wish ) 13 | 14 | foreach w ( $WISHCOMS ) 15 | foreach d ($path) 16 | if (-x $d/$w) then 17 | set wishcom = $d/$w 18 | break 19 | endif 20 | end 21 | if ( $?wishcom ) break 22 | end 23 | if (! $?wishcom) then 24 | echo "Cannot find wish executable in current path -- trad not installed." 25 | exit 1 26 | endif 27 | # if ( $wishcom:t == wish ) then 28 | # set wishcom="$wishcom -f" 29 | # set oldwish 30 | # endif 31 | 32 | echo "Installing trad using $wishcom" 33 | 34 | sed -e "1s|/usr/local/bin/wish4\.0|$wishcom|" \ 35 | -e "s|^set radlib .*|set radlib $libdir|" trad.wsh > $instdir/trad 36 | chmod 755 $instdir/trad 37 | if (! -d $libdir) then 38 | mkdir $libdir 39 | endif 40 | (cd $libdir ; rm -f $TLIBFILES) 41 | cp $TLIBFILES $libdir 42 | if ($?oldwish) then 43 | foreach i ($TDIFFS) 44 | rm -f $libdir/$i.tcl 45 | cp ${i}3.6.tcl $libdir/$i.tcl 46 | end 47 | endif 48 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/util.tcl: -------------------------------------------------------------------------------- 1 | # RCSid: $Id: util.tcl,v 2.4 2003/02/22 02:07:30 greg Exp $ 2 | # 3 | # General utility routines 4 | # 5 | 6 | proc beep {} { # ring the bell 7 | puts -nonewline stderr "\a" 8 | } 9 | 10 | proc view_txt fn { # view a text file 11 | global env 12 | if [info exists env(EDITOR)] { 13 | if {[lsearch -exact {vi vedit view ex edit ed red} \ 14 | [file tail [lindex $env(EDITOR) 0]]] >= 0} { 15 | eval exec xterm +sb -e $env(EDITOR) $fn 16 | } else { 17 | eval exec $env(EDITOR) $fn 18 | } 19 | } else { 20 | foreach f $fn { 21 | exec xedit $f 22 | } 23 | } 24 | } 25 | 26 | proc cardval {var cvl} { # set variable to one of a set of values 27 | upvar $var v 28 | set tv [string toupper $v] 29 | foreach cv $cvl { 30 | if {[string first $tv [string toupper $cv]] == 0} { 31 | set v $cv 32 | return $cv 33 | } 34 | } 35 | return {} ; # this would seem to be an error 36 | } 37 | 38 | proc writevars {f vl} { # write variables to a file 39 | foreach v $vl { 40 | upvar $v myv 41 | if [catch {set il [array names myv]}] { 42 | puts $f "set $v [list $myv]" 43 | } else { 44 | foreach i $il { 45 | puts $f "set ${v}($i) [list $myv($i)]" 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Reference/radiance/src/util/vinfo.csh: -------------------------------------------------------------------------------- 1 | #!/bin/csh -f 2 | # RCSid: $Id: vinfo.csh,v 3.1 2003/02/22 02:07:30 greg Exp $ 3 | # 4 | # Edit information header in Radiance file 5 | # 6 | set plist=() 7 | set ilist=() 8 | foreach f ($*) 9 | if (! -f $f:q) then 10 | echo "${f}: no such file or directory" 11 | continue 12 | endif 13 | if (! -w $f:q) then 14 | echo "$f is read-only" 15 | sleep 1 16 | continue 17 | endif 18 | set info="$f.info" 19 | getinfo < $f:q > $info:q 20 | set plist=($plist:q $f:q) 21 | set ilist=($ilist:q $info:q) 22 | end 23 | vi $ilist:q 24 | set i=1 25 | while ( $i <= $#plist ) 26 | set f=$plist[$i]:q 27 | set info=$ilist[$i]:q 28 | getinfo < $f:q | cmp -s - $info:q 29 | if ($status != 0) then 30 | getinfo - < $f:q >> $info:q 31 | mv $info:q $f:q 32 | else 33 | rm $info:q 34 | endif 35 | @ i++ 36 | end 37 | -------------------------------------------------------------------------------- /Reference/with_sss.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Reference/with_sss.jpg -------------------------------------------------------------------------------- /Reference/with_sss_rotated.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Reference/with_sss_rotated.jpg -------------------------------------------------------------------------------- /Reference/without_sss.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Reference/without_sss.jpg -------------------------------------------------------------------------------- /Reference/without_sss_rotated.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Reference/without_sss_rotated.jpg -------------------------------------------------------------------------------- /Runtime/HDRLoader.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/HDRLoader.dll -------------------------------------------------------------------------------- /Runtime/HDRLoaderD.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/HDRLoaderD.dll -------------------------------------------------------------------------------- /Runtime/LWOLoader.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/LWOLoader.dll -------------------------------------------------------------------------------- /Runtime/LWOLoaderD.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/LWOLoaderD.dll -------------------------------------------------------------------------------- /Runtime/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/SDL.dll -------------------------------------------------------------------------------- /Runtime/SDLApp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/SDLApp.dll -------------------------------------------------------------------------------- /Runtime/SDLAppD.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/SDLAppD.dll -------------------------------------------------------------------------------- /Runtime/SHTest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/SHTest.exe -------------------------------------------------------------------------------- /Runtime/beethoven.lwo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/beethoven.lwo -------------------------------------------------------------------------------- /Runtime/diffuse_interreflected.shc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/diffuse_interreflected.shc -------------------------------------------------------------------------------- /Runtime/diffuse_shadowed.shc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/diffuse_shadowed.shc -------------------------------------------------------------------------------- /Runtime/diffuse_unshadowed.shc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/diffuse_unshadowed.shc -------------------------------------------------------------------------------- /Runtime/getsdlapp.bat: -------------------------------------------------------------------------------- 1 | copy ..\..\SDLApp\Runtime\*.dll . -------------------------------------------------------------------------------- /Runtime/rnl_probe.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/rnl_probe.hdr -------------------------------------------------------------------------------- /Runtime/room.lwo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwilliamson/SHTest/4ef130bcb38beab3bf8882d448d0ed22535e8543/Runtime/room.lwo -------------------------------------------------------------------------------- /Source/Backup/SHTest.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SHTest", "SHTest.vcproj", "{2666AFEF-8D4C-43A9-BBD7-CB09C0180024}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Release|Win32 = Release|Win32 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Debug|Win32.ActiveCfg = Debug|Win32 12 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Debug|Win32.Build.0 = Debug|Win32 13 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Release|Win32.ActiveCfg = Release|Win32 14 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Release|Win32.Build.0 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(SolutionProperties) = preSolution 17 | HideSolutionNode = FALSE 18 | EndGlobalSection 19 | EndGlobal 20 | -------------------------------------------------------------------------------- /Source/Backup1/SHTest.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SHTest", "SHTest.vcproj", "{2666AFEF-8D4C-43A9-BBD7-CB09C0180024}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Release|Win32 = Release|Win32 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Debug|Win32.ActiveCfg = Debug|Win32 12 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Debug|Win32.Build.0 = Debug|Win32 13 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Release|Win32.ActiveCfg = Release|Win32 14 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Release|Win32.Build.0 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(SolutionProperties) = preSolution 17 | HideSolutionNode = FALSE 18 | EndGlobalSection 19 | EndGlobal 20 | -------------------------------------------------------------------------------- /Source/Main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "SHTest.h" 4 | 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | return (sdla::RunApplication(1024, 768)); 9 | } -------------------------------------------------------------------------------- /Source/SHRotMatrix.h: -------------------------------------------------------------------------------- 1 | // SHRotMatrix.h 2 | // Spherical Harmonic Rotation Matrix 3 | // rjgreen june 2002 4 | 5 | #ifndef _SHROTMATRIX_H 6 | #define _SHROTMATRIX_H 7 | 8 | typedef double* double_ptr; 9 | 10 | class SHRotMatrix 11 | { 12 | public: 13 | SHRotMatrix(int i); 14 | ~SHRotMatrix(); 15 | 16 | void rotate_sh( const double rot[], // 4x4 rotation matrix 17 | const int order, // number of bands in the SH vector 18 | const double sh[], // SH vector with order^2 values 19 | double result[] ); // SH vector to hold the result 20 | 21 | private: 22 | SHRotMatrix(); // no unparametarised constructor 23 | SHRotMatrix(const SHRotMatrix& m); // no copy constructor 24 | SHRotMatrix &operator=(const SHRotMatrix &m); // no asignment 25 | 26 | void alloc_mat(double_ptr* &mat); 27 | void free_mat(double_ptr* &mat); 28 | void dump_mat(const double_ptr* mat); 29 | 30 | void store_d(double value, int l,int m,int n); 31 | double get_d(int l,int m,int n); 32 | void calc_d(); 33 | double sigma(int m,double theta); 34 | double eqn_64(int l,int m,int n); 35 | double eqn_65(int l,int m,int n); 36 | double eqn_66(int l,int m,int n); 37 | double eqn_67(int l,int m,int n); 38 | double eqn_68(int l,int m,int n); 39 | double delta(int l,int m,int n); 40 | 41 | int highest_band; 42 | double **d_matrix; // array of d matrices 43 | double **sh_matrix; // array of sh rotaton matrices 44 | }; 45 | 46 | #endif -------------------------------------------------------------------------------- /Source/SHRotate.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include "Types.h" 6 | 7 | 8 | namespace sdla 9 | { 10 | struct cMatrix; 11 | } 12 | 13 | 14 | void SHRotate(SHRotateMatrix& shrm, const sdla::cMatrix& rotation); -------------------------------------------------------------------------------- /Source/SHTest.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | VisualStudioVersion = 14.0.24720.0 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SHTest", "SHTest.vcxproj", "{2666AFEF-8D4C-43A9-BBD7-CB09C0180024}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Release|Win32 = Release|Win32 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Debug|Win32.ActiveCfg = Debug|Win32 14 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Debug|Win32.Build.0 = Debug|Win32 15 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Release|Win32.ActiveCfg = Release|Win32 16 | {2666AFEF-8D4C-43A9-BBD7-CB09C0180024}.Release|Win32.Build.0 = Release|Win32 17 | EndGlobalSection 18 | GlobalSection(SolutionProperties) = preSolution 19 | HideSolutionNode = FALSE 20 | EndGlobalSection 21 | EndGlobal 22 | --------------------------------------------------------------------------------