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-11-27 15:50:37
|
Update of /cvsroot/jrman/drafts/src/org/jrman/grid In directory sc8-pr-cvs1:/tmp/cvs-serv23545/src/org/jrman/grid Modified Files: FloatGrid.java Log Message: More performance optimizations (shadow maps) Index: FloatGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/FloatGrid.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** FloatGrid.java 4 Nov 2003 04:57:44 -0000 1.17 --- FloatGrid.java 27 Nov 2003 15:50:34 -0000 1.18 *************** *** 29,32 **** --- 29,34 ---- public class FloatGrid extends Grid { + private static Point3fGrid pg1 = new Point3fGrid(); + private static Point3f p1 = new Point3f(); *************** *** 1223,1227 **** --- 1225,1232 ---- public void shadow(String shadowName, Point3fGrid p, float bias, float samples, float blur) { int isamples = (int) samples; + float oneOverSamples = 1f / samples; + float halfBlur = blur * .5f; ShadowMap shadowMap = ShadowMap.getShadowMap(shadowName); + pg1.transform(p, shadowMap.getWorldToRaster()); for (int v = 0; v < vSize; v++) for (int u = 0; u < uSize; u++) { *************** *** 1232,1238 **** if (v1 == vSize) v1 = v - 1; ! p.get(u, v, p1); ! p.get(u1, v1, p2); ! set(u, v, shadowMap.get(p1, p2, bias, isamples, blur)); } } --- 1237,1243 ---- if (v1 == vSize) v1 = v - 1; ! pg1.get(u, v, p1); ! pg1.get(u1, v1, p2); ! set(u, v, shadowMap.get(p1, p2, bias, isamples, oneOverSamples, blur, halfBlur)); } } |
From: <ma...@us...> - 2003-11-27 15:50:37
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1:/tmp/cvs-serv23545/src/org/jrman/util Modified Files: Rand.java Log Message: More performance optimizations (shadow maps) Index: Rand.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/util/Rand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Rand.java 23 Aug 2003 21:22:46 -0000 1.1 --- Rand.java 27 Nov 2003 15:50:34 -0000 1.2 *************** *** 27,33 **** --- 27,39 ---- static int ptr; + + static float[] uniforms = new float[7867]; + + static int nextUniform; static { setSeed(31415926); + for (int i = 0; i < uniforms.length; i++) + uniforms[i] = newUniform(); } *************** *** 90,95 **** } ! public final static float uniform() { return (float) uniform(10000000) / 9999999f; } --- 96,108 ---- } ! public final static float newUniform() { return (float) uniform(10000000) / 9999999f; + } + + public final static float uniform() { + float result = uniforms[nextUniform++]; + if (nextUniform == uniforms.length) + nextUniform = 0; + return result; } |
From: <ma...@us...> - 2003-11-27 15:50:37
|
Update of /cvsroot/jrman/drafts/src/org/jrman/maps In directory sc8-pr-cvs1:/tmp/cvs-serv23545/src/org/jrman/maps Modified Files: ShadowMap.java Log Message: More performance optimizations (shadow maps) Index: ShadowMap.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/maps/ShadowMap.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ShadowMap.java 31 Oct 2003 03:03:15 -0000 1.5 --- ShadowMap.java 27 Nov 2003 15:50:34 -0000 1.6 *************** *** 37,49 **** import org.jrman.geom.PerspectiveTransform; import org.jrman.geom.Transform; - import org.jrman.util.Calc; import org.jrman.util.Rand; public class ShadowMap { - private static Point3f ptmp1 = new Point3f(); - - private static Point3f ptmp2 = new Point3f(); - private static Map map = new HashMap(); --- 37,44 ---- *************** *** 172,198 **** } ! private float get(int x, int y, float dist) { ! if (x < 0 || x >= width || y < 0 || y >= height) ! return 0f; float z = data.get(y * width + x); ! return (z < dist) ? 1f : 0f; } ! public float get(Point3f p1, Point3f p2, float bias, int samples, float blur) { ! worldToRaster.transformPoint(p1, ptmp1); ! worldToRaster.transformPoint(p2, ptmp2); float total = 0f; for (int i = 0; i < samples; i++) { ! int x = ! Math.round( ! Calc.interpolate(ptmp1.x, ptmp2.x, Rand.uniform()) ! + (Rand.uniform() - .5f) * blur); ! int y = ! Math.round( ! Calc.interpolate(ptmp1.y, ptmp2.y, Rand.uniform()) ! + (Rand.uniform() - .5f) * blur); ! total += get(x, y, ptmp1.z - bias); } ! return total / samples; } --- 167,206 ---- } ! private boolean get(int x, int y, float dist) { float z = data.get(y * width + x); ! return (z < dist); } ! public Transform getWorldToRaster() { ! return worldToRaster; ! } ! ! public float get( ! Point3f p1, ! Point3f p2, ! float bias, ! int samples, ! float oneOverSamples, ! float blur, ! float halfBlur) { float total = 0f; + float dx = p2.x - p1.x + blur; + float sx = p1.x - halfBlur; + float dy = p2.y - p1.y + blur; + float sy = p1.y - halfBlur; + if (sx + dx < 0f || sx >= width || sy + dy < 0f || sy >= width) + return 0f; + float p1zBias = p1.z - bias; for (int i = 0; i < samples; i++) { ! int x = (int) (dx * Rand.uniform() + sx); ! if (x < 0 || x >= width) ! continue; ! int y = (int) (dy * Rand.uniform() + sy); ! if (y < 0 || y >= height) ! continue; ! if (get(x, y, p1zBias)) ! total += oneOverSamples; } ! return total; } |
From: <ma...@us...> - 2003-11-26 01:25:13
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv15303/src/org/jrman/render Modified Files: RendererHidden.java Log Message: Improved percentage display. Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** RendererHidden.java 26 Nov 2003 01:21:58 -0000 1.53 --- RendererHidden.java 26 Nov 2003 01:25:09 -0000 1.54 *************** *** 403,409 **** percentComplete = percent; System.out.print( ! "\rRendering frame " + frame.getFrameNumber() ! + ": " + percentComplete + "% complete"); --- 403,409 ---- percentComplete = percent; System.out.print( ! "\r" + frame.getDisplay().getName() + " (frame " + frame.getFrameNumber() ! + "): " + percentComplete + "% complete"); |
From: <ma...@us...> - 2003-11-26 01:22:01
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv14597/src/org/jrman/render Modified Files: MemoryBucket.java RendererHidden.java Log Message: Removed bad "optimization" that consumed too much memory for high resolution frames Index: MemoryBucket.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/MemoryBucket.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MemoryBucket.java 5 Nov 2003 04:13:12 -0000 1.4 --- MemoryBucket.java 26 Nov 2003 01:21:58 -0000 1.5 *************** *** 37,42 **** private boolean primitivesModified; ! public MemoryBucket(int n) { ! micropolygons.ensureCapacity(n); } --- 37,41 ---- private boolean primitivesModified; ! public MemoryBucket() { } Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** RendererHidden.java 25 Nov 2003 16:34:08 -0000 1.52 --- RendererHidden.java 26 Nov 2003 01:21:58 -0000 1.53 *************** *** 614,620 **** buckets[i] = new FileBucket(i); else { - int estimatedMicropolygons = (int) (bucketWidth * bucketHeight * 16); for (int i = 0; i < buckets.length; i++) ! buckets[i] = new MemoryBucket(estimatedMicropolygons); } } --- 614,619 ---- buckets[i] = new FileBucket(i); else { for (int i = 0; i < buckets.length; i++) ! buckets[i] = new MemoryBucket(); } } |
From: <ma...@us...> - 2003-11-26 01:22:01
|
Update of /cvsroot/jrman/drafts In directory sc8-pr-cvs1:/tmp/cvs-serv14597 Modified Files: .classpath Log Message: Removed bad "optimization" that consumed too much memory for high resolution frames Index: .classpath =================================================================== RCS file: /cvsroot/jrman/drafts/.classpath,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** .classpath 7 May 2003 07:08:35 -0000 1.5 --- .classpath 26 Nov 2003 01:21:58 -0000 1.6 *************** *** 3,6 **** --- 3,7 ---- <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="lib/vecmath.jar"/> <classpathentry kind="output" path="build"/> </classpath> |
Update of /cvsroot/jrman/drafts/src/org/jrman/shaders In directory sc8-pr-cvs1:/tmp/cvs-serv29833/src/org/jrman/shaders Modified Files: LightPointlight.java VolumeDepthcue.java LightDistantlight.java SurfaceMatte.java SurfaceMetal.java LightShadowdistantlight.java SurfacePlastic.java LightSpotlight.java Shader.java DisplacementShader.java SurfaceReflectivepaintedplastic.java DisplacementBumpy.java LightShadowspotlight.java LightShader.java Imager.java VolumeShader.java SurfacePaintedplastic.java SurfaceShader.java LightAmbientlight.java VolumeFog.java Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: LightPointlight.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/LightPointlight.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LightPointlight.java 9 Sep 2003 03:01:04 -0000 1.3 --- LightPointlight.java 25 Nov 2003 16:34:07 -0000 1.4 *************** *** 30,62 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parser.Global; - import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; public class LightPointlight extends LightShader { ! private static Point3f from = new Point3f(); static FloatGrid fg1 = new FloatGrid(); ! static Color3fGrid cg1 = new Color3fGrid(); protected void initDefaults() { ! float[][] intensity = new float[1][]; ! intensity[0] = new float[1]; ! intensity[0][0] = 1f; ! Parameter param = ! new Parameter(new Declaration("intensity", "uniform float"), intensity); ! defaultParameters.put("intensity", param); ! Color3f[][] lightcolor = new Color3f[1][]; ! lightcolor[0] = new Color3f[1]; ! lightcolor[0][0] = new Color3f(1f, 1f, 1f); ! param = new Parameter(new Declaration("lightcolor", "uniform color"), lightcolor); ! defaultParameters.put("lightcolor", param); ! Point3f[][] from = new Point3f[1][]; ! from[0] = new Point3f[1]; ! from[0][0] = new Point3f(0f, 0f, 0f); ! param = new Parameter(new Declaration("from", "uniform point"), from); ! defaultParameters.put("from", param); } --- 30,55 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; + import org.jrman.parameters.UniformScalarFloat; + import org.jrman.parameters.UniformScalarTuple3f; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; public class LightPointlight extends LightShader { ! private static Point3f from = new Point3f(); static FloatGrid fg1 = new FloatGrid(); ! static Color3fGrid cg1 = new Color3fGrid(); + + static Color3f lightcolor = new Color3f(); protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("intensity", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f(new Declaration("lightcolor", "uniform color"), 1f, 1f, 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f(new Declaration("from", "uniform point"), 0f, 0f, 0f)); } *************** *** 67,82 **** float angle) { super.shade(sv, P, N, angle); ! Parameter param = (Parameter) getParameter(sv, "intensity"); ! float[][] f = (float[][]) param.getData(); ! final float intensity = f[0][0]; ! param = (Parameter) getParameter(sv, "lightcolor"); ! Color3f[][] c = (Color3f[][]) param.getData(); ! final Color3f lightColor = c[0][0]; Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); ! param = (Parameter) getParameter(sv, "from"); ! Point3f[][] p = (Point3f[][]) param.getData(); ! shaderTransform.transformPoint(p[0][0], from); return illuminate(sv, P, N, angle, from, null, 0f, new Statement() { public void execute(ShaderVariables sv) { --- 60,74 ---- float angle) { super.shade(sv, P, N, angle); ! UniformScalarFloat paramIntensity = (UniformScalarFloat) getParameter(sv, "intensity"); ! final float intensity = paramIntensity.getValue(); ! UniformScalarTuple3f paramLightcolor = ! (UniformScalarTuple3f) getParameter(sv, "lightcolor"); ! paramLightcolor.getValue(lightcolor); Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); ! UniformScalarTuple3f paramFrom = (UniformScalarTuple3f) getParameter(sv, "from"); ! paramFrom.getValue(from); ! shaderTransform.transformPoint(from, from); return illuminate(sv, P, N, angle, from, null, 0f, new Statement() { public void execute(ShaderVariables sv) { *************** *** 84,88 **** fg1.div(intensity, fg1); cg1.set(fg1); ! sv.Cl.set(lightColor, tmpCond1); sv.Cl.mul(sv.Cl, cg1, tmpCond1); } --- 76,80 ---- fg1.div(intensity, fg1); cg1.set(fg1); ! sv.Cl.set(lightcolor, tmpCond1); sv.Cl.mul(sv.Cl, cg1, tmpCond1); } Index: VolumeDepthcue.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/VolumeDepthcue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VolumeDepthcue.java 9 Sep 2003 03:01:04 -0000 1.2 --- VolumeDepthcue.java 25 Nov 2003 16:34:08 -0000 1.3 *************** *** 24,68 **** import org.jrman.grid.FloatGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; public class VolumeDepthcue extends VolumeShader { ! private final static Color3f OPAQUE = new Color3f(1f, 1f, 1f); ! private static FloatGrid fg1 = new FloatGrid(); protected void initDefaults() { ! float[][] mindistance = new float[1][]; ! mindistance[0] = new float[1]; ! mindistance[0][0] = 0f; ! Parameter param = ! new Parameter(new Declaration("mindistance", "uniform float"), mindistance); ! defaultParameters.put("mindistance", param); ! float[][] maxdistance = new float[1][]; ! maxdistance[0] = new float[1]; ! maxdistance[0][0] = 1f; ! param = ! new Parameter(new Declaration("maxdistance", "uniform float"), maxdistance); ! defaultParameters.put("maxdistance", param); ! Color3f[][] background = new Color3f[1][]; ! background[0] = new Color3f[1]; ! background[0][0] = new Color3f(0f, 0f, 0f); ! param = ! new Parameter(new Declaration("background", "uniform color"), background); ! defaultParameters.put("background", param); } ! public void shade(ShaderVariables sv, float near, float far) { super.shade(sv, near, far); ! Parameter param = (Parameter) getParameter(sv, "mindistance"); ! float[][] f = (float[][]) param.getData(); ! final float mindistance = f[0][0]; ! param = (Parameter) getParameter(sv, "maxdistance"); ! f = (float[][]) param.getData(); ! final float maxdistance = f[0][0]; ! param = (Parameter) getParameter(sv, "background"); ! Color3f[][] c = (Color3f[][]) param.getData(); ! final Color3f background = c[0][0]; fg1.depth(sv.P, near, far); fg1.sub(fg1, mindistance); --- 24,63 ---- import org.jrman.grid.FloatGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.parameters.UniformScalarTuple3f; import org.jrman.render.ShaderVariables; public class VolumeDepthcue extends VolumeShader { ! private final static Color3f OPAQUE = new Color3f(1f, 1f, 1f); ! private static FloatGrid fg1 = new FloatGrid(); + private static Color3f background = new Color3f(); + protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("mindistance", "uniform float"), 0f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("maxdistance", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f( ! new Declaration("background", "uniform color"), ! 0f, ! 0f, ! 0f)); } ! public void shade(ShaderVariables sv, float near, float far) { super.shade(sv, near, far); ! UniformScalarFloat paramMindistance = ! (UniformScalarFloat) getParameter(sv, "mindistance"); ! final float mindistance = paramMindistance.getValue(); ! UniformScalarFloat paramMaxdistance = ! (UniformScalarFloat) getParameter(sv, "maxdistance"); ! final float maxdistance = paramMaxdistance.getValue(); ! UniformScalarTuple3f paramBackground = ! (UniformScalarTuple3f) getParameter(sv, "background"); ! paramBackground.getValue(background); fg1.depth(sv.P, near, far); fg1.sub(fg1, mindistance); Index: LightDistantlight.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/LightDistantlight.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LightDistantlight.java 9 Sep 2003 03:01:04 -0000 1.3 --- LightDistantlight.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 29,34 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parser.Global; - import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; --- 29,35 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; + import org.jrman.parameters.UniformScalarFloat; + import org.jrman.parameters.UniformScalarTuple3f; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; *************** *** 36,68 **** private static Vector3f vtmp = new Vector3f(); ! private static Point3f from = new Point3f(); ! private static Point3f to = new Point3f(); ! static Color3f c1 = new Color3f(); protected void initDefaults() { ! float[][] intensity = new float[1][]; ! intensity[0] = new float[1]; ! intensity[0][0] = 1f; ! Parameter param = ! new Parameter(new Declaration("intensity", "uniform float"), intensity); ! defaultParameters.put("intensity", param); ! Color3f[][] lightcolor = new Color3f[1][]; ! lightcolor[0] = new Color3f[1]; ! lightcolor[0][0] = new Color3f(1f, 1f, 1f); ! param = new Parameter(new Declaration("lightcolor", "uniform color"), lightcolor); ! defaultParameters.put("lightcolor", param); ! Point3f[][] from = new Point3f[1][]; ! from[0] = new Point3f[1]; ! from[0][0] = new Point3f(0f, 0f, 0f); ! param = new Parameter(new Declaration("from", "uniform point"), from); ! defaultParameters.put("from", param); ! Point3f[][] to = new Point3f[1][]; ! to[0] = new Point3f[1]; ! to[0][0] = new Point3f(0f, 0f, 1f); ! param = new Parameter(new Declaration("to", "uniform point"), to); ! defaultParameters.put("to", param); } --- 37,60 ---- private static Vector3f vtmp = new Vector3f(); ! private static Point3f from = new Point3f(); ! private static Point3f to = new Point3f(); ! static Color3f c1 = new Color3f(); protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("intensity", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f( ! new Declaration("lightcolor", "uniform color"), ! 1f, ! 1f, ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f(new Declaration("from", "uniform point"), 0f, 0f, 0f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f(new Declaration("to", "uniform point"), 0f, 0f, 1f)); } *************** *** 73,95 **** float angle) { super.shade(sv, P, N, angle); ! Parameter param = (Parameter) getParameter(sv, "intensity"); ! float[][] f = (float[][]) param.getData(); ! final float intensity = f[0][0]; ! param = (Parameter) getParameter(sv, "lightcolor"); ! Color3f[][] c = (Color3f[][]) param.getData(); ! final Color3f lightColor = c[0][0]; Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); ! param = (Parameter) getParameter(sv, "from"); ! Point3f[][] p = (Point3f[][]) param.getData(); ! shaderTransform.transformPoint(p[0][0], from); ! param = (Parameter) getParameter(sv, "to"); ! p = (Point3f[][]) param.getData(); ! shaderTransform.transformPoint(p[0][0], to); vtmp.sub(to, from); return solar(sv, P, N, angle, vtmp, 0f, new Statement() { public void execute(ShaderVariables sv) { - c1.set(lightColor); c1.x *= intensity; c1.y *= intensity; --- 65,85 ---- float angle) { super.shade(sv, P, N, angle); ! UniformScalarFloat paramIntensity = (UniformScalarFloat) getParameter(sv, "intensity"); ! final float intensity = paramIntensity.getValue(); ! UniformScalarTuple3f paramLightcolor = ! (UniformScalarTuple3f) getParameter(sv, "lightcolor"); ! paramLightcolor.getValue(c1); Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); ! UniformScalarTuple3f paramFrom = (UniformScalarTuple3f) getParameter(sv, "from"); ! paramFrom.getValue(from); ! shaderTransform.transformPoint(from, from); ! UniformScalarTuple3f paramTo = (UniformScalarTuple3f) getParameter(sv, "to"); ! paramTo.getValue(to); ! shaderTransform.transformPoint(to, to); vtmp.sub(to, from); return solar(sv, P, N, angle, vtmp, 0f, new Statement() { public void execute(ShaderVariables sv) { c1.x *= intensity; c1.y *= intensity; Index: SurfaceMatte.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/SurfaceMatte.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SurfaceMatte.java 9 Sep 2003 03:01:04 -0000 1.2 --- SurfaceMatte.java 25 Nov 2003 16:34:08 -0000 1.3 *************** *** 23,73 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; public class SurfaceMatte 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() { ! float[][] Ka = new float[1][]; ! Ka[0] = new float[1]; ! Ka[0][0] = 1f; ! Parameter param = new Parameter(new Declaration("Ka", "uniform float"), Ka); ! defaultParameters.put("Ka", param); ! float[][] Kd = new float[1][]; ! Kd[0] = new float[1]; ! Kd[0][0] = 1f; ! param = new Parameter(new Declaration("Kd", "uniform float"), Kd); ! defaultParameters.put("Kd", param); } ! public void shade(ShaderVariables sv) { super.shade(sv); ! Parameter param = (Parameter) getParameter(sv, "Ka"); ! float[][] f = (float[][]) param.getData(); ! final float Ka = f[0][0]; ! param = (Parameter) getParameter(sv, "Kd"); ! f = (float[][]) param.getData(); ! final float Kd = f[0][0]; ! 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); ! cg1.mul(cg1, sv.Cs); ! sv.Ci.mul(sv.Os, cg1); ! } ! } --- 23,65 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; import org.jrman.render.ShaderVariables; public class SurfaceMatte 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)); } ! 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(); ! 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); ! cg1.mul(cg1, sv.Cs); ! sv.Ci.mul(sv.Os, cg1); ! } ! } Index: SurfaceMetal.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/SurfaceMetal.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SurfaceMetal.java 9 Sep 2003 03:01:04 -0000 1.2 --- SurfaceMetal.java 25 Nov 2003 16:34:08 -0000 1.3 *************** *** 23,86 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; public class SurfaceMetal extends SurfaceShader { - private static Vector3fGrid vg1 = new Vector3fGrid(); ! private static Vector3fGrid vg2 = new Vector3fGrid(); ! private static Color3fGrid cg1 = new Color3fGrid(); ! private static Color3fGrid cg2 = new Color3fGrid(); ! private static Color3fGrid cg3 = new Color3fGrid(); protected void initDefaults() { ! float[][] Ka = new float[1][]; ! Ka[0] = new float[1]; ! Ka[0][0] = 1f; ! Parameter param = new Parameter(new Declaration("Ka", "uniform float"), Ka); ! defaultParameters.put("Ka", param); ! float[][] Ks = new float[1][]; ! Ks[0] = new float[1]; ! Ks[0][0] = 1f; ! param = new Parameter(new Declaration("Ks", "uniform float"), Ks); ! defaultParameters.put("Ks", param); ! float[][] roughness = new float[1][]; ! roughness[0] = new float[1]; ! roughness[0][0] = .1f; ! param = new Parameter(new Declaration("roughness", "uniform float"), roughness); ! defaultParameters.put("roughness", param); } ! public void shade(ShaderVariables sv) { super.shade(sv); ! Parameter param = (Parameter) getParameter(sv, "Ka"); ! float[][] f = (float[][]) param.getData(); ! final float Ka = f[0][0]; ! param = (Parameter) getParameter(sv, "Ks"); ! f = (float[][]) param.getData(); ! final float Ks = f[0][0]; ! param = (Parameter) getParameter(sv, "roughness"); ! f = (float[][]) param.getData(); ! final float roughness = f[0][0]; ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! vg2.normalize(sv.I); ! vg2.negate(vg2); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! specular(sv, vg1, vg2, roughness, cg2); ! cg3.set(Ks); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! cg1.mul(cg1, sv.Cs); ! sv.Ci.mul(sv.Os, cg1); ! } ! } --- 23,73 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; import org.jrman.render.ShaderVariables; public class SurfaceMetal extends SurfaceShader { private static Vector3fGrid vg1 = new Vector3fGrid(); ! private static Vector3fGrid vg2 = 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("Ks", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("roughness", "uniform float"), .1f)); } ! public void shade(ShaderVariables sv) { super.shade(sv); ! UniformScalarFloat paramKa = (UniformScalarFloat) getParameter(sv, "Ka"); ! final float Ka = paramKa.getValue(); ! UniformScalarFloat paramKs = (UniformScalarFloat) getParameter(sv, "Ks"); ! final float Ks = paramKs.getValue(); ! UniformScalarFloat paramRoughness = (UniformScalarFloat) getParameter(sv, "roughness"); ! final float roughness = paramRoughness.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! vg2.normalize(sv.I); ! vg2.negate(vg2); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! specular(sv, vg1, vg2, roughness, cg2); ! cg3.set(Ks); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! cg1.mul(cg1, sv.Cs); ! sv.Ci.mul(sv.Os, cg1); ! } ! } Index: LightShadowdistantlight.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/LightShadowdistantlight.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LightShadowdistantlight.java 9 Sep 2003 03:01:04 -0000 1.3 --- LightShadowdistantlight.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 31,34 **** --- 31,37 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; + import org.jrman.parameters.UniformScalarFloat; + import org.jrman.parameters.UniformScalarString; + import org.jrman.parameters.UniformScalarTuple3f; import org.jrman.parser.Global; import org.jrman.parser.Parameter; *************** *** 38,97 **** private static Vector3f vtmp = new Vector3f(); ! private static Point3f from = new Point3f(); ! private static Point3f to = new Point3f(); ! static Color3f c1 = new Color3f(); ! static Point3fGrid pg = new Point3fGrid(); ! static FloatGrid fg = new FloatGrid(); ! static Color3fGrid cg = new Color3fGrid(); protected void initDefaults() { ! float[][] intensity = new float[1][]; ! intensity[0] = new float[1]; ! intensity[0][0] = 1f; ! Parameter param = ! new Parameter(new Declaration("intensity", "uniform float"), intensity); ! defaultParameters.put("intensity", param); ! Color3f[][] lightcolor = new Color3f[1][]; ! lightcolor[0] = new Color3f[1]; ! lightcolor[0][0] = new Color3f(1f, 1f, 1f); ! param = new Parameter(new Declaration("lightcolor", "uniform color"), lightcolor); ! defaultParameters.put("lightcolor", param); ! Point3f[][] from = new Point3f[1][]; ! from[0] = new Point3f[1]; ! from[0][0] = new Point3f(0f, 0f, 0f); ! param = new Parameter(new Declaration("from", "uniform point"), from); ! defaultParameters.put("from", param); ! Point3f[][] to = new Point3f[1][]; ! to[0] = new Point3f[1]; ! to[0][0] = new Point3f(0f, 0f, 1f); ! param = new Parameter(new Declaration("to", "uniform point"), to); ! defaultParameters.put("to", param); ! float[][] bias = new float[1][]; ! bias[0] = new float[1]; ! bias[0][0] = .1f; ! param = new Parameter(new Declaration("bias", "uniform float"), bias); ! defaultParameters.put("bias", param); ! String[][] shadowmap = new String[1][]; ! shadowmap[0] = new String[1]; ! shadowmap[0][0] = ""; ! param = ! new Parameter(new Declaration("shadowmap", "string"), shadowmap); ! defaultParameters.put("shadowmap", param); ! float[][] samples = new float[1][]; ! samples[0] = new float[1]; ! samples[0][0] = 16f; ! param = new Parameter(new Declaration("samples", "uniform float"), samples); ! defaultParameters.put("samples", param); ! float[][] blur = new float[1][]; ! blur[0] = new float[1]; ! blur[0][0] = 0f; ! param = new Parameter(new Declaration("blur", "uniform float"), blur); ! defaultParameters.put("blur", param); } --- 41,78 ---- private static Vector3f vtmp = new Vector3f(); ! private static Point3f from = new Point3f(); ! private static Point3f to = new Point3f(); ! static Color3f c1 = new Color3f(); ! static Point3fGrid pg = new Point3fGrid(); ! static FloatGrid fg = new FloatGrid(); ! static Color3fGrid cg = new Color3fGrid(); protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("intensity", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f( ! new Declaration("lightcolor", "uniform color"), ! 1f, ! 1f, ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f(new Declaration("from", "uniform point"), 0f, 0f, 0f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f(new Declaration("to", "uniform point"), 0f, 0f, 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("bias", "uniform float"), .1f)); ! defaultParameters.addParameter( ! new UniformScalarString(new Declaration("shadowmap", "string"), "")); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("samples", "uniform float"), 16f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("blur", "uniform float"), 0f)); } *************** *** 102,136 **** float angle) { super.shade(sv, P, N, angle); ! Parameter param = (Parameter) getParameter(sv, "intensity"); ! float[][] f = (float[][]) param.getData(); ! final float intensity = f[0][0]; ! param = (Parameter) getParameter(sv, "lightcolor"); ! Color3f[][] c = (Color3f[][]) param.getData(); ! final Color3f lightColor = c[0][0]; Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); ! param = (Parameter) getParameter(sv, "from"); ! Point3f[][] p = (Point3f[][]) param.getData(); ! shaderTransform.transformPoint(p[0][0], from); ! param = (Parameter) getParameter(sv, "to"); ! p = (Point3f[][]) param.getData(); ! shaderTransform.transformPoint(p[0][0], to); ! param = (Parameter) getParameter(sv, "bias"); ! f = (float[][]) param.getData(); ! final float bias = f[0][0]; ! param = (Parameter) getParameter(sv, "shadowmap"); ! String[][] s = (String[][]) param.getData(); ! final String shadowmap = s[0][0]; ! param = (Parameter) getParameter(sv, "samples"); ! f = (float[][]) param.getData(); ! final float samples = f[0][0]; ! param = (Parameter) getParameter(sv, "blur"); ! f = (float[][]) param.getData(); ! final float blur = f[0][0]; vtmp.sub(to, from); return solar(sv, P, N, angle, vtmp, 0f, new Statement() { public void execute(ShaderVariables sv) { - c1.set(lightColor); c1.x *= intensity; c1.y *= intensity; --- 83,112 ---- float angle) { super.shade(sv, P, N, angle); ! UniformScalarFloat paramIntensity = (UniformScalarFloat) getParameter(sv, "intensity"); ! final float intensity = paramIntensity.getValue(); ! UniformScalarTuple3f paramLightcolor = ! (UniformScalarTuple3f) getParameter(sv, "lightcolor"); ! paramLightcolor.getValue(c1); Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); ! UniformScalarTuple3f paramFrom = (UniformScalarTuple3f) getParameter(sv, "from"); ! paramFrom.getValue(from); ! shaderTransform.transformPoint(from, from); ! UniformScalarTuple3f paramTo = (UniformScalarTuple3f) getParameter(sv, "to"); ! paramTo.getValue(to); ! shaderTransform.transformPoint(to, to); vtmp.sub(to, from); + UniformScalarFloat paramBias = (UniformScalarFloat) getParameter(sv, "bias"); + final float bias = paramBias.getValue(); + UniformScalarString paramShadowmap = + (UniformScalarString) getParameter(sv, "shadowmap"); + final String shadowmap = paramShadowmap.getValue(); + UniformScalarFloat paramSamples = (UniformScalarFloat) getParameter(sv, "samples"); + final float samples = paramSamples.getValue(); + UniformScalarFloat paramBlur = (UniformScalarFloat) getParameter(sv, "blur"); + final float blur = paramBlur.getValue(); return solar(sv, P, N, angle, vtmp, 0f, new Statement() { public void execute(ShaderVariables sv) { c1.x *= intensity; c1.y *= intensity; Index: SurfacePlastic.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/SurfacePlastic.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SurfacePlastic.java 9 Sep 2003 03:01:04 -0000 1.2 --- SurfacePlastic.java 25 Nov 2003 16:34:08 -0000 1.3 *************** *** 25,29 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; --- 25,30 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.parameters.UniformScalarTuple3f; import org.jrman.render.ShaderVariables; *************** *** 40,89 **** private static Color3fGrid cg3 = new Color3fGrid(); protected void initDefaults() { ! float[][] Ka = new float[1][]; ! Ka[0] = new float[1]; ! Ka[0][0] = 1f; ! Parameter param = new Parameter(new Declaration("Ka", "uniform float"), Ka); ! defaultParameters.put("Ka", param); ! float[][] Kd = new float[1][]; ! Kd[0] = new float[1]; ! Kd[0][0] = 1f; ! param = new Parameter(new Declaration("Kd", "uniform float"), Kd); ! defaultParameters.put("Kd", param); ! float[][] Ks = new float[1][]; ! Ks[0] = new float[1]; ! Ks[0][0] = 1f; ! param = new Parameter(new Declaration("Ks", "uniform float"), Ks); ! defaultParameters.put("Ks", param); ! float[][] roughness = new float[1][]; ! roughness[0] = new float[1]; ! roughness[0][0] = .1f; ! param = new Parameter(new Declaration("roughness", "uniform float"), roughness); ! defaultParameters.put("roughness", param); ! Color3f[][] specularcolor = new Color3f[1][]; ! specularcolor[0] = new Color3f[1]; ! specularcolor[0][0] = new Color3f(1f, 1f, 1f); ! param = ! new Parameter(new Declaration("specularcolor", "uniform color"), specularcolor); ! defaultParameters.put("specularcolor", param); } public void shade(ShaderVariables sv) { super.shade(sv); ! Parameter param = (Parameter) getParameter(sv, "Ka"); ! float[][] f = (float[][]) param.getData(); ! final float Ka = f[0][0]; ! param = (Parameter) getParameter(sv, "Kd"); ! f = (float[][]) param.getData(); ! final float Kd = f[0][0]; ! param = (Parameter) getParameter(sv, "Ks"); ! f = (float[][]) param.getData(); ! final float Ks = f[0][0]; ! param = (Parameter) getParameter(sv, "roughness"); ! f = (float[][]) param.getData(); ! final float roughness = f[0][0]; ! param = (Parameter) getParameter(sv, "specularcolor"); ! Color3f[][] c = (Color3f[][]) param.getData(); ! final Color3f specularcolor = c[0][0]; vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); --- 41,76 ---- private static Color3fGrid cg3 = new Color3fGrid(); + private static Color3f specularcolor = new Color3f(); + 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("Ks", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("roughness", "uniform float"), .1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f( ! new Declaration("specularcolor", "uniform color"), ! 1f, ! 1f, ! 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 paramKs = (UniformScalarFloat) getParameter(sv, "Ks"); ! final float Ks = paramKs.getValue(); ! UniformScalarFloat paramRoughness = (UniformScalarFloat) getParameter(sv, "roughness"); ! final float roughness = paramRoughness.getValue(); ! UniformScalarTuple3f paramSpecularcolor = ! (UniformScalarTuple3f) getParameter(sv, "specularcolor"); ! paramSpecularcolor.getValue(specularcolor); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); Index: LightSpotlight.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/LightSpotlight.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LightSpotlight.java 9 Sep 2003 03:01:04 -0000 1.2 --- LightSpotlight.java 25 Nov 2003 16:34:08 -0000 1.3 *************** *** 31,36 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parser.Global; - import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; --- 31,37 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; + import org.jrman.parameters.UniformScalarFloat; + import org.jrman.parameters.UniformScalarTuple3f; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; *************** *** 42,46 **** static FloatGrid fg3 = new FloatGrid(); ! static Color3fGrid cg1 = new Color3fGrid(); --- 43,47 ---- static FloatGrid fg3 = new FloatGrid(); ! static Color3fGrid cg1 = new Color3fGrid(); *************** *** 51,97 **** private static Point3f to = new Point3f(); ! static Color3f c1 = new Color3f(); protected void initDefaults() { ! float[][] intensity = new float[1][]; ! intensity[0] = new float[1]; ! intensity[0][0] = 1f; ! Parameter param = ! new Parameter(new Declaration("intensity", "uniform float"), intensity); ! defaultParameters.put("intensity", param); ! Color3f[][] lightcolor = new Color3f[1][]; ! lightcolor[0] = new Color3f[1]; ! lightcolor[0][0] = new Color3f(1f, 1f, 1f); ! param = new Parameter(new Declaration("lightcolor", "uniform color"), lightcolor); ! defaultParameters.put("lightcolor", param); ! Point3f[][] from = new Point3f[1][]; ! from[0] = new Point3f[1]; ! from[0][0] = new Point3f(0f, 0f, 0f); ! param = new Parameter(new Declaration("from", "uniform point"), from); ! defaultParameters.put("from", param); ! Point3f[][] to = new Point3f[1][]; ! to[0] = new Point3f[1]; ! to[0][0] = new Point3f(0f, 0f, 1f); ! param = new Parameter(new Declaration("to", "uniform point"), to); ! defaultParameters.put("to", param); ! float[][] coneangle = new float[1][]; ! coneangle[0] = new float[1]; ! coneangle[0][0] = (float) Math.toRadians(30); ! param = new Parameter(new Declaration("coneangle", "uniform float"), coneangle); ! defaultParameters.put("coneangle", param); ! float[][] conedeltaangle = new float[1][]; ! conedeltaangle[0] = new float[1]; ! conedeltaangle[0][0] = (float) Math.toRadians(5); ! param = ! new Parameter(new Declaration("conedeltaangle", "uniform float"), conedeltaangle); ! defaultParameters.put("conedeltaangle", param); ! float[][] beamdistribution = new float[1][]; ! beamdistribution[0] = new float[1]; ! beamdistribution[0][0] = 2f; ! param = ! new Parameter( ! new Declaration("beamdistribution", "uniform float"), ! beamdistribution); ! defaultParameters.put("beamdistribution", param); } --- 52,80 ---- private static Point3f to = new Point3f(); ! static Color3f lightcolor = new Color3f(); protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("intensity", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f( ! new Declaration("lightcolor", "uniform color"), ! 1f, ! 1f, ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f(new Declaration("from", "uniform point"), 0f, 0f, 0f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f(new Declaration("to", "uniform point"), 0f, 0f, 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat( ! new Declaration("coneangle", "uniform float"), ! (float) Math.toRadians(30))); ! defaultParameters.addParameter( ! new UniformScalarFloat( ! new Declaration("conedeltaangle", "uniform float"), ! (float) Math.toRadians(5))); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("beamdistribution", "uniform float"), 2f)); } *************** *** 102,129 **** float angle) { super.shade(sv, P, N, angle); ! Parameter param = (Parameter) getParameter(sv, "intensity"); ! float[][] f = (float[][]) param.getData(); ! final float intensity = f[0][0]; ! param = (Parameter) getParameter(sv, "lightcolor"); ! Color3f[][] c = (Color3f[][]) param.getData(); ! final Color3f lightColor = c[0][0]; Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); ! param = (Parameter) getParameter(sv, "from"); ! Point3f[][] p = (Point3f[][]) param.getData(); ! shaderTransform.transformPoint(p[0][0], from); ! param = (Parameter) getParameter(sv, "to"); ! p = (Point3f[][]) param.getData(); ! shaderTransform.transformPoint(p[0][0], to); ! param = (Parameter) getParameter(sv, "coneangle"); ! f = (float[][]) param.getData(); ! final float coneangle = f[0][0]; ! param = (Parameter) getParameter(sv, "conedeltaangle"); ! f = (float[][]) param.getData(); ! final float conedeltaangle = f[0][0]; ! param = (Parameter) getParameter(sv, "beamdistribution"); ! f = (float[][]) param.getData(); ! final float beamdistribution = f[0][0]; vtmp.sub(to, from); final Vector3f A = vtmp; --- 85,110 ---- float angle) { super.shade(sv, P, N, angle); ! UniformScalarFloat paramIntensity = (UniformScalarFloat) getParameter(sv, "intensity"); ! final float intensity = paramIntensity.getValue(); ! UniformScalarTuple3f paramLightcolor = ! (UniformScalarTuple3f) getParameter(sv, "lightcolor"); ! paramLightcolor.getValue(lightcolor); Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); ! UniformScalarTuple3f paramFrom = (UniformScalarTuple3f) getParameter(sv, "from"); ! paramFrom.getValue(from); ! shaderTransform.transformPoint(from, from); ! UniformScalarTuple3f paramTo = (UniformScalarTuple3f) getParameter(sv, "to"); ! paramTo.getValue(to); ! shaderTransform.transformPoint(to, to); ! UniformScalarFloat paramConeangle = (UniformScalarFloat) getParameter(sv, "coneangle"); ! final float coneangle = paramConeangle.getValue(); ! UniformScalarFloat paramConedeltaangle = ! (UniformScalarFloat) getParameter(sv, "conedeltaangle"); ! final float conedeltaangle = paramConedeltaangle.getValue(); ! UniformScalarFloat paramBeamdistribution = ! (UniformScalarFloat) getParameter(sv, "beamdistribution"); ! final float beamdistribution = paramBeamdistribution.getValue(); vtmp.sub(to, from); final Vector3f A = vtmp; *************** *** 146,150 **** fg2.mul(atten, intensity); cg1.set(fg2); ! sv.Cl.set(lightColor, tmpCond1); sv.Cl.mul(sv.Cl, cg1, tmpCond1); } --- 127,131 ---- fg2.mul(atten, intensity); cg1.set(fg2); ! sv.Cl.set(lightcolor, tmpCond1); sv.Cl.mul(sv.Cl, cg1, tmpCond1); } Index: Shader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/Shader.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Shader.java 9 Sep 2003 03:01:04 -0000 1.3 --- Shader.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,30 **** package org.jrman.shaders; - import java.util.HashMap; - import java.util.Map; - import org.jrman.attributes.Attributes; import org.jrman.grid.FloatGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; --- 20,29 ---- package org.jrman.shaders; import org.jrman.attributes.Attributes; import org.jrman.grid.FloatGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parameters.NParameter; ! import org.jrman.parameters.ParameterList; ! import org.jrman.parameters.UniformScalarFloat; import org.jrman.render.ShaderVariables; *************** *** 33,43 **** protected String name; ! protected Map parameters; protected Attributes attributes; ! protected Map defaultParameters = new HashMap(); ! protected void init(String name, Map parameters, Attributes attributes) { this.name = name; this.parameters = parameters; --- 32,42 ---- protected String name; ! protected ParameterList parameters; protected Attributes attributes; ! protected ParameterList defaultParameters = new ParameterList(); ! protected void init(String name, ParameterList parameters, Attributes attributes) { this.name = name; this.parameters = parameters; *************** *** 49,60 **** } ! protected Object getParameter(ShaderVariables sv, String name) { ! Object result = sv.parameters.get(name); if (result != null) return result; ! result = parameters.get(name); if (result != null) return result; ! return defaultParameters.get(name); } --- 48,59 ---- } ! protected NParameter getParameter(ShaderVariables sv, String name) { ! NParameter result = sv.parameters.getParameter(name); if (result != null) return result; ! result = parameters.getParameter(name); if (result != null) return result; ! return defaultParameters.getParameter(name); } *************** *** 63,67 **** } ! public Map getParameters() { return parameters; } --- 62,66 ---- } ! public ParameterList getParameters() { return parameters; } *************** *** 72,76 **** public float messagePassing(String paramName, Object resultHolder) { ! Parameter param = (Parameter) parameters.get(paramName); if (param == null) return 0f; --- 71,75 ---- public float messagePassing(String paramName, Object resultHolder) { ! NParameter param = parameters.getParameter(paramName); if (param == null) return 0f; *************** *** 82,91 **** Declaration.StorageClass storageClass = declaration.getStorageClass(); if (type == Declaration.Type.FLOAT) { ! float[][] paramValue = (float[][]) param.getData(); if (resultHolder instanceof float[][]) { if (storageClass == Declaration.StorageClass.CONSTANT || storageClass == Declaration.StorageClass.UNIFORM) { float[][]result = (float[][]) resultHolder; ! result[0][0] = paramValue[0][0]; } else throw new IllegalArgumentException( --- 81,90 ---- Declaration.StorageClass storageClass = declaration.getStorageClass(); if (type == Declaration.Type.FLOAT) { ! // float[][] paramValue = (float[][]) param.getData(); if (resultHolder instanceof float[][]) { if (storageClass == Declaration.StorageClass.CONSTANT || storageClass == Declaration.StorageClass.UNIFORM) { float[][]result = (float[][]) resultHolder; ! result[0][0] = ((UniformScalarFloat) param).getValue(); } else throw new IllegalArgumentException( *************** *** 95,99 **** storageClass == Declaration.StorageClass.UNIFORM) { FloatGrid result = (FloatGrid) resultHolder; ! result.set(paramValue[0][0]); } else { // TODO handle vertex/varying parameters --- 94,98 ---- storageClass == Declaration.StorageClass.UNIFORM) { FloatGrid result = (FloatGrid) resultHolder; ! result.set(((UniformScalarFloat) param).getValue()); } else { // TODO handle vertex/varying parameters Index: DisplacementShader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/DisplacementShader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DisplacementShader.java 23 May 2003 06:47:01 -0000 1.5 --- DisplacementShader.java 25 Nov 2003 16:34:08 -0000 1.6 *************** *** 20,28 **** package org.jrman.shaders; - import java.util.Map; - import org.jrman.attributes.Attributes; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.render.ShaderVariables; --- 20,27 ---- package org.jrman.shaders; import org.jrman.attributes.Attributes; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; import org.jrman.render.ShaderVariables; *************** *** 36,40 **** public static DisplacementShader createShader( String name, ! Map parameters, Attributes attributes) { DisplacementShader result; --- 35,39 ---- public static DisplacementShader createShader( String name, ! ParameterList parameters, Attributes attributes) { DisplacementShader result; Index: SurfaceReflectivepaintedplastic.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/SurfaceReflectivepaintedplastic.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SurfaceReflectivepaintedplastic.java 9 Sep 2003 03:01:04 -0000 1.2 --- SurfaceReflectivepaintedplastic.java 25 Nov 2003 16:34:08 -0000 1.3 *************** *** 22,27 **** import javax.vecmath.Color3f; - import org.jrman.geom.Transform; import org.jrman.geom.PerspectiveTransform; import org.jrman.grid.Color3fGrid; import org.jrman.grid.FloatGrid; --- 22,27 ---- import javax.vecmath.Color3f; import org.jrman.geom.PerspectiveTransform; + import org.jrman.geom.Transform; import org.jrman.grid.Color3fGrid; import org.jrman.grid.FloatGrid; *************** *** 29,34 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parser.Global; - import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; --- 29,36 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; + import org.jrman.parameters.UniformScalarFloat; + import org.jrman.parameters.UniformScalarString; + import org.jrman.parameters.UniformScalarTuple3f; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; *************** *** 44,118 **** private static Color3fGrid cg3 = new Color3fGrid(); ! private static FloatGrid s_NDC = new FloatGrid(); ! private static FloatGrid t_NDC = new FloatGrid(); ! private static Point3fGrid P_NDC = new Point3fGrid(); protected void initDefaults() { ! float[][] Ka = new float[1][]; ! Ka[0] = new float[1]; ! Ka[0][0] = 1f; ! Parameter param = new Parameter(new Declaration("Ka", "uniform float"), Ka); ! defaultParameters.put("Ka", param); ! float[][] Kd = new float[1][]; ! Kd[0] = new float[1]; ! Kd[0][0] = 1f; ! param = new Parameter(new Declaration("Kd", "uniform float"), Kd); ! defaultParameters.put("Kd", param); ! float[][] Ks = new float[1][]; ! Ks[0] = new float[1]; ! Ks[0][0] = 1f; ! param = new Parameter(new Declaration("Ks", "uniform float"), Ks); ! defaultParameters.put("Ks", param); ! float[][] roughness = new float[1][]; ! roughness[0] = new float[1]; ! roughness[0][0] = .1f; ! param = new Parameter(new Declaration("roughness", "uniform float"), roughness); ! defaultParameters.put("roughness", param); ! Color3f[][] specularcolor = new Color3f[1][]; ! specularcolor[0] = new Color3f[1]; ! specularcolor[0][0] = new Color3f(1f, 1f, 1f); ! param = ! new Parameter(new Declaration("specularcolor", "uniform color"), specularcolor); ! defaultParameters.put("specularcolor", param); ! String[][] texturename = new String[1][]; ! texturename[0] = new String[1]; ! texturename[0][0] = ""; ! param = ! new Parameter(new Declaration("texturename", "string"), texturename); ! defaultParameters.put("texturename", param); ! String[][] rtexturename = new String[1][]; ! rtexturename[0] = new String[1]; ! rtexturename[0][0] = ""; ! param = ! new Parameter(new Declaration("rtexturename", "string"), texturename); ! defaultParameters.put("rtexturename", param); } public void shade(ShaderVariables sv) { super.shade(sv); ! Parameter param = (Parameter) getParameter(sv, "Ka"); ! float[][] f = (float[][]) param.getData(); ! final float Ka = f[0][0]; ! param = (Parameter) getParameter(sv, "Kd"); ! f = (float[][]) param.getData(); ! final float Kd = f[0][0]; ! param = (Parameter) getParameter(sv, "Ks"); ! f = (float[][]) param.getData(); ! final float Ks = f[0][0]; ! param = (Parameter) getParameter(sv, "roughness"); ! f = (float[][]) param.getData(); ! final float roughness = f[0][0]; ! param = (Parameter) getParameter(sv, "specularcolor"); ! Color3f[][] c = (Color3f[][]) param.getData(); ! final Color3f specularcolor = c[0][0]; ! param = (Parameter) getParameter(sv, "texturename"); ! String[][] s = (String[][]) param.getData(); ! final String texturename = s[0][0]; ! param = (Parameter) getParameter(sv, "rtexturename"); ! s = (String[][]) param.getData(); ! final String rtexturename = s[0][0]; vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); --- 46,98 ---- private static Color3fGrid cg3 = new Color3fGrid(); ! private static FloatGrid s_NDC = new FloatGrid(); ! private static FloatGrid t_NDC = new FloatGrid(); ! private static Point3fGrid P_NDC = new Point3fGrid(); + private static Color3f specularcolor = new Color3f(); + 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("Ks", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("roughness", "uniform float"), .1f)); ! defaultParameters.addParameter( ! new UniformScalarTuple3f( ! new Declaration("specularcolor", "uniform color"), ! 1f, ! 1f, ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarString(new Declaration("texturename", "string"), "")); ! defaultParameters.addParameter( ! new UniformScalarString(new Declaration("rtexturename", "string"), "")); } 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 paramKs = (UniformScalarFloat) getParameter(sv, "Ks"); ! final float Ks = paramKs.getValue(); ! UniformScalarFloat paramRoughness = (UniformScalarFloat) getParameter(sv, "roughness"); ! final float roughness = paramRoughness.getValue(); ! UniformScalarTuple3f paramSpecularcolor = ! (UniformScalarTuple3f) getParameter(sv, "specularcolor"); ! paramSpecularcolor.getValue(specularcolor); ! UniformScalarString paramTexturename = ! (UniformScalarString) getParameter(sv, "texturename"); ! final String texturename = paramTexturename.getValue(); ! UniformScalarString paramRtexturename = ! (UniformScalarString) getParameter(sv, "rtexturename"); ! final String rtexturename = paramRtexturename.getValue(); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); Index: DisplacementBumpy.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/DisplacementBumpy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DisplacementBumpy.java 9 Sep 2003 03:01:04 -0000 1.3 --- DisplacementBumpy.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 22,72 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; ! import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; public class DisplacementBumpy extends DisplacementShader { ! private static FloatGrid fg1 = new FloatGrid(); ! private static Vector3fGrid Nn = new Vector3fGrid(); ! private static Point3fGrid P2 = new Point3fGrid(); ! protected void initDefaults() { ! float[][] Km = new float[1][]; ! Km[0] = new float[1]; ! Km[0][0] = 1f; ! Parameter param = ! new Parameter(new Declaration("Km", "uniform float"), Km); ! defaultParameters.put("Km", param); ! String[][] texturename = new String[1][]; ! texturename[0] = new String[1]; ! texturename[0][0] = ""; ! param = ! new Parameter( ! new Declaration("texturename", "string"), ! texturename); ! defaultParameters.put("texturename", param); ! } ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! Parameter param = (Parameter) getParameter(sv, "Km"); ! float f[][] = (float[][]) param.getData(); ! final float Km = f[0][0]; ! param = (Parameter) getParameter(sv, "texturename"); ! String[][] s = (String[][]) param.getData(); ! final String texturename = s[0][0]; ! if (!texturename.equals("")) ! fg1.texture(texturename, sv.s, sv.t); ! else ! fg1.set(0f); ! fg1.mul(fg1, Km); ! Nn.normalize(sv.N); ! P2.set(fg1); ! P2.mul(P2, Nn); ! sv.P.add(P2, sv.P); ! calculatenormal(sv, sv.P, sv.N); ! } } --- 22,62 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; ! import org.j... [truncated message content] |
From: <ma...@us...> - 2003-11-25 16:34:13
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parameters In directory sc8-pr-cvs1:/tmp/cvs-serv29833/src/org/jrman/parameters Modified Files: Declaration.java ParameterList.java VaryingScalarTuple3f.java Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: Declaration.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/Declaration.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Declaration.java 9 Sep 2003 03:01:04 -0000 1.1 --- Declaration.java 25 Nov 2003 16:34:08 -0000 1.2 *************** *** 216,219 **** --- 216,307 ---- } + private float[] getFloats(float[] numbers, int arraySize) { + float[] result = new float[arraySize]; + System.arraycopy(numbers, 0, result, 0, arraySize); + return result; + } + + private int[] getInts(float[] numbers, int arraySize) { + int[] result = new int[arraySize]; + for (int i = 0; i < arraySize; i++) + result[i] = (int) numbers[i]; + return result; + } + + private String[] getStrings(String[] strings, int arraySize) { + String[] result = new String[arraySize]; + System.arraycopy(strings, 0, result, 0, arraySize); + return result; + } + + public NParameter buildParameter(float[] numbers, String[] strings, int arraySize) { + if (type == Type.FLOAT) { + if (storageClass == StorageClass.CONSTANT + || storageClass == StorageClass.UNIFORM) { + if (count == 1) + return new UniformScalarFloat(this, numbers[0]); + else + return new UniformArrayFloat(this, getFloats(numbers, arraySize)); + } else { + if (count == 1) + return new VaryingScalarFloat(this, getFloats(numbers, arraySize)); + else + return new VaryingArrayFloat(this, getFloats(numbers, arraySize)); + } + } else if (type == Type.INTEGER) { + if (storageClass == StorageClass.CONSTANT + || storageClass == StorageClass.UNIFORM) { + if (count == 1) + return new UniformScalarInteger(this, (int) numbers[0]); + else + return new UniformArrayInteger(this, getInts(numbers, arraySize)); + } + } else if (type == Type.STRING) { + if (storageClass == StorageClass.CONSTANT + || storageClass == StorageClass.UNIFORM) { + if (count == 1) + return new UniformScalarString(this, strings[0]); + else + return new UniformArrayString(this, getStrings(strings, arraySize)); + } + } else if ( + type == Type.COLOR + || type == Type.POINT + || type == Type.VECTOR + || type == Type.NORMAL) { + if (storageClass == StorageClass.CONSTANT + || storageClass == StorageClass.UNIFORM) { + if (count == 1) + return new UniformScalarTuple3f(this, numbers[0], numbers[1], numbers[2]); + else + return new UniformArrayTuple3f(this, getFloats(numbers, arraySize)); + } else { + if (count == 1) + return new VaryingScalarTuple3f(this, getFloats(numbers, arraySize)); + else + return new VaryingArrayTuple3f(this, getFloats(numbers, arraySize)); + } + } else if (type == Type.HPOINT) { + if (storageClass == StorageClass.CONSTANT + || storageClass == StorageClass.UNIFORM) { + if (count == 1) + return new UniformScalarHPoint( + this, + numbers[0], + numbers[1], + numbers[2], + numbers[3]); + else + return new UniformArrayHPoint(this, getFloats(numbers, arraySize)); + } else { + if (count == 1) + return new VaryingScalarHPoint(this, getFloats(numbers, arraySize)); + else + return new VaryingArrayHPoint(this, getFloats(numbers, arraySize)); + } + } + throw new IllegalArgumentException("Unknown type"); + } + public Object translateArray(List array) { Object result = null; Index: ParameterList.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/ParameterList.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ParameterList.java 9 Sep 2003 03:01:04 -0000 1.1 --- ParameterList.java 25 Nov 2003 16:34:08 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + /* ParameterList.java *************** *** 27,30 **** --- 28,39 ---- final private List list = new ArrayList(); + public ParameterList() { + } + + public ParameterList(ParameterList pl) { + for (int i = 0; i < pl.getParameterCount(); i++) + addParameter(pl.getParameter(i)); + } + public void addParameter(NParameter parameter) { list.add(parameter); *************** *** 33,37 **** public NParameter getParameter(String name) { NParameter result = null; ! for (int i = 0; i < list.size(); i++) { NParameter parameter = (NParameter) list.get(i); if (parameter.getDeclaration().getName().equals(name)) { --- 42,46 ---- public NParameter getParameter(String name) { NParameter result = null; ! for (int i = list.size() - 1; i >= 0; i--) { NParameter parameter = (NParameter) list.get(i); if (parameter.getDeclaration().getName().equals(name)) { *************** *** 41,44 **** --- 50,71 ---- } return result; + } + + public int getParameterCount() { + return list.size(); + } + + public NParameter getParameter(int index) { + return (NParameter) list.get(index); + } + + public void removeParameter(String name) { + for (int i = 0; i < list.size(); i++) { + NParameter parameter = (NParameter) list.get(i); + if (parameter.getDeclaration().getName().equals(name)) { + list.remove(i); + break; + } + } } Index: VaryingScalarTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarTuple3f.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VaryingScalarTuple3f.java 9 Sep 2003 03:01:04 -0000 1.1 --- VaryingScalarTuple3f.java 25 Nov 2003 16:34:08 -0000 1.2 *************** *** 37,40 **** --- 37,50 ---- out.z = values[index * 3 + 2]; } + + public void setValue(int index, Tuple3f in) { + values[index * 3] = in.x; + values[index * 3 + 1] = in.y; + values[index * 3 + 2] = in.z; + } + + public int getCount() { + return values.length / 3; + } } |
From: <ma...@us...> - 2003-11-25 16:34:13
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv29833/src/org/jrman/parser Modified Files: Frame.java Parser.java Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: Frame.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Frame.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Frame.java 10 Jul 2003 14:48:26 -0000 1.11 --- Frame.java 25 Nov 2003 16:34:08 -0000 1.12 *************** *** 34,37 **** --- 34,38 ---- import org.jrman.options.Hider; import org.jrman.options.Quantizer; + import org.jrman.parameters.ParameterList; import org.jrman.shaders.Imager; import org.jrman.util.Constants; *************** *** 97,101 **** private Hider hider; ! private Map hiderParameters; private int colorSamples; --- 98,102 ---- private Hider hider; ! private ParameterList hiderParameters; private int colorSamples; *************** *** 477,486 **** } ! public Map getHiderParameters() { return hiderParameters; } ! public void setHiderParameters(Map map) { ! hiderParameters = map; } --- 478,487 ---- } ! public ParameterList getHiderParameters() { return hiderParameters; } ! public void setHiderParameters(ParameterList parameters) { ! hiderParameters = parameters; } Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Parser.java 17 Oct 2003 22:05:15 -0000 1.65 --- Parser.java 25 Nov 2003 16:34:08 -0000 1.66 *************** *** 58,62 **** import org.jrman.options.Hider; import org.jrman.options.Quantizer; ! import org.jrman.parameters.*; import org.jrman.parser.keywords.KeywordParser; import org.jrman.primitive.BicubicPatch; --- 58,69 ---- import org.jrman.options.Hider; import org.jrman.options.Quantizer; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.ParameterList; [...2220 lines suppressed...] ! String swrap, ! 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: <ma...@us...> - 2003-11-25 16:34:13
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv29833/src/org/jrman/primitive Modified Files: Cone.java Hyperboloid.java Paraboloid.java Torus.java Primitive.java Sphere.java Point.java BilinearPatch.java BicubicPatch.java Disk.java Cylinder.java Quadric.java Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: Cone.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Cone.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Cone.java 22 May 2003 04:50:14 -0000 1.5 --- Cone.java 25 Nov 2003 16:34:08 -0000 1.6 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 31,34 **** --- 29,33 ---- import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; import org.jrman.render.ShaderVariables; *************** *** 58,62 **** float thetaMax, float height, ! Map parameters, Attributes attributes) { super(parameters, attributes); --- 57,61 ---- float thetaMax, float height, ! ParameterList parameters, Attributes attributes) { super(parameters, attributes); Index: Hyperboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Hyperboloid.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Hyperboloid.java 13 Aug 2003 03:59:38 -0000 1.6 --- Hyperboloid.java 25 Nov 2003 16:34:08 -0000 1.7 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 31,34 **** --- 29,33 ---- import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; import org.jrman.render.ShaderVariables; *************** *** 72,76 **** float thetaMin, float thetaMax, ! Map parameters, Attributes attributes) { super(parameters, attributes); --- 71,75 ---- float thetaMin, float thetaMax, ! ParameterList parameters, Attributes attributes) { super(parameters, attributes); Index: Paraboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Paraboloid.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Paraboloid.java 25 Jul 2003 13:56:50 -0000 1.6 --- Paraboloid.java 25 Nov 2003 16:34:08 -0000 1.7 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 31,34 **** --- 29,33 ---- import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; import org.jrman.render.ShaderVariables; *************** *** 64,68 **** float maxZ, float maxTheta, ! Map parameters, Attributes attributes) { super(parameters, attributes); --- 63,67 ---- float maxZ, float maxTheta, ! ParameterList parameters, Attributes attributes) { super(parameters, attributes); Index: Torus.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Torus.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Torus.java 22 May 2003 04:50:14 -0000 1.6 --- Torus.java 25 Nov 2003 16:34:08 -0000 1.7 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 31,34 **** --- 29,33 ---- import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; import org.jrman.render.ShaderVariables; *************** *** 58,62 **** float thetaMin, float thetaMax, ! Map parameters, Attributes attributes) { super(parameters, attributes); --- 57,61 ---- float thetaMin, float thetaMax, ! ParameterList parameters, Attributes attributes) { super(parameters, attributes); Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Primitive.java 9 Sep 2003 03:01:04 -0000 1.19 --- Primitive.java 25 Nov 2003 16:34:08 -0000 1.20 *************** *** 20,31 **** package org.jrman.primitive; - import java.util.HashMap; - import java.util.Iterator; - import java.util.Map; - import javax.vecmath.Color3f; - import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; - import javax.vecmath.Point4f; import javax.vecmath.Vector3f; --- 20,25 ---- *************** *** 40,45 **** import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parser.Global; - import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; import org.jrman.util.Calc; --- 34,42 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; + import org.jrman.parameters.NParameter; + import org.jrman.parameters.ParameterList; + import org.jrman.parameters.VaryingScalarFloat; + import org.jrman.parameters.VaryingScalarTuple3f; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; import org.jrman.util.Calc; *************** *** 51,55 **** private static Declaration V_DECL = new Declaration("v", "vertex float"); ! protected Map parameters; protected Attributes attributes; --- 48,76 ---- private static Declaration V_DECL = new Declaration("v", "vertex float"); ! private static Point3f p0 = new Point3f(); ! ! private static Point3f p1 = new Point3f(); ! ! private static Point3f p2 = new Point3f(); ! ! private static Point3f p3 = new Point3f(); ! ! private static Vector3f v0 = new Vector3f(); ! ! private static Vector3f v1 = new Vector3f(); ! ! private static Vector3f v2 = new Vector3f(); ! ! private static Vector3f v3 = new Vector3f(); ! ! private static Color3f c0 = new Color3f(); ! ! private static Color3f c1 = new Color3f(); ! ! private static Color3f c2 = new Color3f(); ! ! private static Color3f c3 = new Color3f(); ! ! protected ParameterList parameters; protected Attributes attributes; *************** *** 63,67 **** protected float distance; ! protected Primitive(Map parameters, Attributes attributes) { this.parameters = parameters; this.attributes = attributes; --- 84,88 ---- protected float distance; ! protected Primitive(ParameterList parameters, Attributes attributes) { this.parameters = parameters; this.attributes = attributes; *************** *** 151,158 **** protected void dice_N(ShaderVariables shaderVariables) { ! Parameter parameter = (Parameter) parameters.get("N"); ! if (parameter != null) { ! Vector3f[][] data = (Vector3f[][]) parameter.getData(); ! diceVector3f(shaderVariables.N, data[0][0], data[1][0], data[2][0], data[3][0]); } else shaderVariables.N.set(shaderVariables.Ng); --- 172,182 ---- protected void dice_N(ShaderVariables shaderVariables) { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("N"); ! if (param != null) { ! param.getValue(0, v0); ! param.getValue(1, v1); ! param.getValue(2, v2); ! param.getValue(3, v3); ! diceVector3f(shaderVariables.N, v0, v1, v2, v3); } else shaderVariables.N.set(shaderVariables.Ng); *************** *** 160,167 **** protected void dice_Cs(ShaderVariables shaderVariables) { ! Parameter parameter = (Parameter) parameters.get("Cs"); ! if (parameter != null) { ! Color3f[][] data = (Color3f[][]) parameter.getData(); ! diceColor3f(shaderVariables.Cs, data[0][0], data[1][0], data[2][0], data[3][0]); } else shaderVariables.Cs.set(attributes.getColor()); --- 184,199 ---- protected void dice_Cs(ShaderVariables shaderVariables) { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("Cs"); ! if (param != null) { ! if (param.getCount() == 4) { ! param.getValue(0, c0); ! param.getValue(1, c1); ! param.getValue(2, c2); ! param.getValue(3, c3); ! diceColor3f(shaderVariables.Cs, c0, c1, c2, c3); ! } else { ! param.getValue(0, c0); ! shaderVariables.Cs.set(c0); ! } } else shaderVariables.Cs.set(attributes.getColor()); *************** *** 169,176 **** protected void dice_Os(ShaderVariables shaderVariables) { ! Parameter parameter = (Parameter) parameters.get("Os"); ! if (parameter != null) { ! Color3f[][] data = (Color3f[][]) parameter.getData(); ! diceColor3f(shaderVariables.Os, data[0][0], data[1][0], data[2][0], data[3][0]); } else shaderVariables.Os.set(attributes.getOpacity()); --- 201,216 ---- protected void dice_Os(ShaderVariables shaderVariables) { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("Os"); ! if (param != null) { ! if (param.getCount() == 4) { ! param.getValue(0, c0); ! param.getValue(1, c1); ! param.getValue(2, c2); ! param.getValue(3, c3); ! diceColor3f(shaderVariables.Os, c0, c1, c2, c3); ! } else { ! param.getValue(0, c0); ! shaderVariables.Os.set(c0); ! } } else shaderVariables.Os.set(attributes.getOpacity()); *************** *** 178,202 **** protected void dice_u(ShaderVariables shaderVariables) { ! Parameter parameter = (Parameter) parameters.get("u"); ! float[][] data = (float[][]) parameter.getData(); ! diceFloat(shaderVariables.u, data[0][0], data[1][0], data[2][0], data[3][0]); } protected void dice_v(ShaderVariables shaderVariables) { ! Parameter parameter = (Parameter) parameters.get("v"); ! float[][] data = (float[][]) parameter.getData(); ! diceFloat(shaderVariables.v, data[0][0], data[1][0], data[2][0], data[3][0]); } protected void dice_s(ShaderVariables shaderVariables) { ! Parameter parameter = (Parameter) parameters.get("s"); ! float[][] data = (float[][]) parameter.getData(); ! diceFloat(shaderVariables.s, data[0][0], data[1][0], data[2][0], data[3][0]); } protected void dice_t(ShaderVariables shaderVariables) { ! Parameter parameter = (Parameter) parameters.get("t"); ! float[][] data = (float[][]) parameter.getData(); ! diceFloat(shaderVariables.t, data[0][0], data[1][0], data[2][0], data[3][0]); } --- 218,258 ---- protected void dice_u(ShaderVariables shaderVariables) { ! VaryingScalarFloat param = (VaryingScalarFloat) parameters.getParameter("u"); ! diceFloat( ! shaderVariables.u, ! param.getValue(0), ! param.getValue(1), ! param.getValue(2), ! param.getValue(3)); } protected void dice_v(ShaderVariables shaderVariables) { ! VaryingScalarFloat param = (VaryingScalarFloat) parameters.getParameter("v"); ! diceFloat( ! shaderVariables.v, ! param.getValue(0), ! param.getValue(1), ! param.getValue(2), ! param.getValue(3)); } protected void dice_s(ShaderVariables shaderVariables) { ! VaryingScalarFloat param = (VaryingScalarFloat) parameters.getParameter("s"); ! diceFloat( ! shaderVariables.s, ! param.getValue(0), ! param.getValue(1), ! param.getValue(2), ! param.getValue(3)); } protected void dice_t(ShaderVariables shaderVariables) { ! VaryingScalarFloat param = (VaryingScalarFloat) parameters.getParameter("t"); ! diceFloat( ! shaderVariables.t, ! param.getValue(0), ! param.getValue(1), ! param.getValue(2), ! param.getValue(3)); } *************** *** 302,499 **** protected void setDefaultParameters() { ! Parameter parameter = (Parameter) parameters.get("u"); if (parameter == null) { ! float[][] u = new float[4][]; ! u[0] = new float[1]; ! u[1] = new float[1]; ! u[2] = new float[1]; ! u[3] = new float[1]; ! u[0][0] = 0f; ! u[1][0] = 1f; ! u[2][0] = 0f; ! u[3][0] = 1f; ! parameters.put("u", new Parameter(U_DECL, u)); } ! parameter = (Parameter) parameters.get("v"); if (parameter == null) { ! float[][] v = new float[4][]; ! v[0] = new float[1]; ! v[1] = new float[1]; ! v[2] = new float[1]; ! v[3] = new float[1]; ! v[0][0] = 0f; ! v[1][0] = 0f; ! v[2][0] = 1f; ! v[3][0] = 1f; ! parameters.put("v", new Parameter(V_DECL, v)); } ! parameter = (Parameter) parameters.get("s"); if (parameter == null) { ! float[][] s = new float[4][]; ! s[0] = new float[1]; ! s[1] = new float[1]; ! s[2] = new float[1]; ! s[3] = new float[1]; ! Parameter uParam = (Parameter) parameters.get("u"); ! float[][] u = (float[][]) uParam.getData(); ! s[0][0] = u[0][0]; ! s[1][0] = u[1][0]; ! s[2][0] = u[2][0]; ! s[3][0] = u[3][0]; ! parameters.put("s", new Parameter(Global.getDeclaration("s"), s)); } ! parameter = (Parameter) parameters.get("t"); if (parameter == null) { ! float[][] t = new float[4][]; ! t[0] = new float[1]; ! t[1] = new float[1]; ! t[2] = new float[1]; ! t[3] = new float[1]; ! Parameter vParam = (Parameter) parameters.get("v"); ! float[][] v = (float[][]) vParam.getData(); ! t[0][0] = v[0][0]; ! t[1][0] = v[1][0]; ! t[2][0] = v[2][0]; ! t[3][0] = v[3][0]; ! parameters.put("t", new Parameter(Global.getDeclaration("t"), t)); } } ! protected Map linearInterpolateParameters( float uMin, float uMax, float vMin, float vMax) { ! Map result = new HashMap(); ! for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) { ! String name = (String) iter.next(); ! Parameter parameter = (Parameter) parameters.get(name); Declaration declaration = parameter.getDeclaration(); Declaration.StorageClass storageClass = declaration.getStorageClass(); if (storageClass == Declaration.StorageClass.CONSTANT || storageClass == Declaration.StorageClass.UNIFORM) { ! result.put(name, parameter); continue; } Declaration.Type type = declaration.getType(); if (type == Declaration.Type.INTEGER || type == Declaration.Type.STRING) { ! result.put(name, parameter); continue; } ! if (type == Declaration.Type.FLOAT) { ! float[][] param = (float[][]) parameter.getData(); ! float[][] sparam = new float[4][]; ! int count = declaration.getCount(); ! sparam[0] = new float[count]; ! sparam[1] = new float[count]; ! sparam[2] = new float[count]; ! sparam[3] = new float[count]; ! for (int i = 0; i < count; i++) { ! float uv00 = param[0][i]; ! float uv10 = param[1][i]; ! float uv01 = param[2][i]; ! float uv11 = param[3][i]; ! sparam[0][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin); ! sparam[1][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin); ! sparam[2][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax); ! sparam[3][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax); ! } ! result.put(name, new Parameter(declaration, sparam)); ! } else if (type == Declaration.Type.POINT) { ! Point3f[][] param = (Point3f[][]) parameter.getData(); ! Point3f[][] sparam = new Point3f[4][]; ! int count = declaration.getCount(); ! sparam[0] = new Point3f[count]; ! sparam[1] = new Point3f[count]; ! sparam[2] = new Point3f[count]; ! sparam[3] = new Point3f[count]; ! for (int i = 0; i < count; i++) { ! Point3f uv00 = param[0][i]; ! Point3f uv10 = param[1][i]; ! Point3f uv01 = param[2][i]; ! Point3f uv11 = param[3][i]; ! sparam[0][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin); ! sparam[1][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin); ! sparam[2][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax); ! sparam[3][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax); ! } ! result.put(name, new Parameter(declaration, sparam)); } else if (type == Declaration.Type.COLOR) { ! Color3f[][] param = (Color3f[][]) parameter.getData(); ! Color3f[][] sparam = new Color3f[4][]; ! int count = declaration.getCount(); ! sparam[0] = new Color3f[count]; ! sparam[1] = new Color3f[count]; ! sparam[2] = new Color3f[count]; ! sparam[3] = new Color3f[count]; ! for (int i = 0; i < count; i++) { ! Color3f uv00 = param[0][i]; ! Color3f uv10 = param[1][i]; ! Color3f uv01 = param[2][i]; ! Color3f uv11 = param[3][i]; ! sparam[0][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin); ! sparam[1][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin); ! sparam[2][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax); ! sparam[3][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax); ! } ! result.put(name, new Parameter(declaration, sparam)); } else if (type == Declaration.Type.VECTOR || type == Declaration.Type.NORMAL) { ! Vector3f[][] param = (Vector3f[][]) parameter.getData(); ! Vector3f[][] sparam = new Vector3f[4][]; ! int count = declaration.getCount(); ! sparam[0] = new Vector3f[count]; ! sparam[1] = new Vector3f[count]; ! sparam[2] = new Vector3f[count]; ! sparam[3] = new Vector3f[count]; ! for (int i = 0; i < count; i++) { ! Vector3f uv00 = param[0][i]; ! Vector3f uv10 = param[1][i]; ! Vector3f uv01 = param[2][i]; ! Vector3f uv11 = param[3][i]; ! sparam[0][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin); ! sparam[1][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin); ! sparam[2][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax); ! sparam[3][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax); ! } ! result.put(name, new Parameter(declaration, sparam)); ! } else if (type == Declaration.Type.HPOINT) { ! Point4f[][] param = (Point4f[][]) parameter.getData(); ! Point4f[][] sparam = new Point4f[4][]; ! int count = declaration.getCount(); ! sparam[0] = new Point4f[count]; ! sparam[1] = new Point4f[count]; ! sparam[2] = new Point4f[count]; ! sparam[3] = new Point4f[count]; ! for (int i = 0; i < count; i++) { ! Point4f uv00 = param[0][i]; ! Point4f uv10 = param[1][i]; ! Point4f uv01 = param[2][i]; ! Point4f uv11 = param[3][i]; ! sparam[0][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin); ! sparam[1][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin); ! sparam[2][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax); ! sparam[3][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax); ! } ! result.put(name, new Parameter(declaration, sparam)); ! } else if (type == Declaration.Type.MATRIX) { ! Matrix4f[][] param = (Matrix4f[][]) parameter.getData(); ! Matrix4f[][] sparam = new Matrix4f[4][]; ! int count = declaration.getCount(); ! sparam[0] = new Matrix4f[count]; ! sparam[1] = new Matrix4f[count]; ! sparam[2] = new Matrix4f[count]; ! sparam[3] = new Matrix4f[count]; ! for (int i = 0; i < count; i++) { ! Matrix4f uv00 = param[0][i]; ! Matrix4f uv10 = param[1][i]; ! Matrix4f uv01 = param[2][i]; ! Matrix4f uv11 = param[3][i]; ! sparam[0][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin); ! sparam[1][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin); ! sparam[2][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax); ! sparam[3][i] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax); ! } ! result.put(name, new Parameter(declaration, sparam)); ! } } return result; --- 358,486 ---- protected void setDefaultParameters() { ! NParameter parameter = parameters.getParameter("u"); if (parameter == null) { ! float[] u = new float[4]; ! u[0] = 0f; ! u[1] = 1f; ! u[2] = 0f; ! u[3] = 1f; ! parameters.addParameter(new VaryingScalarFloat(U_DECL, u)); } ! parameter = parameters.getParameter("v"); if (parameter == null) { ! float[] v = new float[4]; ! v[0] = 0f; ! v[1] = 0f; ! v[2] = 1f; ! v[3] = 1f; ! parameters.addParameter(new VaryingScalarFloat(V_DECL, v)); } ! parameter = parameters.getParameter("s"); if (parameter == null) { ! float[] s = new float[4]; ! VaryingScalarFloat uParam = (VaryingScalarFloat) parameters.getParameter("u"); ! s[0] = uParam.getValue(0); ! s[1] = uParam.getValue(1); ! s[2] = uParam.getValue(2); ! s[3] = uParam.getValue(3); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("s"), s)); } ! parameter = parameters.getParameter("t"); if (parameter == null) { ! float[] t = new float[4]; ! VaryingScalarFloat vParam = (VaryingScalarFloat) parameters.getParameter("v"); ! t[0] = vParam.getValue(0); ! t[1] = vParam.getValue(1); ! t[2] = vParam.getValue(2); ! t[3] = vParam.getValue(3); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("t"), t)); } } ! protected ParameterList linearInterpolateParameters( float uMin, float uMax, float vMin, float vMax) { ! ParameterList result = new ParameterList(); ! for (int i = 0; i < parameters.getParameterCount(); i++) { ! NParameter parameter = parameters.getParameter(i); Declaration declaration = parameter.getDeclaration(); Declaration.StorageClass storageClass = declaration.getStorageClass(); if (storageClass == Declaration.StorageClass.CONSTANT || storageClass == Declaration.StorageClass.UNIFORM) { ! result.addParameter(parameter); continue; } Declaration.Type type = declaration.getType(); if (type == Declaration.Type.INTEGER || type == Declaration.Type.STRING) { ! result.addParameter(parameter); continue; } ! if (type == Declaration.Type.FLOAT && declaration.getCount() == 1) { ! VaryingScalarFloat param = (VaryingScalarFloat) parameter; ! float[] sparam = new float[4]; ! float uv00 = param.getValue(0); ! float uv10 = param.getValue(1); ! float uv01 = param.getValue(2); ! float uv11 = param.getValue(3); ! sparam[0] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin); ! sparam[1] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin); ! sparam[2] = Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax); ! sparam[3] = Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax); ! result.addParameter(new VaryingScalarFloat(declaration, sparam)); ! } 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; ! sparam.setValue(0, Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin)); ! sparam.setValue(1, Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin)); ! sparam.setValue(2, Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax)); ! sparam.setValue(3, Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax)); ! result.addParameter(sparam); } else if (type == Declaration.Type.COLOR) { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameter; ! VaryingScalarTuple3f sparam = ! new VaryingScalarTuple3f(declaration, new float[4 * 3]); ! param.getValue(0, c0); ! param.getValue(1, c1); ! param.getValue(2, c2); ! param.getValue(3, c3); ! Color3f uv00 = c0; ! Color3f uv10 = c1; ! Color3f uv01 = c2; ! Color3f uv11 = c3; ! sparam.setValue(0, Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin)); ! sparam.setValue(1, Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin)); ! sparam.setValue(2, Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax)); ! sparam.setValue(3, Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax)); ! result.addParameter(sparam); } else if (type == Declaration.Type.VECTOR || type == Declaration.Type.NORMAL) { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameter; ! VaryingScalarTuple3f sparam = ! new VaryingScalarTuple3f(declaration, new float[4 * 3]); ! param.getValue(0, v0); ! param.getValue(1, v1); ! param.getValue(2, v2); ! param.getValue(3, v3); ! Vector3f uv00 = v0; ! Vector3f uv10 = v1; ! Vector3f uv01 = v2; ! Vector3f uv11 = v3; ! sparam.setValue(0, Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin)); ! sparam.setValue(1, Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin)); ! sparam.setValue(2, Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax)); ! sparam.setValue(3, Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax)); ! result.addParameter(sparam); ! } else ! throw new UnsupportedOperationException("Can't interpolate: " + declaration); } return result; Index: Sphere.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Sphere.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Sphere.java 22 May 2003 04:50:14 -0000 1.19 --- Sphere.java 25 Nov 2003 16:34:08 -0000 1.20 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; --- 20,23 ---- *************** *** 29,32 **** --- 27,31 ---- import org.jrman.grid.Grid; import org.jrman.grid.Point3fGrid; + import org.jrman.parameters.ParameterList; import org.jrman.render.ShaderVariables; *************** *** 51,55 **** float thetaMin, float thetaMax, ! Map parameters, Attributes attributes) { super(parameters, attributes); --- 50,54 ---- float thetaMin, float thetaMax, ! ParameterList parameters, Attributes attributes) { super(parameters, attributes); Index: Point.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Point.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Point.java 18 May 2003 20:10:50 -0000 1.3 --- Point.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Color3f; import javax.vecmath.Point3f; --- 20,23 ---- *************** *** 33,36 **** --- 31,36 ---- import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; + import org.jrman.parameters.VaryingScalarTuple3f; import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; *************** *** 43,46 **** --- 43,48 ---- private static Vector3f v = new Vector3f(); + + private static Color3f color = new Color3f(); private float width; *************** *** 57,61 **** float y, float z, ! Map parameters, Attributes attributes) { super(parameters, attributes); --- 59,63 ---- float y, float z, ! ParameterList parameters, Attributes attributes) { super(parameters, attributes); *************** *** 86,99 **** dice_PandNg(sv, worldToCamera); sv.N.set(sv.Ng); ! Parameter csParam = (Parameter) parameters.get("Cs"); if (csParam != null) { ! Color3f[][] Cs = (Color3f[][]) csParam.getData(); ! sv.Cs.set(Cs[0][0]); } else sv.Cs.set(attributes.getColor()); ! Parameter osParam = (Parameter) parameters.get("Os"); if (osParam != null) { ! Color3f[][] Os = (Color3f[][]) osParam.getData(); ! sv.Os.set(Os[0][0]); } else sv.Os.set(attributes.getOpacity()); --- 88,101 ---- dice_PandNg(sv, worldToCamera); sv.N.set(sv.Ng); ! VaryingScalarTuple3f csParam = (VaryingScalarTuple3f) parameters.getParameter("Cs"); if (csParam != null) { ! csParam.getValue(0, color); ! sv.Cs.set(color); } else sv.Cs.set(attributes.getColor()); ! VaryingScalarTuple3f osParam = (VaryingScalarTuple3f) parameters.getParameter("Os"); if (osParam != null) { ! osParam.getValue(0, color); ! sv.Os.set(color); } else sv.Os.set(attributes.getOpacity()); Index: BilinearPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/BilinearPatch.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BilinearPatch.java 22 May 2003 04:50:14 -0000 1.1 --- BilinearPatch.java 25 Nov 2003 16:34:08 -0000 1.2 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 28,57 **** import org.jrman.geom.BoundingVolume; import org.jrman.geom.MutableBounds3f; ! import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; public class BilinearPatch extends Primitive { ! ! private static Point3f P00; ! ! private static Point3f P10; ! ! private static Point3f P01; ! ! private static Point3f P11; ! private static Vector3f vtmp = new Vector3f(); ! ! public BilinearPatch(Map parameters, Attributes attributes) { super(parameters, attributes); } ! private void extractPoints() { ! Parameter param = (Parameter) parameters.get("P"); ! Point3f[][] P = (Point3f[][]) param.getData(); ! P00 = P[0][0]; ! P10 = P[1][0]; ! P01 = P[2][0]; ! P11 = P[3][0]; } --- 26,55 ---- import org.jrman.geom.BoundingVolume; import org.jrman.geom.MutableBounds3f; ! import org.jrman.parameters.ParameterList; ! import org.jrman.parameters.VaryingScalarTuple3f; import org.jrman.render.ShaderVariables; public class BilinearPatch extends Primitive { ! ! private static Point3f P00 = new Point3f(); ! ! private static Point3f P10 = new Point3f(); ! ! private static Point3f P01 = new Point3f(); ! ! private static Point3f P11 = new Point3f(); ! private static Vector3f vtmp = new Vector3f(); ! ! public BilinearPatch(ParameterList parameters, Attributes attributes) { super(parameters, attributes); } ! private void extractPoints() { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("P"); ! param.getValue(0, P00); ! param.getValue(1, P10); ! param.getValue(2, P01); ! param.getValue(3, P11); } *************** *** 80,100 **** float vl = (l1 + l2) / 2f; if (ul > vl) { ! result[0] = new BilinearPatch(linearInterpolateParameters(0f, .5f, 0f, 1f), attributes); ! result[1] = new BilinearPatch(linearInterpolateParameters(.5f, 1f, 0f , 1f), attributes); } else { ! result[0] = new BilinearPatch(linearInterpolateParameters(0f, 1f, 0f, .5f), attributes); ! result[1] = new BilinearPatch(linearInterpolateParameters(0f, 1f, .5f , 1f), attributes); } return result; } ! protected void dice_P(ShaderVariables sv) { extractPoints(); dicePoint3f(sv.P, P00, P10, P01, P11); } ! protected void dice_Ng(ShaderVariables sv) { sv.Ng.cross(sv.dPdu, sv.dPdv); } ! } --- 78,102 ---- float vl = (l1 + l2) / 2f; if (ul > vl) { ! result[0] = ! new BilinearPatch(linearInterpolateParameters(0f, .5f, 0f, 1f), attributes); ! result[1] = ! new BilinearPatch(linearInterpolateParameters(.5f, 1f, 0f, 1f), attributes); } else { ! result[0] = ! new BilinearPatch(linearInterpolateParameters(0f, 1f, 0f, .5f), attributes); ! result[1] = ! new BilinearPatch(linearInterpolateParameters(0f, 1f, .5f, 1f), attributes); } return result; } ! protected void dice_P(ShaderVariables sv) { extractPoints(); dicePoint3f(sv.P, P00, P10, P01, P11); } ! protected void dice_Ng(ShaderVariables sv) { sv.Ng.cross(sv.dPdu, sv.dPdv); } ! } Index: BicubicPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/BicubicPatch.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BicubicPatch.java 9 Sep 2003 03:01:04 -0000 1.3 --- BicubicPatch.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 30,34 **** import org.jrman.grid.Grid; import org.jrman.parameters.Declaration; ! import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; import org.jrman.util.Calc; --- 28,33 ---- import org.jrman.grid.Grid; import org.jrman.parameters.Declaration; ! import org.jrman.parameters.ParameterList; ! import org.jrman.parameters.VaryingScalarTuple3f; import org.jrman.render.ShaderVariables; import org.jrman.util.Calc; *************** *** 36,96 **** public class BicubicPatch extends Primitive { ! private static Point3f P00; ! private static Point3f P10; ! private static Point3f P20; ! private static Point3f P30; ! private static Point3f P01; ! private static Point3f P11; ! private static Point3f P21; ! private static Point3f P31; ! private static Point3f P02; ! private static Point3f P12; ! private static Point3f P22; ! private static Point3f P32; ! private static Point3f P03; ! private static Point3f P13; ! private static Point3f P23; ! private static Point3f P33; private static Vector3f vtmp = new Vector3f(); ! public BicubicPatch(Map parameters, Attributes attributes) { super(parameters, attributes); } private void extractPoints() { ! Parameter param = (Parameter) parameters.get("P"); ! Point3f[][] P = (Point3f[][]) param.getData(); ! P00 = P[0][0]; ! P10 = P[1][0]; ! P20 = P[2][0]; ! P30 = P[3][0]; ! P01 = P[4][0]; ! P11 = P[5][0]; ! P21 = P[6][0]; ! P31 = P[7][0]; ! P02 = P[8][0]; ! P12 = P[9][0]; ! P22 = P[10][0]; ! P32 = P[11][0]; ! P03 = P[12][0]; ! P13 = P[13][0]; ! P23 = P[14][0]; ! P33 = P[15][0]; } --- 35,94 ---- public class BicubicPatch extends Primitive { ! private static Point3f P00 = new Point3f(); ! private static Point3f P10 = new Point3f(); ! private static Point3f P20 = new Point3f(); ! private static Point3f P30 = new Point3f(); ! private static Point3f P01 = new Point3f(); ! private static Point3f P11 = new Point3f(); ! private static Point3f P21 = new Point3f(); ! private static Point3f P31 = new Point3f(); ! private static Point3f P02 = new Point3f(); ! private static Point3f P12 = new Point3f(); ! private static Point3f P22 = new Point3f(); ! private static Point3f P32 = new Point3f(); ! private static Point3f P03 = new Point3f(); ! private static Point3f P13 = new Point3f(); ! private static Point3f P23 = new Point3f(); ! private static Point3f P33 = new Point3f(); private static Vector3f vtmp = new Vector3f(); ! public BicubicPatch(ParameterList parameters, Attributes attributes) { super(parameters, attributes); } private void extractPoints() { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("P"); ! param.getValue(0, P00); ! param.getValue(1, P10); ! param.getValue(2, P20); ! param.getValue(3, P30); ! param.getValue(4, P01); ! param.getValue(5, P11); ! param.getValue(6, P21); ! param.getValue(7, P31); ! param.getValue(8, P02); ! param.getValue(9, P12); ! param.getValue(10, P22); ! param.getValue(11, P32); ! param.getValue(12, P03); ! param.getValue(13, P13); ! param.getValue(14, P23); ! param.getValue(15, P33); } *************** *** 144,177 **** } ! protected Map bezierInterpolateParameters( float uv00, float uv10, float uv01, float uv11) { ! Map result = linearInterpolateParameters(uv00, uv10, uv01, uv11); ! result.remove("u"); ! result.remove("v"); extractPoints(); ! Point3f[][] p = new Point3f[16][]; ! for (int i = 0; i < 16; i++) { ! p[i] = new Point3f[1]; ! p[i][0] = new Point3f(); ! } ! Point3f PS00 = p[0][0]; ! Point3f PS10 = p[1][0]; ! Point3f PS20 = p[2][0]; ! Point3f PS30 = p[3][0]; ! Point3f PS01 = p[4][0]; ! Point3f PS11 = p[5][0]; ! Point3f PS21 = p[6][0]; ! Point3f PS31 = p[7][0]; ! Point3f PS02 = p[8][0]; ! Point3f PS12 = p[9][0]; ! Point3f PS22 = p[10][0]; ! Point3f PS32 = p[11][0]; ! Point3f PS03 = p[12][0]; ! Point3f PS13 = p[13][0]; ! Point3f PS23 = p[14][0]; ! Point3f PS33 = p[15][0]; if (uv00 == .5f) { splitUpper(P00, P10, P20, P30, PS00, PS10, PS20, PS30); --- 142,172 ---- } ! protected ParameterList bezierInterpolateParameters( float uv00, float uv10, float uv01, float uv11) { ! ParameterList result = linearInterpolateParameters(uv00, uv10, uv01, uv11); ! result.removeParameter("u"); ! result.removeParameter("v"); extractPoints(); ! VaryingScalarTuple3f sparam = ! new VaryingScalarTuple3f(new Declaration("P", "vertex point"), new float[16 * 3]); ! Point3f PS00 = new Point3f(); ! Point3f PS10 = new Point3f(); ! Point3f PS20 = new Point3f(); ! Point3f PS30 = new Point3f(); ! Point3f PS01 = new Point3f(); ! Point3f PS11 = new Point3f(); ! Point3f PS21 = new Point3f(); ! Point3f PS31 = new Point3f(); ! Point3f PS02 = new Point3f(); ! Point3f PS12 = new Point3f(); ! Point3f PS22 = new Point3f(); ! Point3f PS32 = new Point3f(); ! Point3f PS03 = new Point3f(); ! Point3f PS13 = new Point3f(); ! Point3f PS23 = new Point3f(); ! Point3f PS33 = new Point3f(); if (uv00 == .5f) { splitUpper(P00, P10, P20, P30, PS00, PS10, PS20, PS30); *************** *** 195,199 **** splitLower(P30, P31, P32, P33, PS30, PS31, PS32, PS33); } ! result.put("P", new Parameter(new Declaration("P", "vertex point"), p)); return result; } --- 190,210 ---- splitLower(P30, P31, P32, P33, PS30, PS31, PS32, PS33); } ! sparam.setValue(0, PS00); ! sparam.setValue(1, PS10); ! sparam.setValue(2, PS20); ! sparam.setValue(3, PS30); ! sparam.setValue(4, PS01); ! sparam.setValue(5, PS11); ! sparam.setValue(6, PS21); ! sparam.setValue(7, PS31); ! sparam.setValue(8, PS02); ! sparam.setValue(9, PS12); ! sparam.setValue(10, PS22); ! sparam.setValue(11, PS32); ! sparam.setValue(12, PS03); ! sparam.setValue(13, PS13); ! sparam.setValue(14, PS23); ! sparam.setValue(15, PS33); ! result.addParameter(sparam); return result; } *************** *** 208,224 **** Point3f out2, Point3f out3) { ! out0.set(in0); ! out1.add(in0, in1); ! out1.scale(.5f); ! out2.set(in1); ! out2.scale(2f); ! out2.add(in0); ! out2.add(in2); ! out2.scale(.25f); ! out3.add(in1, in2); ! out3.scale(3f); ! out3.add(in0); ! out3.add(in3); ! out3.scale(.125f); } --- 219,235 ---- Point3f out2, Point3f out3) { ! out0.set(in0); ! out1.add(in0, in1); ! out1.scale(.5f); ! out2.set(in1); ! out2.scale(2f); ! out2.add(in0); ! out2.add(in2); ! out2.scale(.25f); ! out3.add(in1, in2); ! out3.scale(3f); ! out3.add(in0); ! out3.add(in3); ! out3.scale(.125f); } *************** *** 232,248 **** Point3f out2, Point3f out3) { ! out3.set(in3); ! out2.add(in3, in2); ! out2.scale(.5f); ! out1.set(in2); ! out1.scale(2f); ! out1.add(in3); ! out1.add(in1); ! out1.scale(.25f); ! out0.add(in2, in1); ! out0.scale(3f); ! out0.add(in3); ! out0.add(in0); ! out0.scale(.125f); } --- 243,259 ---- Point3f out2, Point3f out3) { ! out3.set(in3); ! out2.add(in3, in2); ! out2.scale(.5f); ! out1.set(in2); ! out1.scale(2f); ! out1.add(in3); ! out1.add(in1); ! out1.scale(.25f); ! out0.add(in2, in1); ! out0.scale(3f); ! out0.add(in3); ! out0.add(in0); ! out0.scale(.125f); } Index: Disk.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Disk.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Disk.java 22 May 2003 04:50:14 -0000 1.6 --- Disk.java 25 Nov 2003 16:34:08 -0000 1.7 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 31,34 **** --- 29,33 ---- import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; import org.jrman.render.ShaderVariables; *************** *** 55,59 **** float rMin, float rMax, ! Map parameters, Attributes attributes) { super(parameters, attributes); --- 54,58 ---- float rMin, float rMax, ! ParameterList parameters, Attributes attributes) { super(parameters, attributes); Index: Cylinder.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Cylinder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Cylinder.java 22 May 2003 04:50:14 -0000 1.5 --- Cylinder.java 25 Nov 2003 16:34:08 -0000 1.6 *************** *** 20,25 **** package org.jrman.primitive; - import java.util.Map; - import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 31,34 **** --- 29,33 ---- import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; import org.jrman.render.ShaderVariables; *************** *** 55,59 **** float thetaMin, float thetaMax, ! Map parameters, Attributes attributes) { super(parameters, attributes); --- 54,58 ---- float thetaMin, float thetaMax, ! ParameterList parameters, Attributes attributes) { super(parameters, attributes); Index: Quadric.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Quadric.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Quadric.java 22 May 2003 04:50:14 -0000 1.13 --- Quadric.java 25 Nov 2003 16:34:08 -0000 1.14 *************** *** 20,30 **** package org.jrman.primitive; - import java.util.Map; - import org.jrman.attributes.Attributes; public abstract class Quadric extends Primitive { ! public Quadric(Map parameters, Attributes attributes) { super(parameters, attributes); } --- 20,29 ---- package org.jrman.primitive; import org.jrman.attributes.Attributes; + import org.jrman.parameters.ParameterList; public abstract class Quadric extends Primitive { ! public Quadric(ParameterList parameters, Attributes attributes) { super(parameters, attributes); } |
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1:/tmp/cvs-serv29833/src/org/jrman/parser/keywords Modified Files: KeywordAreaLightSource.java KeywordLightSource.java KeywordPatch.java KeywordDisplacement.java KeywordTorus.java KeywordExterior.java KeywordHider.java KeywordDisk.java KeywordHyperboloid.java KeywordCone.java KeywordPolygon.java KeywordPointsPolygons.java KeywordParaboloid.java KeywordCylinder.java KeywordPoints.java KeywordProjection.java KeywordMakeTexture.java KeywordSurface.java KeywordImager.java KeywordInterior.java KeywordSphere.java KeywordOption.java KeywordAtmosphere.java KeywordAttribute.java AbstractKeywordParser.java KeywordDisplay.java Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: KeywordAreaLightSource.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordAreaLightSource.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** KeywordAreaLightSource.java 12 Apr 2003 06:10:29 -0000 1.4 --- KeywordAreaLightSource.java 25 Nov 2003 16:34:08 -0000 1.5 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 34,38 **** int sequenceNumber = (int) st.nval; // Expect parameter list ! Map parameters =parseParameterList(st); parser.createAreaLightSource(name, sequenceNumber, parameters); } --- 33,37 ---- int sequenceNumber = (int) st.nval; // Expect parameter list ! ParameterList parameters =parseParameterList(st); parser.createAreaLightSource(name, sequenceNumber, parameters); } Index: KeywordLightSource.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordLightSource.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordLightSource.java 12 Apr 2003 06:10:29 -0000 1.3 --- KeywordLightSource.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 34,38 **** int sequenceNumber = (int) st.nval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.createLightSource(name, sequenceNumber, parameters); } --- 33,37 ---- int sequenceNumber = (int) st.nval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.createLightSource(name, sequenceNumber, parameters); } Index: KeywordPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPatch.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** KeywordPatch.java 22 May 2003 07:36:26 -0000 1.4 --- KeywordPatch.java 25 Nov 2003 16:34:08 -0000 1.5 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String type = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); if (type.equals("bilinear")) parser.addBilinearPatch(parameters); --- 30,34 ---- String type = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); if (type.equals("bilinear")) parser.addBilinearPatch(parameters); Index: KeywordDisplacement.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordDisplacement.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordDisplacement.java 20 May 2003 01:08:39 -0000 1.3 --- KeywordDisplacement.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setDisplacement(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setDisplacement(name, parameters); } Index: KeywordTorus.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordTorus.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordTorus.java 5 May 2003 08:29:08 -0000 1.3 --- KeywordTorus.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 53,57 **** match(st, TK_RBRACE); // Expect parameter list ! Map parameters = parseParameterList(st); parser.addTorus(majorRadius, minorRadius, phiMin, phiMax, thetaMax, parameters); } --- 52,56 ---- match(st, TK_RBRACE); // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.addTorus(majorRadius, minorRadius, phiMin, phiMax, thetaMax, parameters); } Index: KeywordExterior.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordExterior.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordExterior.java 12 Apr 2003 06:10:28 -0000 1.3 --- KeywordExterior.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setExterior(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setExterior(name, parameters); } Index: KeywordHider.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordHider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordHider.java 11 Apr 2003 22:23:11 -0000 1.3 --- KeywordHider.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String type = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setHider(type, parameters); } --- 30,34 ---- String type = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setHider(type, parameters); } Index: KeywordDisk.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordDisk.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** KeywordDisk.java 11 May 2003 02:53:43 -0000 1.4 --- KeywordDisk.java 25 Nov 2003 16:34:08 -0000 1.5 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 46,50 **** match(st, TK_RBRACE); // Expect parameter list ! Map parameters = parseParameterList(st); parser.addDisk(height,radius,thetaMax,parameters); } --- 45,49 ---- match(st, TK_RBRACE); // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.addDisk(height,radius,thetaMax,parameters); } Index: KeywordHyperboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordHyperboloid.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** KeywordHyperboloid.java 5 Aug 2003 23:52:18 -0000 1.6 --- KeywordHyperboloid.java 25 Nov 2003 16:34:08 -0000 1.7 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 59,63 **** match(st, TK_RBRACE); // Expect parameter list ! Map parameters = parseParameterList(st); parser.addHyperboloid(x1, y1, z1, x2, y2, z2, thetaMax, parameters); } --- 58,62 ---- match(st, TK_RBRACE); // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.addHyperboloid(x1, y1, z1, x2, y2, z2, thetaMax, parameters); } Index: KeywordCone.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordCone.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** KeywordCone.java 11 May 2003 02:53:43 -0000 1.4 --- KeywordCone.java 25 Nov 2003 16:34:08 -0000 1.5 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 46,50 **** match(st, TK_RBRACE); // Expect parameter list ! Map parameters = parseParameterList(st); parser.addCone(height,radius,thetaMax,parameters); } --- 45,49 ---- match(st, TK_RBRACE); // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.addCone(height,radius,thetaMax,parameters); } Index: KeywordPolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPolygon.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** KeywordPolygon.java 11 Sep 2003 21:53:47 -0000 1.5 --- KeywordPolygon.java 25 Nov 2003 16:34:08 -0000 1.6 *************** *** 26,30 **** public void parse(Tokenizer st) throws Exception { // Expect parameter list ! parser.addPolygon(parseParameterList(st)); } --- 26,30 ---- public void parse(Tokenizer st) throws Exception { // Expect parameter list ! //parser.addPolygon(parseParameterList(st)); } Index: KeywordPointsPolygons.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPointsPolygons.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordPointsPolygons.java 11 Sep 2003 21:53:47 -0000 1.3 --- KeywordPointsPolygons.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 21,26 **** import java.util.List; - import java.util.Map; import org.jrman.parser.Tokenizer; --- 21,26 ---- import java.util.List; + import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 28,31 **** --- 28,32 ---- public void parse(Tokenizer st) throws Exception { + /* // Expect array nVertices List nVertices = parseArray(st); *************** *** 35,40 **** // Expect parameter list ! Map parameterList = parseParameterList(st); parser.addPointsPolygon(nVertices, vertices, parameterList); } --- 36,42 ---- // Expect parameter list ! ParameterList parameterList = parseParameterList(st); parser.addPointsPolygon(nVertices, vertices, parameterList); + */ } Index: KeywordParaboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordParaboloid.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordParaboloid.java 27 May 2003 02:44:20 -0000 1.3 --- KeywordParaboloid.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 50,54 **** match(st, TK_RBRACE); // Expect parameter list ! Map parameters = parseParameterList(st); parser.addParaboloid(radius, zMin, zMax, thetaMax, parameters); } --- 49,53 ---- match(st, TK_RBRACE); // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.addParaboloid(radius, zMin, zMax, thetaMax, parameters); } Index: KeywordCylinder.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordCylinder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordCylinder.java 7 May 2003 07:08:35 -0000 1.3 --- KeywordCylinder.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 50,54 **** match(st, TK_RBRACE); // Expect parameter list ! Map parameters = parseParameterList(st); parser.addCylinder(radius, zmin, zmax, thetaMax, parameters); } --- 49,53 ---- match(st, TK_RBRACE); // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.addCylinder(radius, zmin, zmax, thetaMax, parameters); } Index: KeywordPoints.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPoints.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** KeywordPoints.java 17 May 2003 21:47:57 -0000 1.4 --- KeywordPoints.java 25 Nov 2003 16:34:08 -0000 1.5 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 28,32 **** public void parse(Tokenizer st) throws Exception { // Expect parameter list ! Map parameters = parseParameterList(st); parser.addPoints(parameters); } --- 27,31 ---- public void parse(Tokenizer st) throws Exception { // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.addPoints(parameters); } Index: KeywordProjection.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordProjection.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordProjection.java 11 Apr 2003 04:22:33 -0000 1.3 --- KeywordProjection.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setProjection(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setProjection(name, parameters); } Index: KeywordMakeTexture.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordMakeTexture.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordMakeTexture.java 12 Jun 2003 18:36:03 -0000 1.3 --- KeywordMakeTexture.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; - import java.util.Map; - import org.jrman.parser.Tokenizer; --- 20,23 ---- *************** *** 48,53 **** match(st, TK_NUMBER); int twidth = (int) st.nval; - // Expect parameter list - Map parameters = parseParameterList(st); parser.makeTexture(picturename, texturename, swrap, twrap, filter, swidth, twidth); } --- 46,49 ---- Index: KeywordSurface.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordSurface.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordSurface.java 12 Apr 2003 06:10:29 -0000 1.3 --- KeywordSurface.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setSurface(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setSurface(name, parameters); } Index: KeywordImager.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordImager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** KeywordImager.java 12 Apr 2003 06:10:29 -0000 1.4 --- KeywordImager.java 25 Nov 2003 16:34:08 -0000 1.5 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setImager(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setImager(name, parameters); } Index: KeywordInterior.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordInterior.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordInterior.java 12 Apr 2003 06:10:28 -0000 1.3 --- KeywordInterior.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setInterior(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setInterior(name, parameters); } Index: KeywordSphere.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordSphere.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordSphere.java 12 Apr 2003 07:06:35 -0000 1.3 --- KeywordSphere.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 49,53 **** match(st, TK_RBRACE); // Expect parameter list ! Map parameters = parseParameterList(st); parser.addSphere(radius, zMin, zMax, thetaMax, parameters); } --- 48,52 ---- match(st, TK_RBRACE); // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.addSphere(radius, zMin, zMax, thetaMax, parameters); } Index: KeywordOption.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordOption.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordOption.java 11 Apr 2003 22:23:10 -0000 1.3 --- KeywordOption.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setOption(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setOption(name, parameters); } Index: KeywordAtmosphere.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordAtmosphere.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordAtmosphere.java 12 Apr 2003 06:10:29 -0000 1.3 --- KeywordAtmosphere.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setAtmosphere(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setAtmosphere(name, parameters); } Index: KeywordAttribute.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordAttribute.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordAttribute.java 11 Apr 2003 22:50:09 -0000 1.3 --- KeywordAttribute.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 31,35 **** String name = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setAttribute(name, parameters); } --- 30,34 ---- String name = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setAttribute(name, parameters); } Index: AbstractKeywordParser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/AbstractKeywordParser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractKeywordParser.java 11 Apr 2003 22:50:10 -0000 1.6 --- AbstractKeywordParser.java 25 Nov 2003 16:34:08 -0000 1.7 *************** *** 25,29 **** import java.util.HashSet; import java.util.List; - import java.util.Map; import java.util.Set; --- 25,28 ---- *************** *** 32,35 **** --- 31,37 ---- import org.jrman.geom.Bounds3f; + import org.jrman.parameters.Declaration; + import org.jrman.parameters.ParameterList; + import org.jrman.parser.Global; import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; *************** *** 50,53 **** --- 52,61 ---- final static int TK_RBRACE = ']'; + + private static float[] numbers = new float[100]; + + private static String[] strings = new String[10]; + + private static int arraySize; protected Parser parser; *************** *** 229,234 **** } ! protected List parseArray(Tokenizer st) throws Exception { ! List array = new ArrayList(); // Expect array start match(st, TK_LBRACE); --- 237,267 ---- } ! /* ! protected Map parseParameterList(Tokenizer st) throws Exception { ! List list = new ArrayList(); ! // Expect list of key & value pairs ! while (st.nextToken() == TK_STRING) { ! list.add(st.sval); ! int token = st.nextToken(); ! if (token == TK_LBRACE) { ! st.pushBack(); ! list.add(parseArray(st)); ! } else if (token == TK_NUMBER) { ! List array = new ArrayList(); ! array.add(new Float((float) st.nval)); ! list.add(array); ! } else if (token == TK_STRING) { ! List array = new ArrayList(); ! array.add(st.sval); ! list.add(array); ! } ! } ! st.pushBack(); ! return parser.translateParameterList(list); ! } ! */ ! ! protected void parseArray(Tokenizer st) throws Exception { ! arraySize = 0; // Expect array start match(st, TK_LBRACE); *************** *** 238,245 **** switch (token) { case TK_NUMBER : ! array.add(new Float((float) st.nval)); break; case TK_STRING : ! array.add(st.sval); break; } --- 271,288 ---- switch (token) { case TK_NUMBER : ! if (arraySize == numbers.length) { ! float[] tmp = new float[numbers.length * 2]; ! System.arraycopy(numbers, 0, tmp, 0, numbers.length); ! numbers = tmp; ! } ! numbers[arraySize++] = (float) st.nval; break; case TK_STRING : ! if (arraySize == strings.length) { ! String[] tmp = new String[strings.length * 2]; ! System.arraycopy(strings, 0, tmp, 0, strings.length); ! strings = tmp; ! } ! strings[arraySize++] = st.sval; break; } *************** *** 247,274 **** // Expect array end match(st, TK_RBRACE); - return array; } ! protected Map parseParameterList(Tokenizer st) throws Exception { ! List list = new ArrayList(); // Expect list of key & value pairs while (st.nextToken() == TK_STRING) { ! list.add(st.sval); int token = st.nextToken(); if (token == TK_LBRACE) { st.pushBack(); ! list.add(parseArray(st)); } else if (token == TK_NUMBER) { ! List array = new ArrayList(); ! array.add(new Float((float) st.nval)); ! list.add(array); } else if (token == TK_STRING) { ! List array = new ArrayList(); ! array.add(st.sval); ! list.add(array); } } st.pushBack(); ! return parser.translateParameterList(list); } --- 290,334 ---- // Expect array end match(st, TK_RBRACE); } ! private Declaration getDeclaration(String name) { ! Declaration declaration = Global.getDeclaration(name); ! if (declaration != null) ! return declaration; ! // Check for inline declaration ! name = name.trim(); // Just being careful... ! int pos = name.lastIndexOf(' '); ! if (pos == -1) ! throw new IllegalArgumentException(); ! String decl = name.substring(0, pos); ! name = name.substring(pos + 1); ! return new Declaration(name, decl); ! } ! ! protected ParameterList parseParameterList(Tokenizer st) throws Exception { ! ParameterList parameters = new ParameterList(); // Expect list of key & value pairs while (st.nextToken() == TK_STRING) { ! Declaration declaration = null; ! try { ! declaration = getDeclaration(st.sval); ! } catch (IllegalArgumentException e) { ! System.err.println("Unknown type for parameter: " + st.sval); ! } int token = st.nextToken(); if (token == TK_LBRACE) { st.pushBack(); ! parseArray(st); } else if (token == TK_NUMBER) { ! numbers[0] = (float) st.nval; ! arraySize = 1; } else if (token == TK_STRING) { ! strings[0] = st.sval; ! arraySize = 1; } + parameters.addParameter(declaration.buildParameter(numbers, strings, arraySize)); } st.pushBack(); ! return parameters; } Index: KeywordDisplay.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordDisplay.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordDisplay.java 11 Apr 2003 22:23:11 -0000 1.3 --- KeywordDisplay.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 20,25 **** package org.jrman.parser.keywords; ! import java.util.Map; ! import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 37,41 **** String mode = st.sval; // Expect parameter list ! Map parameters = parseParameterList(st); parser.setDisplay(name, type, mode, parameters); } --- 36,40 ---- String mode = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); parser.setDisplay(name, type, mode, parameters); } |
From: <ma...@us...> - 2003-11-25 16:34:13
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv29833/sampleData Modified Files: points.rib Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: points.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/points.rib,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** points.rib 26 May 2003 01:47:59 -0000 1.3 --- points.rib 25 Nov 2003 16:34:09 -0000 1.4 *************** *** 1,2 **** --- 1,3 ---- + Display "points" "framebuffer" "rgba" Format 480 360 1 PixelSamples 4 4 |
From: <ma...@us...> - 2003-11-25 16:34:13
|
Update of /cvsroot/jrman/drafts/src In directory sc8-pr-cvs1:/tmp/cvs-serv29833/src Modified Files: SurfaceRandomcolors.java Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: SurfaceRandomcolors.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceRandomcolors.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SurfaceRandomcolors.java 9 Sep 2003 03:01:05 -0000 1.3 --- SurfaceRandomcolors.java 25 Nov 2003 16:34:08 -0000 1.4 *************** *** 21,24 **** --- 21,25 ---- import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; + import org.jrman.parameters.UniformScalarFloat; import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; *************** *** 36,59 **** protected void initDefaults() { ! float[][] Ka = new float[1][]; ! Ka[0] = new float[1]; ! Ka[0][0] = 1f; ! Parameter param = new Parameter(new Declaration("Ka", "uniform float"), Ka); ! defaultParameters.put("Ka", param); ! float[][] Kd = new float[1][]; ! Kd[0] = new float[1]; ! Kd[0][0] = 1f; ! param = new Parameter(new Declaration("Kd", "uniform float"), Kd); ! defaultParameters.put("Kd", param); } ! public void shade(ShaderVariables sv) { super.shade(sv); ! Parameter param = (Parameter) getParameter(sv, "Ka"); ! float[][] f = (float[][]) param.getData(); ! final float Ka = f[0][0]; ! param = (Parameter) getParameter(sv, "Kd"); ! f = (float[][]) param.getData(); ! final float Kd = f[0][0]; vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); --- 37,52 ---- protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Kd", "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(); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); |
From: <ma...@us...> - 2003-11-25 16:34:13
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv29833/src/org/jrman/render Modified Files: RendererHidden.java ShaderVariables.java Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** RendererHidden.java 6 Nov 2003 01:38:39 -0000 1.51 --- RendererHidden.java 25 Nov 2003 16:34:08 -0000 1.52 *************** *** 21,25 **** import java.io.File; - import java.util.HashMap; import javax.imageio.ImageIO; --- 21,24 ---- *************** *** 30,34 **** import org.jrman.attributes.Attributes; ! import org.jrman.geom.*; import org.jrman.maps.ShadowMap; import org.jrman.options.CameraProjection; --- 29,38 ---- import org.jrman.attributes.Attributes; ! import org.jrman.geom.BoundingVolume; ! import org.jrman.geom.Bounds2f; ! import org.jrman.geom.ClippingVolume; ! import org.jrman.geom.PerspectiveTransform; ! import org.jrman.geom.Plane; ! import org.jrman.geom.Transform; import org.jrman.maps.ShadowMap; import org.jrman.options.CameraProjection; *************** *** 36,39 **** --- 40,44 ---- import org.jrman.options.Filter; import org.jrman.options.Quantizer; + import org.jrman.parameters.ParameterList; import org.jrman.parser.Frame; import org.jrman.parser.Global; *************** *** 315,319 **** SurfaceShader.createShader( "fakedlight", ! new HashMap(), attr); surface.shade(shaderVariables); --- 320,324 ---- SurfaceShader.createShader( "fakedlight", ! new ParameterList(), attr); surface.shade(shaderVariables); Index: ShaderVariables.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ShaderVariables.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ShaderVariables.java 20 Aug 2003 20:41:21 -0000 1.9 --- ShaderVariables.java 25 Nov 2003 16:34:08 -0000 1.10 *************** *** 33,36 **** --- 33,37 ---- import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; + import org.jrman.parameters.ParameterList; public class ShaderVariables { *************** *** 80,84 **** public Attributes attributes; ! public Map parameters; private Map map = new HashMap(); --- 81,85 ---- public Attributes attributes; ! public ParameterList parameters; private Map map = new HashMap(); |
From: <ma...@us...> - 2003-11-25 16:34:13
|
Update of /cvsroot/jrman/drafts/src/org/jrman/sl In directory sc8-pr-cvs1:/tmp/cvs-serv29833/src/org/jrman/sl Modified Files: Tuple3fGridValue.java Log Message: Reimplemented primitive parameter lists to improve the API and use less memory. NOTE: Polygons are disabled, need to be fixed.... Index: Tuple3fGridValue.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/sl/Tuple3fGridValue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Tuple3fGridValue.java 8 Nov 2003 17:24:39 -0000 1.1 --- Tuple3fGridValue.java 25 Nov 2003 16:34:08 -0000 1.2 *************** *** 20,25 **** --- 20,28 ---- package org.jrman.sl; + import org.jrman.grid.BooleanGrid; + import org.jrman.grid.Color3fGrid; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Tuple3fGrid; + import org.jrman.grid.Vector3fGrid; public class Tuple3fGridValue extends Value { *************** *** 33,36 **** --- 36,47 ---- } + public Tuple3fGrid getCompatibleTupleGrid() { + if (value instanceof Point3fGrid) + return Point3fGrid.getInstance(); + if (value instanceof Vector3fGrid) + return Vector3fGrid.getInstance(); + return Color3fGrid.getInstance(); + } + public Tuple3fGridValue(Tuple3fGrid value) { this.value = value; *************** *** 39,42 **** --- 50,68 ---- public Tuple3fGrid getValue() { return value; + } + + public Value add(Value other, BooleanGrid cond) { + if (other instanceof Tuple3fGridValue) { + Tuple3fGrid t3fg = getCompatibleTupleGrid(); + t3fg.add(value, ((Tuple3fGridValue) other).value, cond); + return new Tuple3fGridValue(t3fg); + } + if (other instanceof Tuple3fValue) { + } + if (other instanceof FloatValue) { + } + if (other instanceof FloatGridValue) { + } + return other.reverseAdd(this, cond); } |
From: <ma...@us...> - 2003-11-25 10:45:47
|
Update of /cvsroot/jrman/drafts/src/net/falappa/swing In directory sc8-pr-cvs1:/tmp/cvs-serv18865/src/net/falappa/swing Modified Files: CheckeredPaint.java Log Message: Small fixes... (which???) Index: CheckeredPaint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/swing/CheckeredPaint.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CheckeredPaint.java 8 Oct 2003 12:24:08 -0000 1.1 --- CheckeredPaint.java 25 Nov 2003 06:00:57 -0000 1.2 *************** *** 1,72 **** ! package net.falappa.swing; ! ! import java.awt.Color; ! import java.awt.Graphics; ! import java.awt.TexturePaint; ! import java.awt.geom.Rectangle2D; ! import java.awt.image.BufferedImage; ! ! public class CheckeredPaint extends TexturePaint { ! private static final int TONE_BITMASK= 0x0f; ! private static final int SIZE_BITMASK= 0xf0; ! public static final int PRESET_LIGHT_TONE_SMALL= 0x00; ! public static final int PRESET_MID_TONE_SMALL= 0x01; ! public static final int PRESET_DARK_TONE_SMALL= 0x02; ! public static final int PRESET_LIGHT_TONE_MEDIUM= 0x10; ! public static final int PRESET_MID_TONE_MEDIUM= 0x11; ! public static final int PRESET_DARK_TONE_MEDIUM= 0x12; ! public static final int PRESET_LIGHT_TONE_LARGE= 0x20; ! public static final int PRESET_MID_TONE_LARGE= 0x21; ! public static final int PRESET_DARK_TONE_LARGE= 0x22; ! ! private void init(int squareSize, Color color1, Color color2) { ! Graphics g= getImage().getGraphics(); ! g.setColor(color1); ! g.fillRect(0, 0, squareSize, squareSize); ! g.fillRect(squareSize, squareSize, squareSize, squareSize); ! g.setColor(color2); ! g.fillRect(squareSize, 0, squareSize, squareSize); ! g.fillRect(0, squareSize, squareSize, squareSize); ! } ! ! public CheckeredPaint(int squareSize, Color color1, Color color2) { ! super( ! new BufferedImage( ! 2 * squareSize, ! 2 * squareSize, ! BufferedImage.TYPE_INT_RGB), ! new Rectangle2D.Float(0.f, 0.f, 2 * squareSize, 2 * squareSize)); ! init(squareSize, color1, color2); ! } ! ! public CheckeredPaint() { ! this(8, Color.white, Color.lightGray); ! } ! ! public static CheckeredPaint createPreset(int preset) { ! int checkSize; ! Color c1, c2; ! int i= (preset & SIZE_BITMASK) >> 4; ! if (i == 2) ! checkSize= 32; ! else if (i == 1) ! checkSize= 16; ! else ! checkSize= 8; ! i= (preset & TONE_BITMASK); ! if (i == 2) { ! c1= Color.lightGray; ! c2= Color.darkGray; ! } ! else if (i == 1) { ! c1= Color.white; ! c2= Color.gray; ! } ! else { ! c1= Color.white; ! c2= Color.lightGray; ! } ! return new CheckeredPaint(checkSize, c1, c2); ! } ! ! } --- 1,72 ---- ! package net.falappa.swing; ! ! import java.awt.Color; ! import java.awt.Graphics; ! import java.awt.TexturePaint; ! import java.awt.geom.Rectangle2D; ! import java.awt.image.BufferedImage; ! ! public class CheckeredPaint extends TexturePaint { ! private static final int TONE_BITMASK= 0x0f; ! private static final int SIZE_BITMASK= 0xf0; ! public static final int PRESET_LIGHT_TONE_SMALL= 0x00; ! public static final int PRESET_MID_TONE_SMALL= 0x01; ! public static final int PRESET_DARK_TONE_SMALL= 0x02; ! public static final int PRESET_LIGHT_TONE_MEDIUM= 0x10; ! public static final int PRESET_MID_TONE_MEDIUM= 0x11; ! public static final int PRESET_DARK_TONE_MEDIUM= 0x12; ! public static final int PRESET_LIGHT_TONE_LARGE= 0x20; ! public static final int PRESET_MID_TONE_LARGE= 0x21; ! public static final int PRESET_DARK_TONE_LARGE= 0x22; ! ! private void init(int squareSize, Color color1, Color color2) { ! Graphics g= getImage().getGraphics(); ! g.setColor(color1); ! g.fillRect(0, 0, squareSize, squareSize); ! g.fillRect(squareSize, squareSize, squareSize, squareSize); ! g.setColor(color2); ! g.fillRect(squareSize, 0, squareSize, squareSize); ! g.fillRect(0, squareSize, squareSize, squareSize); ! } ! ! public CheckeredPaint(int squareSize, Color color1, Color color2) { ! super( ! new BufferedImage( ! 2 * squareSize, ! 2 * squareSize, ! BufferedImage.TYPE_INT_RGB), ! new Rectangle2D.Float(0.f, 0.f, 2 * squareSize, 2 * squareSize)); ! init(squareSize, color1, color2); ! } ! ! public CheckeredPaint() { ! this(8, Color.white, Color.lightGray); ! } ! ! public static CheckeredPaint createPreset(int preset) { ! int checkSize; ! Color c1, c2; ! int i= (preset & SIZE_BITMASK) >> 4; ! if (i == 2) ! checkSize= 32; ! else if (i == 1) ! checkSize= 16; ! else ! checkSize= 8; ! i= (preset & TONE_BITMASK); ! if (i == 2) { ! c1= Color.lightGray; ! c2= Color.darkGray; ! } ! else if (i == 1) { ! c1= Color.white; ! c2= Color.gray; ! } ! else { ! c1= Color.white; ! c2= Color.lightGray; ! } ! return new CheckeredPaint(checkSize, c1, c2); ! } ! ! } |
From: <ma...@us...> - 2003-11-25 07:56:12
|
Update of /cvsroot/jrman/drafts/src/net/falappa/swing/widgets/res In directory sc8-pr-cvs1:/tmp/cvs-serv18865/src/net/falappa/swing/widgets/res Modified Files: JImageViewerPanel.properties JImageViewerPanel_it.properties Log Message: Small fixes... (which???) Index: JImageViewerPanel.properties =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/swing/widgets/res/JImageViewerPanel.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JImageViewerPanel.properties 8 Oct 2003 12:24:08 -0000 1.1 --- JImageViewerPanel.properties 25 Nov 2003 06:01:00 -0000 1.2 *************** *** 1,6 **** ! #Default english strings resource bundle ! bZoomToFit_ToolTipText=Fit in view ! bZoomOut_ToolTipText=Zoom out ! bNoZoom_ToolTipText=Actual pixels ! bZoomIn_ToolTipText=Zoom in ! cbZoomValue_ToolTipText=Free zoom --- 1,6 ---- ! #Default english strings resource bundle ! bZoomToFit_ToolTipText=Fit in view ! bZoomOut_ToolTipText=Zoom out ! bNoZoom_ToolTipText=Actual pixels ! bZoomIn_ToolTipText=Zoom in ! cbZoomValue_ToolTipText=Free zoom Index: JImageViewerPanel_it.properties =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/swing/widgets/res/JImageViewerPanel_it.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JImageViewerPanel_it.properties 8 Oct 2003 12:24:08 -0000 1.1 --- JImageViewerPanel_it.properties 25 Nov 2003 06:01:01 -0000 1.2 *************** *** 1,6 **** ! #Italian strings resource bundle ! bZoomToFit_ToolTipText=Adatta alla finestra ! bZoomOut_ToolTipText=Riduci ! bNoZoom_ToolTipText=Dimensioni originali ! bZoomIn_ToolTipText=Ingrandisci ! cbZoomValue_ToolTipText=Imposta fattore di zoom --- 1,6 ---- ! #Italian strings resource bundle ! bZoomToFit_ToolTipText=Adatta alla finestra ! bZoomOut_ToolTipText=Riduci ! bNoZoom_ToolTipText=Dimensioni originali ! bZoomIn_ToolTipText=Ingrandisci ! cbZoomValue_ToolTipText=Imposta fattore di zoom |
Update of /cvsroot/jrman/drafts/src/net/falappa/imageio In directory sc8-pr-cvs1:/tmp/cvs-serv18865/src/net/falappa/imageio Modified Files: ImageReaderSpiFileFilter.java ImageViewerPanelLoadAction.java ImageViewerPanelSaveAction.java ImageWriterSpiFileFilter.java Log Message: Small fixes... (which???) Index: ImageReaderSpiFileFilter.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/imageio/ImageReaderSpiFileFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImageReaderSpiFileFilter.java 8 Oct 2003 12:49:05 -0000 1.1 --- ImageReaderSpiFileFilter.java 25 Nov 2003 06:00:55 -0000 1.2 *************** *** 1,100 **** ! package net.falappa.imageio; ! ! import java.io.File; ! import java.text.MessageFormat; ! import java.util.ResourceBundle; ! ! import javax.imageio.spi.ImageReaderSpi; ! import javax.swing.filechooser.FileFilter; ! ! /** ! * A file filter based on an <code>ImageReaderSpi</code> object. ! * The file filter accepts directories and files ending with the suffixes ! * of the <code>ImageReaderSpi</code> object it is based on. ! * The file filter description is built according to the pattern below: ! * <blockquote><code> ! * <I><FORMAT NAME></I> image files (*.<I><FILE SUFFIX></I>;*.<I><FILE SUFFIX></I>;...) ! * </code></blockquote> ! * where <FORMAT NAME> is the first string between those returned by ! * <code>ImageReaderSpi.getFormatNames()</code> method and the <FILE SUFFIX>es ! * are those returned by <code>ImageReaderSpi.getFileSuffixes()</code> method. ! * Typical use is as follows: ! * <pre> ! * JFileChooser fc=new JFileChooser(); ! * IIORegistry theRegistry=IIORegistry.getDefaultInstance(); ! * Iterator it=theRegistry.getServiceProviders(ImageReaderSpi.class,false); ! * while(it.hasNext()){ ! * ImageReaderSpi reader=(ImageReaderSpi)it.next(); ! * ImageReaderSpiFileFilter ff=new ImageReaderSpiFileFilter(reader); ! * fc.addChoosableFileFilter(ff); ! * } ! * </pre> ! * The class offers utility methods to test if a string is a valid filename ! * according to the <code>ImageReaderSpi</code> object and to add such a suffix. ! * @see javax.imageio.spi.ImageReaderSpi#getFormatNames() ! * @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes() ! * @author Alessandro Falappa ! */ ! public class ImageReaderSpiFileFilter extends FileFilter { ! private String description; ! private String[] suffixes; ! private ImageReaderSpi reader; ! private static final ResourceBundle messagesBundle= ! ResourceBundle.getBundle( ! ImageViewerPanelSaveAction.class.getPackage().getName() ! + ".res.ImageSpiFileFilters"); ! ! /** ! * Create a file filter based on an image reader. ! * @param reader the ImageReaderSpi object the filter is based on ! */ ! public ImageReaderSpiFileFilter(ImageReaderSpi reader){ ! this.reader=reader; ! StringBuffer sb=new StringBuffer(); ! String template= messagesBundle.getString("ImageSpiFileFilter.image_files"); //$NON-NLS-1$ ! sb.append( ! MessageFormat.format( ! template, ! new String[] { reader.getFormatNames()[0].toUpperCase()})); ! suffixes=reader.getFileSuffixes(); ! sb.append(" (*.").append(suffixes[0]); //$NON-NLS-1$ ! for (int i = 1; i < suffixes.length; i++) ! sb.append(";*.").append(suffixes[i]); //$NON-NLS-1$ ! sb.append(')'); ! description=sb.toString(); ! } ! // implements the method of the abstract base class ! public boolean accept(File f) { ! return f.isDirectory()||hasCorrectSuffix(f.getName()); ! } ! // implements the method of the abstract base class ! public String getDescription() { ! return description; ! } ! /** ! * Tests if a string ends with one of the suffixes accepted by the image reader. ! * @param name the string to test ! * @return true if the string passes the test ! */ ! public boolean hasCorrectSuffix(String name){ ! boolean accepted=false; ! for (int i = 0; !accepted && i < suffixes.length; i++) ! accepted=accepted||name.endsWith(suffixes[i]); ! return accepted; ! } ! /** ! * Appends a suffix accepted by the image reader to the file name passed as argument. ! * @param fileName the file name to modify ! * @return a new file name ! */ ! public String addSuffix(String fileName){ ! return fileName+"."+suffixes[0]; //$NON-NLS-1$ ! } ! /** ! * Returns the imagewriter corresponding to the filter ! * @return a ImageReaderSpi object ! */ ! public ImageReaderSpi getImageReaderSpi(){ ! return reader; ! } ! } --- 1,100 ---- ! package net.falappa.imageio; ! ! import java.io.File; ! import java.text.MessageFormat; ! import java.util.ResourceBundle; ! ! import javax.imageio.spi.ImageReaderSpi; ! import javax.swing.filechooser.FileFilter; ! ! /** ! * A file filter based on an <code>ImageReaderSpi</code> object. ! * The file filter accepts directories and files ending with the suffixes ! * of the <code>ImageReaderSpi</code> object it is based on. ! * The file filter description is built according to the pattern below: ! * <blockquote><code> ! * <I><FORMAT NAME></I> image files (*.<I><FILE SUFFIX></I>;*.<I><FILE SUFFIX></I>;...) ! * </code></blockquote> ! * where <FORMAT NAME> is the first string between those returned by ! * <code>ImageReaderSpi.getFormatNames()</code> method and the <FILE SUFFIX>es ! * are those returned by <code>ImageReaderSpi.getFileSuffixes()</code> method. ! * Typical use is as follows: ! * <pre> ! * JFileChooser fc=new JFileChooser(); ! * IIORegistry theRegistry=IIORegistry.getDefaultInstance(); ! * Iterator it=theRegistry.getServiceProviders(ImageReaderSpi.class,false); ! * while(it.hasNext()){ ! * ImageReaderSpi reader=(ImageReaderSpi)it.next(); ! * ImageReaderSpiFileFilter ff=new ImageReaderSpiFileFilter(reader); ! * fc.addChoosableFileFilter(ff); ! * } ! * </pre> ! * The class offers utility methods to test if a string is a valid filename ! * according to the <code>ImageReaderSpi</code> object and to add such a suffix. ! * @see javax.imageio.spi.ImageReaderSpi#getFormatNames() ! * @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes() ! * @author Alessandro Falappa ! */ ! public class ImageReaderSpiFileFilter extends FileFilter { ! private String description; ! private String[] suffixes; ! private ImageReaderSpi reader; ! private static final ResourceBundle messagesBundle= ! ResourceBundle.getBundle( ! ImageViewerPanelSaveAction.class.getPackage().getName() ! + ".res.ImageSpiFileFilters"); ! ! /** ! * Create a file filter based on an image reader. ! * @param reader the ImageReaderSpi object the filter is based on ! */ ! public ImageReaderSpiFileFilter(ImageReaderSpi reader){ ! this.reader=reader; ! StringBuffer sb=new StringBuffer(); ! String template= messagesBundle.getString("ImageSpiFileFilter.image_files"); //$NON-NLS-1$ ! sb.append( ! MessageFormat.format( ! template, ! new String[] { reader.getFormatNames()[0].toUpperCase()})); ! suffixes=reader.getFileSuffixes(); ! sb.append(" (*.").append(suffixes[0]); //$NON-NLS-1$ ! for (int i = 1; i < suffixes.length; i++) ! sb.append(";*.").append(suffixes[i]); //$NON-NLS-1$ ! sb.append(')'); ! description=sb.toString(); ! } ! // implements the method of the abstract base class ! public boolean accept(File f) { ! return f.isDirectory()||hasCorrectSuffix(f.getName()); ! } ! // implements the method of the abstract base class ! public String getDescription() { ! return description; ! } ! /** ! * Tests if a string ends with one of the suffixes accepted by the image reader. ! * @param name the string to test ! * @return true if the string passes the test ! */ ! public boolean hasCorrectSuffix(String name){ ! boolean accepted=false; ! for (int i = 0; !accepted && i < suffixes.length; i++) ! accepted=accepted||name.endsWith(suffixes[i]); ! return accepted; ! } ! /** ! * Appends a suffix accepted by the image reader to the file name passed as argument. ! * @param fileName the file name to modify ! * @return a new file name ! */ ! public String addSuffix(String fileName){ ! return fileName+"."+suffixes[0]; //$NON-NLS-1$ ! } ! /** ! * Returns the imagewriter corresponding to the filter ! * @return a ImageReaderSpi object ! */ ! public ImageReaderSpi getImageReaderSpi(){ ! return reader; ! } ! } Index: ImageViewerPanelLoadAction.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/imageio/ImageViewerPanelLoadAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImageViewerPanelLoadAction.java 8 Oct 2003 12:49:05 -0000 1.1 --- ImageViewerPanelLoadAction.java 25 Nov 2003 06:00:55 -0000 1.2 *************** *** 1,135 **** ! //Chicchi ! //Copyright © 2003, Alessandro Falappa ! // ! //Contact: ale...@fa... ! // ! //This library 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 library 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 library; if not, write to the Free Software ! //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! ! package net.falappa.imageio; ! ! import java.awt.event.ActionEvent; ! import java.awt.image.BufferedImage; ! import java.io.File; ! import java.io.IOException; ! import java.util.Iterator; ! import java.util.ResourceBundle; ! ! import javax.imageio.ImageIO; ! import javax.imageio.ImageReadParam; ! import javax.imageio.ImageReader; ! import javax.imageio.spi.IIORegistry; ! import javax.imageio.spi.ImageReaderSpi; ! import javax.imageio.stream.ImageInputStream; ! import javax.swing.AbstractAction; ! import javax.swing.JFileChooser; ! import javax.swing.JOptionPane; ! import javax.swing.UIManager; ! ! import net.falappa.swing.widgets.JImageViewerPanel; ! ! /** ! * A user <code>Action</code> to add to a <code>JimageViewerPanel</code> to load ! * an image trough the Java ImageIO API. ! * Vanilla Java2 SDK 1.4.1 support reading GIF, JPEG and PNG file formats. ! * By installing the Java Advanced Imaging ImageIO codecs more formats become ! * available. ! * @see JImageViewerPanel ! * ! * @author Alessandro Falappa ! */ ! public class ImageViewerPanelLoadAction extends AbstractAction { ! private JImageViewerPanel viewerPanel; ! private static final ResourceBundle messagesBundle= ! ResourceBundle.getBundle( ! ImageViewerPanelSaveAction.class.getPackage().getName() ! + ".res.ImageViewerPanelActions"); ! private JFileChooser fc; ! ! /** ! * Constructs and initializes this object ! * @param viewerPanel the <code>JImageViewerPanel</code> this action is linked to ! */ ! public ImageViewerPanelLoadAction(JImageViewerPanel viewerPanel) { ! super(messagesBundle.getString("ImageViewerPanelLoadAction.Load_2")); //$NON-NLS-1$ ! this.viewerPanel= viewerPanel; ! putValue(SHORT_DESCRIPTION, messagesBundle.getString("ImageViewerPanelLoadAction.Load_image_from_file_3")); //$NON-NLS-1$ ! putValue(SMALL_ICON, UIManager.getIcon("Tree.openIcon")); //$NON-NLS-1$ ! } ! ! /* (non-Javadoc) ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! if (fc == null) { ! fc= new JFileChooser(); ! fc.setAcceptAllFileFilterUsed(false); ! fc.setFileSelectionMode(JFileChooser.FILES_ONLY); ! fc.setMultiSelectionEnabled(false); ! fc.setDialogTitle(messagesBundle.getString("ImageViewerPanelLoadAction.Choose_filename_to_load_5")); //$NON-NLS-1$ ! // prepare file filters ! IIORegistry theRegistry= IIORegistry.getDefaultInstance(); ! Iterator it= ! theRegistry.getServiceProviders(ImageReaderSpi.class, false); ! while (it.hasNext()) { ! ImageReaderSpi reader= (ImageReaderSpi)it.next(); ! ImageReaderSpiFileFilter ff= ! new ImageReaderSpiFileFilter(reader); ! fc.addChoosableFileFilter(ff); ! } ! } ! if (fc.showOpenDialog(viewerPanel) == JFileChooser.APPROVE_OPTION) { ! File selectedFile= fc.getSelectedFile(); ! if (selectedFile != null && selectedFile.exists()) { ! //String fileName= selectedFile.getAbsolutePath(); ! ImageReaderSpiFileFilter ff= ! (ImageReaderSpiFileFilter)fc.getFileFilter(); ! readFromFile(selectedFile, ff); ! } ! } ! } ! ! /** ! * @param selectedFile ! * @param ff ! */ ! private void readFromFile(File selectedFile, ImageReaderSpiFileFilter ff) { ! try { ! ImageInputStream iis= ImageIO.createImageInputStream(selectedFile); ! ImageReader ir= ff.getImageReaderSpi().createReaderInstance(); ! ir.setInput(iis); ! // preparing a destination bufferedimage of type INT_RGB will make ! // scrolling and zooming faster (at least on Win2k) ! int idx= ir.getMinIndex(); ! BufferedImage bufferedImage= ! new BufferedImage( ! ir.getWidth(idx), ! ir.getHeight(idx), ! BufferedImage.TYPE_INT_RGB); ! ImageReadParam irp= ir.getDefaultReadParam(); ! irp.setDestination(bufferedImage); ! bufferedImage= ir.read(idx,irp); ! viewerPanel.setImage(bufferedImage); ! ir.dispose(); ! iis.close(); ! } ! catch (IOException ioe) { ! JOptionPane.showMessageDialog(viewerPanel, messagesBundle.getString("ImageViewerPanelLoadAction.Error_during_image_loading_7"), //$NON-NLS-1$ ! messagesBundle.getString("ImageViewerPanelLoadAction.Error_8"), //$NON-NLS-1$ ! JOptionPane.ERROR_MESSAGE); ! ioe.printStackTrace(); ! } ! } ! ! } --- 1,135 ---- ! //Chicchi ! //Copyright © 2003, Alessandro Falappa ! // ! //Contact: ale...@fa... ! // ! //This library 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 library 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 library; if not, write to the Free Software ! //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! ! package net.falappa.imageio; ! ! import java.awt.event.ActionEvent; ! import java.awt.image.BufferedImage; ! import java.io.File; ! import java.io.IOException; ! import java.util.Iterator; ! import java.util.ResourceBundle; ! ! import javax.imageio.ImageIO; ! import javax.imageio.ImageReadParam; ! import javax.imageio.ImageReader; ! import javax.imageio.spi.IIORegistry; ! import javax.imageio.spi.ImageReaderSpi; ! import javax.imageio.stream.ImageInputStream; ! import javax.swing.AbstractAction; ! import javax.swing.JFileChooser; ! import javax.swing.JOptionPane; ! import javax.swing.UIManager; ! ! import net.falappa.swing.widgets.JImageViewerPanel; ! ! /** ! * A user <code>Action</code> to add to a <code>JimageViewerPanel</code> to load ! * an image trough the Java ImageIO API. ! * Vanilla Java2 SDK 1.4.1 support reading GIF, JPEG and PNG file formats. ! * By installing the Java Advanced Imaging ImageIO codecs more formats become ! * available. ! * @see JImageViewerPanel ! * ! * @author Alessandro Falappa ! */ ! public class ImageViewerPanelLoadAction extends AbstractAction { ! private JImageViewerPanel viewerPanel; ! private static final ResourceBundle messagesBundle= ! ResourceBundle.getBundle( ! ImageViewerPanelSaveAction.class.getPackage().getName() ! + ".res.ImageViewerPanelActions"); ! private JFileChooser fc; ! ! /** ! * Constructs and initializes this object ! * @param viewerPanel the <code>JImageViewerPanel</code> this action is linked to ! */ ! public ImageViewerPanelLoadAction(JImageViewerPanel viewerPanel) { ! super(messagesBundle.getString("ImageViewerPanelLoadAction.Load_2")); //$NON-NLS-1$ ! this.viewerPanel= viewerPanel; ! putValue(SHORT_DESCRIPTION, messagesBundle.getString("ImageViewerPanelLoadAction.Load_image_from_file_3")); //$NON-NLS-1$ ! putValue(SMALL_ICON, UIManager.getIcon("Tree.openIcon")); //$NON-NLS-1$ ! } ! ! /* (non-Javadoc) ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! if (fc == null) { ! fc= new JFileChooser(); ! fc.setAcceptAllFileFilterUsed(false); ! fc.setFileSelectionMode(JFileChooser.FILES_ONLY); ! fc.setMultiSelectionEnabled(false); ! fc.setDialogTitle(messagesBundle.getString("ImageViewerPanelLoadAction.Choose_filename_to_load_5")); //$NON-NLS-1$ ! // prepare file filters ! IIORegistry theRegistry= IIORegistry.getDefaultInstance(); ! Iterator it= ! theRegistry.getServiceProviders(ImageReaderSpi.class, false); ! while (it.hasNext()) { ! ImageReaderSpi reader= (ImageReaderSpi)it.next(); ! ImageReaderSpiFileFilter ff= ! new ImageReaderSpiFileFilter(reader); ! fc.addChoosableFileFilter(ff); ! } ! } ! if (fc.showOpenDialog(viewerPanel) == JFileChooser.APPROVE_OPTION) { ! File selectedFile= fc.getSelectedFile(); ! if (selectedFile != null && selectedFile.exists()) { ! //String fileName= selectedFile.getAbsolutePath(); ! ImageReaderSpiFileFilter ff= ! (ImageReaderSpiFileFilter)fc.getFileFilter(); ! readFromFile(selectedFile, ff); ! } ! } ! } ! ! /** ! * @param selectedFile ! * @param ff ! */ ! private void readFromFile(File selectedFile, ImageReaderSpiFileFilter ff) { ! try { ! ImageInputStream iis= ImageIO.createImageInputStream(selectedFile); ! ImageReader ir= ff.getImageReaderSpi().createReaderInstance(); ! ir.setInput(iis); ! // preparing a destination bufferedimage of type INT_RGB will make ! // scrolling and zooming faster (at least on Win2k) ! int idx= ir.getMinIndex(); ! BufferedImage bufferedImage= ! new BufferedImage( ! ir.getWidth(idx), ! ir.getHeight(idx), ! BufferedImage.TYPE_INT_RGB); ! ImageReadParam irp= ir.getDefaultReadParam(); ! irp.setDestination(bufferedImage); ! bufferedImage= ir.read(idx,irp); ! viewerPanel.setImage(bufferedImage); ! ir.dispose(); ! iis.close(); ! } ! catch (IOException ioe) { ! JOptionPane.showMessageDialog(viewerPanel, messagesBundle.getString("ImageViewerPanelLoadAction.Error_during_image_loading_7"), //$NON-NLS-1$ ! messagesBundle.getString("ImageViewerPanelLoadAction.Error_8"), //$NON-NLS-1$ ! JOptionPane.ERROR_MESSAGE); ! ioe.printStackTrace(); ! } ! } ! ! } Index: ImageViewerPanelSaveAction.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/imageio/ImageViewerPanelSaveAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ImageViewerPanelSaveAction.java 21 Oct 2003 01:58:40 -0000 1.2 --- ImageViewerPanelSaveAction.java 25 Nov 2003 06:00:55 -0000 1.3 *************** *** 1,170 **** ! //Chicchi ! //Copyright © 2003, Alessandro Falappa ! // ! //Contact: ale...@fa... ! // ! //This library 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 library 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 library; if not, write to the Free Software ! //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! ! package net.falappa.imageio; ! ! import java.awt.Image; ! import java.awt.event.ActionEvent; ! import java.awt.image.BufferedImage; ! import java.io.File; ! import java.io.IOException; ! import java.text.MessageFormat; ! import java.util.Iterator; ! import java.util.ResourceBundle; ! ! import javax.imageio.IIOImage; ! import javax.imageio.ImageIO; ! import javax.imageio.ImageWriteParam; ! import javax.imageio.ImageWriter; ! import javax.imageio.spi.IIORegistry; ! import javax.imageio.spi.ImageWriterSpi; ! import javax.imageio.stream.ImageOutputStream; ! import javax.swing.AbstractAction; ! import javax.swing.JFileChooser; ! import javax.swing.JOptionPane; ! import javax.swing.UIManager; ! ! import net.falappa.swing.widgets.JImageViewerPanel; ! ! /** ! * A user <code>Action</code> to add to a <code>JimageViewerPanel</code> to save ! * the currently displayed image trough the Java ImageIO API. ! * Vanilla Java2 SDK 1.4.1 support writing JPEG and PNG file formats. By installing ! * the Java Advanced Imaging ImageIO codecs more formats become available. ! * @see JImageViewerPanel ! * ! * @author Alessandro Falappa ! */ ! public class ImageViewerPanelSaveAction extends AbstractAction { ! private JImageViewerPanel viewerPanel; ! private int imageType; ! private static final ResourceBundle messagesBundle= ! ResourceBundle.getBundle(ImageViewerPanelSaveAction.class.getPackage().getName() ! + ".res.ImageViewerPanelActions"); ! private JFileChooser fc; ! ! /** ! * Constructs and initializes this object ! * @param viewerPanel the <code>JImageViewerPanel</code> this action is linked to ! */ ! public ImageViewerPanelSaveAction(JImageViewerPanel viewerPanel,int imageType){ ! super(messagesBundle.getString("ImageViewerPanelSaveAction.Save_1")); //$NON-NLS-1$ ! assert viewerPanel!=null; ! this.imageType = imageType; ! this.viewerPanel= viewerPanel; ! putValue(SHORT_DESCRIPTION, ! messagesBundle.getString("ImageViewerPanelSaveAction.Save_image_to_file_2")); ! //$NON-NLS-1$ ! putValue(SMALL_ICON, UIManager.getIcon("FileView.floppyDriveIcon")); //$NON-NLS-1$ ! } ! ! /* (non-Javadoc) ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! if (fc == null) { ! fc= new JFileChooser(); ! fc.setAcceptAllFileFilterUsed(false); ! fc.setFileSelectionMode(JFileChooser.FILES_ONLY); ! fc.setMultiSelectionEnabled(false); ! fc.setDialogTitle(messagesBundle.getString ! ("ImageViewerPanelSaveAction.Choose_filename_to_save_4")); ! //$NON-NLS-1$ ! ! // prepare file filters ! IIORegistry theRegistry= IIORegistry.getDefaultInstance(); ! Iterator it= ! theRegistry.getServiceProviders(ImageWriterSpi.class, false); ! while (it.hasNext()) { ! ImageWriterSpi writer= (ImageWriterSpi)it.next(); ! if((imageType == BufferedImage.TYPE_INT_ARGB ! || imageType == BufferedImage.TYPE_INT_ARGB_PRE) && ! "JPEG".equals(writer.getFormatNames()[0].toUpperCase())) ! continue; ! ImageWriterSpiFileFilter ff= new ImageWriterSpiFileFilter(writer); ! fc.addChoosableFileFilter(ff); ! } ! } ! if (fc.showSaveDialog(viewerPanel) == JFileChooser.APPROVE_OPTION) { ! File selectedFile= fc.getSelectedFile(); ! if (selectedFile != null) { ! String fileName= selectedFile.getAbsolutePath(); ! ImageWriterSpiFileFilter ff= ! (ImageWriterSpiFileFilter)fc.getFileFilter(); ! if (!ff.hasCorrectSuffix(fileName)) ! fileName= ff.addSuffix(fileName); ! selectedFile= new File(fileName); ! if (selectedFile.exists()) { ! String message = MessageFormat.format ! (messagesBundle ! .getString("ImageViewerPanelSaveAction.Overwrite_question_5"), ! //$NON-NLS-1$ ! new String[] { fileName }); ! if (JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog ! (viewerPanel, message, ! messagesBundle.getString("ImageViewerPanelSaveAction.Warning_6"), ! //$NON-NLS-1$ ! JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)) ! return; ! } ! writeToFile(selectedFile, ff); ! } ! } ! } ! ! private void writeToFile(File selectedFile, ImageWriterSpiFileFilter ff) { ! try { ! ImageOutputStream ios= ! ImageIO.createImageOutputStream(selectedFile); ! ImageWriter iw= ff.getImageWriterSpi().createWriterInstance(); ! iw.setOutput(ios); ! ImageWriteParam iwp= iw.getDefaultWriteParam(); ! if (iwp.canWriteCompressed()) { ! iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); ! // set maximum image quality ! iwp.setCompressionQuality(1.f); ! } ! Image image= viewerPanel.getImage(); ! BufferedImage bufferedImage; ! if (viewerPanel.getImage() instanceof BufferedImage) ! bufferedImage= (BufferedImage)viewerPanel.getImage(); ! else { ! bufferedImage= ! new BufferedImage( ! image.getWidth(null), ! image.getHeight(null), ! BufferedImage.TYPE_INT_RGB); ! bufferedImage.createGraphics().drawImage(image, 0, 0, null); ! } ! iw.write(null, new IIOImage(bufferedImage, null, null), iwp); ! iw.dispose(); ! ios.close(); ! } ! catch (IOException ioe) { ! JOptionPane.showMessageDialog ! (viewerPanel, messagesBundle.getString ! ("ImageViewerPanelSaveAction.Error_during_image_saving_message_7"), ! //$NON-NLS-1$ ! messagesBundle.getString("ImageViewerPanelSaveAction.Error_dialog_title_8"), ! //$NON-NLS-1$ ! JOptionPane.ERROR_MESSAGE); ! ioe.printStackTrace(); ! } ! } ! } --- 1,170 ---- ! //Chicchi ! //Copyright © 2003, Alessandro Falappa ! // ! //Contact: ale...@fa... ! // ! //This library 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 library 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 library; if not, write to the Free Software ! //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! ! package net.falappa.imageio; ! ! import java.awt.Image; ! import java.awt.event.ActionEvent; ! import java.awt.image.BufferedImage; ! import java.io.File; ! import java.io.IOException; ! import java.text.MessageFormat; ! import java.util.Iterator; ! import java.util.ResourceBundle; ! ! import javax.imageio.IIOImage; ! import javax.imageio.ImageIO; ! import javax.imageio.ImageWriteParam; ! import javax.imageio.ImageWriter; ! import javax.imageio.spi.IIORegistry; ! import javax.imageio.spi.ImageWriterSpi; ! import javax.imageio.stream.ImageOutputStream; ! import javax.swing.AbstractAction; ! import javax.swing.JFileChooser; ! import javax.swing.JOptionPane; ! import javax.swing.UIManager; ! ! import net.falappa.swing.widgets.JImageViewerPanel; ! ! /** ! * A user <code>Action</code> to add to a <code>JimageViewerPanel</code> to save ! * the currently displayed image trough the Java ImageIO API. ! * Vanilla Java2 SDK 1.4.1 support writing JPEG and PNG file formats. By installing ! * the Java Advanced Imaging ImageIO codecs more formats become available. ! * @see JImageViewerPanel ! * ! * @author Alessandro Falappa ! */ ! public class ImageViewerPanelSaveAction extends AbstractAction { ! private JImageViewerPanel viewerPanel; ! private int imageType; ! private static final ResourceBundle messagesBundle= ! ResourceBundle.getBundle(ImageViewerPanelSaveAction.class.getPackage().getName() ! + ".res.ImageViewerPanelActions"); ! private JFileChooser fc; ! ! /** ! * Constructs and initializes this object ! * @param viewerPanel the <code>JImageViewerPanel</code> this action is linked to ! */ ! public ImageViewerPanelSaveAction(JImageViewerPanel viewerPanel,int imageType){ ! super(messagesBundle.getString("ImageViewerPanelSaveAction.Save_1")); //$NON-NLS-1$ ! assert viewerPanel!=null; ! this.imageType = imageType; ! this.viewerPanel= viewerPanel; ! putValue(SHORT_DESCRIPTION, ! messagesBundle.getString("ImageViewerPanelSaveAction.Save_image_to_file_2")); ! //$NON-NLS-1$ ! putValue(SMALL_ICON, UIManager.getIcon("FileView.floppyDriveIcon")); //$NON-NLS-1$ ! } ! ! /* (non-Javadoc) ! * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) ! */ ! public void actionPerformed(ActionEvent e) { ! if (fc == null) { ! fc= new JFileChooser(); ! fc.setAcceptAllFileFilterUsed(false); ! fc.setFileSelectionMode(JFileChooser.FILES_ONLY); ! fc.setMultiSelectionEnabled(false); ! fc.setDialogTitle(messagesBundle.getString ! ("ImageViewerPanelSaveAction.Choose_filename_to_save_4")); ! //$NON-NLS-1$ ! ! // prepare file filters ! IIORegistry theRegistry= IIORegistry.getDefaultInstance(); ! Iterator it= ! theRegistry.getServiceProviders(ImageWriterSpi.class, false); ! while (it.hasNext()) { ! ImageWriterSpi writer= (ImageWriterSpi)it.next(); ! if((imageType == BufferedImage.TYPE_INT_ARGB ! || imageType == BufferedImage.TYPE_INT_ARGB_PRE) && ! "JPEG".equals(writer.getFormatNames()[0].toUpperCase())) ! continue; ! ImageWriterSpiFileFilter ff= new ImageWriterSpiFileFilter(writer); ! fc.addChoosableFileFilter(ff); ! } ! } ! if (fc.showSaveDialog(viewerPanel) == JFileChooser.APPROVE_OPTION) { ! File selectedFile= fc.getSelectedFile(); ! if (selectedFile != null) { ! String fileName= selectedFile.getAbsolutePath(); ! ImageWriterSpiFileFilter ff= ! (ImageWriterSpiFileFilter)fc.getFileFilter(); ! if (!ff.hasCorrectSuffix(fileName)) ! fileName= ff.addSuffix(fileName); ! selectedFile= new File(fileName); ! if (selectedFile.exists()) { ! String message = MessageFormat.format ! (messagesBundle ! .getString("ImageViewerPanelSaveAction.Overwrite_question_5"), ! //$NON-NLS-1$ ! new String[] { fileName }); ! if (JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog ! (viewerPanel, message, ! messagesBundle.getString("ImageViewerPanelSaveAction.Warning_6"), ! //$NON-NLS-1$ ! JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)) ! return; ! } ! writeToFile(selectedFile, ff); ! } ! } ! } ! ! private void writeToFile(File selectedFile, ImageWriterSpiFileFilter ff) { ! try { ! ImageOutputStream ios= ! ImageIO.createImageOutputStream(selectedFile); ! ImageWriter iw= ff.getImageWriterSpi().createWriterInstance(); ! iw.setOutput(ios); ! ImageWriteParam iwp= iw.getDefaultWriteParam(); ! if (iwp.canWriteCompressed()) { ! iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); ! // set maximum image quality ! iwp.setCompressionQuality(1.f); ! } ! Image image= viewerPanel.getImage(); ! BufferedImage bufferedImage; ! if (viewerPanel.getImage() instanceof BufferedImage) ! bufferedImage= (BufferedImage)viewerPanel.getImage(); ! else { ! bufferedImage= ! new BufferedImage( ! image.getWidth(null), ! image.getHeight(null), ! BufferedImage.TYPE_INT_RGB); ! bufferedImage.createGraphics().drawImage(image, 0, 0, null); ! } ! iw.write(null, new IIOImage(bufferedImage, null, null), iwp); ! iw.dispose(); ! ios.close(); ! } ! catch (IOException ioe) { ! JOptionPane.showMessageDialog ! (viewerPanel, messagesBundle.getString ! ("ImageViewerPanelSaveAction.Error_during_image_saving_message_7"), ! //$NON-NLS-1$ ! messagesBundle.getString("ImageViewerPanelSaveAction.Error_dialog_title_8"), ! //$NON-NLS-1$ ! JOptionPane.ERROR_MESSAGE); ! ioe.printStackTrace(); ! } ! } ! } Index: ImageWriterSpiFileFilter.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/imageio/ImageWriterSpiFileFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ImageWriterSpiFileFilter.java 21 Oct 2003 01:58:40 -0000 1.2 --- ImageWriterSpiFileFilter.java 25 Nov 2003 06:00:56 -0000 1.3 *************** *** 1,100 **** ! package net.falappa.imageio; ! ! import javax.swing.filechooser.*; ! import javax.imageio.spi.ImageWriterSpi; ! import java.io.File; ! import java.text.MessageFormat; ! import java.util.ResourceBundle; ! ! /** ! * A file filter based on an <code>ImageWriterSpi</code> object. ! * The file filter accepts directories and files ending with the suffixes ! * of the <code>ImageWriterSpi</code> object it is based on. ! * The file filter description is built according to the pattern below: ! * <blockquote><code> ! * <I><FORMAT NAME></I> image files (*.<I><FILE SUFFIX></I>;*.<I><FILE SUFFIX></I>;...) ! * </code></blockquote> ! * where <FORMAT NAME> is the first string between those returned by ! * <code>ImageWriterSpi.getFormatNames()</code> method and the <FILE SUFFIX>es ! * are those returned by <code>ImageWriterSpi.getFileSuffixes()</code> method. ! * Typical use is as follows: ! * <pre> ! * JFileChooser fc=new JFileChooser(); ! * IIORegistry theRegistry=IIORegistry.getDefaultInstance(); ! * Iterator it=theRegistry.getServiceProviders(ImageWriterSpi.class,false); ! * while(it.hasNext()){ ! * ImageWriterSpi writer=(ImageWriterSpi)it.next(); ! * ImageWriterSpiFileFilter ff=new ImageWriterSpiFileFilter(writer); ! * fc.addChoosableFileFilter(ff); ! * } ! * </pre> ! * The class offers utility methods to test if a string is a valid filename ! * according to the <code>ImageWriterSpi</code> object and to add such a suffix. ! * @see javax.imageio.spi.ImageWriterSpi#getFormatNames() ! * @see javax.imageio.spi.ImageWriterSpi#getFileSuffixes() ! * @author Alessandro Falappa ! */ ! public class ImageWriterSpiFileFilter extends FileFilter { ! private String description; ! private String[] suffixes; ! private ImageWriterSpi writer; ! private static final ResourceBundle messagesBundle= ! ResourceBundle.getBundle( ! ImageViewerPanelSaveAction.class.getPackage().getName() ! + ".res.ImageSpiFileFilters"); ! ! /** ! * Create a file filter based on an image writer. ! * @param writer the ImageWriterSpi object the filter is based on ! */ ! public ImageWriterSpiFileFilter(ImageWriterSpi writer) { ! this.writer= writer; ! StringBuffer sb= new StringBuffer(); ! String template= messagesBundle.getString("ImageSpiFileFilter.image_files"); //$NON-NLS-1$ ! sb.append( ! MessageFormat.format( ! template, ! new String[] { writer.getFormatNames()[0].toUpperCase()})); ! suffixes= writer.getFileSuffixes(); ! sb.append(" (*.").append(suffixes[0]); //$NON-NLS-1$ ! for (int i= 1; i < suffixes.length; i++) ! sb.append(";*.").append(suffixes[i]); //$NON-NLS-1$ ! sb.append(')'); ! description= sb.toString(); ! } ! // implements the method of the abstract base class ! public boolean accept(File f) { ! return f.isDirectory() || hasCorrectSuffix(f.getName()); ! } ! // implements the method of the abstract base class ! public String getDescription() { ! return description; ! } ! ! /** ! * Tests if a string ends with one of the suffixes accepted by the image writer. ! * @param name the string to test ! * @return true if the string passes the test ! */ ! public boolean hasCorrectSuffix(String name) { ! boolean accepted= false; ! for (int i= 0; !accepted && i < suffixes.length; i++) ! accepted= accepted || name.endsWith(suffixes[i]); ! return accepted; ! } ! /** ! * Appends a suffix accepted by the image writer to the file name passed as argument. ! * @param fileName the file name to modify ! * @return a new file name ! */ ! public String addSuffix(String fileName) { ! return fileName + "." + suffixes[0]; //$NON-NLS-1$ ! } ! /** ! * Returns the imagewriter corresponding to the filter ! * @return a ImageWriterSpi object ! */ ! public ImageWriterSpi getImageWriterSpi() { ! return writer; ! } ! } --- 1,100 ---- ! package net.falappa.imageio; ! ! import javax.swing.filechooser.*; ! import javax.imageio.spi.ImageWriterSpi; ! import java.io.File; ! import java.text.MessageFormat; ! import java.util.ResourceBundle; ! ! /** ! * A file filter based on an <code>ImageWriterSpi</code> object. ! * The file filter accepts directories and files ending with the suffixes ! * of the <code>ImageWriterSpi</code> object it is based on. ! * The file filter description is built according to the pattern below: ! * <blockquote><code> ! * <I><FORMAT NAME></I> image files (*.<I><FILE SUFFIX></I>;*.<I><FILE SUFFIX></I>;...) ! * </code></blockquote> ! * where <FORMAT NAME> is the first string between those returned by ! * <code>ImageWriterSpi.getFormatNames()</code> method and the <FILE SUFFIX>es ! * are those returned by <code>ImageWriterSpi.getFileSuffixes()</code> method. ! * Typical use is as follows: ! * <pre> ! * JFileChooser fc=new JFileChooser(); ! * IIORegistry theRegistry=IIORegistry.getDefaultInstance(); ! * Iterator it=theRegistry.getServiceProviders(ImageWriterSpi.class,false); ! * while(it.hasNext()){ ! * ImageWriterSpi writer=(ImageWriterSpi)it.next(); ! * ImageWriterSpiFileFilter ff=new ImageWriterSpiFileFilter(writer); ! * fc.addChoosableFileFilter(ff); ! * } ! * </pre> ! * The class offers utility methods to test if a string is a valid filename ! * according to the <code>ImageWriterSpi</code> object and to add such a suffix. ! * @see javax.imageio.spi.ImageWriterSpi#getFormatNames() ! * @see javax.imageio.spi.ImageWriterSpi#getFileSuffixes() ! * @author Alessandro Falappa ! */ ! public class ImageWriterSpiFileFilter extends FileFilter { ! private String description; ! private String[] suffixes; ! private ImageWriterSpi writer; ! private static final ResourceBundle messagesBundle= ! ResourceBundle.getBundle( ! ImageViewerPanelSaveAction.class.getPackage().getName() ! + ".res.ImageSpiFileFilters"); ! ! /** ! * Create a file filter based on an image writer. ! * @param writer the ImageWriterSpi object the filter is based on ! */ ! public ImageWriterSpiFileFilter(ImageWriterSpi writer) { ! this.writer= writer; ! StringBuffer sb= new StringBuffer(); ! String template= messagesBundle.getString("ImageSpiFileFilter.image_files"); //$NON-NLS-1$ ! sb.append( ! MessageFormat.format( ! template, ! new String[] { writer.getFormatNames()[0].toUpperCase()})); ! suffixes= writer.getFileSuffixes(); ! sb.append(" (*.").append(suffixes[0]); //$NON-NLS-1$ ! for (int i= 1; i < suffixes.length; i++) ! sb.append(";*.").append(suffixes[i]); //$NON-NLS-1$ ! sb.append(')'); ! description= sb.toString(); ! } ! // implements the method of the abstract base class ! public boolean accept(File f) { ! return f.isDirectory() || hasCorrectSuffix(f.getName()); ! } ! // implements the method of the abstract base class ! public String getDescription() { ! return description; ! } ! ! /** ! * Tests if a string ends with one of the suffixes accepted by the image writer. ! * @param name the string to test ! * @return true if the string passes the test ! */ ! public boolean hasCorrectSuffix(String name) { ! boolean accepted= false; ! for (int i= 0; !accepted && i < suffixes.length; i++) ! accepted= accepted || name.endsWith(suffixes[i]); ! return accepted; ! } ! /** ! * Appends a suffix accepted by the image writer to the file name passed as argument. ! * @param fileName the file name to modify ! * @return a new file name ! */ ! public String addSuffix(String fileName) { ! return fileName + "." + suffixes[0]; //$NON-NLS-1$ ! } ! /** ! * Returns the imagewriter corresponding to the filter ! * @return a ImageWriterSpi object ! */ ! public ImageWriterSpi getImageWriterSpi() { ! return writer; ! } ! } |
From: <ma...@us...> - 2003-11-25 06:29:42
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv18865/sampleData Modified Files: 4INS-Balls.rib cubeScene.rib frog.rib trumpet.rib Log Message: Small fixes... (which???) Index: 4INS-Balls.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/4INS-Balls.rib,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** 4INS-Balls.rib 17 Jul 2003 04:03:10 -0000 1.3 --- 4INS-Balls.rib 25 Nov 2003 06:00:47 -0000 1.4 *************** *** 1,6 **** ##RenderMan RIB-Structure 1.0 version 3.03 ! Display "4INS-Balls" "framebuffer" "rgb" ! Format 320 240 1 #FrameAspectRatio 1.054393 #ScreenWindow -1.581590 1.581590 -1.500000 1.500000 --- 1,6 ---- ##RenderMan RIB-Structure 1.0 version 3.03 ! Display "4INS-Balls" "framebuffer" "rgba" ! Format 800 600 1 #FrameAspectRatio 1.054393 #ScreenWindow -1.581590 1.581590 -1.500000 1.500000 *************** *** 27,34 **** Scale 10 10 10 WorldBegin ! ShadingRate .1 ! Surface "paintedplastic" "texturename" "moon.txr" "Ks" 0 ! Displacement "bumpy" "texturename" "moon.txr" "Km" .8 ! Attribute "displacementbound" "sphere" 1.6 # MoleculeID: 0 ReprID: 0 Beginning VDW #Opacity .3 .3 .3 --- 27,31 ---- Scale 10 10 10 WorldBegin ! ShadingRate 1 # MoleculeID: 0 ReprID: 0 Beginning VDW #Opacity .3 .3 .3 Index: cubeScene.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/cubeScene.rib,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** cubeScene.rib 26 May 2003 01:47:59 -0000 1.5 --- cubeScene.rib 25 Nov 2003 06:00:50 -0000 1.6 *************** *** 2,6 **** PixelSamples 4 4 Exposure 1 2.2 ! Display "cubeScene.tif" "framebuffer" "rgb" PixelFilter "box" 1 1 Projection "perspective" "fov" 50 --- 2,6 ---- PixelSamples 4 4 Exposure 1 2.2 ! Display "cubeScene.tif" "framebuffer" "rgba" PixelFilter "box" 1 1 Projection "perspective" "fov" 50 Index: frog.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/frog.rib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** frog.rib 26 May 2003 07:17:23 -0000 1.1 --- frog.rib 25 Nov 2003 06:00:52 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- # scene definitions + Display "frog" "framebuffer" "rgba" PixelSamples 4 4 Exposure 1 2.2 Index: trumpet.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/trumpet.rib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** trumpet.rib 26 May 2003 08:13:10 -0000 1.1 --- trumpet.rib 25 Nov 2003 06:00:54 -0000 1.2 *************** *** 2,6 **** version 3.03 ! Display "hama_out.tif" "file" "rgba" Format 640 480 1 PixelSamples 4 4 --- 2,6 ---- version 3.03 ! Display "hama_out.tif" "framebuffer" "rgba" Format 640 480 1 PixelSamples 4 4 |
Update of /cvsroot/jrman/drafts/src/net/falappa/imageio/res In directory sc8-pr-cvs1:/tmp/cvs-serv18865/src/net/falappa/imageio/res Modified Files: ImageSpiFileFilters.properties ImageSpiFileFilters_it.properties ImageViewerPanelActions.properties ImageViewerPanelActions_it.properties Log Message: Small fixes... (which???) Index: ImageSpiFileFilters.properties =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/imageio/res/ImageSpiFileFilters.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImageSpiFileFilters.properties 8 Oct 2003 12:49:05 -0000 1.1 --- ImageSpiFileFilters.properties 25 Nov 2003 06:00:56 -0000 1.2 *************** *** 1,2 **** ! #Default english string resource bundle for ImageReaderSpiFileFilter and ImageWriterSpiFileFilter ! ImageSpiFileFilter.image_files={0} image files --- 1,2 ---- ! #Default english string resource bundle for ImageReaderSpiFileFilter and ImageWriterSpiFileFilter ! ImageSpiFileFilter.image_files={0} image files Index: ImageSpiFileFilters_it.properties =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/imageio/res/ImageSpiFileFilters_it.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImageSpiFileFilters_it.properties 8 Oct 2003 12:49:05 -0000 1.1 --- ImageSpiFileFilters_it.properties 25 Nov 2003 06:00:56 -0000 1.2 *************** *** 1,2 **** ! #Italian string resource bundle for ImageReaderSpiFileFilter and ImageWriterSpiFileFilter ! ImageSpiFileFilter.image_files=File immagine {0} --- 1,2 ---- ! #Italian string resource bundle for ImageReaderSpiFileFilter and ImageWriterSpiFileFilter ! ImageSpiFileFilter.image_files=File immagine {0} Index: ImageViewerPanelActions.properties =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/imageio/res/ImageViewerPanelActions.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImageViewerPanelActions.properties 8 Oct 2003 12:49:05 -0000 1.1 --- ImageViewerPanelActions.properties 25 Nov 2003 06:00:56 -0000 1.2 *************** *** 1,13 **** ! #Default english string resource bundle for ImageViewerPaneSaveAction and ImageViewerPaneLoadAction ! ImageViewerPanelSaveAction.Save_1=Save ! ImageViewerPanelSaveAction.Save_image_to_file_2=Save image to file ! ImageViewerPanelSaveAction.Choose_filename_to_save_4=Choose filename to save ! ImageViewerPanelSaveAction.Overwrite_question_5=The file {0}\nalready exists. Ok to overwrite? ! ImageViewerPanelSaveAction.Warning_6=Warning ! ImageViewerPanelSaveAction.Error_during_image_saving_message_7=An error occurred during image saving\! ! ImageViewerPanelSaveAction.Error_dialog_title_8=Error ! ImageViewerPanelLoadAction.Load_2=Load ! ImageViewerPanelLoadAction.Load_image_from_file_3=Load image from file ! ImageViewerPanelLoadAction.Choose_filename_to_load_5=Choose filename to load ! ImageViewerPanelLoadAction.Error_during_image_loading_7=An error occurred during image loading\! ! ImageViewerPanelLoadAction.Error_8=Error --- 1,13 ---- ! #Default english string resource bundle for ImageViewerPaneSaveAction and ImageViewerPaneLoadAction ! ImageViewerPanelSaveAction.Save_1=Save ! ImageViewerPanelSaveAction.Save_image_to_file_2=Save image to file ! ImageViewerPanelSaveAction.Choose_filename_to_save_4=Choose filename to save ! ImageViewerPanelSaveAction.Overwrite_question_5=The file {0}\nalready exists. Ok to overwrite? ! ImageViewerPanelSaveAction.Warning_6=Warning ! ImageViewerPanelSaveAction.Error_during_image_saving_message_7=An error occurred during image saving\! ! ImageViewerPanelSaveAction.Error_dialog_title_8=Error ! ImageViewerPanelLoadAction.Load_2=Load ! ImageViewerPanelLoadAction.Load_image_from_file_3=Load image from file ! ImageViewerPanelLoadAction.Choose_filename_to_load_5=Choose filename to load ! ImageViewerPanelLoadAction.Error_during_image_loading_7=An error occurred during image loading\! ! ImageViewerPanelLoadAction.Error_8=Error Index: ImageViewerPanelActions_it.properties =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/imageio/res/ImageViewerPanelActions_it.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImageViewerPanelActions_it.properties 8 Oct 2003 12:49:05 -0000 1.1 --- ImageViewerPanelActions_it.properties 25 Nov 2003 06:00:56 -0000 1.2 *************** *** 1,13 **** ! #Italian string resource bundle for ImageViewerPaneSaveAction and ImageViewerPaneLoadAction ! ImageViewerPanelSaveAction.Save_1=Salva ! ImageViewerPanelSaveAction.Save_image_to_file_2=Salva l'immagine su file ! ImageViewerPanelSaveAction.Choose_filename_to_save_4=Scegli il nome del file dell\'immagine ! ImageViewerPanelSaveAction.Overwrite_question_5=Il file {0}\nesiste già. Sovrascriverlo? ! ImageViewerPanelSaveAction.Warning_6=Attenzione ! ImageViewerPanelSaveAction.Error_during_image_saving_message_7=Rilevato un errore durante il salvataggio\! ! ImageViewerPanelSaveAction.Error_dialog_title_8=Errore ! ImageViewerPanelLoadAction.Load_2=Apri ! ImageViewerPanelLoadAction.Load_image_from_file_3=Apri immagine da file ! ImageViewerPanelLoadAction.Choose_filename_to_load_5=Seleziona l\'immagine da aprire ! ImageViewerPanelLoadAction.Error_during_image_loading_7=Rilevato un errore durante il caricamento\! ! ImageViewerPanelLoadAction.Error_8=Errore --- 1,13 ---- ! #Italian string resource bundle for ImageViewerPaneSaveAction and ImageViewerPaneLoadAction ! ImageViewerPanelSaveAction.Save_1=Salva ! ImageViewerPanelSaveAction.Save_image_to_file_2=Salva l'immagine su file ! ImageViewerPanelSaveAction.Choose_filename_to_save_4=Scegli il nome del file dell\'immagine ! ImageViewerPanelSaveAction.Overwrite_question_5=Il file {0}\nesiste già. Sovrascriverlo? ! ImageViewerPanelSaveAction.Warning_6=Attenzione ! ImageViewerPanelSaveAction.Error_during_image_saving_message_7=Rilevato un errore durante il salvataggio\! ! ImageViewerPanelSaveAction.Error_dialog_title_8=Errore ! ImageViewerPanelLoadAction.Load_2=Apri ! ImageViewerPanelLoadAction.Load_image_from_file_3=Apri immagine da file ! ImageViewerPanelLoadAction.Choose_filename_to_load_5=Seleziona l\'immagine da aprire ! ImageViewerPanelLoadAction.Error_during_image_loading_7=Rilevato un errore durante il caricamento\! ! ImageViewerPanelLoadAction.Error_8=Errore |
From: <ma...@us...> - 2003-11-25 06:29:41
|
Update of /cvsroot/jrman/drafts/src/org/jrman/ui In directory sc8-pr-cvs1:/tmp/cvs-serv18865/src/org/jrman/ui Modified Files: Framebuffer.java Log Message: Small fixes... (which???) Index: Framebuffer.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/ui/Framebuffer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Framebuffer.java 31 Oct 2003 03:03:15 -0000 1.3 --- Framebuffer.java 25 Nov 2003 06:01:06 -0000 1.4 *************** *** 58,61 **** --- 58,62 ---- new ImageIcon(getClass().getResource("images/framebuffer_icon.png")).getImage()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + getRootPane().setDoubleBuffered(false); getContentPane().add(imagePanel); pack(); |
From: <ma...@us...> - 2003-11-25 06:29:41
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv18865/src/org/jrman/render Modified Files: Sample.java SamplePoint.java Sampler.java SimpleMicropolygon.java Log Message: Small fixes... (which???) Index: Sample.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sample.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Sample.java 3 Nov 2003 07:37:25 -0000 1.5 --- Sample.java 25 Nov 2003 06:01:02 -0000 1.6 *************** *** 60,64 **** return opacityRed== 1f && opacityGreen == 1f && opacityBlue == 1f; } ! public void overlayOver(Color3f ocolor) { ocolor.x = ocolor.x * (1f - opacityRed) + colorRed; --- 60,64 ---- return opacityRed== 1f && opacityGreen == 1f && opacityBlue == 1f; } ! public void overlayOver(Color3f ocolor) { ocolor.x = ocolor.x * (1f - opacityRed) + colorRed; *************** *** 66,70 **** ocolor.z = ocolor.z * (1f - opacityBlue) + colorBlue; } ! public float getZ() { return z; --- 66,78 ---- ocolor.z = ocolor.z * (1f - opacityBlue) + colorBlue; } ! ! /* ! public void overlayOver(float[] dst, int offset) { ! dst[offset] = dst[offset] * (1f - opacityRed) + colorRed; ! dst[offset + 1] = dst[offset + 1] * (1f - opacityGreen) + colorGreen; ! dst[offset + 2] = dst[offset + 2] * (1f - opacityBlue) + colorBlue; ! } ! */ ! public float getZ() { return z; Index: SamplePoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SamplePoint.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SamplePoint.java 6 Nov 2003 01:38:39 -0000 1.16 --- SamplePoint.java 25 Nov 2003 06:01:03 -0000 1.17 *************** *** 106,110 **** z = nz; opaque = true; ! sampler.updateDepth(column, row); } } --- 106,110 ---- z = nz; opaque = true; ! sampler.updateDepth(column, row, z); } } *************** *** 124,127 **** --- 124,144 ---- } } + + /* + public void getColor(float[] dst, int offset) { + dst[offset] = dst[offset + 1] = dst[offset + 2] = 0f; + int i = 0; + int size = samples.size(); + while (i < size) { + Sample sample = (Sample) samples.get(i++); + if (sample.isOpaque()) + break; + } + while (i > 0) { + Sample sample = (Sample) samples.get(--i); + sample.overlayOver(dst, offset); + } + } + */ public float getDepth() { Index: Sampler.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sampler.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Sampler.java 6 Nov 2003 01:38:39 -0000 1.14 --- Sampler.java 25 Nov 2003 06:01:03 -0000 1.15 *************** *** 201,205 **** } */ ! public void getColors( float[] dst, --- 201,205 ---- } */ ! public void getColors( float[] dst, *************** *** 223,226 **** --- 223,246 ---- } + /* + public void getColors( + float[] dst, + int dstOffset, + int rowLength, + int bands, + int bandOffset) { + int srcOffset = 0; + int destOffset = dstOffset + bandOffset; + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + int offset = destOffset + col * bands; + samplePoints[srcOffset + col].getColor(dst, offset); + } + srcOffset += width; + destOffset += rowLength * bands; + } + } + */ + public void getDepths(float[] depths) { for (int row = 0; row < height; row++) *************** *** 255,262 **** } ! public void updateDepth(int column, int row) { ! modified = true; MaskElement me = pixelsVisibility[row * bucketWidth + column]; ! me.modified = true; } --- 275,284 ---- } ! public void updateDepth(int column, int row, float z) { MaskElement me = pixelsVisibility[row * bucketWidth + column]; ! if (z < me.z) { ! me.modified = true; ! modified = true; ! } } Index: SimpleMicropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SimpleMicropolygon.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SimpleMicropolygon.java 13 Nov 2003 14:57:42 -0000 1.14 --- SimpleMicropolygon.java 25 Nov 2003 06:01:04 -0000 1.15 *************** *** 236,244 **** if (z < minZ) return; ! if ((ay - by) * (point.x - ax) + (bx - ax) * (point.y - ay) > 0f) return; if ((by - cy) * (point.x - bx) + (cx - bx) * (point.y - by) > 0f) return; ! if ((cy - ay) * (point.x - cx) + (ax - cx) * (point.y - cy) > 0f) return; sp.addSample( --- 236,244 ---- if (z < minZ) return; ! if ((cy - ay) * (point.x - cx) + (ax - cx) * (point.y - cy) > 0f) return; if ((by - cy) * (point.x - bx) + (cx - bx) * (point.y - by) > 0f) return; ! if ((ay - by) * (point.x - ax) + (bx - ax) * (point.y - ay) > 0f) return; sp.addSample( |
From: <ma...@us...> - 2003-11-25 06:29:41
|
Update of /cvsroot/jrman/drafts/src/net/falappa/swing/widgets In directory sc8-pr-cvs1:/tmp/cvs-serv18865/src/net/falappa/swing/widgets Modified Files: JImageViewerPanel.java Log Message: Small fixes... (which???) Index: JImageViewerPanel.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/net/falappa/swing/widgets/JImageViewerPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JImageViewerPanel.java 21 Oct 2003 01:58:40 -0000 1.2 --- JImageViewerPanel.java 25 Nov 2003 06:00:58 -0000 1.3 *************** *** 1,875 **** ! //Chicchi ! //Copyright © 2003, Alessandro Falappa ! // ! //Contact: ale...@fa... ! // ! //This library 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. ! // [...1721 lines suppressed...] ! // method of Scrollable interface ! public boolean getScrollableTracksViewportHeight() { ! return false; ! } ! ! /** ! * @return ! */ ! public boolean isShowTransparency() { ! return showTransparency; ! } ! ! /** ! * @param b ! */ ! public void setShowTransparency(boolean b) { ! showTransparency= b; ! } ! ! } |
From: <ma...@us...> - 2003-11-13 15:05:59
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv32294/src/org/jrman/render Modified Files: Micropolygon.java SimpleMicropolygon.java Log Message: More speed Index: Micropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Micropolygon.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Micropolygon.java 6 Nov 2003 01:38:39 -0000 1.15 --- Micropolygon.java 13 Nov 2003 14:57:42 -0000 1.16 *************** *** 26,30 **** import org.jrman.util.Constants; ! public abstract class Micropolygon implements Comparable { public static int count; --- 26,30 ---- import org.jrman.util.Constants; ! public abstract class Micropolygon { public static int count; Index: SimpleMicropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SimpleMicropolygon.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SimpleMicropolygon.java 13 Nov 2003 01:40:34 -0000 1.13 --- SimpleMicropolygon.java 13 Nov 2003 14:57:42 -0000 1.14 *************** *** 222,227 **** for (int col = minColumn; col <= maxColumn; col++) { SamplePoint sp = sampler.getSamplePoint(col, row); - if (sp.isOpaque() && sp.getZ() < minZ) - continue; sampleAtPoint(sp); } --- 222,225 ---- *************** *** 233,236 **** --- 231,236 ---- if (point.x < minX || point.x > maxX || point.y < minY || point.y > maxY) return; + if (sp.isOpaque() && sp.getZ() < minZ) + return; float z = nxOverZ * (ax - point.x) + nyOverZ * (ay - point.y) + az; if (z < minZ) *************** *** 251,263 **** z); return; - } - - public int compareTo(Object other) { - Micropolygon mp = (Micropolygon) other; - if (maxX < mp.getMaxX()) - return -1; - if (maxX > mp.getMaxX()) - return 1; - return 0; } --- 251,254 ---- |
From: <ma...@us...> - 2003-11-13 01:40:40
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv27141/sampleData Modified Files: jrm.bat Log Message: Small speed improvement. Index: jrm.bat =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/jrm.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** jrm.bat 6 Nov 2003 01:38:39 -0000 1.1 --- jrm.bat 13 Nov 2003 01:40:33 -0000 1.2 *************** *** 4,6 **** set MEMORY=384m ! java -server -Xprof -Xms%MEMORY% -Xmx%MEMORY% org.jrman.main.JRMan %* --- 4,6 ---- set MEMORY=384m ! java -server -Xms%MEMORY% -Xmx%MEMORY% org.jrman.main.JRMan %* |