You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(116) |
May
(220) |
Jun
(52) |
Jul
(30) |
Aug
(35) |
Sep
(24) |
Oct
(49) |
Nov
(44) |
Dec
(70) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(21) |
Feb
(30) |
Mar
(9) |
Apr
(44) |
May
(2) |
Jun
|
Jul
(10) |
Aug
(20) |
Sep
(25) |
Oct
(12) |
Nov
(16) |
Dec
(4) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
(25) |
Aug
|
Sep
|
Oct
|
Nov
(26) |
Dec
(10) |
2006 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(33) |
2007 |
Jan
(4) |
Feb
(57) |
Mar
(17) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ma...@us...> - 2003-12-14 10:52:47
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv23089/src/org/jrman/primitive Modified Files: BicubicPatch.java Primitive.java Log Message: Fixed bugs (enhanced performance as a side effect!). Index: BicubicPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/BicubicPatch.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BicubicPatch.java 30 Nov 2003 03:23:16 -0000 1.5 --- BicubicPatch.java 13 Dec 2003 18:00:25 -0000 1.6 *************** *** 1,4 **** /* ! BilinearPatch.java Copyright (C) 2003 Gerardo Horvilleur Martinez --- 1,4 ---- /* ! BicubicPatch.java Copyright (C) 2003 Gerardo Horvilleur Martinez *************** *** 25,29 **** import org.jrman.attributes.Attributes; import org.jrman.geom.BoundingVolume; ! import org.jrman.geom.MutableBounds3f; import org.jrman.grid.Grid; import org.jrman.parameters.Declaration; --- 25,29 ---- import org.jrman.attributes.Attributes; import org.jrman.geom.BoundingVolume; ! import org.jrman.geom.ConvexHull3f; import org.jrman.grid.Grid; import org.jrman.parameters.Declaration; *************** *** 126,130 **** public BoundingVolume getBoundingVolume() { ! MutableBounds3f ch = new MutableBounds3f(); extractPoints(); ch.addPoint(P00); --- 126,130 ---- public BoundingVolume getBoundingVolume() { ! ConvexHull3f ch = new ConvexHull3f(); extractPoints(); ch.addPoint(P00); Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Primitive.java 9 Dec 2003 04:51:53 -0000 1.22 --- Primitive.java 13 Dec 2003 18:00:25 -0000 1.23 *************** *** 104,108 **** public float getMinGridSize() { ! return 4f; } --- 104,108 ---- public float getMinGridSize() { ! return 16f; } *************** *** 444,466 **** } else if (type == Declaration.Type.POINT && declaration.getCount() == 1) { VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameter; ! VaryingScalarTuple3f sparam = ! new VaryingScalarTuple3f(declaration, new float[4 * 3]); ! param.getValue(0, p0); ! param.getValue(1, p1); ! param.getValue(2, p2); ! param.getValue(3, p3); ! Point3f uv00 = p0; ! Point3f uv10 = p1; ! Point3f uv01 = p2; ! Point3f uv11 = p3; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, pi0); ! sparam.setValue(0, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, pi0); ! sparam.setValue(1, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, pi0); ! sparam.setValue(2, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, pi0); ! sparam.setValue(3, pi0); ! result.addParameter(sparam); } else if (type == Declaration.Type.COLOR) { VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameter; --- 444,468 ---- } else if (type == Declaration.Type.POINT && declaration.getCount() == 1) { VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameter; ! if (param.getCount() == 4) { ! VaryingScalarTuple3f sparam = ! new VaryingScalarTuple3f(declaration, new float[4 * 3]); ! param.getValue(0, p0); ! param.getValue(1, p1); ! param.getValue(2, p2); ! param.getValue(3, p3); ! Point3f uv00 = p0; ! Point3f uv10 = p1; ! Point3f uv01 = p2; ! Point3f uv11 = p3; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, pi0); ! sparam.setValue(0, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, pi0); ! sparam.setValue(1, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, pi0); ! sparam.setValue(2, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, pi0); ! sparam.setValue(3, pi0); ! result.addParameter(sparam); ! } } else if (type == Declaration.Type.COLOR) { VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameter; |
From: <ma...@us...> - 2003-12-14 10:52:47
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv23089/src/org/jrman/render Modified Files: RendererHidden.java Log Message: Fixed bugs (enhanced performance as a side effect!). Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** RendererHidden.java 11 Dec 2003 15:08:06 -0000 1.56 --- RendererHidden.java 13 Dec 2003 18:00:26 -0000 1.57 *************** *** 133,139 **** float db= primitive.getAttributes().getDisplacementBound(); BoundingVolume bve; ! bve= bv.enlarge(db); ! bve= bve.transform(objectToCamera); ! bv= bv.transform(objectToCamera); if (clippingVolume.whereIs(bve) == Plane.Side.OUTSIDE) return true; --- 133,145 ---- float db= primitive.getAttributes().getDisplacementBound(); BoundingVolume bve; ! if (db != 0f) { ! bve= bv.enlarge(db); ! bve= bve.transform(objectToCamera); ! bv= bv.transform(objectToCamera); ! } ! else { ! bv = bv.transform(objectToCamera); ! bve = bv; ! } if (clippingVolume.whereIs(bve) == Plane.Side.OUTSIDE) return true; |
From: <ma...@us...> - 2003-12-14 08:40:38
|
Update of /cvsroot/jrman/drafts In directory sc8-pr-cvs1:/tmp/cvs-serv23089 Modified Files: build.properties Log Message: Fixed bugs (enhanced performance as a side effect!). Index: build.properties =================================================================== RCS file: /cvsroot/jrman/drafts/build.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.properties 29 Sep 2003 12:07:58 -0000 1.2 --- build.properties 13 Dec 2003 18:00:25 -0000 1.3 *************** *** 1 **** ! dist = jrman-0_2 --- 1 ---- ! dist = jrman-0_3 |
From: <ma...@us...> - 2003-12-12 23:50:26
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv9690/src/org/jrman/parser Modified Files: Global.java Parser.java Log Message: Added -q option. Index: Global.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Global.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Global.java 9 Sep 2003 03:01:05 -0000 1.8 --- Global.java 12 Dec 2003 23:50:19 -0000 1.9 *************** *** 38,42 **** declarations.put("bucketsize", new Declaration("bucketsize", "integer[2]")); declarations.put("endofframe", new Declaration("endofframe", "integer")); ! declarations.put("file", new Declaration("endofframe", "integer")); declarations.put("intensity", new Declaration("intensity", "float")); declarations.put("lightcolor", new Declaration("lightcolor", "color")); --- 38,43 ---- declarations.put("bucketsize", new Declaration("bucketsize", "integer[2]")); declarations.put("endofframe", new Declaration("endofframe", "integer")); ! declarations.put("file", new Declaration("file", "integer")); ! declarations.put("highlights", new Declaration("highlights", "integer")); declarations.put("intensity", new Declaration("intensity", "float")); declarations.put("lightcolor", new Declaration("lightcolor", "color")); Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** Parser.java 11 Dec 2003 20:21:11 -0000 1.71 --- Parser.java 12 Dec 2003 23:50:19 -0000 1.72 *************** *** 495,498 **** --- 495,500 ---- pushAttributes(); renderer = Renderer.createRenderer(frame, world); + // Must be set after defining gridsize... + SurfaceShader.setBetterHighlights(cmdLine.hasOption(JRMan.OPTION_QUALITY)); } *************** *** 681,685 **** if (param != null) frame.setFileBuckets(param.getValue() != 0); ! } } --- 683,692 ---- if (param != null) frame.setFileBuckets(param.getValue() != 0); ! } else if (name.equals("quality")) { ! UniformScalarInteger param = ! (UniformScalarInteger) parameters.getParameter("highlights"); ! if (param != null) ! SurfaceShader.setBetterHighlights(param.getValue() != 0); ! } } |
From: <ma...@us...> - 2003-12-12 23:50:26
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv9690/sampleData Modified Files: dragonhead.rib noiseShadersTest.rib Log Message: Added -q option. Index: dragonhead.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/dragonhead.rib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dragonhead.rib 12 Jun 2003 18:36:01 -0000 1.2 --- dragonhead.rib 12 Dec 2003 23:50:19 -0000 1.3 *************** *** 5,9 **** # scene definitions ! Display "Dragon Head" "framebuffer" "rgb" PixelSamples 4 4 Exposure 1 2.2 --- 5,9 ---- # scene definitions ! Display "Dragon Head" "framebuffer" "rgba" PixelSamples 4 4 Exposure 1 2.2 *************** *** 18,21 **** --- 18,23 ---- LightSource "distantlight" 4 "intensity" [1] "lightcolor" [1.0 1.0 1.0] "from" [0 500 -1000] "to" [0 0 0] WorldBegin + Displacement "noisetest" "uniform float noisescale" 2 "uniform integer noiseoctaves" 4 "uniform float Km" 0.03 + Attribute "displacementbound" "sphere" 0.03 # object definitions Index: noiseShadersTest.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/noiseShadersTest.rib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** noiseShadersTest.rib 11 Dec 2003 20:21:11 -0000 1.2 --- noiseShadersTest.rib 12 Dec 2003 23:50:19 -0000 1.3 *************** *** 1,4 **** ! Format 800 800 1 ! Display "shaderTest" "framebuffer" "rgb" PixelSamples 4 4 PixelFilter "gaussian" 2 2 --- 1,4 ---- ! Format 512 512 1 ! Display "shaderTest" "framebuffer" "rgba" PixelSamples 4 4 PixelFilter "gaussian" 2 2 *************** *** 9,13 **** LightSource "distantlight" 1 "from" [1 1 -1] "to" [0 0 0] "intensity" 1 LightSource "ambientlight" 2 "intensity" 0.05 - AttributeBegin Translate -2.2 2.2 0 --- 9,12 ---- |
From: <ma...@us...> - 2003-12-12 23:50:26
|
Update of /cvsroot/jrman/drafts/src/org/jrman/shaders In directory sc8-pr-cvs1:/tmp/cvs-serv9690/src/org/jrman/shaders Modified Files: SurfaceShader.java Log Message: Added -q option. Index: SurfaceShader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/SurfaceShader.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SurfaceShader.java 30 Nov 2003 03:23:16 -0000 1.17 --- SurfaceShader.java 12 Dec 2003 23:50:19 -0000 1.18 *************** *** 49,52 **** --- 49,54 ---- private static Pattern SEPARATOR = Pattern.compile(", *"); + private static boolean betterHighlights = false; + static FloatGrid _fg1 = new FloatGrid(); *************** *** 98,101 **** --- 100,107 ---- } + public static void setBetterHighlights(boolean value) { + betterHighlights = value; + } + protected void ambient(ShaderVariables sv, Color3fGrid out) { out.set(BLACK); *************** *** 146,151 **** _fg2.dot(Nn, H); _fg2.max(_fg2, 0f); ! //_fg2.pow(_fg2, 10f / roughness); ! _fg2.simulPow(_fg2, 18f / roughness); nonspec.sub(1, nonspec); _fg2.mul(_fg2, nonspec); --- 152,159 ---- _fg2.dot(Nn, H); _fg2.max(_fg2, 0f); ! if (betterHighlights) ! _fg2.pow(_fg2, 10f / roughness); ! else ! _fg2.simulPow(_fg2, 25f / roughness); nonspec.sub(1, nonspec); _fg2.mul(_fg2, nonspec); |
From: <ma...@us...> - 2003-12-12 23:50:26
|
Update of /cvsroot/jrman/drafts/src/org/jrman/main In directory sc8-pr-cvs1:/tmp/cvs-serv9690/src/org/jrman/main Modified Files: JRMan.java Log Message: Added -q option. Index: JRMan.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/main/JRMan.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JRMan.java 11 Dec 2003 15:08:06 -0000 1.6 --- JRMan.java 12 Dec 2003 23:50:19 -0000 1.7 *************** *** 40,43 **** --- 40,44 ---- public static final char OPTION_HELP= 'h'; public static final char OPTION_PROGRESS= 'p'; + public static final char OPTION_QUALITY = 'q'; public static void main(String args[]) { *************** *** 123,126 **** --- 124,130 ---- //OptionBuilder.withArgName("level"); options.addOption(OptionBuilder.create(OPTION_STATISTICS)); + OptionBuilder.withLongOpt("quality"); + OptionBuilder.withDescription("higher rendering quality (slightly slower)"); + options.addOption(OptionBuilder.create(OPTION_QUALITY)); return options; } |
From: <afa...@us...> - 2003-12-12 09:54:29
|
Update of /cvsroot/jrman/drafts/src/org/jrman/ui In directory sc8-pr-cvs1:/tmp/cvs-serv16600/src/org/jrman/ui Modified Files: Framebuffer.java Log Message: Removed cpu hogging parts Code clean-up Added comments Index: Framebuffer.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/ui/Framebuffer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Framebuffer.java 11 Dec 2003 15:08:06 -0000 1.5 --- Framebuffer.java 12 Dec 2003 09:54:26 -0000 1.6 *************** *** 37,47 **** private JImageViewerPanel imagePanel = new JImageViewerPanel(); private ImageViewerPanelSaveAction save= ! new ImageViewerPanelSaveAction(imagePanel,BufferedImage.TYPE_INT_ARGB); ! private StringBuffer sb = new StringBuffer(); private String name; /** ! * @param name ! * @param image */ public Framebuffer(String name, BufferedImage image) { --- 37,47 ---- private JImageViewerPanel imagePanel = new JImageViewerPanel(); private ImageViewerPanelSaveAction save= ! new ImageViewerPanelSaveAction(imagePanel,BufferedImage.TYPE_INT_ARGB); private String name; /** ! * Constructs a new framebuffer window ! * @param name string used as window title ! * @param image <code>BufferedImage</code> object to show */ public Framebuffer(String name, BufferedImage image) { *************** *** 64,88 **** /** ! * ! * @param x ! * @param y ! * @param w ! * @param h */ public void refresh(int x, int y, int w, int h) { imagePanel.repaintImage(x, y, w, h); - /* - Commented this because updating the title for each bucket usesup to 50% of CPU time!!!! - sb.setLength(0); - sb.append(name).append(" - bucket["); - sb.append(x).append(',').append(y).append(']'); - setTitle(sb.toString()); - */ } public void completed() { save.setEnabled(true); - setTitle(name); - sb = null; } } --- 64,82 ---- /** ! * Signal that a certain rectangular region has changed ! * @param x top-left x coordinate ! * @param y top-left y coordinate ! * @param w rectangle width ! * @param h rectangle height */ public void refresh(int x, int y, int w, int h) { imagePanel.repaintImage(x, y, w, h); } + /** + * Signal image is completed + */ public void completed() { save.setEnabled(true); } } |
From: <afa...@us...> - 2003-12-12 09:31:48
|
Update of /cvsroot/jrman/drafts/src/net/falappa/swing In directory sc8-pr-cvs1:/tmp/cvs-serv13288/src/net/falappa/swing Added Files: ExtensionFileFilter.java Log Message: Added missing ExtensionFileFilter class --- NEW FILE: ExtensionFileFilter.java --- /* * Created on 26-ott-2003 */ package net.falappa.swing; import java.io.File; import java.text.MessageFormat; import java.util.ResourceBundle; import javax.swing.filechooser.FileFilter; /** * A <code>JFileChooser</code> file filter based on an extension string. * The file filter accepts directories and files ending with the extension it is * built with. * * @author Alessandro Falappa */ public class ExtensionFileFilter extends FileFilter { private String ext; private String desc; private static final ResourceBundle messagesBundle= ResourceBundle.getBundle( ExtensionFileFilter.class.getPackage().getName() + ".res.ExtensionFileFilter"); /** * Constructs a <code>ExtensionFileFilter</code> object. * * @param ext * the extension this filter will allow to select */ public ExtensionFileFilter(String ext) { if (ext == null) throw new NullPointerException("invalid extension"); //$NON-NLS-1$ this.ext= ext; desc= MessageFormat.format( messagesBundle.getString("ExtensionFileFilter.description"), //$NON-NLS-1$ new String[] { ext.toUpperCase(), ext }); } /* * (non-Javadoc) * * @see javax.swing.filechooser.FileFilter#accept(java.io.File) */ public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase().endsWith(ext); } /* * (non-Javadoc) * * @see javax.swing.filechooser.FileFilter#getDescription() */ public String getDescription() { return desc; } } |
From: <afa...@us...> - 2003-12-12 09:30:44
|
Update of /cvsroot/jrman/drafts/src/org/jrman/ui In directory sc8-pr-cvs1:/tmp/cvs-serv13189/src/org/jrman/ui Modified Files: MainFrame.java Log Message: Readded ExtensionFileFilter invocation Index: MainFrame.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/ui/MainFrame.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MainFrame.java 11 Dec 2003 18:11:46 -0000 1.2 --- MainFrame.java 12 Dec 2003 09:30:41 -0000 1.3 *************** *** 34,37 **** --- 34,39 ---- import javax.swing.event.ListSelectionListener; + import net.falappa.swing.ExtensionFileFilter; + import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.ParseException; *************** *** 112,118 **** chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - /* Commented by JVG chooser.addChoosableFileFilter(new ExtensionFileFilter("rib")); - */ } if (JFileChooser.APPROVE_OPTION --- 114,118 ---- |
From: <ma...@us...> - 2003-12-11 20:21:14
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv22627/src/org/jrman/parser Modified Files: Frame.java Parser.java Log Message: Updated build.xml (and fixed a bug in it!). Fixed unix, dos scripts for jrman and mktxr. Ensured -p, -d & -s options work for all .rib files. Index: Frame.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Frame.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Frame.java 11 Dec 2003 15:08:06 -0000 1.14 --- Frame.java 11 Dec 2003 20:21:11 -0000 1.15 *************** *** 110,116 **** private boolean fileBuckets; ! private boolean showProgressEnabled; ! private boolean framebufferAlways; public Frame() { --- 110,117 ---- private boolean fileBuckets; ! ! private boolean showProgressEnabled; ! private boolean framebufferAlways; public Frame() { *************** *** 179,182 **** --- 180,185 ---- endOfFrameStatistics = other.endOfFrameStatistics; fileBuckets = other.fileBuckets; + showProgressEnabled = other.showProgressEnabled; + framebufferAlways = other.framebufferAlways; } Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** Parser.java 11 Dec 2003 18:11:47 -0000 1.70 --- Parser.java 11 Dec 2003 20:21:11 -0000 1.71 *************** *** 218,221 **** --- 218,225 ---- world = new World(); frame = new Frame(); + frame.setEndOfFrameStatistics( + cmdLine.hasOption(JRMan.OPTION_STATISTICS)); + frame.setShowProgressEnabled(cmdLine.hasOption(JRMan.OPTION_PROGRESS)); + frame.setFramebufferAlways(cmdLine.hasOption(JRMan.OPTION_FRAMEBUFFER)); currentAttributes = new MutableAttributes(); } *************** *** 425,432 **** worldStack.push(new World(world)); frame.setFrameNumber(n); - frame.setEndOfFrameStatistics( - cmdLine.hasOption(JRMan.OPTION_STATISTICS)); - frame.setShowProgressEnabled(cmdLine.hasOption(JRMan.OPTION_PROGRESS)); - frame.setFramebufferAlways(cmdLine.hasOption(JRMan.OPTION_FRAMEBUFFER)); } --- 429,432 ---- |
From: <ma...@us...> - 2003-12-11 20:21:14
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv22627/sampleData Modified Files: noiseShadersTest.rib uteapot.rib Log Message: Updated build.xml (and fixed a bug in it!). Fixed unix, dos scripts for jrman and mktxr. Ensured -p, -d & -s options work for all .rib files. Index: noiseShadersTest.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/noiseShadersTest.rib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** noiseShadersTest.rib 11 Dec 2003 15:25:23 -0000 1.1 --- noiseShadersTest.rib 11 Dec 2003 20:21:11 -0000 1.2 *************** *** 1,6 **** Format 800 800 1 Display "shaderTest" "framebuffer" "rgb" ! PixelSamples 3 3 ! PixelFilter "box" 3 3 Exposure 1 2.2 Projection "perspective" "fov" 10 --- 1,6 ---- Format 800 800 1 Display "shaderTest" "framebuffer" "rgb" ! PixelSamples 4 4 ! PixelFilter "gaussian" 2 2 Exposure 1 2.2 Projection "perspective" "fov" 10 Index: uteapot.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/uteapot.rib,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** uteapot.rib 8 Sep 2003 23:03:29 -0000 1.7 --- uteapot.rib 11 Dec 2003 20:21:11 -0000 1.8 *************** *** 40,46 **** Surface "plastic" "Ka" 0.1 "Kd" 0.05 "Ks" 1.0 "roughness" 0.1 "specularcolor" [1 .4 .1] ! #Surface "paintedplastic" "Ka" 0.1 "Kd" 0.05 "Ks" 1.0 "roughness" 0.1 "specularcolor" [1 .4 .1] ! # "texturename" "mandrill.jpg" ! #Surface "metal" # xBodyBack --- 40,44 ---- Surface "plastic" "Ka" 0.1 "Kd" 0.05 "Ks" 1.0 "roughness" 0.1 "specularcolor" [1 .4 .1] ! #Displacement "dented" "uniform float noisescale" .1 "uniform integer noiseoctaves" 6 "uniform float Km" 5 # xBodyBack |
From: <ma...@us...> - 2003-12-11 20:21:14
|
Update of /cvsroot/jrman/drafts/jrMan/bin In directory sc8-pr-cvs1:/tmp/cvs-serv22627/jrMan/bin Modified Files: jrman jrman.bat mktxr mktxr.bat Log Message: Updated build.xml (and fixed a bug in it!). Fixed unix, dos scripts for jrman and mktxr. Ensured -p, -d & -s options work for all .rib files. Index: jrman =================================================================== RCS file: /cvsroot/jrman/drafts/jrMan/bin/jrman,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** jrman 17 Oct 2003 22:05:13 -0000 1.3 --- jrman 11 Dec 2003 20:21:11 -0000 1.4 *************** *** 1,3 **** ! export CLASSPATH=$JRMAN_HOME/jar/jrman.jar:$JRMAN_HOME/jar/vecmath.jar export MEMORY=160m --- 1,3 ---- ! export CLASSPATH=$JRMAN_HOME/jar/jrman.jar:$JRMAN_HOME/jar/vecmath.jar:$JRMAN_HOME/jar/commons-cli-1.0.jar export MEMORY=160m Index: jrman.bat =================================================================== RCS file: /cvsroot/jrman/drafts/jrMan/bin/jrman.bat,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** jrman.bat 11 Dec 2003 15:08:05 -0000 1.5 --- jrman.bat 11 Dec 2003 20:21:11 -0000 1.6 *************** *** 1,5 **** @echo off ! set CLASSPATH=%JRMAN_HOME%\jar\jrman.jar;%JRMAN_HOME%\jar\vecmath.jar set MEMORY=160m java -Xms%MEMORY% -Xmx%MEMORY% org.jrman.main.JRMan %* --- 1,5 ---- @echo off ! set CLASSPATH=%JRMAN_HOME%\jar\jrman.jar;%JRMAN_HOME%\jar\vecmath.jar;%JRMAN_HOME%\jar\commons-cli-1.0.jar set MEMORY=160m java -Xms%MEMORY% -Xmx%MEMORY% org.jrman.main.JRMan %* Index: mktxr =================================================================== RCS file: /cvsroot/jrman/drafts/jrMan/bin/mktxr,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mktxr 17 Oct 2003 22:05:13 -0000 1.2 --- mktxr 11 Dec 2003 20:21:11 -0000 1.3 *************** *** 1,3 **** ! export CLASSPATH=$JRMAN_HOME/jar/jrman.jar:$JRMAN_HOME/jar/vecmath.jar export MEMORY=192m --- 1,3 ---- ! export CLASSPATH=$JRMAN_HOME/jar/jrman.jar:$JRMAN_HOME/jar/vecmath.jar:$JRMAN_HOME/jar/commons-cli-1.0.jar export MEMORY=192m Index: mktxr.bat =================================================================== RCS file: /cvsroot/jrman/drafts/jrMan/bin/mktxr.bat,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mktxr.bat 11 Dec 2003 15:08:05 -0000 1.5 --- mktxr.bat 11 Dec 2003 20:21:11 -0000 1.6 *************** *** 1,5 **** @echo off ! set CLASSPATH=%JRMAN_HOME%\jar\jrman.jar;%JRMAN_HOME%\jar\vecmath.jar set MEMORY=192m java -Xms%MEMORY% -Xmx%MEMORY% org.jrman.main.MkTxr %* --- 1,5 ---- @echo off ! set CLASSPATH=%JRMAN_HOME%\jar\jrman.jar;%JRMAN_HOME%\jar\vecmath.jar;%JRMAN_HOME%\jar\commons-cli-1.0.jar set MEMORY=192m java -Xms%MEMORY% -Xmx%MEMORY% org.jrman.main.MkTxr %* |
From: <ma...@us...> - 2003-12-11 20:21:14
|
Update of /cvsroot/jrman/drafts In directory sc8-pr-cvs1:/tmp/cvs-serv22627 Modified Files: build.xml Log Message: Updated build.xml (and fixed a bug in it!). Fixed unix, dos scripts for jrman and mktxr. Ensured -p, -d & -s options work for all .rib files. Index: build.xml =================================================================== RCS file: /cvsroot/jrman/drafts/build.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** build.xml 17 Oct 2003 22:05:13 -0000 1.14 --- build.xml 11 Dec 2003 20:21:11 -0000 1.15 *************** *** 18,26 **** </target> <target name="compile" depends="init" description="compile the source " > <!-- Compile the java code from ${src} into ${build} --> ! <javac srcdir="${src}" destdir="${build}" source="1.4" debug="on" ! classpath="${lib}/vecmath.jar" /> </target> --- 18,33 ---- </target> + <path id="project.class.path"> + <fileset dir="lib"> + <include name="**/*.jar"/> + </fileset> + </path> + <target name="compile" depends="init" description="compile the source " > <!-- Compile the java code from ${src} into ${build} --> ! <javac srcdir="${src}" destdir="${build}" source="1.4" debug="on"> ! <classpath refid="project.class.path"/> ! </javac> </target> *************** *** 42,48 **** basedir="${build}"> <fileset dir="src"> <include name="net/**"/> <include name="org/**"/> - <include name="*.java"/> </fileset> </jar> --- 49,55 ---- basedir="${build}"> <fileset dir="src"> + <exclude name="*.java"/> <include name="net/**"/> <include name="org/**"/> </fileset> </jar> |
From: <edi...@us...> - 2003-12-11 18:11:50
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv27524/src/org/jrman/parser Modified Files: Parser.java Log Message: Fixing some problems during last commit in Parser and MainFrame Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Parser.java 11 Dec 2003 15:08:06 -0000 1.69 --- Parser.java 11 Dec 2003 18:11:47 -0000 1.70 *************** *** 90,937 **** public class Parser { ! private final static String KEYWORD_PREFIX= "org.jrman.parser.keywords.Keyword"; ! private static Color3f tmpColor= new Color3f(); ! private boolean inAreaLightSource; ! private String beginName; [...1995 lines suppressed...] ! String twrap, ! String filter, ! int swidth, ! int twidth) { ! try { ! MipMap.makeMipMap( ! picturename, ! texturename, ! MipMap.Mode.getNamed(swrap), ! MipMap.Mode.getNamed(twrap), ! filter, ! swidth, ! twidth); ! } catch (IOException e) { ! throw new IllegalArgumentException( ! "Can't create texture: " + picturename); ! } ! } } |
From: <edi...@us...> - 2003-12-11 18:11:50
|
Update of /cvsroot/jrman/drafts/src/org/jrman/ui In directory sc8-pr-cvs1:/tmp/cvs-serv27524/src/org/jrman/ui Modified Files: MainFrame.java Log Message: Fixing some problems during last commit in Parser and MainFrame Index: MainFrame.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/ui/MainFrame.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MainFrame.java 11 Dec 2003 15:25:24 -0000 1.1 --- MainFrame.java 11 Dec 2003 18:11:46 -0000 1.2 *************** *** 1,249 **** ! /* ! * Created on 26-ott-2003 ! */ ! package org.jrman.ui; ! ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.HeadlessException; ! import java.awt.Insets; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.awt.event.KeyEvent; ! import java.io.File; ! import java.io.IOException; ! ! import javax.swing.*; ! import javax.swing.event.ListDataEvent; ! import javax.swing.event.ListDataListener; ! import javax.swing.event.ListSelectionEvent; ! import javax.swing.event.ListSelectionListener; ! ! import net.falappa.swing.ExtensionFileFilter; ! ! import org.apache.commons.cli.CommandLine; ! import org.apache.commons.cli.ParseException; ! import org.jrman.parser.Parser; ! ! /** ! * A basic graphical user interface to select a group of file to render, start ! * the rendering process and monitoring its progress. ! * ! * @author Alessandro Falappa ! */ ! public class MainFrame extends JFrame { ! private CommandLine commandLine; ! private JButton bExit= new JButton("Exit"); ! private DefaultListModel dlm= new DefaultListModel(); ! private JList fileList= new JList(dlm); ! private class RenderRunnable implements Runnable{ ! DefaultListModel queue; ! CommandLine commandLine; ! /* (non-Javadoc) ! * @see java.lang.Runnable#run() ! */ ! public void run() { ! if(queue!=null && MainFrame.this.commandLine!=null) { ! ProgressMonitor monitor=new ProgressMonitor(MainFrame.this,"Rendering:","filename",0,queue.size()+1); ! monitor.setMillisToDecideToPopup(0); ! monitor.setMillisToPopup(0); ! monitor.setProgress(0); ! for (int i= 0; i < queue.size(); i++) { ! File f= (File)queue.elementAt(i); ! monitor.setNote(f.getName()); ! monitor.setProgress(i+1); ! try { ! Parser parser= new Parser(commandLine); ! parser.begin(f.getAbsolutePath()); ! parser.parse(f.getAbsolutePath()); ! parser.end(); ! } ! catch (ParseException pe) { ! System.err.println(pe.getLocalizedMessage()); ! } ! catch (IOException ioe) { ! System.err.println( ! "Error on file " + ioe.getLocalizedMessage()); ! } ! catch (Exception e) { ! System.err.println(e.getLocalizedMessage()); ! } ! if(monitor.isCanceled()) ! break; ! } ! monitor.close(); ! renderAction.setEnabled(true); ! addAction.setEnabled(true); ! removeAction.setEnabled(true); ! } ! } ! } ! private class AddAction extends AbstractAction { ! private JFileChooser chooser; ! public AddAction() { ! putValue(Action.NAME, "Add..."); ! putValue( ! Action.SHORT_DESCRIPTION, ! "Add a rib file to the render queue"); ! putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A)); ! } ! /* ! * (non-Javadoc) ! * ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! if (chooser == null) { ! chooser= new JFileChooser(); ! chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); ! chooser.addChoosableFileFilter(new ExtensionFileFilter("rib")); ! } ! if(JFileChooser.APPROVE_OPTION==chooser.showOpenDialog(MainFrame.this)) { ! File f=chooser.getSelectedFile(); ! if(f!=null) { ! dlm.addElement(f); ! fileList.setSelectedIndex(dlm.getSize() - 1); ! } ! } ! } ! }; ! ! private class RemoveAction extends AbstractAction { ! public RemoveAction() { ! putValue(Action.NAME, "Delete"); ! putValue( ! Action.SHORT_DESCRIPTION, ! "Removes the selected rib file from the render queue"); ! putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_D)); ! } ! /* ! * (non-Javadoc) ! * ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! int idx= fileList.getSelectedIndex(); ! if (idx >= 0) { ! dlm.remove(idx--); ! fileList.setSelectedIndex(idx < 0 ? 0 : idx); ! } ! } ! } ! private class RenderAction extends AbstractAction { ! public RenderAction() { ! putValue(Action.NAME, "Render"); ! putValue( ! Action.SHORT_DESCRIPTION, ! "Starts rendering of the queued rib files"); ! putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R)); ! } ! /* ! * (non-Javadoc) ! * ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! this.setEnabled(false); ! addAction.setEnabled(false); ! removeAction.setEnabled(false); ! RenderRunnable runnable=new RenderRunnable(); ! runnable.queue=dlm; ! runnable.commandLine=commandLine; ! Thread t=new Thread(runnable,"renderthread"); ! t.start(); ! } ! ! } ! private AddAction addAction= new AddAction(); ! private RemoveAction removeAction= new RemoveAction(); ! private RenderAction renderAction= new RenderAction(); ! private JButton bAdd= new JButton(addAction); ! private JButton bRemove= new JButton(removeAction); ! private JButton bRender= new JButton(renderAction); ! ! public MainFrame(CommandLine commandLine) throws HeadlessException { ! super("jrMan"); ! this.commandLine=commandLine; ! removeAction.setEnabled(false); ! renderAction.setEnabled(false); ! bExit.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent e) { ! System.exit(0); ! } ! }); ! fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ! fileList.addListSelectionListener(new ListSelectionListener() { ! public void valueChanged(ListSelectionEvent e) { ! if (!e.getValueIsAdjusting()) { ! updateActions(); ! } ! } ! }); ! fileList.getModel().addListDataListener(new ListDataListener() { ! public void intervalAdded(ListDataEvent e) { ! updateActions(); ! } ! ! public void intervalRemoved(ListDataEvent e) { ! updateActions(); ! } ! ! public void contentsChanged(ListDataEvent e) { ! updateActions(); ! } ! ! }); ! layComponents(); ! } ! ! private void layComponents() { ! JPanel contentPane= new JPanel(new GridBagLayout()); ! contentPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); ! GridBagConstraints gbc= new GridBagConstraints(); ! gbc.gridwidth= 2; ! gbc.weightx= 1.0; ! gbc.gridx= GridBagConstraints.REMAINDER; ! gbc.anchor= GridBagConstraints.WEST; ! contentPane.add(new JLabel("Select files to render"), gbc); ! gbc.gridheight= 5; ! gbc.gridwidth= 1; ! gbc.weighty= 1.0; ! gbc.fill= GridBagConstraints.BOTH; ! contentPane.add(new JScrollPane(fileList), gbc); ! gbc.gridheight= 1; ! gbc.weighty= 0.0; ! gbc.weightx= 0.0; ! gbc.fill= GridBagConstraints.HORIZONTAL; ! gbc.gridx= 1; ! gbc.gridy= 1; ! gbc.insets= new Insets(0, 2, 0, 0); ! contentPane.add(bAdd, gbc); ! gbc.gridy= 2; ! gbc.insets= new Insets(2, 2, 0, 0); ! contentPane.add(bRemove, gbc); ! gbc.gridy= 3; ! gbc.weighty= 1.0; ! gbc.fill= GridBagConstraints.BOTH; ! contentPane.add(Box.createVerticalGlue(), gbc); ! gbc.gridy= 4; ! gbc.weighty= 0.0; ! gbc.fill= GridBagConstraints.HORIZONTAL; ! contentPane.add(bRender, gbc); ! gbc.gridy= 5; ! contentPane.add(bExit, gbc); ! setContentPane(contentPane); ! setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ! setIconImage( ! new ImageIcon( ! getClass().getResource("images/framebuffer_icon.png")) ! .getImage()); ! pack(); ! } ! ! private void updateActions() { ! renderAction.setEnabled(fileList.getModel().getSize() > 0); ! removeAction.setEnabled( ! fileList.getModel().getSize() > 0 ! && fileList.getSelectedIndex() >= 0); ! } ! } --- 1,267 ---- ! /* ! * Created on 26-ott-2003 ! */ ! package org.jrman.ui; ! ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.HeadlessException; ! import java.awt.Insets; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.awt.event.KeyEvent; ! import java.io.File; ! import java.io.IOException; ! ! import javax.swing.AbstractAction; ! import javax.swing.Action; ! import javax.swing.BorderFactory; ! import javax.swing.Box; ! import javax.swing.DefaultListModel; ! import javax.swing.ImageIcon; ! import javax.swing.JButton; ! import javax.swing.JFileChooser; ! import javax.swing.JFrame; ! import javax.swing.JLabel; ! import javax.swing.JList; ! import javax.swing.JPanel; ! import javax.swing.JScrollPane; ! import javax.swing.ListSelectionModel; ! import javax.swing.ProgressMonitor; ! import javax.swing.event.ListDataEvent; ! import javax.swing.event.ListDataListener; ! import javax.swing.event.ListSelectionEvent; ! import javax.swing.event.ListSelectionListener; ! ! import org.apache.commons.cli.CommandLine; ! import org.apache.commons.cli.ParseException; ! import org.jrman.parser.Parser; ! ! /** ! * A basic graphical user interface to select a group of file to render, start ! * the rendering process and monitoring its progress. ! * ! * @author Alessandro Falappa ! */ ! public class MainFrame extends JFrame { ! private CommandLine commandLine; ! private JButton bExit = new JButton("Exit"); ! private DefaultListModel dlm = new DefaultListModel(); ! private JList fileList = new JList(dlm); ! private class RenderRunnable implements Runnable { ! DefaultListModel queue; ! CommandLine commandLine; ! /* (non-Javadoc) ! * @see java.lang.Runnable#run() ! */ ! public void run() { ! if (queue != null && MainFrame.this.commandLine != null) { ! ProgressMonitor monitor = ! new ProgressMonitor( ! MainFrame.this, ! "Rendering:", ! "filename", ! 0, ! queue.size() + 1); ! monitor.setMillisToDecideToPopup(0); ! monitor.setMillisToPopup(0); ! monitor.setProgress(0); ! for (int i = 0; i < queue.size(); i++) { ! File f = (File) queue.elementAt(i); ! monitor.setNote(f.getName()); ! monitor.setProgress(i + 1); ! try { ! Parser parser = new Parser(commandLine); ! parser.begin(f.getAbsolutePath()); ! parser.parse(f.getAbsolutePath()); ! parser.end(); ! } catch (ParseException pe) { ! System.err.println(pe.getLocalizedMessage()); ! } catch (IOException ioe) { ! System.err.println( ! "Error on file " + ioe.getLocalizedMessage()); ! } catch (Exception e) { ! System.err.println(e.getLocalizedMessage()); ! } ! if (monitor.isCanceled()) ! break; ! } ! monitor.close(); ! renderAction.setEnabled(true); ! addAction.setEnabled(true); ! removeAction.setEnabled(true); ! } ! } ! } ! private class AddAction extends AbstractAction { ! private JFileChooser chooser; ! public AddAction() { ! putValue(Action.NAME, "Add..."); ! putValue( ! Action.SHORT_DESCRIPTION, ! "Add a rib file to the render queue"); ! putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A)); ! } ! /* ! * (non-Javadoc) ! * ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! if (chooser == null) { ! chooser = new JFileChooser(); ! chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); ! /* Commented by JVG ! chooser.addChoosableFileFilter(new ExtensionFileFilter("rib")); ! */ ! } ! if (JFileChooser.APPROVE_OPTION ! == chooser.showOpenDialog(MainFrame.this)) { ! File f = chooser.getSelectedFile(); ! if (f != null) { ! dlm.addElement(f); ! fileList.setSelectedIndex(dlm.getSize() - 1); ! } ! } ! } ! }; ! ! private class RemoveAction extends AbstractAction { ! public RemoveAction() { ! putValue(Action.NAME, "Delete"); ! putValue( ! Action.SHORT_DESCRIPTION, ! "Removes the selected rib file from the render queue"); ! putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_D)); ! } ! /* ! * (non-Javadoc) ! * ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! int idx = fileList.getSelectedIndex(); ! if (idx >= 0) { ! dlm.remove(idx--); ! fileList.setSelectedIndex(idx < 0 ? 0 : idx); ! } ! } ! } ! private class RenderAction extends AbstractAction { ! public RenderAction() { ! putValue(Action.NAME, "Render"); ! putValue( ! Action.SHORT_DESCRIPTION, ! "Starts rendering of the queued rib files"); ! putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R)); ! } ! /* ! * (non-Javadoc) ! * ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! this.setEnabled(false); ! addAction.setEnabled(false); ! removeAction.setEnabled(false); ! RenderRunnable runnable = new RenderRunnable(); ! runnable.queue = dlm; ! runnable.commandLine = commandLine; ! Thread t = new Thread(runnable, "renderthread"); ! t.start(); ! } ! ! } ! private AddAction addAction = new AddAction(); ! private RemoveAction removeAction = new RemoveAction(); ! private RenderAction renderAction = new RenderAction(); ! private JButton bAdd = new JButton(addAction); ! private JButton bRemove = new JButton(removeAction); ! private JButton bRender = new JButton(renderAction); ! ! public MainFrame(CommandLine commandLine) throws HeadlessException { ! super("jrMan"); ! this.commandLine = commandLine; ! removeAction.setEnabled(false); ! renderAction.setEnabled(false); ! bExit.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent e) { ! System.exit(0); ! } ! }); ! fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ! fileList.addListSelectionListener(new ListSelectionListener() { ! public void valueChanged(ListSelectionEvent e) { ! if (!e.getValueIsAdjusting()) { ! updateActions(); ! } ! } ! }); ! fileList.getModel().addListDataListener(new ListDataListener() { ! public void intervalAdded(ListDataEvent e) { ! updateActions(); ! } ! ! public void intervalRemoved(ListDataEvent e) { ! updateActions(); ! } ! ! public void contentsChanged(ListDataEvent e) { ! updateActions(); ! } ! ! }); ! layComponents(); ! } ! ! private void layComponents() { ! JPanel contentPane = new JPanel(new GridBagLayout()); ! contentPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); ! GridBagConstraints gbc = new GridBagConstraints(); ! gbc.gridwidth = 2; ! gbc.weightx = 1.0; ! gbc.gridx = GridBagConstraints.REMAINDER; ! gbc.anchor = GridBagConstraints.WEST; ! contentPane.add(new JLabel("Select files to render"), gbc); ! gbc.gridheight = 5; ! gbc.gridwidth = 1; ! gbc.weighty = 1.0; ! gbc.fill = GridBagConstraints.BOTH; ! contentPane.add(new JScrollPane(fileList), gbc); ! gbc.gridheight = 1; ! gbc.weighty = 0.0; ! gbc.weightx = 0.0; ! gbc.fill = GridBagConstraints.HORIZONTAL; ! gbc.gridx = 1; ! gbc.gridy = 1; ! gbc.insets = new Insets(0, 2, 0, 0); ! contentPane.add(bAdd, gbc); ! gbc.gridy = 2; ! gbc.insets = new Insets(2, 2, 0, 0); ! contentPane.add(bRemove, gbc); ! gbc.gridy = 3; ! gbc.weighty = 1.0; ! gbc.fill = GridBagConstraints.BOTH; ! contentPane.add(Box.createVerticalGlue(), gbc); ! gbc.gridy = 4; ! gbc.weighty = 0.0; ! gbc.fill = GridBagConstraints.HORIZONTAL; ! contentPane.add(bRender, gbc); ! gbc.gridy = 5; ! contentPane.add(bExit, gbc); ! setContentPane(contentPane); ! setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ! setIconImage( ! new ImageIcon( ! getClass().getResource("images/framebuffer_icon.png")) ! .getImage()); ! pack(); ! } ! ! private void updateActions() { ! renderAction.setEnabled(fileList.getModel().getSize() > 0); ! removeAction.setEnabled( ! fileList.getModel().getSize() > 0 ! && fileList.getSelectedIndex() >= 0); ! } ! } |
From: <afa...@us...> - 2003-12-11 15:25:34
|
Update of /cvsroot/jrman/drafts/src In directory sc8-pr-cvs1:/tmp/cvs-serv22311/drafts/src Added Files: DisplacementDented.java DisplacementNoisetest.java DisplacementTurbulence.java SurfaceClouds.java SurfaceConfetti.java SurfaceNoisetest.java SurfaceRandomcheckers.java SurfaceTurbulence.java Log Message: committed new files I forgot to add in previous commit --- NEW FILE: DisplacementDented.java --- /* * DisplacementDented.java Copyright (C) 2003 Alessandro Falappa * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.jrman.geom.Transform; import org.jrman.grid.FloatGrid; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.UniformScalarFloat; import org.jrman.parameters.UniformScalarInteger; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; import org.jrman.shaders.DisplacementShader; public class DisplacementDented extends DisplacementShader { private static FloatGrid fg1= new FloatGrid(); private static FloatGrid fg2= new FloatGrid(); private static Point3fGrid pg1= new Point3fGrid(); private static Vector3fGrid Nn= new Vector3fGrid(); private static Point3fGrid P2= new Point3fGrid(); protected void initDefaults() { defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Km", "uniform float"), 0.5f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); } public void shade(ShaderVariables sv) { super.shade(sv); UniformScalarFloat paramKm= (UniformScalarFloat)getParameter(sv, "Km"); final float Km= paramKm.getValue(); UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); final int noiseoctaves= paramNoiseoctaves.getValue(); P2.set(sv.P); Transform transform= Global.getTransform("camera"); transform= transform.concat(sv.attributes.getTransform()); transform= transform.getInverse(); P2.transform(P2, transform); Nn.vtransform(sv.N, transform); Nn.normalize(Nn); pg1.mul(P2, noisescale); fg2.set(0f); for (int j= 1; j <= noiseoctaves; j++) { fg1.snoise(pg1); fg1.abs(fg1); fg1.mul(fg1, 0.5f / j); fg2.add(fg2, fg1); pg1.mul(pg1, 2.0123f); } fg2.mul(fg2, fg2); fg2.mul(fg2, fg2); fg2.mul(fg2, -Km); P2.set(fg2); P2.mul(P2, Nn); sv.P.add(P2, sv.P); calculatenormal(sv, sv.P, sv.N); } } --- NEW FILE: DisplacementNoisetest.java --- /* * DisplacementNoisetest.java Copyright (C) 2003 Alessandro Falappa * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.jrman.geom.Transform; import org.jrman.grid.FloatGrid; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.UniformScalarFloat; import org.jrman.parameters.UniformScalarInteger; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; import org.jrman.shaders.DisplacementShader; public class DisplacementNoisetest extends DisplacementShader { private static FloatGrid fg1= new FloatGrid(); private static FloatGrid fg2= new FloatGrid(); private static Point3fGrid pg1= new Point3fGrid(); private static Vector3fGrid Nn= new Vector3fGrid(); private static Point3fGrid P2= new Point3fGrid(); protected void initDefaults() { defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Km", "uniform float"), 0.5f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); } public void shade(ShaderVariables sv) { super.shade(sv); UniformScalarFloat paramKm= (UniformScalarFloat)getParameter(sv, "Km"); final float Km= paramKm.getValue(); UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); final int noiseoctaves= paramNoiseoctaves.getValue(); P2.set(sv.P); Transform transform= Global.getTransform("camera"); transform= transform.concat(sv.attributes.getTransform()); transform= transform.getInverse(); P2.transform(P2, transform); Nn.vtransform(sv.N, transform); Nn.normalize(Nn); pg1.mul(P2, noisescale); fg2.set(0f); for (int j= 1; j <= noiseoctaves; j++) { fg1.snoise(pg1); fg1.mul(fg1, 0.5f / j); fg2.add(fg2, fg1); pg1.mul(pg1, 2.0123f); } fg2.mul(fg2, Km); P2.set(fg2); P2.mul(P2, Nn); sv.P.add(P2, sv.P); calculatenormal(sv, sv.P, sv.N); } } --- NEW FILE: DisplacementTurbulence.java --- /* * DisplacementNoisetest.java Copyright (C) 2003 Alessandro Falappa * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.jrman.geom.Transform; import org.jrman.grid.FloatGrid; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.UniformScalarFloat; import org.jrman.parameters.UniformScalarInteger; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; import org.jrman.shaders.DisplacementShader; public class DisplacementTurbulence extends DisplacementShader { private static FloatGrid fg1= new FloatGrid(); private static FloatGrid fg2= new FloatGrid(); private static Point3fGrid pg1= new Point3fGrid(); private static Vector3fGrid Nn= new Vector3fGrid(); private static Point3fGrid P2= new Point3fGrid(); protected void initDefaults() { defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Km", "uniform float"), 0.5f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); } public void shade(ShaderVariables sv) { super.shade(sv); UniformScalarFloat paramKm= (UniformScalarFloat)getParameter(sv, "Km"); final float Km= paramKm.getValue(); UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); final int noiseoctaves= paramNoiseoctaves.getValue(); P2.set(sv.P); Transform transform= Global.getTransform("camera"); transform= transform.concat(sv.attributes.getTransform()); transform= transform.getInverse(); P2.transform(P2, transform); Nn.vtransform(sv.N, transform); Nn.normalize(Nn); pg1.mul(P2, noisescale); fg2.set(0f); for (int j= 1; j <= noiseoctaves; j++) { fg1.snoise(pg1); fg1.abs(fg1); fg1.mul(fg1, 0.5f / j); fg2.add(fg2, fg1); pg1.mul(pg1, 2.0123f); } fg2.mul(fg2, Km); P2.set(fg2); P2.mul(P2, Nn); sv.P.add(P2, sv.P); calculatenormal(sv, sv.P, sv.N); } } --- NEW FILE: SurfaceClouds.java --- /* * DisplacementDented.java Copyright (C) 2003 Alessandro Falappa * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.jrman.grid.Color3fGrid; import org.jrman.grid.FloatGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.UniformScalarFloat; import org.jrman.parameters.UniformScalarInteger; import org.jrman.render.ShaderVariables; import org.jrman.shaders.SurfaceShader; public class SurfaceClouds extends SurfaceShader { private static Vector3fGrid vg1= new Vector3fGrid(); private static Color3fGrid cg1= new Color3fGrid(); private static Color3fGrid cg2= new Color3fGrid(); private static Color3fGrid cg3= new Color3fGrid(); private static FloatGrid fg1= new FloatGrid(); private static FloatGrid fg2= new FloatGrid(); protected void initDefaults() { defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); } public void shade(ShaderVariables sv) { super.shade(sv); UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); final float Ka= paramKa.getValue(); UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); final float Kd= paramKd.getValue(); UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); final int noiseoctaves= paramNoiseoctaves.getValue(); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); sv.Oi.set(sv.Os); ambient(sv, cg1); cg3.set(Ka); cg1.mul(cg1, cg3); diffuse(sv, vg1, cg2); cg3.set(Kd); cg2.mul(cg2, cg3); cg1.add(cg1, cg2); vg1.set(noisescale); vg1.mul(vg1, sv.P); fg2.set(0f); for (int j= 1; j <= noiseoctaves; j++) { fg1.noise(vg1); fg1.mul(fg1, 0.5f / j); fg2.add(fg2, fg1); vg1.mul(vg1, 2.0123f); } cg3.set(fg2); cg1.mul(cg1, cg3); sv.Ci.mul(sv.Os, cg1); } } --- NEW FILE: SurfaceConfetti.java --- /* * SurfaceConfetti.java Copyright (C) 2003 Alessandro Falappa * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.jrman.grid.Color3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.UniformScalarFloat; import org.jrman.render.ShaderVariables; import org.jrman.shaders.SurfaceShader; public class SurfaceConfetti extends SurfaceShader { private static Vector3fGrid vg1= new Vector3fGrid(); private static Color3fGrid cg1= new Color3fGrid(); private static Color3fGrid cg2= new Color3fGrid(); private static Color3fGrid cg3= new Color3fGrid(); protected void initDefaults() { defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); } public void shade(ShaderVariables sv) { super.shade(sv); UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); final float Ka= paramKa.getValue(); UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); final float Kd= paramKd.getValue(); UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); sv.Oi.set(sv.Os); ambient(sv, cg1); cg3.set(Ka); cg1.mul(cg1, cg3); diffuse(sv, vg1, cg2); cg3.set(Kd); cg2.mul(cg2, cg3); cg1.add(cg1, cg2); vg1.set(noisescale); vg1.mul(vg1, sv.P); cg3.noise(vg1); cg1.mul(cg1, cg3); sv.Ci.mul(sv.Os, cg1); } } --- NEW FILE: SurfaceNoisetest.java --- /* * SurfaceNoisetest.java Copyright (C) 2003 Alessandro Falappa * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.jrman.grid.Color3fGrid; import org.jrman.grid.FloatGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.UniformScalarFloat; import org.jrman.parameters.UniformScalarInteger; import org.jrman.render.ShaderVariables; import org.jrman.shaders.SurfaceShader; public class SurfaceNoisetest extends SurfaceShader { private static Vector3fGrid vg1= new Vector3fGrid(); private static Color3fGrid cg1= new Color3fGrid(); private static Color3fGrid cg2= new Color3fGrid(); private static Color3fGrid cg3= new Color3fGrid(); private static FloatGrid fg1= new FloatGrid(); private static FloatGrid fg2= new FloatGrid(); protected void initDefaults() { defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); } public void shade(ShaderVariables sv) { super.shade(sv); UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); final float Ka= paramKa.getValue(); UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); final float Kd= paramKd.getValue(); UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); final int noiseoctaves= paramNoiseoctaves.getValue(); final float maxrange= calcMaxRange(noiseoctaves); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); sv.Oi.set(sv.Os); ambient(sv, cg1); cg3.set(Ka); cg1.mul(cg1, cg3); diffuse(sv, vg1, cg2); cg3.set(Kd); cg2.mul(cg2, cg3); cg1.add(cg1, cg2); vg1.set(noisescale); vg1.mul(vg1, sv.P); fg2.set(0f); for (int j= 1; j <= noiseoctaves; j++) { fg1.noise(vg1); fg1.mul(fg1, 1f / j); fg2.add(fg2, fg1); vg1.mul(vg1, 2.0123f); } fg2.div(fg2, maxrange); cg3.set(fg2); cg1.mul(cg1, cg3); sv.Ci.mul(sv.Os, cg1); } /** * @param noiseoctaves * @return */ private float calcMaxRange(int noiseoctaves) { float ret= 0f; for (int j= 1; j <= noiseoctaves; j++) { ret += (1f / j); } return ret; } } --- NEW FILE: SurfaceRandomcheckers.java --- /* * SurfaceRandomcheckers.java Copyright (C) 2003 Alessandro Falappa * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.jrman.grid.Color3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.UniformScalarFloat; import org.jrman.render.ShaderVariables; import org.jrman.shaders.SurfaceShader; public class SurfaceRandomcheckers extends SurfaceShader { private static Vector3fGrid vg1= new Vector3fGrid(); private static Color3fGrid cg1= new Color3fGrid(); private static Color3fGrid cg2= new Color3fGrid(); private static Color3fGrid cg3= new Color3fGrid(); protected void initDefaults() { defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); } public void shade(ShaderVariables sv) { super.shade(sv); UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); final float Ka= paramKa.getValue(); UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); final float Kd= paramKd.getValue(); UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); sv.Oi.set(sv.Os); ambient(sv, cg1); cg3.set(Ka); cg1.mul(cg1, cg3); diffuse(sv, vg1, cg2); cg3.set(Kd); cg2.mul(cg2, cg3); cg1.add(cg1, cg2); vg1.set(noisescale); vg1.mul(vg1, sv.P); cg3.cellnoise(vg1); cg1.mul(cg1, cg3); sv.Ci.mul(sv.Os, cg1); } } --- NEW FILE: SurfaceTurbulence.java --- /* * SurfaceTurbulence.java Copyright (C) 2003 Alessandro Falappa * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.jrman.grid.Color3fGrid; import org.jrman.grid.FloatGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.UniformScalarFloat; import org.jrman.parameters.UniformScalarInteger; import org.jrman.render.ShaderVariables; import org.jrman.shaders.SurfaceShader; public class SurfaceTurbulence extends SurfaceShader { private static Vector3fGrid vg1= new Vector3fGrid(); private static Color3fGrid cg1= new Color3fGrid(); private static Color3fGrid cg2= new Color3fGrid(); private static Color3fGrid cg3= new Color3fGrid(); private static FloatGrid fg1= new FloatGrid(); private static FloatGrid fg2= new FloatGrid(); protected void initDefaults() { defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); } public void shade(ShaderVariables sv) { super.shade(sv); UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); final float Ka= paramKa.getValue(); UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); final float Kd= paramKd.getValue(); UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); final int noiseoctaves= paramNoiseoctaves.getValue(); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); sv.Oi.set(sv.Os); ambient(sv, cg1); cg3.set(Ka); cg1.mul(cg1, cg3); diffuse(sv, vg1, cg2); cg3.set(Kd); cg2.mul(cg2, cg3); cg1.add(cg1, cg2); vg1.mul(sv.P, noisescale); fg2.set(0f); for (int j= 1; j <= noiseoctaves; j++) { fg1.snoise(vg1); fg1.abs(fg1); fg1.mul(fg1, 0.5f / j); fg2.add(fg2, fg1); vg1.mul(vg1, 2.0123f); } cg3.set(fg2); cg1.mul(cg1, cg3); sv.Ci.mul(sv.Os, cg1); } } |
From: <afa...@us...> - 2003-12-11 15:25:34
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1:/tmp/cvs-serv22311/drafts/src/org/jrman/util Added Files: PerlinNoise.java Log Message: committed new files I forgot to add in previous commit --- NEW FILE: PerlinNoise.java --- /* PerlinNoise.java Copyright (C) 2003 Alessandro Falappa This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.util; /** * A multidimensional Perlin noise and cell noise generator class. * <p> * The generator produces float numbers in the range [-1;1] given one, two or * three arguments. The noise function is C1 and C2 continuous everywhere and * assumes a zero value at integer arguments. * <p> * This class can also provide a constant noise over integer cells. Generation * of values is as that of Perlin noise without final smooth interpolation * between values at the grid corners. * <p> * The algorithm is outlined in the Siggraph 2002 paper by <i>Ken Perlin * " Improving Noise"</i>. The code in this class is based on the * reference implementation found at http://mrl.nyu.edu/~perlin/noise/. * * @author Alessandro Falappa */ public final class PerlinNoise { static public float noise1d(float x) { int X= (int)Math.floor(x) & 255; x -= Math.floor(x); float u= fade(x); return Calc.interpolate( grad(p[p[p[X]]], x, 0, 0), grad(p[p[p[X + 1]]], x - 1, 0, 0), u); } static public float noise2d(float x, float y) { int X= (int)Math.floor(x) & 255; int Y= (int)Math.floor(y) & 255; x -= Math.floor(x); y -= Math.floor(y); float u= fade(x); float v= fade(y); int A= p[X] + Y; int AA= p[A]; int AB= p[A + 1]; A= p[X + 1] + Y; int BA= p[A]; int BB= p[A + 1]; float tmp1= Calc.interpolate(grad(p[AA], x, y, 0), grad(p[BA], x - 1, y, 0), u); float tmp2= Calc.interpolate( grad(p[AB], x, y - 1, 0), grad(p[BB], x - 1, y - 1, 0), u); return Calc.interpolate(tmp1, tmp2, v); } static public float noise3d(float x, float y, float z) { int X= (int)Math.floor(x) & 255; int Y= (int)Math.floor(y) & 255; int Z= (int)Math.floor(z) & 255; x -= Math.floor(x); y -= Math.floor(y); z -= Math.floor(z); float u= fade(x); float v= fade(y); float w= fade(z); int A= p[X] + Y; int AA= p[A] + Z; int AB= p[A + 1] + Z; A= p[X + 1] + Y; int BA= p[A] + Z; int BB= p[A + 1] + Z; float tmp1= Calc.interpolate(grad(p[AA], x, y, z), grad(p[BA], x - 1, y, z), u); float tmp2= Calc.interpolate( grad(p[AB], x, y - 1, z), grad(p[BB], x - 1, y - 1, z), u); float tmp3= Calc.interpolate( grad(p[AA + 1], x, y, z - 1), grad(p[BA + 1], x - 1, y, z - 1), u); float tmp4= Calc.interpolate( grad(p[AB + 1], x, y - 1, z - 1), grad(p[BB + 1], x - 1, y - 1, z - 1), u); return Calc.interpolate( Calc.interpolate(tmp1, tmp2, v), Calc.interpolate(tmp3, tmp4, v), w); } static public float noise4d(float x, float y, float z, float w) { int X= (int)Math.floor(x) & 255; int Y= (int)Math.floor(y) & 255; int Z= (int)Math.floor(z) & 255; int W= (int)Math.floor(w) & 255; x -= Math.floor(x); y -= Math.floor(y); z -= Math.floor(z); w -= Math.floor(w); float a= fade(x); float b= fade(y); float c= fade(z); float d= fade(w); int A= p[X] + Y, AA= p[A] + Z, AB= p[A + 1] + Z, B= p[X + 1] + Y, BA= p[B] + Z, BB= p[B + 1] + Z, AAA= p[AA] + W, AAB= p[AA + 1] + W, ABA= p[AB] + W, ABB= p[AB + 1] + W, BAA= p[BA] + W, BAB= p[BA + 1] + W, BBA= p[BB] + W, BBB= p[BB + 1] + W; return Calc.interpolate( Calc.interpolate( Calc.interpolate( Calc.interpolate( grad4d(p[AAA], x, y, z, w), grad4d(p[BAA], x - 1, y, z, w), a), Calc.interpolate( grad4d(p[ABA], x, y - 1, z, w), grad4d(p[BBA], x - 1, y - 1, z, w), a), b), Calc.interpolate( Calc.interpolate( grad4d(p[AAB], x, y, z - 1, w), grad4d(p[BAB], x - 1, y, z - 1, w), a), Calc.interpolate( grad4d(p[ABB], x, y - 1, z - 1, w), grad4d(p[BBB], x - 1, y - 1, z - 1, w), a), b), c), Calc.interpolate( Calc.interpolate( Calc.interpolate( grad4d(p[AAA + 1], x, y, z, w - 1), grad4d(p[BAA + 1], x - 1, y, z, w - 1), a), Calc.interpolate( grad4d(p[ABA + 1], x, y - 1, z, w - 1), grad4d(p[BBA + 1], x - 1, y - 1, z, w - 1), a), b), Calc.interpolate( Calc.interpolate( grad4d(p[AAB + 1], x, y, z - 1, w - 1), grad4d(p[BAB + 1], x - 1, y, z - 1, w - 1), a), Calc.interpolate( grad4d(p[ABB + 1], x, y - 1, z - 1, w - 1), grad4d(p[BBB + 1], x - 1, y - 1, z - 1, w - 1), a), b), c), d); } public static float cellnoise1d(float x) { int X= (int)Math.floor(x) & 255; return p[X]/255f; } public static float cellnoise2d(float x, float y) { int X= (int)Math.floor(x) & 255; int Y= (int)Math.floor(y) & 255; return p[p[X]+Y]/255f; } public static float cellnoise3d(float x, float y, float z) { int X= (int)Math.floor(x) & 255; int Y= (int)Math.floor(y) & 255; int Z= (int)Math.floor(z) & 255; return p[p[p[X]+Y]+Z]/255f; } public static float cellnoise4d(float x, float y, float z, float w) { int X= (int)Math.floor(x) & 255; int Y= (int)Math.floor(y) & 255; int Z= (int)Math.floor(z) & 255; int W= (int)Math.floor(w) & 255; return p[p[p[p[X]+Y]+Z]+W]/255f; } private static float fade(float t) { return t * t * t * (t * (t * 6 - 15) + 10); } private static float grad(int hash, float x, float y, float z) { int h= hash & 15; float u= h < 8 ? x : y; float v= h < 4 ? y : (h == 12 || h == 14 ? x : z); return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); } private static float grad4d(int hash, float x, float y, float z, float w) { int h= hash & 31; float a= y, b= z, c= w; switch (h >> 3) { case 1 : a= w; b= x; c= y; break; case 2 : a= z; b= w; c= x; break; case 3 : a= y; b= z; c= w; break; } return ((h & 4) == 0 ? -a : a) + ((h & 2) == 0 ? -b : b) + ((h & 1) == 0 ? -c : c); } private static final int p[]= new int[512]; private static final int permutation[]= { 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180 }; static { for (int i= 0; i < 256; i++) p[256 + i]= p[i]= permutation[i]; } // prevent instantiation private PerlinNoise() { } // public static void main(String[] args) { // int samples= 400; // float dx= 40.f / samples; // float dy= 40.f / samples; // float min= 0f, max= 0f, x, y; // int i, j; // BufferedImage image= // new BufferedImage(samples, samples, BufferedImage.TYPE_INT_RGB); // long time= System.currentTimeMillis(); // for (i= 0, x= 0f; i < samples; i++, x += dx) // for (j= 0, y= 0f; j < samples; j++, y += dy) { // float s= PerlinNoise.noise2d(x, y); // //s=PerlinNoise.noise2d(x+s,y+s); // //s=PerlinNoise.noise1d(s); // //s=PerlinNoise.noise1d(x+s); // if (s < min) // min= s; // else if (s > max) // max= s; // int col= Color.getHSBColor(0.f, 0.f, 0.5f*s+0.5f).getRGB(); // image.setRGB(i, j, col); // } // System.out.println("millis " + (System.currentTimeMillis() - time)); // System.out.println("min=" + min + " max=" + max); // JFrame frame= new JFrame("noise"); // JLabel label= new JLabel(new ImageIcon(image)); // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // frame.getContentPane().add(label); // frame.pack(); // frame.setVisible(true); // } } |
From: <afa...@us...> - 2003-12-11 15:25:34
|
Update of /cvsroot/jrman/drafts/src/org/jrman/ui In directory sc8-pr-cvs1:/tmp/cvs-serv22311/drafts/src/org/jrman/ui Added Files: MainFrame.java Log Message: committed new files I forgot to add in previous commit --- NEW FILE: MainFrame.java --- /* * Created on 26-ott-2003 */ package org.jrman.ui; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.HeadlessException; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.io.File; import java.io.IOException; import javax.swing.*; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import net.falappa.swing.ExtensionFileFilter; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.ParseException; import org.jrman.parser.Parser; /** * A basic graphical user interface to select a group of file to render, start * the rendering process and monitoring its progress. * * @author Alessandro Falappa */ public class MainFrame extends JFrame { private CommandLine commandLine; private JButton bExit= new JButton("Exit"); private DefaultListModel dlm= new DefaultListModel(); private JList fileList= new JList(dlm); private class RenderRunnable implements Runnable{ DefaultListModel queue; CommandLine commandLine; /* (non-Javadoc) * @see java.lang.Runnable#run() */ public void run() { if(queue!=null && MainFrame.this.commandLine!=null) { ProgressMonitor monitor=new ProgressMonitor(MainFrame.this,"Rendering:","filename",0,queue.size()+1); monitor.setMillisToDecideToPopup(0); monitor.setMillisToPopup(0); monitor.setProgress(0); for (int i= 0; i < queue.size(); i++) { File f= (File)queue.elementAt(i); monitor.setNote(f.getName()); monitor.setProgress(i+1); try { Parser parser= new Parser(commandLine); parser.begin(f.getAbsolutePath()); parser.parse(f.getAbsolutePath()); parser.end(); } catch (ParseException pe) { System.err.println(pe.getLocalizedMessage()); } catch (IOException ioe) { System.err.println( "Error on file " + ioe.getLocalizedMessage()); } catch (Exception e) { System.err.println(e.getLocalizedMessage()); } if(monitor.isCanceled()) break; } monitor.close(); renderAction.setEnabled(true); addAction.setEnabled(true); removeAction.setEnabled(true); } } } private class AddAction extends AbstractAction { private JFileChooser chooser; public AddAction() { putValue(Action.NAME, "Add..."); putValue( Action.SHORT_DESCRIPTION, "Add a rib file to the render queue"); putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A)); } /* * (non-Javadoc) * * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { if (chooser == null) { chooser= new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.addChoosableFileFilter(new ExtensionFileFilter("rib")); } if(JFileChooser.APPROVE_OPTION==chooser.showOpenDialog(MainFrame.this)) { File f=chooser.getSelectedFile(); if(f!=null) { dlm.addElement(f); fileList.setSelectedIndex(dlm.getSize() - 1); } } } }; private class RemoveAction extends AbstractAction { public RemoveAction() { putValue(Action.NAME, "Delete"); putValue( Action.SHORT_DESCRIPTION, "Removes the selected rib file from the render queue"); putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_D)); } /* * (non-Javadoc) * * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { int idx= fileList.getSelectedIndex(); if (idx >= 0) { dlm.remove(idx--); fileList.setSelectedIndex(idx < 0 ? 0 : idx); } } } private class RenderAction extends AbstractAction { public RenderAction() { putValue(Action.NAME, "Render"); putValue( Action.SHORT_DESCRIPTION, "Starts rendering of the queued rib files"); putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R)); } /* * (non-Javadoc) * * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { this.setEnabled(false); addAction.setEnabled(false); removeAction.setEnabled(false); RenderRunnable runnable=new RenderRunnable(); runnable.queue=dlm; runnable.commandLine=commandLine; Thread t=new Thread(runnable,"renderthread"); t.start(); } } private AddAction addAction= new AddAction(); private RemoveAction removeAction= new RemoveAction(); private RenderAction renderAction= new RenderAction(); private JButton bAdd= new JButton(addAction); private JButton bRemove= new JButton(removeAction); private JButton bRender= new JButton(renderAction); public MainFrame(CommandLine commandLine) throws HeadlessException { super("jrMan"); this.commandLine=commandLine; removeAction.setEnabled(false); renderAction.setEnabled(false); bExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fileList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { updateActions(); } } }); fileList.getModel().addListDataListener(new ListDataListener() { public void intervalAdded(ListDataEvent e) { updateActions(); } public void intervalRemoved(ListDataEvent e) { updateActions(); } public void contentsChanged(ListDataEvent e) { updateActions(); } }); layComponents(); } private void layComponents() { JPanel contentPane= new JPanel(new GridBagLayout()); contentPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); GridBagConstraints gbc= new GridBagConstraints(); gbc.gridwidth= 2; gbc.weightx= 1.0; gbc.gridx= GridBagConstraints.REMAINDER; gbc.anchor= GridBagConstraints.WEST; contentPane.add(new JLabel("Select files to render"), gbc); gbc.gridheight= 5; gbc.gridwidth= 1; gbc.weighty= 1.0; gbc.fill= GridBagConstraints.BOTH; contentPane.add(new JScrollPane(fileList), gbc); gbc.gridheight= 1; gbc.weighty= 0.0; gbc.weightx= 0.0; gbc.fill= GridBagConstraints.HORIZONTAL; gbc.gridx= 1; gbc.gridy= 1; gbc.insets= new Insets(0, 2, 0, 0); contentPane.add(bAdd, gbc); gbc.gridy= 2; gbc.insets= new Insets(2, 2, 0, 0); contentPane.add(bRemove, gbc); gbc.gridy= 3; gbc.weighty= 1.0; gbc.fill= GridBagConstraints.BOTH; contentPane.add(Box.createVerticalGlue(), gbc); gbc.gridy= 4; gbc.weighty= 0.0; gbc.fill= GridBagConstraints.HORIZONTAL; contentPane.add(bRender, gbc); gbc.gridy= 5; contentPane.add(bExit, gbc); setContentPane(contentPane); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setIconImage( new ImageIcon( getClass().getResource("images/framebuffer_icon.png")) .getImage()); pack(); } private void updateActions() { renderAction.setEnabled(fileList.getModel().getSize() > 0); removeAction.setEnabled( fileList.getModel().getSize() > 0 && fileList.getSelectedIndex() >= 0); } } |
From: <afa...@us...> - 2003-12-11 15:25:34
|
Update of /cvsroot/jrman/drafts/src/net/falappa/swing/res In directory sc8-pr-cvs1:/tmp/cvs-serv22311/drafts/src/net/falappa/swing/res Added Files: ExtensionFileFilter.properties ExtensionFileFilter_it.properties Log Message: committed new files I forgot to add in previous commit --- NEW FILE: ExtensionFileFilter.properties --- #Default english string resource bundle for ExtensionFileFilter ExtensionFileFilter.description={0} files (*.{1}) --- NEW FILE: ExtensionFileFilter_it.properties --- #Default italian string resource bundle for ExtensionFileFilter ExtensionFileFilter.description=File {0} (*.{1}) |
From: <afa...@us...> - 2003-12-11 15:25:33
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv22311/drafts/sampleData Added Files: noiseShadersTest.rib Log Message: committed new files I forgot to add in previous commit --- NEW FILE: noiseShadersTest.rib --- Format 800 800 1 Display "shaderTest" "framebuffer" "rgb" PixelSamples 3 3 PixelFilter "box" 3 3 Exposure 1 2.2 Projection "perspective" "fov" 10 Translate 0 0 40 WorldBegin LightSource "distantlight" 1 "from" [1 1 -1] "to" [0 0 0] "intensity" 1 LightSource "ambientlight" 2 "intensity" 0.05 AttributeBegin Translate -2.2 2.2 0 Surface "noisetest" "uniform float noisescale" 4 "uniform integer noiseoctaves" 1 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Translate 0 2.2 0 Surface "noisetest" "uniform float noisescale" 2 "uniform integer noiseoctaves" 5 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Translate 2.2 2.2 0 Surface "turbulence" "uniform float noisescale" 2 "uniform integer noiseoctaves" 5 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Translate -2.2 0 0 Surface "matte" Displacement "noisetest" "uniform float noisescale" 2 "uniform integer noiseoctaves" 4 "uniform float Km" 0.3 Attribute "displacementbound" "sphere" 0.3 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Surface "matte" Displacement "dented" "uniform float noisescale" 2 "uniform integer noiseoctaves" 6 "uniform float Km" 0.3 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Translate 2.2 0 0 Surface "matte" Displacement "turbulence" "uniform float noisescale" 2 "uniform integer noiseoctaves" 4 "uniform float Km" 0.3 Attribute "displacementbound" "sphere" 0.3 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Translate -2.2 -2.2 0 Surface "randomcheckers" "uniform float noisescale" 10 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Translate 0 -2.2 0 Surface "confetti" "uniform float noisescale" 4 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Translate 2.2 -2.2 0 Surface "confetti" "uniform float noisescale" 4 Displacement "dented" "uniform float noisescale" 3 "uniform integer noiseoctaves" 4 "uniform float Km" 0.3 Color 1 1 1 Sphere 1 -1 1 360 AttributeEnd WorldEnd |
From: <afa...@us...> - 2003-12-11 15:25:33
|
Update of /cvsroot/jrman/drafts/lib In directory sc8-pr-cvs1:/tmp/cvs-serv22311/drafts/lib Added Files: commons-cli-1.0.jar Log Message: committed new files I forgot to add in previous commit --- NEW FILE: commons-cli-1.0.jar --- (This appears to be a binary file; contents omitted.) |
From: <afa...@us...> - 2003-12-11 15:17:40
|
Update of /cvsroot/jrman/drafts/src/net/falappa/swing/res In directory sc8-pr-cvs1:/tmp/cvs-serv20649/res Log Message: Directory /cvsroot/jrman/drafts/src/net/falappa/swing/res added to the repository |
From: <afa...@us...> - 2003-12-11 15:08:10
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv17786/drafts/src/org/jrman/render Modified Files: RendererHidden.java Log Message: added command line options and their processing added simple GUI when no input file is specified added noise and cellnoise added noise test shaders updated some net.falappa.* components updated icon Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** RendererHidden.java 30 Nov 2003 03:23:16 -0000 1.55 --- RendererHidden.java 11 Dec 2003 15:08:06 -0000 1.56 *************** *** 1,20 **** /* ! RendererHidden.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package org.jrman.render; --- 1,19 ---- /* ! * RendererHidden.java Copyright (C) 2003 Gerardo Horvilleur Martinez ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package org.jrman.render; *************** *** 55,61 **** public class RendererHidden extends Renderer { ! private final static int MAX_EYE_SPLITS = 20; ! private final static Vector3f ORTHO_I = new Vector3f(0f, 0f, 1f); private ClippingVolume clippingVolume; --- 54,60 ---- public class RendererHidden extends Renderer { ! private final static int MAX_EYE_SPLITS= 20; ! private final static Vector3f ORTHO_I= new Vector3f(0f, 0f, 1f); private ClippingVolume clippingVolume; *************** *** 101,116 **** public void init(Frame frame, World world) { super.init(frame, world); ! worldToCamera = Global.getTransform("camera"); ! Transform cameraToScreen = Global.getTransform("screen"); ! Transform screenToRaster = Global.getTransform("raster"); if (cameraToScreen instanceof PerspectiveTransform) ! cameraToRaster = ((PerspectiveTransform) cameraToScreen).preConcat(screenToRaster); else ! cameraToRaster = screenToRaster.concat(cameraToScreen); ! eyePlane = Plane.createWithPointAndNormal(new Point3f(), new Vector3f(0f, 0f, -1f)); createClippingVolume(); createBuckets(); ! samplesFilter = frame.getFilter().getSamplesFilter(); ! worldParseStart = System.currentTimeMillis(); } --- 100,115 ---- public void init(Frame frame, World world) { super.init(frame, world); ! worldToCamera= Global.getTransform("camera"); ! Transform cameraToScreen= Global.getTransform("screen"); ! Transform screenToRaster= Global.getTransform("raster"); if (cameraToScreen instanceof PerspectiveTransform) ! cameraToRaster= ((PerspectiveTransform)cameraToScreen).preConcat(screenToRaster); else ! cameraToRaster= screenToRaster.concat(cameraToScreen); ! eyePlane= Plane.createWithPointAndNormal(new Point3f(), new Vector3f(0f, 0f, -1f)); createClippingVolume(); createBuckets(); ! samplesFilter= frame.getFilter().getSamplesFilter(); ! worldParseStart= System.currentTimeMillis(); } *************** *** 119,131 **** } ! private void internalAddPrimitive( ! Primitive primitive, ! int curColumn, ! int curRow, ! boolean check) { ! Transform objectToCamera = primitive.getObjectToCamera(); if (objectToCamera == null) { ! Transform objectToWorld = primitive.getAttributes().getTransform(); ! objectToCamera = worldToCamera.concat(objectToWorld); primitive.setObjectToCamera(objectToCamera); } --- 118,126 ---- } ! private void internalAddPrimitive(Primitive primitive, int curColumn, int curRow, boolean check) { ! Transform objectToCamera= primitive.getObjectToCamera(); if (objectToCamera == null) { ! Transform objectToWorld= primitive.getAttributes().getTransform(); ! objectToCamera= worldToCamera.concat(objectToWorld); primitive.setObjectToCamera(objectToCamera); } *************** *** 134,153 **** } ! private boolean addPrimitive( ! Primitive primitive, ! int recursionLevel, ! Transform objectToCamera, ! int curColumn, ! int curRow, ! boolean check) { ! BoundingVolume bv = primitive.getBoundingVolume(); ! float db = primitive.getAttributes().getDisplacementBound(); BoundingVolume bve; ! bve = bv.enlarge(db); ! bve = bve.transform(objectToCamera); ! bv = bv.transform(objectToCamera); if (clippingVolume.whereIs(bve) == Plane.Side.OUTSIDE) return true; ! Plane.Side side = bv.whichSideOf(eyePlane); if (side == Plane.Side.INSIDE) { placeInBucket(primitive, bve, bv, curColumn, curRow, check); --- 129,142 ---- } ! private boolean addPrimitive(Primitive primitive, int recursionLevel, Transform objectToCamera, int curColumn, int curRow, boolean check) { ! BoundingVolume bv= primitive.getBoundingVolume(); ! float db= primitive.getAttributes().getDisplacementBound(); BoundingVolume bve; ! bve= bv.enlarge(db); ! bve= bve.transform(objectToCamera); ! bv= bv.transform(objectToCamera); if (clippingVolume.whereIs(bve) == Plane.Side.OUTSIDE) return true; ! Plane.Side side= bv.whichSideOf(eyePlane); if (side == Plane.Side.INSIDE) { placeInBucket(primitive, bve, bv, curColumn, curRow, check); *************** *** 157,189 **** if (recursionLevel == MAX_EYE_SPLITS) return false; ! Primitive[] sub = primitive.split(); ! boolean result = true; ! for (int i = 0; i < sub.length; i++) ! if (!addPrimitive(sub[i], ! recursionLevel + 1, ! objectToCamera, ! curColumn, ! curRow, ! check)) ! result = false; return result; } ! private void placeInBucket( ! Primitive primitive, ! BoundingVolume bve, ! BoundingVolume bv, ! int column, ! int row, ! boolean check) { ! bve = bve.transform(cameraToRaster); primitive.setDistance(bve.getMinZ()); ! Bounds2f bounds = bve.toBounds2f(); ! float db = primitive.getAttributes().getDisplacementBound(); if (db != 0f) { ! bv = bv.transform(cameraToRaster); ! Bounds2f bnd = bv.toBounds2f(); ! float dw = bounds.getWidth() - bnd.getWidth(); ! float dh = bounds.getHeight() - bnd.getHeight(); primitive.setScreenDisplacementWidth(dw); primitive.setScreenDisplacementHeight(dh); --- 146,167 ---- if (recursionLevel == MAX_EYE_SPLITS) return false; ! Primitive[] sub= primitive.split(); ! boolean result= true; ! for (int i= 0; i < sub.length; i++) ! if (!addPrimitive(sub[i], recursionLevel + 1, objectToCamera, curColumn, curRow, check)) ! result= false; return result; } ! private void placeInBucket(Primitive primitive, BoundingVolume bve, BoundingVolume bv, int column, int row, boolean check) { ! bve= bve.transform(cameraToRaster); primitive.setDistance(bve.getMinZ()); ! Bounds2f bounds= bve.toBounds2f(); ! float db= primitive.getAttributes().getDisplacementBound(); if (db != 0f) { ! bv= bv.transform(cameraToRaster); ! Bounds2f bnd= bv.toBounds2f(); ! float dw= bounds.getWidth() - bnd.getWidth(); ! float dh= bounds.getHeight() - bnd.getHeight(); primitive.setScreenDisplacementWidth(dw); primitive.setScreenDisplacementHeight(dh); *************** *** 193,217 **** } ! private void doPlaceInBucket( ! Primitive primitive, ! int curColumn, ! int curRow, ! boolean check) { ! Bounds2f bounds = primitive.getRasterBounds(); if (!bounds.intersects(rasterWindow)) return; ! float minX = bounds.getMinX() - rasterWindow.getMinX(); ! float minY = bounds.getMinY() - rasterWindow.getMinY(); ! int column = Calc.clamp((int) (minX / bucketWidth), 0, bucketColumns - 1); ! int row = Calc.clamp((int) (minY / bucketHeight), 0, bucketRows - 1); if (check && row <= curRow) { ! float maxY = bounds.getMaxY() - rasterWindow.getMinY(); ! int maxRow = Calc.clamp((int) Math.ceil(maxY / bucketHeight), 0, bucketRows - 1); if (maxRow < curRow) return; ! row = curRow; ! float maxX = bounds.getMaxX() - rasterWindow.getMinX(); ! int maxColumn = ! Calc.clamp((int) Math.ceil(maxX / bucketWidth), 0, bucketColumns - 1); if (column <= curColumn && curColumn <= maxColumn) { getBucket(curColumn, curRow).addPrimitive(primitive); --- 171,190 ---- } ! private void doPlaceInBucket(Primitive primitive, int curColumn, int curRow, boolean check) { ! Bounds2f bounds= primitive.getRasterBounds(); if (!bounds.intersects(rasterWindow)) return; ! float minX= bounds.getMinX() - rasterWindow.getMinX(); ! float minY= bounds.getMinY() - rasterWindow.getMinY(); ! int column= Calc.clamp((int) (minX / bucketWidth), 0, bucketColumns - 1); ! int row= Calc.clamp((int) (minY / bucketHeight), 0, bucketRows - 1); if (check && row <= curRow) { ! float maxY= bounds.getMaxY() - rasterWindow.getMinY(); ! int maxRow= Calc.clamp((int)Math.ceil(maxY / bucketHeight), 0, bucketRows - 1); if (maxRow < curRow) return; ! row= curRow; ! float maxX= bounds.getMaxX() - rasterWindow.getMinX(); ! int maxColumn= Calc.clamp((int)Math.ceil(maxX / bucketWidth), 0, bucketColumns - 1); if (column <= curColumn && curColumn <= maxColumn) { getBucket(curColumn, curRow).addPrimitive(primitive); *************** *** 232,245 **** if (mp.getMaxX() < rasterWindowMin.x || mp.getMaxY() < rasterWindowMin.y) return; ! float mpMinX = mp.getMinX() - rasterWindowMin.x; ! float mpMinY = mp.getMinY() - rasterWindowMin.y; ! float mpMaxX = mp.getMaxX() - rasterWindowMin.x; ! float mpMaxY = mp.getMaxY() - rasterWindowMin.y; ! int minColumn = (int) (mpMinX / bucketWidth); ! int minRow = (int) (mpMinY / bucketHeight); ! int maxColumn = (int) (mpMaxX / bucketWidth); ! int maxRow = (int) (mpMaxY / bucketHeight); ! for (int col = minColumn; col <= maxColumn; col++) ! for (int row = minRow; row <= maxRow; row++) if (col >= 0 && col < bucketColumns && row >= 0 && row < bucketRows) getBucket(col, row).addMicropolygon(mp); --- 205,218 ---- if (mp.getMaxX() < rasterWindowMin.x || mp.getMaxY() < rasterWindowMin.y) return; ! float mpMinX= mp.getMinX() - rasterWindowMin.x; ! float mpMinY= mp.getMinY() - rasterWindowMin.y; ! float mpMaxX= mp.getMaxX() - rasterWindowMin.x; ! float mpMaxY= mp.getMaxY() - rasterWindowMin.y; ! int minColumn= (int) (mpMinX / bucketWidth); ! int minRow= (int) (mpMinY / bucketHeight); ! int maxColumn= (int) (mpMaxX / bucketWidth); ! int maxRow= (int) (mpMaxY / bucketHeight); ! for (int col= minColumn; col <= maxColumn; col++) ! for (int row= minRow; row <= maxRow; row++) if (col >= 0 && col < bucketColumns && row >= 0 && row < bucketRows) getBucket(col, row).addMicropolygon(mp); *************** *** 251,316 **** public void render() { ! worldParseEnd = System.currentTimeMillis(); ! Display.Mode displayMode = frame.getDisplay().getMode(); ! Display.Type displayType = frame.getDisplay().getType(); ! ImageStore imageStore = ! new ImageStore( ! frame.getHorizontalResolution(), ! frame.getVerticalResolution(), ! frame.getDisplay()); ! ZStore zStore = null; if (displayMode == Display.Mode.Z) { ! zStore = ! new ZStore(frame.getHorizontalResolution(), frame.getVerticalResolution()); ShadowMap.flushShadowMap(frame.getDisplay().getName()); } ! Framebuffer fb = null; ! if (displayType == Display.Type.FRAMEBUFFER) { ! fb = new Framebuffer(frame.getDisplay().getName(), imageStore.getImage()); fb.setVisible(true); } ! int gridSize = frame.getGridSize(); ! ShaderVariables shaderVariables = new ShaderVariables(worldToCamera.getInverse()); ! int gridCount = 0; ! Sampler sampler = ! new Sampler( ! bucketWidth, ! bucketHeight, ! frame.getHorizontalSamplingRate(), ! frame.getVerticalSamplingRate()); ! Filter filter = frame.getFilter(); ! samplesFilter.init( ! (int) Math.ceil(filter.getHorizontalWidth() * sampler.getPixelWidth()), ! (int) Math.ceil(filter.getVerticalWidth() * sampler.getPixelHeight()), ! filter.getHorizontalWidth(), ! filter.getVerticalWidth()); ! float[] samples = ! new float[sampler.getWidth() ! * bucketColumns ! * (sampler.getHeight() + vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * 3]; ! float[] filteredSamples = new float[bucketWidth * bucketHeight * 3]; ! int[] pixels = new int[bucketWidth * bucketHeight]; ! float[] depths = new float[bucketWidth * bucketHeight]; ! long start = System.currentTimeMillis(); ! Point2f rmin = rasterWindow.getMin(); ! int percentComplete = -1; ! for (int row = 0; row < bucketRows; row++) { ! for (int column = 0; column < bucketColumns; column++) { ! Bucket bucket = getBucket(column, row); prefetchNextBucket(column, row); ! float samplerX = rmin.x + bucketWidth * column; ! float samplerY = rmin.y + bucketHeight * row; sampler.init(samplerX, samplerY); while (bucket.hasMorePrimitives()) { primitivePatchCount++; ! Primitive p = bucket.getNextPrimitive(); if (isPrimitiveVisible(p, sampler)) { if (p.isReadyToBeDiced(gridSize)) { gridCount++; p.dice(shaderVariables); ! Attributes attr = p.getAttributes(); ! DisplacementShader ds = attr.getDisplacement(); if (ds != null) ds.shade(shaderVariables); --- 224,271 ---- public void render() { ! worldParseEnd= System.currentTimeMillis(); ! Display.Mode displayMode= frame.getDisplay().getMode(); ! Display.Type displayType= frame.getDisplay().getType(); ! ImageStore imageStore= new ImageStore(frame.getHorizontalResolution(), frame.getVerticalResolution(), frame.getDisplay()); ! ZStore zStore= null; if (displayMode == Display.Mode.Z) { ! zStore= new ZStore(frame.getHorizontalResolution(), frame.getVerticalResolution()); ShadowMap.flushShadowMap(frame.getDisplay().getName()); } ! Framebuffer fb= null; ! if (displayType == Display.Type.FRAMEBUFFER || frame.isFramebufferAlways()) { ! fb= new Framebuffer(frame.getDisplay().getName(), imageStore.getImage()); fb.setVisible(true); } ! int gridSize= frame.getGridSize(); ! ShaderVariables shaderVariables= new ShaderVariables(worldToCamera.getInverse()); ! int gridCount= 0; ! Sampler sampler= new Sampler(bucketWidth, bucketHeight, frame.getHorizontalSamplingRate(), frame.getVerticalSamplingRate()); ! Filter filter= frame.getFilter(); ! samplesFilter.init((int)Math.ceil(filter.getHorizontalWidth() * sampler.getPixelWidth()), (int)Math.ceil(filter.getVerticalWidth() * sampler.getPixelHeight()), filter.getHorizontalWidth(), filter.getVerticalWidth()); ! float[] samples= new float[sampler.getWidth() * bucketColumns * (sampler.getHeight() + vFilterExtra + vPixelLess * sampler.getPixelHeight()) * 3]; ! float[] filteredSamples= new float[bucketWidth * bucketHeight * 3]; ! int[] pixels= new int[bucketWidth * bucketHeight]; ! float[] depths= new float[bucketWidth * bucketHeight]; ! long start= System.currentTimeMillis(); ! Point2f rmin= rasterWindow.getMin(); ! int percentComplete= -1; ! for (int row= 0; row < bucketRows; row++) { ! for (int column= 0; column < bucketColumns; column++) { ! Bucket bucket= getBucket(column, row); prefetchNextBucket(column, row); ! float samplerX= rmin.x + bucketWidth * column; ! float samplerY= rmin.y + bucketHeight * row; sampler.init(samplerX, samplerY); while (bucket.hasMorePrimitives()) { primitivePatchCount++; ! Primitive p= bucket.getNextPrimitive(); if (isPrimitiveVisible(p, sampler)) { if (p.isReadyToBeDiced(gridSize)) { gridCount++; p.dice(shaderVariables); ! Attributes attr= p.getAttributes(); ! DisplacementShader ds= attr.getDisplacement(); if (ds != null) ds.shade(shaderVariables); *************** *** 319,345 **** else shaderVariables.I.set(ORTHO_I); ! SurfaceShader surface = attr.getSurface(); if (surface == null) ! surface = ! SurfaceShader.createShader( ! "fakedlight", ! new ParameterList(), ! attr); surface.shade(shaderVariables); ! VolumeShader vs = attr.getAtmosphere(); if (vs != null) ! vs.shade( ! shaderVariables, ! frame.getNearClipping(), ! frame.getFarClipping()); shaderVariables.transform(cameraToRaster); shaderVariables.getMicropolygons(this); sampler.sampleBucket(bucket, bucket.hasMorePrimitives()); ! } else { ! Primitive[] sub = p.split(); ! for (int i = 0; i < sub.length; i++) internalAddPrimitive(sub[i], column, row, true); } ! } else { placeInNextBucket(p, column, row); invisiblePatchCount++; --- 274,295 ---- else shaderVariables.I.set(ORTHO_I); ! SurfaceShader surface= attr.getSurface(); if (surface == null) ! surface= SurfaceShader.createShader("fakedlight", new ParameterList(), attr); surface.shade(shaderVariables); ! VolumeShader vs= attr.getAtmosphere(); if (vs != null) ! vs.shade(shaderVariables, frame.getNearClipping(), frame.getFarClipping()); shaderVariables.transform(cameraToRaster); shaderVariables.getMicropolygons(this); sampler.sampleBucket(bucket, bucket.hasMorePrimitives()); ! } ! else { ! Primitive[] sub= p.split(); ! for (int i= 0; i < sub.length; i++) internalAddPrimitive(sub[i], column, row, true); } ! } ! else { placeInNextBucket(p, column, row); invisiblePatchCount++; *************** *** 350,493 **** bucket.flush(); if (displayMode == Display.Mode.RGB || displayMode == Display.Mode.RGBA) { ! sampler.getColors( ! samples, ! (column * sampler.getWidth() ! + (row == 0 ? 0 : 1) ! * (vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * bucketColumns ! * sampler.getWidth()) ! * 3, ! bucketColumns * sampler.getWidth(), ! 3, ! 0); ! samplesFilter.doFilter( ! samples, ! (column * sampler.getWidth() ! - (column == 0 ! ? 0 ! : (hFilterExtra + hPixelLess * sampler.getPixelWidth()))) ! * 3, ! bucketColumns * sampler.getWidth(), ! filteredSamples, ! 0, ! bucketWidth, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0), ! sampler.getPixelWidth(), ! sampler.getPixelHeight(), ! 3); colorsToPixels(filteredSamples, pixels); ! imageStore.setPixels( ! pixels, ! column * bucketWidth - (column == 0 ? 0 : hPixelLess) + (int) rmin.x, ! row * bucketHeight - (row == 0 ? 0 : vPixelLess) + (int) rmin.y, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0), ! bucketWidth); if (fb != null) ! fb.refresh( ! column * bucketWidth ! - (column == 0 ? 0 : hPixelLess) ! + (int) rmin.x, ! row * bucketHeight - (row == 0 ? 0 : vPixelLess) + (int) rmin.y, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0)); ! } else if (displayMode == Display.Mode.Z) { sampler.getDepths(depths); ! zStore.setDepths( ! depths, ! column * bucketWidth + (int) rmin.x, ! row * bucketHeight + (int) rmin.y, ! bucketWidth, ! bucketHeight, ! bucketWidth); } ! int percent = (row * bucketColumns + column + 1) * 100 / buckets.length; ! if (percent > percentComplete) { ! percentComplete = percent; ! System.out.print( ! "\r" ! + frame.getDisplay().getName() ! + " (frame " ! + frame.getFrameNumber() ! + "): " ! + percentComplete ! + "% complete"); } } ! System.arraycopy( ! samples, ! (bucketHeight * sampler.getPixelHeight() ! - (row == 0 ? (vFilterExtra + vPixelLess * sampler.getPixelHeight()) : 0)) ! * bucketColumns ! * sampler.getWidth() ! * 3, ! samples, ! 0, ! (vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * bucketColumns ! * sampler.getWidth() ! * 3); } ! if (displayType == Display.Type.FRAMEBUFFER) { System.out.println(); fb.completed(); ! } else if (displayType == Display.Type.FILE) try { if (displayMode == Display.Mode.RGB || displayMode == Display.Mode.RGBA) { ! String name = frame.getDisplay().getName(); ! String ext = name.substring(name.lastIndexOf('.') + 1); ! File file = new File(frame.getDisplay().getName()); ImageIO.write(imageStore.getImage(), ext, file); ! } else if (displayMode == Display.Mode.Z) ! ShadowMap.writeShadowMap( ! frame.getDisplay().getName(), ! worldToCamera, ! cameraToRaster, ! frame.getHorizontalResolution(), ! frame.getVerticalResolution(), ! zStore.getDepths()); ! } catch (Exception e) { System.err.println("Error writing image file: " + e); } ! for (int i = 0; i < buckets.length; i++) { if (buckets[i].hasMorePrimitives()) System.out.println("More primitives: " + i); } ! long end = System.currentTimeMillis(); ! float time = (end - start) / 1000f; if (frame.endOfFrameStatisticsEnabled()) { ! System.out.println("*** Statistics ***"); ! System.out.println( ! "World parse time: " + Format.time(worldParseEnd - worldParseStart)); System.out.println("Total patches: " + primitivePatchCount); System.out.println("Patches/second: " + primitivePatchCount / time); System.out.println("Invisible patches: " + invisiblePatchCount); ! System.out.println( ! "Patches culled: " + invisiblePatchCount * 100f / primitivePatchCount + "%"); System.out.println("Root count: " + Sampler.rootCount); System.out.println("Pixel count: " + Sampler.pixelCount); ! System.out.println( ! "gridCount = " ! + gridCount ! + " in " ! + time ! + " seconds\n" ! + gridCount / time ! + "grids/second"); System.out.println("Total micropolygons: " + Micropolygon.count); System.out.println("Micropolygons/second: " + Micropolygon.count / time); System.out.println("Bucket samples: " + Sampler.bucketSamplesCount); ! System.out.println( ! "Modified bucket samples: " + Sampler.modifiedSampleBucketsCount); System.out.println("---------------------------------------------------"); ! primitivePatchCount = 0; ! invisiblePatchCount = 0; ! Sampler.rootCount = 0; ! Sampler.pixelCount = 0; ! gridCount = 0; ! Micropolygon.count = 0; ! Sampler.bucketSamplesCount = 0; ! Sampler.modifiedSampleBucketsCount = 0; } } --- 300,372 ---- bucket.flush(); if (displayMode == Display.Mode.RGB || displayMode == Display.Mode.RGBA) { ! sampler.getColors(samples, (column * sampler.getWidth() + (row == 0 ? 0 : 1) * (vFilterExtra + vPixelLess * sampler.getPixelHeight()) * bucketColumns * sampler.getWidth()) * 3, bucketColumns * sampler.getWidth(), 3, 0); ! samplesFilter.doFilter(samples, (column * sampler.getWidth() - (column == 0 ? 0 : (hFilterExtra + hPixelLess * sampler.getPixelWidth()))) * 3, bucketColumns * sampler.getWidth(), filteredSamples, 0, bucketWidth, bucketWidth - (column == 0 ? hPixelLess : 0), bucketHeight - (row == 0 ? vPixelLess : 0), sampler.getPixelWidth(), sampler.getPixelHeight(), 3); colorsToPixels(filteredSamples, pixels); ! imageStore.setPixels(pixels, column * bucketWidth - (column == 0 ? 0 : hPixelLess) + (int)rmin.x, row * bucketHeight - (row == 0 ? 0 : vPixelLess) + (int)rmin.y, bucketWidth - (column == 0 ? hPixelLess : 0), bucketHeight - (row == 0 ? vPixelLess : 0), bucketWidth); if (fb != null) ! fb.refresh(column * bucketWidth - (column == 0 ? 0 : hPixelLess) + (int)rmin.x, row * bucketHeight - (row == 0 ? 0 : vPixelLess) + (int)rmin.y, bucketWidth - (column == 0 ? hPixelLess : 0), bucketHeight - (row == 0 ? vPixelLess : 0)); ! } ! else if (displayMode == Display.Mode.Z) { sampler.getDepths(depths); ! zStore.setDepths(depths, column * bucketWidth + (int)rmin.x, row * bucketHeight + (int)rmin.y, bucketWidth, bucketHeight, bucketWidth); } ! if (frame.isShowProgressEnabled()) { ! int percent= (row * bucketColumns + column + 1) * 100 / buckets.length; ! if (percent > percentComplete) { ! percentComplete= percent; ! System.out.print("\r" + frame.getDisplay().getName() + " (frame " + frame.getFrameNumber() + "): " + percentComplete + "% complete"); ! } ! } } ! System.arraycopy(samples, (bucketHeight * sampler.getPixelHeight() - (row == 0 ? (vFilterExtra + vPixelLess * sampler.getPixelHeight()) : 0)) * bucketColumns * sampler.getWidth() * 3, samples, 0, (vFilterExtra + vPixelLess * sampler.getPixelHeight()) * bucketColumns * sampler.getWidth() * 3); } ! if (frame.isShowProgressEnabled()) System.out.println(); + if (fb != null) fb.completed(); ! if (displayType == Display.Type.FILE) try { if (displayMode == Display.Mode.RGB || displayMode == Display.Mode.RGBA) { ! String name= frame.getDisplay().getName(); ! String ext= name.substring(name.lastIndexOf('.') + 1); ! File file= new File(frame.getDisplay().getName()); ImageIO.write(imageStore.getImage(), ext, file); ! } ! else if (displayMode == Display.Mode.Z) ! ShadowMap.writeShadowMap(frame.getDisplay().getName(), worldToCamera, cameraToRaster, frame.getHorizontalResolution(), frame.getVerticalResolution(), zStore.getDepths()); ! } ! catch (Exception e) { System.err.println("Error writing image file: " + e); } ! for (int i= 0; i < buckets.length; i++) { if (buckets[i].hasMorePrimitives()) System.out.println("More primitives: " + i); } ! long end= System.currentTimeMillis(); ! float time= (end - start) / 1000f; if (frame.endOfFrameStatisticsEnabled()) { ! System.out.println("*** Frame Statistics ***"); ! System.out.println("World parse time: " + Format.time(worldParseEnd - worldParseStart)); System.out.println("Total patches: " + primitivePatchCount); System.out.println("Patches/second: " + primitivePatchCount / time); System.out.println("Invisible patches: " + invisiblePatchCount); ! System.out.println("Patches culled: " + invisiblePatchCount * 100f / primitivePatchCount + "%"); System.out.println("Root count: " + Sampler.rootCount); System.out.println("Pixel count: " + Sampler.pixelCount); ! System.out.println("gridCount = " + gridCount + " in " + time + " seconds\n" + gridCount / time + "grids/second"); System.out.println("Total micropolygons: " + Micropolygon.count); System.out.println("Micropolygons/second: " + Micropolygon.count / time); System.out.println("Bucket samples: " + Sampler.bucketSamplesCount); ! System.out.println("Modified bucket samples: " + Sampler.modifiedSampleBucketsCount); System.out.println("---------------------------------------------------"); ! primitivePatchCount= 0; ! invisiblePatchCount= 0; ! Sampler.rootCount= 0; ! Sampler.pixelCount= 0; ! gridCount= 0; ! Micropolygon.count= 0; ! Sampler.bucketSamplesCount= 0; ! Sampler.modifiedSampleBucketsCount= 0; } } *************** *** 512,625 **** private void colorsToPixels(float[] colors, int[] result) { ! Color3f tmp = new Color3f(); ! for (int row = 0; row < bucketHeight; row++) ! for (int col = 0; col < bucketWidth; col++) { ! int offset = (row * bucketWidth + col) * 3; ! tmp.x = colors[offset++]; ! tmp.y = colors[offset++]; ! tmp.z = colors[offset]; frame.getExposure().expose(tmp, tmp); ! Quantizer qt = frame.getColorQuantizer(); ! int red = qt.quantize(tmp.x); ! int green = qt.quantize(tmp.y); ! int blue = qt.quantize(tmp.z); ! offset = row * bucketWidth + col; ! result[offset] = ((255 << 24) | (red << 16) | (green << 8) | blue); } } private void createClippingVolume() { ! rasterWindow = createRasterWindow(); ! rasterWindowMin = rasterWindow.getMin(); ! Transform rasterToScreen = Global.getTransform("raster").getInverse(); ! Bounds2f renderingScreenWindow = rasterWindow.transform(rasterToScreen); ! Point2f min = renderingScreenWindow.getMin(); ! Point2f max = renderingScreenWindow.getMax(); ! clippingVolume = new ClippingVolume(); if (frame.getCameraProjection() == CameraProjection.PERSPECTIVE) { ! Point3f origin = new Point3f(); ! Point3f upperLeft = new Point3f(min.x, max.y, 1f); ! Point3f upperRight = new Point3f(max.x, max.y, 1f); ! Point3f lowerLeft = new Point3f(min.x, min.y, 1f); ! Point3f lowerRight = new Point3f(max.x, min.y, 1f); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(origin, upperLeft, upperRight)); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(origin, upperRight, lowerRight)); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(origin, lowerRight, lowerLeft)); clippingVolume.addPlane(Plane.createWithThreePoints(origin, lowerLeft, upperLeft)); - } else { - Point3f upperLeft = new Point3f(min.x, max.y, 1f); - Point3f upperRight = new Point3f(max.x, max.y, 1f); - Point3f lowerLeft = new Point3f(min.x, min.y, 1f); - Point3f lowerRight = new Point3f(max.x, min.y, 1f); - Point3f originUpperLeft = new Point3f(min.x, max.y, 0f); - Point3f originUpperRight = new Point3f(max.x, max.y, 0f); - Point3f originLowerLeft = new Point3f(min.x, min.y, 0f); - Point3f originLowerRight = new Point3f(max.x, min.y, 0f); - clippingVolume.addPlane( - Plane.createWithThreePoints(originUpperLeft, upperLeft, upperRight)); - clippingVolume.addPlane( - Plane.createWithThreePoints(originUpperRight, upperRight, lowerRight)); - clippingVolume.addPlane( - Plane.createWithThreePoints(originLowerRight, lowerRight, lowerLeft)); - clippingVolume.addPlane( - Plane.createWithThreePoints(originLowerLeft, lowerLeft, upperLeft)); } ! float near = frame.getNearClipping(); ! clippingVolume.addPlane( ! Plane.createWithPointAndNormal( ! new Point3f(0f, 0f, near), ! new Vector3f(0f, 0f, -1f))); ! float far = frame.getFarClipping(); ! clippingVolume.addPlane( ! Plane.createWithPointAndNormal( ! new Point3f(0f, 0f, far), ! new Vector3f(0f, 0f, 1f))); } private Bounds2f createRasterWindow() { ! Bounds2f cropWindow = frame.getCropWindow(); ! Point2f min = cropWindow.getMin(); ! Point2f max = cropWindow.getMax(); ! int xResolution = frame.getHorizontalResolution(); ! int yResolution = frame.getVerticalResolution(); ! float rxmin = Calc.clamp((float) Math.ceil(xResolution * min.x), 0f, xResolution - 1); ! float rxmax = ! Calc.clamp((float) Math.ceil(xResolution * max.x - 1f), 0f, xResolution - 1); ! float rymin = Calc.clamp((float) Math.ceil(yResolution * min.y), 0f, yResolution - 1); ! float rymax = ! Calc.clamp((float) Math.ceil(yResolution * max.y - 1f), 0f, yResolution - 1); ! Filter filter = frame.getFilter(); ! float xw = (filter.getHorizontalWidth() - 1) / 2f; ! hFilterExtra = (int) Math.ceil(xw * frame.getHorizontalSamplingRate()); ! hPixelLess = (int) Math.ceil((float) hFilterExtra / frame.getHorizontalSamplingRate()); ! float yw = (filter.getVerticalWidth() - 1) / 2f; ! vFilterExtra = (int) Math.ceil(yw * frame.getVerticalSamplingRate()); ! vPixelLess = (int) Math.ceil((float) vFilterExtra / frame.getVerticalSamplingRate()); ! rxmin = (float) Math.floor(rxmin - xw); ! rxmax = (float) Math.ceil(rxmax + xw); ! rymin = (float) Math.floor(rymin - yw); ! rymax = (float) Math.ceil(rymax + yw); return new Bounds2f(rxmin, rxmax, rymin, rymax); } private void createBuckets() { ! Point2f min = rasterWindow.getMin(); ! Point2f max = rasterWindow.getMax(); ! float width = max.x - min.x + 1; ! float height = max.y - min.y + 1; ! bucketWidth = frame.getBucketSizeX(); ! bucketHeight = frame.getBucketSizeY(); ! bucketColumns = (int) Math.ceil(width / bucketWidth); ! bucketRows = (int) Math.ceil(height / bucketHeight); ! buckets = new Bucket[bucketColumns * bucketRows]; if (frame.fileBucketsEnabled()) ! for (int i = 0; i < buckets.length; i++) ! buckets[i] = new FileBucket(i); else { ! for (int i = 0; i < buckets.length; i++) ! buckets[i] = new MemoryBucket(); } } --- 391,490 ---- private void colorsToPixels(float[] colors, int[] result) { ! Color3f tmp= new Color3f(); ! for (int row= 0; row < bucketHeight; row++) ! for (int col= 0; col < bucketWidth; col++) { ! int offset= (row * bucketWidth + col) * 3; ! tmp.x= colors[offset++]; ! tmp.y= colors[offset++]; ! tmp.z= colors[offset]; frame.getExposure().expose(tmp, tmp); ! Quantizer qt= frame.getColorQuantizer(); ! int red= qt.quantize(tmp.x); ! int green= qt.quantize(tmp.y); ! int blue= qt.quantize(tmp.z); ! offset= row * bucketWidth + col; ! result[offset]= ((255 << 24) | (red << 16) | (green << 8) | blue); } } private void createClippingVolume() { ! rasterWindow= createRasterWindow(); ! rasterWindowMin= rasterWindow.getMin(); ! Transform rasterToScreen= Global.getTransform("raster").getInverse(); ! Bounds2f renderingScreenWindow= rasterWindow.transform(rasterToScreen); ! Point2f min= renderingScreenWindow.getMin(); ! Point2f max= renderingScreenWindow.getMax(); ! clippingVolume= new ClippingVolume(); if (frame.getCameraProjection() == CameraProjection.PERSPECTIVE) { ! Point3f origin= new Point3f(); ! Point3f upperLeft= new Point3f(min.x, max.y, 1f); ! Point3f upperRight= new Point3f(max.x, max.y, 1f); ! Point3f lowerLeft= new Point3f(min.x, min.y, 1f); ! Point3f lowerRight= new Point3f(max.x, min.y, 1f); ! clippingVolume.addPlane(Plane.createWithThreePoints(origin, upperLeft, upperRight)); ! clippingVolume.addPlane(Plane.createWithThreePoints(origin, upperRight, lowerRight)); ! clippingVolume.addPlane(Plane.createWithThreePoints(origin, lowerRight, lowerLeft)); clippingVolume.addPlane(Plane.createWithThreePoints(origin, lowerLeft, upperLeft)); } ! else { ! Point3f upperLeft= new Point3f(min.x, max.y, 1f); ! Point3f upperRight= new Point3f(max.x, max.y, 1f); ! Point3f lowerLeft= new Point3f(min.x, min.y, 1f); ! Point3f lowerRight= new Point3f(max.x, min.y, 1f); ! Point3f originUpperLeft= new Point3f(min.x, max.y, 0f); ! Point3f originUpperRight= new Point3f(max.x, max.y, 0f); ! Point3f originLowerLeft= new Point3f(min.x, min.y, 0f); ! Point3f originLowerRight= new Point3f(max.x, min.y, 0f); ! clippingVolume.addPlane(Plane.createWithThreePoints(originUpperLeft, upperLeft, upperRight)); ! clippingVolume.addPlane(Plane.createWithThreePoints(originUpperRight, upperRight, lowerRight)); ! clippingVolume.addPlane(Plane.createWithThreePoints(originLowerRight, lowerRight, lowerLeft)); ! clippingVolume.addPlane(Plane.createWithThreePoints(originLowerLeft, lowerLeft, upperLeft)); ! } ! float near= frame.getNearClipping(); ! clippingVolume.addPlane(Plane.createWithPointAndNormal(new Point3f(0f, 0f, near), new Vector3f(0f, 0f, -1f))); ! float far= frame.getFarClipping(); ! clippingVolume.addPlane(Plane.createWithPointAndNormal(new Point3f(0f, 0f, far), new Vector3f(0f, 0f, 1f))); } private Bounds2f createRasterWindow() { ! Bounds2f cropWindow= frame.getCropWindow(); ! Point2f min= cropWindow.getMin(); ! Point2f max= cropWindow.getMax(); ! int xResolution= frame.getHorizontalResolution(); ! int yResolution= frame.getVerticalResolution(); ! float rxmin= Calc.clamp((float)Math.ceil(xResolution * min.x), 0f, xResolution - 1); ! float rxmax= Calc.clamp((float)Math.ceil(xResolution * max.x - 1f), 0f, xResolution - 1); ! float rymin= Calc.clamp((float)Math.ceil(yResolution * min.y), 0f, yResolution - 1); ! float rymax= Calc.clamp((float)Math.ceil(yResolution * max.y - 1f), 0f, yResolution - 1); ! Filter filter= frame.getFilter(); ! float xw= (filter.getHorizontalWidth() - 1) / 2f; ! hFilterExtra= (int)Math.ceil(xw * frame.getHorizontalSamplingRate()); ! hPixelLess= (int)Math.ceil((float)hFilterExtra / frame.getHorizontalSamplingRate()); ! float yw= (filter.getVerticalWidth() - 1) / 2f; ! vFilterExtra= (int)Math.ceil(yw * frame.getVerticalSamplingRate()); ! vPixelLess= (int)Math.ceil((float)vFilterExtra / frame.getVerticalSamplingRate()); ! rxmin= (float)Math.floor(rxmin - xw); ! rxmax= (float)Math.ceil(rxmax + xw); ! rymin= (float)Math.floor(rymin - yw); ! rymax= (float)Math.ceil(rymax + yw); return new Bounds2f(rxmin, rxmax, rymin, rymax); } private void createBuckets() { ! Point2f min= rasterWindow.getMin(); ! Point2f max= rasterWindow.getMax(); ! float width= max.x - min.x + 1; ! float height= max.y - min.y + 1; ! bucketWidth= frame.getBucketSizeX(); ! bucketHeight= frame.getBucketSizeY(); ! bucketColumns= (int)Math.ceil(width / bucketWidth); ! bucketRows= (int)Math.ceil(height / bucketHeight); ! buckets= new Bucket[bucketColumns * bucketRows]; if (frame.fileBucketsEnabled()) ! for (int i= 0; i < buckets.length; i++) ! buckets[i]= new FileBucket(i); else { ! for (int i= 0; i < buckets.length; i++) ! buckets[i]= new MemoryBucket(); } } |
From: <afa...@us...> - 2003-12-11 15:08:10
|
Update of /cvsroot/jrman/drafts/src/org/jrman/ui/images In directory sc8-pr-cvs1:/tmp/cvs-serv17786/drafts/src/org/jrman/ui/images Modified Files: framebuffer_icon.png Log Message: added command line options and their processing added simple GUI when no input file is specified added noise and cellnoise added noise test shaders updated some net.falappa.* components updated icon Index: framebuffer_icon.png =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/ui/images/framebuffer_icon.png,v retrieving revision 1.1 retrieving revision 1.3 diff -C2 -d -r1.1 -r1.3 Binary files /tmp/cvs4XdcMi and /tmp/cvsE7hOmr differ |