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
|
Update of /cvsroot/jrman/drafts/src/org/jrman/geom In directory sc8-pr-cvs1:/tmp/cvs-serv515/src/org/jrman/geom Added Files: PerspectiveTransform.java Bounds3f.java Transform.java AffineTransform.java Bounds2f.java Log Message: Reorganized packages. Fixed misc. errors. --- NEW FILE: PerspectiveTransform.java --- /* PerspectiveTransform.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.geom; import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; import javax.vecmath.Point4f; public class PerspectiveTransform extends AffineTransform { protected PerspectiveTransform(Matrix4f matrix) { super(matrix); } public PerspectiveTransform(float fov, float near, float far) { super( new Matrix4f( 1f, 0f, 0f, 0f, 0f, 1f, 0f, 1f, 0f, 0f, (fovToH(fov) * far) / (near * (far - near)), fovToH(fov) / near, 0f, 0f, - (fovToH(fov) * far) / (far - near), 0f)); } private static float fovToH(float fov) { return (float) Math.tan(fov * Math.PI / 360f); } public Transform getCopy() { return new PerspectiveTransform(getMatrix()); } public Transform concat(Matrix4f m) { Matrix4f matrix = getMatrix(); matrix.mul(m); return new PerspectiveTransform(matrix); } public Transform concat(Transform transform) { Matrix4f matrix = getMatrix(); matrix.mul(transform.getMatrix()); return new PerspectiveTransform(matrix); } public Transform preConcat(Transform transform) { Transform perspective = new PerspectiveTransform(transform.getMatrix()); return perspective.concat(this); } public void transformPoint(Point3f point) { Point4f hpoint = new Point4f(point); transformHPoint(hpoint); point.project(hpoint); } } --- NEW FILE: Bounds3f.java --- /* Bounds3f.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.geom; import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; public class Bounds3f { private Point3f max; private Point3f min; public Bounds3f() { this( Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY); } public Bounds3f(float xMin, float xMax, float yMin, float yMax, float zMin, float zMax) { min = new Point3f(xMin, yMin, zMin); max = new Point3f(xMax, yMax, zMax); } public Bounds3f(Point3f newMin, Point3f newMax) { min = new Point3f(newMin); max = new Point3f(newMax); } public Bounds3f transform(Matrix4f transform){ Point3f newMin = new Point3f(); Point3f newMax = new Point3f(); transform.transform(min, newMin); transform.transform(max, newMax); return new Bounds3f(newMin, newMax); } public Point3f getMax() { return new Point3f(max); } public Point3f getMin(){ return new Point3f(min); } } --- NEW FILE: Transform.java --- /* Transform.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.geom; import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; import javax.vecmath.Point4f; import javax.vecmath.Vector3f; public interface Transform { Transform getCopy(); Transform concat(Transform transform); Transform concat(Matrix4f matrix); void transformPoint(Point3f point); void transformHPoint(Point4f hpoint); void transformVector(Vector3f vector); void transformNormal(Vector3f normal); void untransformPoint(Point3f point); void untransformHPoint(Point4f hpoint); void untransformVector(Vector3f vector); void untransformNormal(Vector3f normal); Matrix4f getMatrix(); } --- NEW FILE: AffineTransform.java --- /* AffineTransform.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.geom; import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; import javax.vecmath.Point4f; import javax.vecmath.Vector3f; public class AffineTransform implements Transform { public static final AffineTransform IDENTITY; static { Matrix4f identity = new Matrix4f(); identity.setIdentity(); IDENTITY = new AffineTransform(identity); } private Matrix4f matrix; private Matrix4f inverseMatrix; private Matrix4f normalsMatrix; private Matrix4f inverseNormalsMatrix; protected AffineTransform(Matrix4f matrix) { this.matrix = new Matrix4f(matrix); } protected AffineTransform(Transform transform) { this(transform.getMatrix()); } public Transform getCopy(){ return new AffineTransform(this); } public Transform concat(Transform transform) { Matrix4f matrix = getMatrix(); matrix.mul(transform.getMatrix()); return new AffineTransform(matrix); } public Transform concat(Matrix4f m){ Matrix4f matrix = getMatrix(); matrix.mul(m); return new AffineTransform(matrix); } public void transformPoint(Point3f point) { matrix.transform(point); } public void transformHPoint(Point4f hpoint) { matrix.transform(hpoint); } public void transformVector(Vector3f vector) { matrix.transform(vector); } public void transformNormal(Vector3f normal) { getNormalsMatrix().transform(normal); } public void untransformPoint(Point3f point) { getInverseMatrix().transform(point); } public void untransformHPoint(Point4f hpoint) { getInverseMatrix().transform(hpoint); } public void untransformVector(Vector3f vector) { getInverseMatrix().transform(vector); } public void untransformNormal(Vector3f normal) { getInverseNormalsMatrix().transform(normal); } public Matrix4f getMatrix() { return new Matrix4f(matrix); } protected Matrix4f getInverseMatrix() { if (inverseMatrix == null) { inverseMatrix = new Matrix4f(matrix); inverseMatrix.invert(); } return inverseMatrix; } protected Matrix4f getNormalsMatrix() { if (normalsMatrix == null) { normalsMatrix = new Matrix4f(getInverseMatrix()); normalsMatrix.transpose(); } return normalsMatrix; } protected Matrix4f getInverseNormalsMatrix() { if (inverseNormalsMatrix == null) { inverseNormalsMatrix = new Matrix4f(getNormalsMatrix()); inverseNormalsMatrix.invert(); } return inverseNormalsMatrix; } } --- NEW FILE: Bounds2f.java --- /* Bounds2f.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.geom; import javax.vecmath.Point2f; public class Bounds2f { private Point2f max; private Point2f min; public Bounds2f() { this( Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY); } public Bounds2f(float xMin, float xMax, float yMin, float yMax) { min = new Point2f(xMin, yMin); max = new Point2f(xMax, yMax); } public Bounds2f(Point2f min, Point2f max) { this.min = new Point2f(min); this.max = new Point2f(max); } public Point2f getMax() { return new Point2f(max); } public Point2f getMin() { return new Point2f(min); } } |
Update of /cvsroot/jrman/drafts/src/org/jrman/options In directory sc8-pr-cvs1:/tmp/cvs-serv515/src/org/jrman/options Added Files: Quantizer.java Filter.java Display.java CameraProjection.java Imager.java Exposure.java Hider.java Options.java Log Message: Reorganized packages. Fixed misc. errors. --- NEW FILE: Quantizer.java --- /* Quantizer.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.options; public class Quantizer { private float ditherAmplitude; private int max; private int min; private int one; public Quantizer(int one, int min, int max, float ditherAmplitude) { this.one = one; this.min = min; this.max = max; this.ditherAmplitude = ditherAmplitude; } public float getDitherAmplitude() { return ditherAmplitude; } public int getMax() { return max; } public int getMin() { return min; } public int getOne() { return one; } } --- NEW FILE: Filter.java --- /* Filter.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.options; import java.util.HashMap; import java.util.Map; public class Filter { private Type type; private float horizontalWidth; private float verticalWidth; public static class Type { public final static Type BOX = new Type("box"); public final static Type TRIANGLE = new Type("triangle"); public final static Type CATMULL_ROM = new Type("catmull-rom"); public final static Type SINC = new Type("sinc"); public final static Type GAUSSIAN = new Type("gaussian"); private static Map map = new HashMap(); static { map.put("box", BOX); map.put("triangle", TRIANGLE); map.put("catmull-rom", CATMULL_ROM); map.put("sinc", SINC); map.put("gaussian", GAUSSIAN); } private String name; private Type(String name) { this.name = name; } public static Type getNamed(String name) { Type result = (Type) map.get(name); if (result == null) throw new IllegalArgumentException("no such filter type: " + name); return result; } public String toString() { return name; } } public Filter(Type type, float horizontalWidth, float verticalWidth) { this.type = type; this.horizontalWidth = horizontalWidth; this.verticalWidth = verticalWidth; } public float getHorizontalWidth() { return horizontalWidth; } public Type getType() { return type; } public float getVerticalWidth() { return verticalWidth; } } --- NEW FILE: Display.java --- /* Display.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.options; import java.util.HashMap; import java.util.Map; public class Display { private Mode mode; private Type type; private String name; public static class Type { public final static Type FRAMEBUFFER = new Type("framebuffer"); public final static Type FILE = new Type("file"); private String name; private static Map map = new HashMap(); static { map.put("framebuffer", FRAMEBUFFER); map.put("file", FILE); } private Type(String name) { this.name = name; } public String toString() { return name; } public static Type getNamed(String name) { Type result = (Type) map.get(name); if (name == null) throw new IllegalArgumentException("no such display type: " + name); return result; } } public static class Mode { public final static Mode RGBA = new Mode("rgba"); public final static Mode RGB = new Mode("rgb"); public final static Mode Z = new Mode("z"); public final static Mode A = new Mode("a"); private static Map map = new HashMap(); static { map.put("rgba", RGBA); map.put("rgb", RGB); map.put("z", Z); map.put("a", A); } private String name; private Mode(String name) { this.name = name; } public static Mode getNamed(String name) { Mode result = (Mode) map.get(name); if (result == null) throw new IllegalArgumentException("no such display mode: " + name); return result; } public String toString() { return name; } } public Display(String name, Type type, Mode mode) { this.name = name; this.type = type; this.mode = mode; } public Mode getMode() { return mode; } public String getName() { return name; } public Type getType() { return type; } } --- NEW FILE: CameraProjection.java --- /* CameraProjection.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.options; import java.util.HashMap; import java.util.Map; public class CameraProjection { public final static CameraProjection ORTHOGRAPHIC = new CameraProjection("orthographic"); public final static CameraProjection PERSPECTIVE = new CameraProjection("perspective"); private static Map map = new HashMap(); static { map.put("orthographic", ORTHOGRAPHIC); map.put("perspective", PERSPECTIVE); } private String name; private CameraProjection(String name){ this.name = name; } public final static CameraProjection getNamed(String name){ CameraProjection result = (CameraProjection) map.get(name); if (result == null) throw new IllegalArgumentException("no such projection: " + name); return result; } public String toString() { return name; } } --- NEW FILE: Imager.java --- /* Imager.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.options; public interface Imager { } --- NEW FILE: Exposure.java --- /* Exposure.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.options; public class Exposure { private float gain; private float gamma; public Exposure(float gain, float gamma) { this.gain = gain; this.gamma = gamma; } public float getGain() { return gain; } public float getGamma() { return gamma; } } --- NEW FILE: Hider.java --- /* Hider.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.options; import java.util.HashMap; import java.util.Map; public class Hider { public static final Hider HIDDEN = new Hider("hidden"); public static final Hider NULL = new Hider("null"); private String name; private static Map map = new HashMap(); static { map.put("hidden", HIDDEN); map.put("null", NULL); } private Hider(String name) { this.name = name; } public static Hider getNamed(String name) { Hider result = (Hider) map.get(name); if (result == null) throw new IllegalArgumentException("no such hider: " + name); return result; } public String toString() { return name; } } --- NEW FILE: Options.java --- /* Options.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.options; import org.jrman.geom.Bounds2f; public class Options { private float[] times; // Just now to avoid compiler warnings... private int frameNumber; // just now to avoid compiler warnings... private int horizontalResolution; private int verticalResolution; private float pixelAspectRatio; private Bounds2f cropWindow; private float frameAspectRatio; private Bounds2f screenWindows; private CameraProjection cameraProjection; private float nearClipping; private float farClipping; private float fStop; private float focalLength; private float focalDistance; private float shutterOpen; private float shutterClose; private float pixelVariance; private float horizontalSamplingRate; private float verticalSamplingRate; private Filter filter; private Exposure exposure; private Imager imager; private Quantizer colorQuantizer; private Quantizer depthQuantizer; private Display display; private Hider hider; private int colorSamples; private float relativeDetail; public Options() { horizontalResolution = 640; verticalResolution = 480; pixelAspectRatio = 1f; cropWindow = new Bounds2f(0f, 1f, 0f, 1f); frameAspectRatio = 4f / 3f; screenWindows = new Bounds2f(-4f / 3f, 4f / 3f, -1f, 1f); cameraProjection = CameraProjection.ORTHOGRAPHIC; nearClipping = Float.MIN_VALUE; farClipping = Float.POSITIVE_INFINITY; fStop = Float.POSITIVE_INFINITY; shutterOpen = 0f; shutterClose = 0f; horizontalSamplingRate = 2f; verticalSamplingRate = 2f; filter = new Filter(Filter.Type.GAUSSIAN, 2f, 2f); exposure = new Exposure(1f, 1f); colorQuantizer = new Quantizer(255, 0, 255, 0.5f); depthQuantizer = new Quantizer(Integer.MAX_VALUE, 0, Integer.MAX_VALUE, 0.5f); display = new Display("out.tif", Display.Type.FILE, Display.Mode.RGBA); hider = Hider.HIDDEN; colorSamples = 3; relativeDetail = 1f; } public CameraProjection getCameraProjection() { return cameraProjection; } public Quantizer getColorQuantizer() { return colorQuantizer; } public int getColorSamples() { return colorSamples; } public Bounds2f getCropWindow() { return cropWindow; } public Quantizer getDepthQuantizer() { return depthQuantizer; } public Display getDisplay() { return display; } public Exposure getExposure() { return exposure; } public float getFarClipping() { return farClipping; } public Filter getFilter() { return filter; } public float getFocalDistance() { return focalDistance; } public float getFocalLength() { return focalLength; } public float getFrameAspectRatio() { return frameAspectRatio; } public float getFStop() { return fStop; } public Hider getHider() { return hider; } public int getHorizontalResolution() { return horizontalResolution; } public float getHorizontalSamplingRate() { return horizontalSamplingRate; } public Imager getImager() { return imager; } public float getNearClipping() { return nearClipping; } public float getPixelAspectRatio() { return pixelAspectRatio; } public float getPixelVariance() { return pixelVariance; } public float getRelativeDetail() { return relativeDetail; } public Bounds2f getScreenWindows() { return screenWindows; } public float getShutterClose() { return shutterClose; } public float getShutterOpen() { return shutterOpen; } public int getVerticalResolution() { return verticalResolution; } public float getVerticalSamplingRate() { return verticalSamplingRate; } public void setCameraProjection(CameraProjection projection) { cameraProjection = projection; } public void setColorQuantizer(Quantizer quantizer) { colorQuantizer = quantizer; } public void setColorSamples(int i) { colorSamples = i; } public void setCropWindow(Bounds2f bounds2f) { cropWindow = bounds2f; } public void setDepthQuantizer(Quantizer quantizer) { depthQuantizer = quantizer; } public void setDisplay(Display display) { this.display = display; } public void setExposure(Exposure exposure) { this.exposure = exposure; } public void setFarClipping(float f) { farClipping = f; } public void setFilter(Filter filter) { this.filter = filter; } public void setFocalDistance(float f) { focalDistance = f; } public void setFocalLength(float f) { focalLength = f; } public void setFrameAspectRatio(float f) { frameAspectRatio = f; } public void setFStop(float f) { fStop = f; } public void setHider(Hider hider) { this.hider = hider; } public void setHorizontalResolution(int i) { horizontalResolution = i; } public void setHorizontalSamplingRate(float f) { horizontalSamplingRate = f; } public void setImager(Imager imager) { this.imager = imager; } public void setNearClipping(float f) { nearClipping = f; } public void setPixelAspectRatio(float f) { pixelAspectRatio = f; } public void setPixelVariance(float f) { pixelVariance = f; } public void setRelativeDetail(float f) { relativeDetail = f; } public void setScreenWindows(Bounds2f bounds2f) { screenWindows = bounds2f; } public void setShutterClose(float f) { shutterClose = f; } public void setShutterOpen(float f) { shutterOpen = f; } public void setVerticalResolution(int i) { verticalResolution = i; } public void setVerticalSamplingRate(float f) { verticalSamplingRate = f; } public void setFrameNumber(int n) { frameNumber = n; } public void setMotionTimes(float[] times) { this.times = new float[times.length]; System.arraycopy(times, 0, this.times, 0, times.length); } } |
From: <ma...@us...> - 2003-04-09 05:05:02
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1:/tmp/cvs-serv515/src/org/jrman/parser/keywords Modified Files: KeywordBasis.java KeywordBound.java KeywordDetail.java AbstractKeywordParser.java Log Message: Reorganized packages. Fixed misc. errors. Index: KeywordBasis.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordBasis.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordBasis.java 7 Apr 2003 08:24:28 -0000 1.2 --- KeywordBasis.java 9 Apr 2003 05:04:58 -0000 1.3 *************** *** 22,26 **** import javax.vecmath.Matrix4f; ! import org.jrman.parser.Basis; import org.jrman.parser.Tokenizer; --- 22,26 ---- import javax.vecmath.Matrix4f; ! import org.jrman.attributes.Basis; import org.jrman.parser.Tokenizer; Index: KeywordBound.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordBound.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordBound.java 7 Apr 2003 08:24:30 -0000 1.2 --- KeywordBound.java 9 Apr 2003 05:04:58 -0000 1.3 *************** *** 20,24 **** package org.jrman.parser.keywords; ! import org.jrman.parser.Bounds3f; import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.geom.Bounds3f; import org.jrman.parser.Tokenizer; Index: KeywordDetail.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordDetail.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordDetail.java 7 Apr 2003 08:24:30 -0000 1.2 --- KeywordDetail.java 9 Apr 2003 05:04:58 -0000 1.3 *************** *** 20,24 **** package org.jrman.parser.keywords; ! import org.jrman.parser.Bounds3f; import org.jrman.parser.Tokenizer; --- 20,24 ---- package org.jrman.parser.keywords; ! import org.jrman.geom.Bounds3f; import org.jrman.parser.Tokenizer; Index: AbstractKeywordParser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/AbstractKeywordParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractKeywordParser.java 7 Apr 2003 17:07:34 -0000 1.4 --- AbstractKeywordParser.java 9 Apr 2003 05:04:58 -0000 1.5 *************** *** 31,35 **** import javax.vecmath.Matrix4f; ! import org.jrman.parser.Bounds3f; import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; --- 31,35 ---- import javax.vecmath.Matrix4f; ! import org.jrman.geom.Bounds3f; import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; |
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv515/src/org/jrman/parser Modified Files: Scene.java Parser.java Removed Files: Imager.java SurfaceShader.java Filter.java Exposure.java Display.java MutableAttributes.java Bounds2f.java Options.java Hider.java Bounds3f.java PerspectiveTransform.java DetailRange.java GeometricApproximation.java Quantizer.java Transform.java CameraProjection.java TrimCurveSense.java DisplacementShader.java SolidOperation.java VolumeShader.java Basis.java Attributes.java ShadingInterpolation.java Declaration.java Orientation.java TextureCoordinates.java AffineTransform.java ObjectInstance.java Log Message: Reorganized packages. Fixed misc. errors. Index: Scene.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Scene.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Scene.java 9 Apr 2003 00:37:44 -0000 1.7 --- Scene.java 9 Apr 2003 05:04:58 -0000 1.8 *************** *** 23,26 **** --- 23,29 ---- import java.util.Map; + import org.jrman.attributes.*; + import org.jrman.geom.*; + public class Scene { Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Parser.java 9 Apr 2003 04:34:22 -0000 1.10 --- Parser.java 9 Apr 2003 05:04:58 -0000 1.11 *************** *** 33,36 **** --- 33,39 ---- import javax.vecmath.Vector3f; + import org.jrman.attributes.*; + import org.jrman.geom.*; + import org.jrman.options.*; import org.jrman.parser.keywords.KeywordParser; *************** *** 250,254 **** public void setTransform(Matrix4f matrix) { ! currentAttributes.setTransform(new AffineTransform(matrix)); } --- 253,257 ---- public void setTransform(Matrix4f matrix) { ! currentAttributes.setTransform(AffineTransform.IDENTITY.concat(matrix)); } --- Imager.java DELETED --- --- SurfaceShader.java DELETED --- --- Filter.java DELETED --- --- Exposure.java DELETED --- --- Display.java DELETED --- --- MutableAttributes.java DELETED --- --- Bounds2f.java DELETED --- --- Options.java DELETED --- --- Hider.java DELETED --- --- Bounds3f.java DELETED --- --- PerspectiveTransform.java DELETED --- --- DetailRange.java DELETED --- --- GeometricApproximation.java DELETED --- --- Quantizer.java DELETED --- --- Transform.java DELETED --- --- CameraProjection.java DELETED --- --- TrimCurveSense.java DELETED --- --- DisplacementShader.java DELETED --- --- SolidOperation.java DELETED --- --- VolumeShader.java DELETED --- --- Basis.java DELETED --- --- Attributes.java DELETED --- --- ShadingInterpolation.java DELETED --- --- Declaration.java DELETED --- --- Orientation.java DELETED --- --- TextureCoordinates.java DELETED --- --- AffineTransform.java DELETED --- --- ObjectInstance.java DELETED --- |
Update of /cvsroot/jrman/drafts/src/org/jrman/attributes In directory sc8-pr-cvs1:/tmp/cvs-serv515/src/org/jrman/attributes Added Files: Orientation.java ShadingInterpolation.java TrimCurveSense.java TextureCoordinates.java GeometricApproximation.java Declaration.java Basis.java Attributes.java DetailRange.java MutableAttributes.java ObjectInstance.java SolidOperation.java Log Message: Reorganized packages. Fixed misc. errors. --- NEW FILE: Orientation.java --- /* Orientation.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.util.HashMap; import java.util.Map; public class Orientation { public static final Orientation OUTSIDE = new Orientation("outside"); public static final Orientation INSIDE = new Orientation("inside"); public static final Orientation LH = new Orientation("lh"); public static final Orientation RH = new Orientation("rh"); private final static Map map = new HashMap(); static { Orientation.map.put("outside", Orientation.OUTSIDE); Orientation.map.put("inside", Orientation.INSIDE); Orientation.map.put("lh", Orientation.LH); Orientation.map.put("rh", Orientation.RH); } private String name; private Orientation(String name) { this.name = name; } public static Orientation getNamed(String name) { Orientation result = (Orientation) Orientation.map.get(name); if (result == null) throw new IllegalArgumentException("No such orientation: " + name); return result; } public Orientation getReverse() { Orientation result = null; if (this == Orientation.OUTSIDE) result = Orientation.INSIDE; else if (this == Orientation.INSIDE) result = Orientation.OUTSIDE; else if (this == Orientation.LH) result = Orientation.RH; else if (this == Orientation.RH) result = Orientation.LH; return result; } public String toString() { return name; } } --- NEW FILE: ShadingInterpolation.java --- /* ShadingInterpolation.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.util.HashMap; import java.util.Map; public class ShadingInterpolation { public static final ShadingInterpolation CONSTANT = new ShadingInterpolation("constant"); public static final ShadingInterpolation SMOOTH = new ShadingInterpolation("smooth"); private final static Map map = new HashMap(); static { ShadingInterpolation.map.put("constant", ShadingInterpolation.CONSTANT); ShadingInterpolation.map.put("smooth", ShadingInterpolation.SMOOTH); } private String name; private ShadingInterpolation(String name) { this.name = name; } public static ShadingInterpolation getNamed(String name) { ShadingInterpolation result = (ShadingInterpolation) ShadingInterpolation.map.get(name); if (result == null) throw new IllegalArgumentException("No such shading interpolation: " + name); return result; } public String toString() { return name; } } --- NEW FILE: TrimCurveSense.java --- /* TrimCurveSense.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.util.HashMap; import java.util.Map; public class TrimCurveSense { public static final TrimCurveSense OUTSIDE = new TrimCurveSense("outside"); public static final TrimCurveSense INSIDE = new TrimCurveSense("inside"); private final static Map map = new HashMap(); static { TrimCurveSense.map.put("outside", TrimCurveSense.OUTSIDE); TrimCurveSense.map.put("inside", TrimCurveSense.INSIDE); } private String name; private TrimCurveSense(String name) { this.name = name; } public static TrimCurveSense getNamed(String name) { TrimCurveSense result = (TrimCurveSense) TrimCurveSense.map.get(name); if (result == null) throw new IllegalArgumentException("No such sense: " + name); return result; } public String toString() { return name; } } --- NEW FILE: TextureCoordinates.java --- /* TextureCoordinates.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; public class TextureCoordinates { private float s1; private float t1; private float s2; private float t2; private float s3; private float t3; private float s4; private float t4; public TextureCoordinates( float s1, float t1, float s2, float t2, float s3, float t3, float s4, float t4) { this.s1 = s1; this.t1 = t1; this.s2 = s2; this.t2 = t2; this.s3 = s3; this.t3 = t3; this.s4 = s4; this.t4 = t4; } public float getS1() { return s1; } public float getT1() { return t1; } public float getS2() { return s2; } public float getT2() { return t2; } public float getS3() { return s3; } public float getT3() { return t3; } public float getS4() { return s4; } public float getT4() { return t4; } } --- NEW FILE: GeometricApproximation.java --- /* GeometricApproximation.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.util.HashMap; import java.util.Map; public class GeometricApproximation { private GeometricApproximation.Type type; private float value; public static class Type { public static final GeometricApproximation.Type FLATNESS = new GeometricApproximation.Type("flatness"); private final static Map map = new HashMap(); static { Type.map.put("flatness", Type.FLATNESS); } private String name; private Type(String name) { this.name = name; } public static GeometricApproximation.Type getNamed(String name) { GeometricApproximation.Type result = (GeometricApproximation.Type) Type.map.get(name); if (result == null) throw new IllegalArgumentException("No such approximation type: " + name); return result; } public String toString() { return name; } } public GeometricApproximation(GeometricApproximation.Type type, float value) { this.type = type; this.value = value; } public GeometricApproximation(String type, float value) { this.type = GeometricApproximation.Type.getNamed(type); this.value = value; } public GeometricApproximation.Type getType() { return type; } public float getValue() { return value; } } --- NEW FILE: Declaration.java --- /* Declaration.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.io.StreamTokenizer; import java.io.StringReader; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.vecmath.Color3f; import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; import javax.vecmath.Point4f; import javax.vecmath.Vector3f; public class Declaration { private String name; private StorageClass storageClass; private Type type; private int count; public static class StorageClass { public static final StorageClass CONSTANT = new StorageClass("constant"); public static final StorageClass UNIFORM = new StorageClass("uniform"); public static final StorageClass VARYING = new StorageClass("varying"); public static final StorageClass VERTEX = new StorageClass("vertex"); private final static Map map = new HashMap(); static { map.put("constant", CONSTANT); map.put("uniform", UNIFORM); map.put("varying", VARYING); map.put("vertex", VERTEX); } private String name; private StorageClass(String name) { this.name = name; } public static StorageClass getNamed(String name) { StorageClass result = (StorageClass) map.get(name); if (result == null) throw new IllegalArgumentException("No such storage class: " + name); return result; } public static boolean isStorageClassName(String name) { return map.containsKey(name); } public String toString() { return name; } } public static class Type { public static final Type FLOAT = new Type("float"); public static final Type INTEGER = new Type("integer"); public static final Type STRING = new Type("string"); public static final Type COLOR = new Type("color"); public static final Type POINT = new Type("point"); public static final Type VECTOR = new Type("vector"); public static final Type NORMAL = new Type("normal"); public static final Type MATRIX = new Type("matrix"); public static final Type HPOINT = new Type("hpoint"); private final static Map map = new HashMap(); static { map.put("float", FLOAT); map.put("integer", INTEGER); map.put("string", STRING); map.put("color", COLOR); map.put("point", POINT); map.put("vector", VECTOR); map.put("normal", NORMAL); map.put("matrix", MATRIX); map.put("hpoint", HPOINT); } private String name; private Type(String name) { this.name = name; } public static Type getNamed(String name) { Type result = (Type) map.get(name); if (result == null) throw new IllegalArgumentException("No such data type: " + name); return result; } public String toString() { return name; } } public Declaration(String name, StorageClass storageClass, Type type, int count) { this.name = name; this.storageClass = storageClass; this.type = type; this.count = count; } public Declaration(String name, String decl) { this.name = name; count = 1; try { StreamTokenizer st = new StreamTokenizer(new StringReader(decl)); if (st.nextToken() != StreamTokenizer.TT_WORD) throw new Exception("expected storage class"); if (StorageClass.isStorageClassName(st.sval)) storageClass = StorageClass.getNamed(st.sval); else { st.pushBack(); storageClass = StorageClass.UNIFORM; } if (st.nextToken() != StreamTokenizer.TT_WORD) throw new Exception("Expected type"); type = Type.getNamed(st.sval); int token = st.nextToken(); if (token == '[') { if (st.nextToken() != StreamTokenizer.TT_NUMBER) throw new Exception("Expected array size"); count = (int) st.nval; token = st.nextToken(); if (token != ']') throw new Exception("expected ]"); token = st.nextToken(); } if (token != StreamTokenizer.TT_EOF) throw new Exception("Extra data at end of declaration"); } catch (Exception e) { throw new IllegalArgumentException(e.toString()); } } public String getName() { return name; } public StorageClass getSClass() { return storageClass; } public Type getType() { return type; } public int getCount() { return count; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append(name).append(" "); sb.append(storageClass).append(" "); sb.append(type); if (count > 1) sb.append(" [").append(count).append("]"); return sb.toString(); } public Object translateArray(List array) { Object result = null; if (type == Type.FLOAT) result = toFloatArray(array); else if (type == Type.INTEGER) result = toIntegerArray(array); else if (type == Type.STRING) result = toStringArray(array); else if (type == Type.COLOR) result = toColorArray(array); else if (type == Type.POINT) result = toPointArray(array); else if (type == Type.VECTOR) result = toVectorArray(array); else if (type == Type.NORMAL) result = toVectorArray(array); else if (type == Type.MATRIX) result = toMatrixArray(array); else if (type == Type.HPOINT) result = toHPointArray(array); return result; } private Object toFloatArray(List array) { float[][] result = new float[array.size() / count][]; int ptr = 0; for (int i = 0; i < result.length; i++) { float[] element = new float[count]; for (int j = 0; j < count; j++) element[j] = ((Float) array.get(ptr++)).floatValue(); result[i] = element; } return result; } private Object toIntegerArray(List array) { int[][] result = new int[array.size() / count][]; int ptr = 0; for (int i = 0; i < result.length; i++) { int[] element = new int[count]; for (int j = 0; j < count; j++) element[j] = ((Float) array.get(ptr++)).intValue(); result[i] = element; } return result; } private Object toStringArray(List array) { String[][] result = new String[array.size() / count][]; int ptr = 0; for (int i = 0; i < result.length; i++) { String[] element = new String[count]; for (int j = 0; j < count; j++) element[j] = (String) array.get(ptr++); result[i] = element; } return result; } private Object toColorArray(List array) { Color3f[][] result = new Color3f[array.size() / (count * 3)][]; int ptr = 0; for (int i = 0; i < result.length; i++) { Color3f[] element = new Color3f[count]; for (int j = 0; j < count; j++) { float red = ((Float) array.get(ptr++)).floatValue(); float green = ((Float) array.get(ptr++)).floatValue(); float blue = ((Float) array.get(ptr++)).floatValue(); element[j] = new Color3f(red, green, blue); } result[i] = element; } return result; } private Object toPointArray(List array) { Point3f[][] result = new Point3f[array.size() / (count * 3)][]; int ptr = 0; for (int i = 0; i < result.length; i++) { Point3f[] element = new Point3f[count]; for (int j = 0; j < count; j++) { float x = ((Float) array.get(ptr++)).floatValue(); float y = ((Float) array.get(ptr++)).floatValue(); float z = ((Float) array.get(ptr++)).floatValue(); element[j] = new Point3f(x, y, z); } result[i] = element; } return result; } private Object toVectorArray(List array) { Vector3f[][] result = new Vector3f[array.size() / (count * 3)][]; int ptr = 0; for (int i = 0; i < result.length; i++) { Vector3f[] element = new Vector3f[count]; for (int j = 0; j < count; j++) { float x = ((Float) array.get(ptr++)).floatValue(); float y = ((Float) array.get(ptr++)).floatValue(); float z = ((Float) array.get(ptr++)).floatValue(); element[j] = new Vector3f(x, y, z); } result[i] = element; } return result; } private Object toMatrixArray(List array) { Matrix4f[][] result = new Matrix4f[array.size() / (count * 16)][]; int ptr = 0; for (int ii = 0; ii < result.length; ii++) { Matrix4f[] element = new Matrix4f[count]; for (int jj = 0; jj < count; jj++) { float a = ((Float) array.get(ptr++)).floatValue(); float b = ((Float) array.get(ptr++)).floatValue(); float c = ((Float) array.get(ptr++)).floatValue(); float d = ((Float) array.get(ptr++)).floatValue(); float e = ((Float) array.get(ptr++)).floatValue(); float f = ((Float) array.get(ptr++)).floatValue(); float g = ((Float) array.get(ptr++)).floatValue(); float h = ((Float) array.get(ptr++)).floatValue(); float i = ((Float) array.get(ptr++)).floatValue(); float j = ((Float) array.get(ptr++)).floatValue(); float k = ((Float) array.get(ptr++)).floatValue(); float l = ((Float) array.get(ptr++)).floatValue(); float m = ((Float) array.get(ptr++)).floatValue(); float n = ((Float) array.get(ptr++)).floatValue(); float o = ((Float) array.get(ptr++)).floatValue(); float p = ((Float) array.get(ptr++)).floatValue(); element[jj] = new Matrix4f(a, e, i, m, b, f, j, n, c, g, k, o, d, h, l, p); } result[ii] = element; } return result; } private Object toHPointArray(List array) { Point4f[][] result = new Point4f[array.size() / (count * 4)][]; int ptr = 0; for (int i = 0; i < result.length; i++) { Point4f[] element = new Point4f[count]; for (int j = 0; j < count; j++) { float x = ((Float) array.get(ptr++)).floatValue(); float y = ((Float) array.get(ptr++)).floatValue(); float z = ((Float) array.get(ptr++)).floatValue(); float w = ((Float) array.get(ptr++)).floatValue(); element[j] = new Point4f(x, y, z, w); } result[i] = element; } return result; } } --- NEW FILE: Basis.java --- /* Basis.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.util.HashMap; import java.util.Map; import javax.vecmath.Matrix4f; public class Basis { public final static Basis BEZIER = new Basis( new Matrix4f(-1f, 3f, -3f, 1, 3f, -6f, 3f, 0f, -3f, 3f, 0f, 0f, 1f, 0f, 0f, 0f)); public final static Basis B_SPLINE = new Basis( new Matrix4f( -1f / 6f, 3f / 6f, -3f / 6f, 1f / 6f, 3f / 6f, -6f / 6f, 0f / 6f, 4f / 6f, -3f / 6f, 3f / 6f, 3f / 6f, 1f / 6f, 1f / 6f, 0f / 6f, 0f / 6f, 0f / 6f)); public final static Basis CATMULL_ROM = new Basis( new Matrix4f( -1f / 2f, 2f / 2f, -1f / 2f, 0f / 2f, 3f / 2f, -5f / 2f, 0f / 2f, 2f / 2f, -3f / 2f, 4f / 2f, 1f / 2f, 0f / 2f, 1f / 2f, -1f / 2f, 0f / 2f, 0f / 2f)); public final static Basis HERMITE = new Basis( new Matrix4f(2f, -3f, 0f, 1f, 1f, -2f, 1f, 0f, -2f, 3f, 0f, 0f, 1f, -1f, 0f, 0f)); public final static Basis POWER = new Basis( new Matrix4f(1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f)); private static final Map map = new HashMap(); static { map.put("bezier", BEZIER); map.put("b-spline", B_SPLINE); map.put("catmullrom", CATMULL_ROM); map.put("hermite", HERMITE); map.put("power", POWER); } private Matrix4f matrix; public Basis(Matrix4f matrix) { this.matrix = new Matrix4f(matrix); } public static Basis getNamed(String name) { Basis result = (Basis) map.get(name); if (result == null) throw new IllegalArgumentException("No such basis: " + name); return result; } public Matrix4f getMatrix() { return new Matrix4f(matrix); } } --- NEW FILE: Attributes.java --- /* Attributes.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.util.Collections; import java.util.Set; import javax.vecmath.Color3f; import org.jrman.geom.*; import org.jrman.shaders.*; public class Attributes { protected Color3f color; protected Color3f opacity; protected TextureCoordinates textureCoordinates; protected Set lightSources; protected SurfaceShader surface; protected DisplacementShader displacement; protected VolumeShader atmosphere; protected VolumeShader interior; protected VolumeShader exterior; protected float shadingRate; protected ShadingInterpolation shadingInterpolation; protected boolean matte; protected Bounds3f bound; protected Bounds3f detail; protected DetailRange detailRange; protected GeometricApproximation geometricApproximation; protected Orientation orientation; protected int sides; protected Transform transform; protected float displacementBound; protected String displacementBoundCoordinateSystem; protected String objectIdentifier; protected TrimCurveSense trimCurveSense; protected Basis uBasis; protected int uStep; protected Basis vBasis; protected int vStep; protected Attributes() { } public Attributes(Attributes other) { color = other.getColor(); opacity = other.getOpacity(); textureCoordinates = other.getTextureCoordinates(); lightSources = other.getLightSources(); surface = other.getSurface(); displacement = other.getDisplacement(); atmosphere = other.getAtmosphere(); interior = other.getInterior(); exterior = other.getExterior(); shadingRate = other.getShadingRate(); shadingInterpolation = other.getShadingInterpolation(); matte = other.isMatte(); bound = other.getBound(); detail = other.getDetail(); detailRange = other.getDetailRange(); geometricApproximation = other.getGeometricApproximation(); orientation = other.getOrientation(); sides = other.getSides(); transform = other.getTransform(); displacementBound = other.getDisplacementBound(); displacementBoundCoordinateSystem = other.getDisplacementBoundCoordinateSystem(); objectIdentifier = other.getObjectIdentifier(); trimCurveSense = other.getTrimCurveSense(); uBasis = Basis.BEZIER; uStep = 3; vBasis = Basis.BEZIER; vStep = 3; } public Color3f getColor() { return new Color3f(color); } public Color3f getOpacity() { return new Color3f(opacity); } public TextureCoordinates getTextureCoordinates() { return textureCoordinates; } public Set getLightSources() { return Collections.unmodifiableSet(lightSources); } public SurfaceShader getSurface() { return surface; } public DisplacementShader getDisplacement() { return displacement; } public VolumeShader getAtmosphere() { return atmosphere; } public VolumeShader getInterior() { return interior; } public VolumeShader getExterior() { return exterior; } public float getShadingRate() { return shadingRate; } public ShadingInterpolation getShadingInterpolation() { return shadingInterpolation; } public boolean isMatte() { return matte; } public Bounds3f getBound() { return bound; } public Bounds3f getDetail() { return detail; } public DetailRange getDetailRange() { return detailRange; } public GeometricApproximation getGeometricApproximation() { return geometricApproximation; } public Orientation getOrientation() { return orientation; } public int getSides() { return sides; } public Transform getTransform() { return transform; } public float getDisplacementBound() { return displacementBound; } public String getDisplacementBoundCoordinateSystem() { return displacementBoundCoordinateSystem; } public String getObjectIdentifier() { return objectIdentifier; } public TrimCurveSense getTrimCurveSense() { return trimCurveSense; } public Basis getUBasis() { return uBasis; } public Basis getVBasis() { return vBasis; } } --- NEW FILE: DetailRange.java --- /* DetailRange.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; public class DetailRange { private float minVisible; private float lowerTransition; private float upperTransition; private float maxVisible; public DetailRange() { this(0f, 0f, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); } public DetailRange( float minVisible, float lowerTransition, float upperTransition, float maxVisible) { this.minVisible = minVisible; this.lowerTransition = lowerTransition; this.upperTransition = upperTransition; this.maxVisible = maxVisible; } public float getMinVisible() { return minVisible; } public float getLowerTranstion() { return lowerTransition; } public float getUpperTransition() { return upperTransition; } public float getMaxVisible() { return maxVisible; } } --- NEW FILE: MutableAttributes.java --- /* MutableAttributes.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.util.Collections; import java.util.HashSet; import java.util.Set; import javax.vecmath.Color3f; import org.jrman.geom.*; import org.jrman.shaders.*; public class MutableAttributes extends Attributes { private boolean modified; public MutableAttributes() { color = new Color3f(1f, 1f, 1f); opacity = new Color3f(1f, 1f, 1f); textureCoordinates = new TextureCoordinates(0f, 0f, 1f, 0f, 0f, 1f, 1f, 1f); lightSources = Collections.EMPTY_SET; surface = null; // new SurfaceShaderConstant(); displacement = null; atmosphere = null; interior = null; exterior = null; shadingRate = 1f; shadingInterpolation = ShadingInterpolation.CONSTANT; matte = false; detail = new Bounds3f(); geometricApproximation = new GeometricApproximation(GeometricApproximation.Type.FLATNESS, 1f); orientation = Orientation.OUTSIDE; sides = 2; transform = AffineTransform.IDENTITY; displacementBound = 0f; displacementBoundCoordinateSystem = "object"; objectIdentifier = null; trimCurveSense = TrimCurveSense.INSIDE; } public MutableAttributes(Attributes other) { super(other); } public boolean isModified() { return modified; } public void setModified(boolean modified) { this.modified = modified; } public void setColor(Color3f color) { this.color = new Color3f(color); modified = true; } public void setOpacity(Color3f opacity) { this.opacity = new Color3f(opacity); modified = true; } public void setTextureCoordinates(TextureCoordinates textureCoordinates) { this.textureCoordinates = textureCoordinates; modified = true; } public void setLightSources(Set lightSources) { this.lightSources = new HashSet(lightSources); modified = true; } public void setSurface(SurfaceShader surface) { this.surface = surface; modified = true; } public void setDisplacement(DisplacementShader displacement) { this.displacement = displacement; modified = true; } public void setAtmosphere(VolumeShader atmosphere) { this.atmosphere = atmosphere; modified = true; } public void setInterior(VolumeShader interior) { this.interior = interior; modified = true; } public void setExterior(VolumeShader exterior) { this.exterior = exterior; modified = true; } public void setShadingRate(float shadingRate) { this.shadingRate = shadingRate; modified = true; } public void setShadingInterpolation(ShadingInterpolation shadingInterpolation) { this.shadingInterpolation = shadingInterpolation; modified = true; } public void setMatte(boolean matte) { this.matte = matte; modified = true; } public void setBound(Bounds3f bound) { this.bound = bound; modified = true; } public void setDetail(Bounds3f detail) { this.detail = detail; modified = true; } public void setDetailRange(DetailRange detailRange) { this.detailRange = detailRange; modified = true; } public void setGeometricApproximation(GeometricApproximation geometricApproximation) { this.geometricApproximation = geometricApproximation; modified = true; } public void setOrientation(Orientation orientation) { this.orientation = orientation; modified = true; } public void setSides(int sides) { this.sides = sides; modified = true; } public void setTransform(Transform transform) { this.transform = transform; modified = true; } public void setDisplacementBound(float displacementBound) { this.displacementBound = displacementBound; modified = true; } public void setDisplacementBoundCoordinateSystem(String displacementBoundCoordinateSystem) { this.displacementBoundCoordinateSystem = displacementBoundCoordinateSystem; modified = true; } public void setObjectIdentifer(String objectIdentifier) { this.objectIdentifier = objectIdentifier; modified = true; } public void setTrimCurveSense(TrimCurveSense trimCurveSense) { this.trimCurveSense = trimCurveSense; modified = true; } public void setBasis(Basis uBasis, int uStep, Basis vBasis, int vStep) { this.uBasis = uBasis; this.uStep = uStep; this.vBasis = vBasis; this.vStep = vStep; modified = true; } } --- NEW FILE: ObjectInstance.java --- /* ObjectInstance.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; public class ObjectInstance { } --- NEW FILE: SolidOperation.java --- /* SolidOperation.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.attributes; import java.util.HashMap; import java.util.Map; public class SolidOperation { public final static SolidOperation PRIMITIVE = new SolidOperation("primitive"); public final static SolidOperation INTERSECTION = new SolidOperation("intersection"); public final static SolidOperation UNION = new SolidOperation("union"); public final static SolidOperation DIFFERENCE = new SolidOperation("difference"); private static Map map = new HashMap(); static { map.put("primitive", PRIMITIVE); map.put("intersection", INTERSECTION); map.put("union", UNION); map.put("difference", DIFFERENCE); } private String name; private SolidOperation(String name) { this.name = name; } public static SolidOperation getNamed(String name){ SolidOperation result = (SolidOperation) map.get(name); if (result == null) throw new IllegalArgumentException("No such solid operation: " + name); return result; } public String toString() { return name; } } |
From: <ma...@us...> - 2003-04-09 05:04:34
|
Update of /cvsroot/jrman/drafts/src/org/jrman/shaders In directory sc8-pr-cvs1:/tmp/cvs-serv438/src/org/jrman/shaders Log Message: Directory /cvsroot/jrman/drafts/src/org/jrman/shaders added to the repository |
From: <ma...@us...> - 2003-04-09 05:04:34
|
Update of /cvsroot/jrman/drafts/src/org/jrman/options In directory sc8-pr-cvs1:/tmp/cvs-serv438/src/org/jrman/options Log Message: Directory /cvsroot/jrman/drafts/src/org/jrman/options added to the repository |
From: <ma...@us...> - 2003-04-09 05:04:34
|
Update of /cvsroot/jrman/drafts/src/org/jrman/geom In directory sc8-pr-cvs1:/tmp/cvs-serv438/src/org/jrman/geom Log Message: Directory /cvsroot/jrman/drafts/src/org/jrman/geom added to the repository |
From: <ma...@us...> - 2003-04-09 05:04:34
|
Update of /cvsroot/jrman/drafts/src/org/jrman/attributes In directory sc8-pr-cvs1:/tmp/cvs-serv438/src/org/jrman/attributes Log Message: Directory /cvsroot/jrman/drafts/src/org/jrman/attributes added to the repository |
From: <ma...@us...> - 2003-04-09 04:34:26
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv24802/src/org/jrman/parser Modified Files: Transform.java Parser.java PerspectiveTransform.java AffineTransform.java Log Message: Fixed and improved Transforms implementation (one more time...) Index: Transform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Transform.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Transform.java 9 Apr 2003 01:12:46 -0000 1.3 --- Transform.java 9 Apr 2003 04:34:22 -0000 1.4 *************** *** 27,33 **** public interface Transform { ! Transform newTransform(); ! Transform newTransformConcat(Matrix4f matrix); void transformPoint(Point3f point); --- 27,35 ---- public interface Transform { ! Transform getCopy(); ! Transform concat(Transform transform); ! ! Transform concat(Matrix4f matrix); void transformPoint(Point3f point); *************** *** 49,57 **** Matrix4f getMatrix(); - Matrix4f getInverseMatrix(); - - Matrix4f getNormalsMatrix(); - - Matrix4f getInverseNormalsMatrix(); - } --- 51,53 ---- Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Parser.java 9 Apr 2003 01:12:46 -0000 1.9 --- Parser.java 9 Apr 2003 04:34:22 -0000 1.10 *************** *** 224,227 **** --- 224,234 ---- } + public void perspective(float fov) { + PerspectiveTransform perspective = + new PerspectiveTransform(fov, 1f, Float.POSITIVE_INFINITY); + Transform current = currentAttributes.getTransform(); + currentAttributes.setTransform(perspective.preConcat(current)); + } + public void setDetailRange( float minVisible, *************** *** 247,252 **** public void concatTransform(Matrix4f trans) { ! currentAttributes.setTransform( ! currentAttributes.getTransform().newTransformConcat(trans)); } --- 254,260 ---- public void concatTransform(Matrix4f trans) { ! Transform current = currentAttributes.getTransform(); ! current = current.concat(trans); ! currentAttributes.setTransform(current); } Index: PerspectiveTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/PerspectiveTransform.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PerspectiveTransform.java 9 Apr 2003 01:41:40 -0000 1.4 --- PerspectiveTransform.java 9 Apr 2003 04:34:22 -0000 1.5 *************** *** 26,43 **** public class PerspectiveTransform extends AffineTransform { ! public PerspectiveTransform(Matrix4f matrix){ super(matrix); } ! ! public Transform newTransform() { return new PerspectiveTransform(getMatrix()); } ! ! public Transform newTransformConcat(Matrix4f m){ Matrix4f matrix = getMatrix(); matrix.mul(m); ! return new AffineTransform(matrix); } public void transformPoint(Point3f point) { Point4f hpoint = new Point4f(point); --- 26,79 ---- public class PerspectiveTransform extends AffineTransform { ! protected PerspectiveTransform(Matrix4f matrix) { super(matrix); } ! ! public PerspectiveTransform(float fov, float near, float far) { ! super( ! new Matrix4f( ! 1f, ! 0f, ! 0f, ! 0f, ! 0f, ! 1f, ! 0f, ! 1f, ! 0f, ! 0f, ! (fovToH(fov) * far) / (near * (far - near)), ! fovToH(fov) / near, ! 0f, ! 0f, ! - (fovToH(fov) * far) / (far - near), ! 0f)); ! } ! ! private static float fovToH(float fov) { ! return (float) Math.tan(fov * Math.PI / 360f); ! } ! ! public Transform getCopy() { return new PerspectiveTransform(getMatrix()); } ! ! public Transform concat(Matrix4f m) { Matrix4f matrix = getMatrix(); matrix.mul(m); ! return new PerspectiveTransform(matrix); } + public Transform concat(Transform transform) { + Matrix4f matrix = getMatrix(); + matrix.mul(transform.getMatrix()); + return new PerspectiveTransform(matrix); + } + + public Transform preConcat(Transform transform) { + Transform perspective = new PerspectiveTransform(transform.getMatrix()); + return perspective.concat(this); + } + public void transformPoint(Point3f point) { Point4f hpoint = new Point4f(point); *************** *** 45,48 **** point.project(hpoint); } ! } --- 81,84 ---- point.project(hpoint); } ! } Index: AffineTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/AffineTransform.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AffineTransform.java 9 Apr 2003 01:12:46 -0000 1.4 --- AffineTransform.java 9 Apr 2003 04:34:22 -0000 1.5 *************** *** 43,59 **** private Matrix4f inverseNormalsMatrix; ! public AffineTransform(Matrix4f matrix) { this.matrix = new Matrix4f(matrix); } ! public AffineTransform(Transform transform) { this(transform.getMatrix()); } ! public Transform newTransform(){ return new AffineTransform(this); } ! public Transform newTransformConcat(Matrix4f m){ Matrix4f matrix = getMatrix(); matrix.mul(m); --- 43,65 ---- private Matrix4f inverseNormalsMatrix; ! protected AffineTransform(Matrix4f matrix) { this.matrix = new Matrix4f(matrix); } ! protected AffineTransform(Transform transform) { this(transform.getMatrix()); } ! public Transform getCopy(){ return new AffineTransform(this); } ! public Transform concat(Transform transform) { ! Matrix4f matrix = getMatrix(); ! matrix.mul(transform.getMatrix()); ! return new AffineTransform(matrix); ! } ! ! public Transform concat(Matrix4f m){ Matrix4f matrix = getMatrix(); matrix.mul(m); *************** *** 96,109 **** return new Matrix4f(matrix); } ! ! public Matrix4f getInverseMatrix() { if (inverseMatrix == null) { ! inverseMatrix = new Matrix4f(); ! matrix.invert(inverseMatrix); } return inverseMatrix; } ! public Matrix4f getNormalsMatrix() { if (normalsMatrix == null) { normalsMatrix = new Matrix4f(getInverseMatrix()); --- 102,115 ---- return new Matrix4f(matrix); } ! ! protected Matrix4f getInverseMatrix() { if (inverseMatrix == null) { ! inverseMatrix = new Matrix4f(matrix); ! inverseMatrix.invert(); } return inverseMatrix; } ! protected Matrix4f getNormalsMatrix() { if (normalsMatrix == null) { normalsMatrix = new Matrix4f(getInverseMatrix()); *************** *** 113,120 **** } ! public Matrix4f getInverseNormalsMatrix() { if (inverseNormalsMatrix == null) { ! inverseNormalsMatrix = new Matrix4f(); ! getNormalsMatrix().invert(inverseNormalsMatrix); } return inverseNormalsMatrix; --- 119,126 ---- } ! protected Matrix4f getInverseNormalsMatrix() { if (inverseNormalsMatrix == null) { ! inverseNormalsMatrix = new Matrix4f(getNormalsMatrix()); ! inverseNormalsMatrix.invert(); } return inverseNormalsMatrix; |
From: <ma...@us...> - 2003-04-09 04:34:26
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1:/tmp/cvs-serv24802/src/org/jrman/parser/keywords Modified Files: KeywordPerspective.java Log Message: Fixed and improved Transforms implementation (one more time...) Index: KeywordPerspective.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPerspective.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordPerspective.java 7 Apr 2003 08:24:21 -0000 1.2 --- KeywordPerspective.java 9 Apr 2003 04:34:23 -0000 1.3 *************** *** 27,30 **** --- 27,32 ---- // Expect fov match(st, TK_NUMBER); + float fov = (float) st.nval; + parser.perspective(fov); } |
From: <ma...@us...> - 2003-04-09 01:41:43
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv10832/src/org/jrman/parser Modified Files: PerspectiveTransform.java Log Message: Modified PerspectiveTransform to not throw UnsupportedOperationException anymore. But it probably will give wrong results.... Index: PerspectiveTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/PerspectiveTransform.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PerspectiveTransform.java 9 Apr 2003 01:12:46 -0000 1.3 --- PerspectiveTransform.java 9 Apr 2003 01:41:40 -0000 1.4 *************** *** 23,27 **** import javax.vecmath.Point3f; import javax.vecmath.Point4f; - import javax.vecmath.Vector3f; public class PerspectiveTransform extends AffineTransform { --- 23,26 ---- *************** *** 47,61 **** } - public void transformVector(Vector3f vector) { - throw new UnsupportedOperationException(); - } - - public Matrix4f getInverseMatrix() { - throw new UnsupportedOperationException(); - } - - public Matrix4f getNormalsMatrix() { - throw new UnsupportedOperationException(); - } - } --- 46,48 ---- |
From: <ma...@us...> - 2003-04-09 01:12:49
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv2564/src/org/jrman/parser Modified Files: Transform.java Parser.java PerspectiveTransform.java AffineTransform.java Log Message: More improvements to implementation of transforms. Index: Transform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Transform.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Transform.java 8 Apr 2003 23:48:40 -0000 1.2 --- Transform.java 9 Apr 2003 01:12:46 -0000 1.3 *************** *** 27,30 **** --- 27,34 ---- public interface Transform { + Transform newTransform(); + + Transform newTransformConcat(Matrix4f matrix); + void transformPoint(Point3f point); Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Parser.java 9 Apr 2003 00:37:44 -0000 1.8 --- Parser.java 9 Apr 2003 01:12:46 -0000 1.9 *************** *** 209,215 **** Matrix4f rotation = new Matrix4f(); rotation.set(axisAngle); ! Matrix4f matrix = currentAttributes.getTransform().getMatrix(); ! matrix.mul(rotation); ! currentAttributes.setTransform(new AffineTransform(matrix)); } --- 209,213 ---- Matrix4f rotation = new Matrix4f(); rotation.set(axisAngle); ! concatTransform(rotation); } *************** *** 217,223 **** Matrix4f scale = new Matrix4f(sx, 0f, 0f, 0f, 0f, sy, 0f, 0f, 0f, 0f, sz, 0f, 0f, 0f, 0f, 1f); ! Matrix4f matrix = currentAttributes.getTransform().getMatrix(); ! matrix.mul(scale); ! currentAttributes.setTransform(new AffineTransform(matrix)); } --- 215,219 ---- Matrix4f scale = new Matrix4f(sx, 0f, 0f, 0f, 0f, sy, 0f, 0f, 0f, 0f, sz, 0f, 0f, 0f, 0f, 1f); ! concatTransform(scale); } *************** *** 225,231 **** Matrix4f translation = new Matrix4f(); translation.setTranslation(new Vector3f(dx, dy, dz)); ! Matrix4f matrix = currentAttributes.getTransform().getMatrix(); ! matrix.mul(translation); ! currentAttributes.setTransform(new AffineTransform(matrix)); } --- 221,225 ---- Matrix4f translation = new Matrix4f(); translation.setTranslation(new Vector3f(dx, dy, dz)); ! concatTransform(translation); } *************** *** 253,259 **** public void concatTransform(Matrix4f trans) { ! Matrix4f matrix = currentAttributes.getTransform().getMatrix(); ! matrix.mul(trans); ! currentAttributes.setTransform(new AffineTransform(matrix)); } --- 247,252 ---- public void concatTransform(Matrix4f trans) { ! currentAttributes.setTransform( ! currentAttributes.getTransform().newTransformConcat(trans)); } Index: PerspectiveTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/PerspectiveTransform.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PerspectiveTransform.java 8 Apr 2003 23:48:40 -0000 1.2 --- PerspectiveTransform.java 9 Apr 2003 01:12:46 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- import javax.vecmath.Point3f; import javax.vecmath.Point4f; + import javax.vecmath.Vector3f; public class PerspectiveTransform extends AffineTransform { *************** *** 29,32 **** --- 30,43 ---- super(matrix); } + + public Transform newTransform() { + return new PerspectiveTransform(getMatrix()); + } + + public Transform newTransformConcat(Matrix4f m){ + Matrix4f matrix = getMatrix(); + matrix.mul(m); + return new AffineTransform(matrix); + } public void transformPoint(Point3f point) { *************** *** 34,37 **** --- 45,52 ---- transformHPoint(hpoint); point.project(hpoint); + } + + public void transformVector(Vector3f vector) { + throw new UnsupportedOperationException(); } Index: AffineTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/AffineTransform.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AffineTransform.java 9 Apr 2003 00:37:44 -0000 1.3 --- AffineTransform.java 9 Apr 2003 01:12:46 -0000 1.4 *************** *** 50,53 **** --- 50,63 ---- this(transform.getMatrix()); } + + public Transform newTransform(){ + return new AffineTransform(this); + } + + public Transform newTransformConcat(Matrix4f m){ + Matrix4f matrix = getMatrix(); + matrix.mul(m); + return new AffineTransform(matrix); + } public void transformPoint(Point3f point) { |
From: <ma...@us...> - 2003-04-09 00:37:49
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv23537/src/org/jrman/parser Modified Files: Scene.java Parser.java MutableAttributes.java AffineTransform.java Log Message: More work on transforms. Index: Scene.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Scene.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Scene.java 8 Apr 2003 23:44:51 -0000 1.6 --- Scene.java 9 Apr 2003 00:37:44 -0000 1.7 *************** *** 38,42 **** declarations.put("conedeltaangle", new Declaration("conedeltaangle", "float")); declarations.put("beamdistribution", new Declaration("beamdistribution", "float")); - declarations.put("lighttype", new Declaration("lighttype", "string")); declarations.put("Ka", new Declaration("Ka", "float")); declarations.put("Kd", new Declaration("Kd", "float")); --- 38,41 ---- Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Parser.java 8 Apr 2003 23:44:51 -0000 1.7 --- Parser.java 9 Apr 2003 00:37:44 -0000 1.8 *************** *** 202,208 **** public void setIdentity() { ! Matrix4f identity = new Matrix4f(); ! identity.setIdentity(); ! currentAttributes.setTransform(new AffineTransform(identity)); } --- 202,206 ---- public void setIdentity() { ! currentAttributes.setTransform(AffineTransform.IDENTITY); } *************** *** 338,343 **** pushState(State.WORLD); saveCurrentTransformAs("camera"); - Matrix4f identity = new Matrix4f(); - identity.setIdentity(); setIdentity(); } --- 336,339 ---- Index: MutableAttributes.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/MutableAttributes.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MutableAttributes.java 8 Apr 2003 23:44:51 -0000 1.2 --- MutableAttributes.java 9 Apr 2003 00:37:44 -0000 1.3 *************** *** 25,29 **** import javax.vecmath.Color3f; - import javax.vecmath.Matrix4f; public class MutableAttributes extends Attributes { --- 25,28 ---- *************** *** 49,54 **** orientation = Orientation.OUTSIDE; sides = 2; ! Matrix4f identity = new Matrix4f(); ! transform = new AffineTransform(identity); displacementBound = 0f; displacementBoundCoordinateSystem = "object"; --- 48,52 ---- orientation = Orientation.OUTSIDE; sides = 2; ! transform = AffineTransform.IDENTITY; displacementBound = 0f; displacementBoundCoordinateSystem = "object"; Index: AffineTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/AffineTransform.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AffineTransform.java 8 Apr 2003 23:48:40 -0000 1.2 --- AffineTransform.java 9 Apr 2003 00:37:44 -0000 1.3 *************** *** 26,29 **** --- 26,37 ---- public class AffineTransform implements Transform { + + public static final AffineTransform IDENTITY; + + static { + Matrix4f identity = new Matrix4f(); + identity.setIdentity(); + IDENTITY = new AffineTransform(identity); + } private Matrix4f matrix; |