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: Gerardo H. <ma...@us...> - 2004-04-08 21:42:38
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17122/sampleData Modified Files: TextureTest.rib Log Message: Handling of TextureCoordinates. Index: TextureTest.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/TextureTest.rib,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TextureTest.rib 14 Dec 2003 22:28:28 -0000 1.9 --- TextureTest.rib 8 Apr 2004 21:29:26 -0000 1.10 *************** *** 25,28 **** --- 25,29 ---- ShadingRate .25 Surface "paintedplastic" + TextureCoordinates 0 0 0 300 300 0 300 300 Patch "bilinear" "P" [-1000 -5 0 -1000 -5 1000 *************** *** 30,35 **** 1000 -5 1000] "texturename" "mandrill.txr" ! "s" [0 0 300 300] ! "t" [0 300 0 300] Patch "bilinear" "P" [-1000 5 0 -1000 5 1000 --- 31,35 ---- 1000 -5 1000] "texturename" "mandrill.txr" ! TextureCoordinates 0 0 0 1000 1000 0 1000 1000 Patch "bilinear" "P" [-1000 5 0 -1000 5 1000 *************** *** 37,41 **** 1000 5 1000] "texturename" "checkerboard.txr" - "s" [0 0 1000 1000] - "t" [0 1000 0 1000] WorldEnd --- 37,39 ---- |
Update of /cvsroot/jrman/drafts/src/org/jrman/parameters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11866/src/org/jrman/parameters Modified Files: VaryingArrayFloat.java UniformArrayHPoint.java UniformArrayTuple3f.java UniformScalarFloat.java UniformScalarHPoint.java VaryingArrayHPoint.java VaryingScalarTuple3f.java UniformArrayString.java UniformScalarInteger.java UniformScalarString.java VaryingArrayTuple3f.java ParameterList.java UniformScalarTuple3f.java VaryingScalarHPoint.java VaryingScalarFloat.java UniformArrayFloat.java UniformArrayInteger.java Parameter.java Log Message: Refactored parameter selection. Index: UniformScalarTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarTuple3f.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformScalarTuple3f.java 8 Apr 2004 17:34:38 -0000 1.4 --- UniformScalarTuple3f.java 8 Apr 2004 21:03:32 -0000 1.5 *************** *** 53,55 **** --- 53,59 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } Index: UniformArrayInteger.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayInteger.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UniformArrayInteger.java 8 Apr 2004 17:34:38 -0000 1.5 --- UniformArrayInteger.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 43,45 **** --- 43,49 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } Index: UniformArrayTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayTuple3f.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UniformArrayTuple3f.java 8 Apr 2004 17:34:38 -0000 1.5 --- UniformArrayTuple3f.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 25,29 **** public class UniformArrayTuple3f extends Parameter { ! final private float[] values; --- 25,29 ---- public class UniformArrayTuple3f extends Parameter { ! final private float[] values; *************** *** 32,36 **** this.values = values; } ! public void getValue(int index, Tuple3f out) { out.x = values[index * 3]; --- 32,36 ---- this.values = values; } ! public void getValue(int index, Tuple3f out) { out.x = values[index * 3]; *************** *** 44,48 **** public void linearDice(Grid grid) { ! throw new UnsupportedOperationException("Parameter not diceable: " + declaration); } --- 44,52 ---- public void linearDice(Grid grid) { ! throw new UnsupportedOperationException("Parameter not diceable: " + declaration); ! } ! ! public Parameter selectValues(int[] indexes) { ! return this; } Index: VaryingScalarFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarFloat.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VaryingScalarFloat.java 8 Apr 2004 17:34:38 -0000 1.5 --- VaryingScalarFloat.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 63,65 **** --- 63,72 ---- } + public Parameter selectValues(int[] indexes) { + float[] newValues = new float[indexes.length]; + for (int i = 0; i < indexes.length; i++) + newValues[i] = values[indexes[i]]; + return new VaryingScalarFloat(declaration, newValues); + } + } Index: VaryingScalarHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarHPoint.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** VaryingScalarHPoint.java 8 Apr 2004 17:34:38 -0000 1.6 --- VaryingScalarHPoint.java 8 Apr 2004 21:03:32 -0000 1.7 *************** *** 86,88 **** --- 86,100 ---- } + public Parameter selectValues(int[] indexes) { + float[] newValues = new float[indexes.length * 4]; + for (int i = 0; i < indexes.length; i++) { + int srcOffset = indexes[i] * 4; + int dstOffset = i * 4; + newValues[dstOffset] = values[srcOffset]; + newValues[dstOffset + 1] = values[srcOffset + 1]; + newValues[dstOffset + 2] = values[srcOffset + 2]; + newValues[dstOffset + 3] = values[srcOffset + 3]; + } + return new VaryingScalarHPoint(declaration, newValues); + } } Index: VaryingArrayFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayFloat.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** VaryingArrayFloat.java 8 Apr 2004 17:34:37 -0000 1.7 --- VaryingArrayFloat.java 8 Apr 2004 21:03:31 -0000 1.8 *************** *** 86,88 **** --- 86,100 ---- } + public Parameter selectValues(int[] indexes) { + int n = declaration.getCount(); + float[] newValues = new float[indexes.length * n]; + for (int i = 0; i < indexes.length; i++) { + int srcOffset = indexes[i] * n; + int dstOffset = i * n; + for (int e = 0; e < n; e++) + newValues[dstOffset + e] = values[srcOffset + e]; + } + return new VaryingArrayFloat(declaration, newValues); + } + } Index: UniformScalarFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarFloat.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformScalarFloat.java 8 Apr 2004 17:34:38 -0000 1.4 --- UniformScalarFloat.java 8 Apr 2004 21:03:32 -0000 1.5 *************** *** 43,45 **** --- 43,49 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } Index: UniformArrayString.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayString.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UniformArrayString.java 8 Apr 2004 17:34:38 -0000 1.5 --- UniformArrayString.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 43,45 **** --- 43,49 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } Index: ParameterList.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/ParameterList.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ParameterList.java 8 Apr 2004 00:53:02 -0000 1.5 --- ParameterList.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 41,44 **** --- 41,51 ---- return pl; } + + public ParameterList selectValues(int[] indexes) { + ParameterList pl = new ParameterList(); + for (int i = 0; i < getParameterCount(); i++) + pl.addParameter(getParameter(i).selectValues(indexes)); + return pl; + } public void addParameter(Parameter parameter) { Index: UniformScalarHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarHPoint.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformScalarHPoint.java 8 Apr 2004 17:34:38 -0000 1.4 --- UniformScalarHPoint.java 8 Apr 2004 21:03:32 -0000 1.5 *************** *** 57,59 **** --- 57,63 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } Index: UniformArrayHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayHPoint.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UniformArrayHPoint.java 8 Apr 2004 17:34:38 -0000 1.5 --- UniformArrayHPoint.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 48,50 **** --- 48,54 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } Index: VaryingArrayHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayHPoint.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VaryingArrayHPoint.java 8 Apr 2004 17:34:38 -0000 1.5 --- VaryingArrayHPoint.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 61,63 **** --- 61,75 ---- } + public Parameter selectValues(int[] indexes) { + int n = declaration.getCount() * 4; + float[] newValues = new float[indexes.length * n]; + for (int i = 0; i < indexes.length; i++) { + int srcOffset = indexes[i] * n; + int dstOffset = i * n; + for (int e = 0; e < n; e++) + newValues[dstOffset + e] = values[srcOffset + e]; + } + return new VaryingArrayHPoint(declaration, newValues); + } + } Index: Parameter.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/Parameter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Parameter.java 8 Apr 2004 17:34:38 -0000 1.3 --- Parameter.java 8 Apr 2004 21:03:32 -0000 1.4 *************** *** 37,40 **** --- 37,42 ---- public abstract void linearDice(Grid grid); + + public abstract Parameter selectValues(int[] indexes); } Index: VaryingScalarTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarTuple3f.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** VaryingScalarTuple3f.java 8 Apr 2004 17:34:38 -0000 1.7 --- VaryingScalarTuple3f.java 8 Apr 2004 21:03:32 -0000 1.8 *************** *** 95,97 **** --- 95,109 ---- } + public Parameter selectValues(int[] indexes) { + float[] newValues = new float[indexes.length * 3]; + for (int i = 0; i < indexes.length; i++) { + int srcOffset = indexes[i] * 3; + int dstOffset = i * 3; + newValues[dstOffset] = values[srcOffset]; + newValues[dstOffset + 1] = values[srcOffset + 1]; + newValues[dstOffset + 2] = values[srcOffset + 2]; + } + return new VaryingScalarTuple3f(declaration, newValues); + } + } Index: UniformScalarInteger.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarInteger.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformScalarInteger.java 8 Apr 2004 17:34:38 -0000 1.4 --- UniformScalarInteger.java 8 Apr 2004 21:03:32 -0000 1.5 *************** *** 43,45 **** --- 43,49 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } Index: UniformScalarString.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarString.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformScalarString.java 8 Apr 2004 17:34:38 -0000 1.4 --- UniformScalarString.java 8 Apr 2004 21:03:32 -0000 1.5 *************** *** 43,45 **** --- 43,49 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } Index: VaryingArrayTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayTuple3f.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VaryingArrayTuple3f.java 8 Apr 2004 17:34:38 -0000 1.5 --- VaryingArrayTuple3f.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 60,62 **** --- 60,74 ---- } + public Parameter selectValues(int[] indexes) { + int n = declaration.getCount() * 3; + float[] newValues = new float[indexes.length * n]; + for (int i = 0; i < indexes.length; i++) { + int srcOffset = indexes[i] * n; + int dstOffset = i * n; + for (int e = 0; e < n; e++) + newValues[dstOffset + e] = values[srcOffset + e]; + } + return new VaryingArrayTuple3f(declaration, newValues); + } + } Index: UniformArrayFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayFloat.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UniformArrayFloat.java 8 Apr 2004 17:34:38 -0000 1.5 --- UniformArrayFloat.java 8 Apr 2004 21:03:32 -0000 1.6 *************** *** 43,45 **** --- 43,49 ---- } + public Parameter selectValues(int[] indexes) { + return this; + } + } |
From: Gerardo H. <ma...@us...> - 2004-04-08 21:16:45
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11866/src/org/jrman/parser Modified Files: Parser.java Log Message: Refactored parameter selection. Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** Parser.java 29 Mar 2004 16:47:30 -0000 1.80 --- Parser.java 8 Apr 2004 21:03:33 -0000 1.81 *************** *** 65,69 **** import org.jrman.parameters.UniformScalarInteger; import org.jrman.parameters.UniformScalarString; - import org.jrman.parameters.VaryingArrayFloat; import org.jrman.parameters.VaryingScalarFloat; import org.jrman.parameters.VaryingScalarTuple3f; --- 65,68 ---- *************** *** 970,991 **** else throw new IllegalArgumentException("Unknown v wrap type: " + vWrap); ! VaryingScalarTuple3f pParam = (VaryingScalarTuple3f) parameters.getParameter("P"); ! Point3f tmp = new Point3f(); for (int i = 0; i < nU; i++) for (int j = 0; j < nV; j++) { ! ParameterList nparameters = new ParameterList(parameters); ! nparameters.removeParameter("P"); ! VaryingScalarTuple3f npParam = ! new VaryingScalarTuple3f(pParam.getDeclaration(), new float[4 * 3]); ! pParam.getValue(evalIndex(i, nu, j, nv), tmp); ! npParam.setValue(0, tmp); ! pParam.getValue(evalIndex(i + 1, nu, j, nv), tmp); ! npParam.setValue(1, tmp); ! pParam.getValue(evalIndex(i, nu, j + 1, nv), tmp); ! npParam.setValue(2, tmp); ! pParam.getValue(evalIndex(i + 1, nu, j + 1, nv), tmp); ! npParam.setValue(3, tmp); ! nparameters.addParameter(npParam); ! addBilinearPatch(nparameters); } } --- 969,980 ---- else throw new IllegalArgumentException("Unknown v wrap type: " + vWrap); ! int[] indexes = new int[4]; for (int i = 0; i < nU; i++) for (int j = 0; j < nV; j++) { ! indexes[0] = evalIndex(i, nu, j, nv); ! indexes[1] = evalIndex(i + 1, nu, j, nv); ! indexes[2] = evalIndex(i, nu, j + 1, nv); ! indexes[3] = evalIndex(i + 1, nu, j + 1, nv); ! addBilinearPatch(parameters.selectValues(indexes)); } } *************** *** 997,1077 **** String vWrap, ParameterList parameters) { ! int uStep = currentAttributes.getUStep(); ! int nU; ! if (uWrap.equals("periodic")) ! nU = nu / uStep; ! else if (uWrap.equals("nonperiodic")) ! nU = (nu - 4) / uStep + 1; ! else ! throw new IllegalArgumentException("Unknown u wrap type: " + uWrap); ! int vStep = currentAttributes.getVStep(); ! int nV; ! if (vWrap.equals("periodic")) ! nV = nv / vStep; ! else if (uWrap.equals("nonperiodic")) ! nV = (nv - 4) / vStep + 1; ! else ! throw new IllegalArgumentException("Unknown v wrap type: " + vWrap); ! VaryingScalarTuple3f pParam = (VaryingScalarTuple3f) parameters.getParameter("P"); ! Point3f tmp = new Point3f(); ! int i = 0; ! for (int ii = 0; ii < nU; ii++) { ! int j = 0; ! for (int jj = 0; jj < nV; jj++) { ! ParameterList nparameters = new ParameterList(parameters); ! nparameters.removeParameter("P"); ! VaryingScalarTuple3f npParam = ! new VaryingScalarTuple3f(pParam.getDeclaration(), new float[16 * 3]); ! pParam.getValue(evalIndex(i, nu, j, nv), tmp); ! npParam.setValue(0, tmp); ! pParam.getValue(evalIndex(i + 1, nu, j, nv), tmp); ! npParam.setValue(1, tmp); ! pParam.getValue(evalIndex(i + 2, nu, j, nv), tmp); ! npParam.setValue(2, tmp); ! pParam.getValue(evalIndex(i + 3, nu, j, nv), tmp); ! npParam.setValue(3, tmp); ! pParam.getValue(evalIndex(i, nu, j + 1, nv), tmp); ! npParam.setValue(4, tmp); ! pParam.getValue(evalIndex(i + 1, nu, j + 1, nv), tmp); ! npParam.setValue(5, tmp); ! pParam.getValue(evalIndex(i + 2, nu, j + 1, nv), tmp); ! npParam.setValue(6, tmp); ! pParam.getValue(evalIndex(i + 3, nu, j + 1, nv), tmp); ! npParam.setValue(7, tmp); ! pParam.getValue(evalIndex(i, nu, j + 2, nv), tmp); ! npParam.setValue(8, tmp); ! pParam.getValue(evalIndex(i + 1, nu, j + 2, nv), tmp); ! npParam.setValue(9, tmp); ! pParam.getValue(evalIndex(i + 2, nu, j + 2, nv), tmp); ! npParam.setValue(10, tmp); ! pParam.getValue(evalIndex(i + 3, nu, j + 2, nv), tmp); ! npParam.setValue(11, tmp); ! pParam.getValue(evalIndex(i, nu, j + 3, nv) , tmp); ! npParam.setValue(12, tmp); ! pParam.getValue(evalIndex(i + 1, nu, j + 3, nv), tmp); ! npParam.setValue(13, tmp); ! pParam.getValue(evalIndex(i + 2, nu, j + 3, nv), tmp); ! npParam.setValue(14, tmp); ! pParam.getValue(evalIndex(i + 3, nu, j + 3, nv), tmp); ! npParam.setValue(15, tmp); ! nparameters.addParameter(npParam); ! addBicubicPatch(nparameters); ! j += vStep; ! } ! i += uStep; } } ! public void addNuPatch(final int nu, ! final int uorder, ! final float[] uknot, ! final float umin, ! final float umax, ! final int vu, ! final int vorder, ! final float[] vknot, ! final float vmin, ! final float vmax, ! final ParameterList parameterList) { if (inAreaLightSource) return; --- 986,1045 ---- String vWrap, ParameterList parameters) { ! int uStep = currentAttributes.getUStep(); ! int nU; ! if (uWrap.equals("periodic")) ! nU = nu / uStep; ! else if (uWrap.equals("nonperiodic")) ! nU = (nu - 4) / uStep + 1; ! else ! throw new IllegalArgumentException("Unknown u wrap type: " + uWrap); ! int vStep = currentAttributes.getVStep(); ! int nV; ! if (vWrap.equals("periodic")) ! nV = nv / vStep; ! else if (uWrap.equals("nonperiodic")) ! nV = (nv - 4) / vStep + 1; ! else ! throw new IllegalArgumentException("Unknown v wrap type: " + vWrap); ! int[] indexes = new int[16]; ! int i = 0; ! for (int ii = 0; ii < nU; ii++) { ! int j = 0; ! for (int jj = 0; jj < nV; jj++) { ! indexes[0] = evalIndex(i, nu, j, nv); ! indexes[1] = evalIndex(i + 1, nu, j, nv); ! indexes[2] = evalIndex(i + 2, nu, j, nv); ! indexes[3] = evalIndex(i + 3, nu, j, nv); ! indexes[4] = evalIndex(i, nu, j + 1, nv); ! indexes[5] = evalIndex(i + 1, nu, j + 1, nv); ! indexes[6] = evalIndex(i + 2, nu, j + 1, nv); ! indexes[7] = evalIndex(i + 3, nu, j + 1, nv); ! indexes[8] = evalIndex(i, nu, j + 2, nv); ! indexes[9] = evalIndex(i + 1, nu, j + 2, nv); ! indexes[10] = evalIndex(i + 2, nu, j + 2, nv); ! indexes[11] = evalIndex(i + 3, nu, j + 2, nv); ! indexes[12] = evalIndex(i, nu, j + 3, nv); ! indexes[13] = evalIndex(i + 1, nu, j + 3, nv); ! indexes[14] = evalIndex(i + 2, nu, j + 3, nv); ! indexes[15] = evalIndex(i + 3, nu, j + 3, nv); ! addBicubicPatch(parameters.selectValues(indexes)); ! j += vStep; } + i += uStep; + } } ! public void addNuPatch( ! final int nu, ! final int uorder, ! final float[] uknot, ! final float umin, ! final float umax, ! final int vu, ! final int vorder, ! final float[] vknot, ! final float vmin, ! final float vmax, ! final ParameterList parameterList) { if (inAreaLightSource) return; *************** *** 1083,1091 **** currentObjectInstanceList .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! //NuPatch patch = ! //new NuPatch(parameters, createAttributes(transform, attributes)); ! //return patch; ! return null; } }); --- 1051,1059 ---- currentObjectInstanceList .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! //NuPatch patch = ! //new NuPatch(parameters, createAttributes(transform, attributes)); ! //return patch; ! return null; } }); *************** *** 1119,1174 **** public void addPolygon(final ParameterList parameters) { VaryingScalarTuple3f pParam = (VaryingScalarTuple3f) parameters.getParameter("P"); ! VaryingArrayFloat stParam = (VaryingArrayFloat) parameters.getParameter("st"); ! VaryingScalarTuple3f nParam = (VaryingScalarTuple3f) parameters.getParameter("N"); ! Point3f point = new Point3f(); ! for (int i = 1; i < pParam.getCount() - 1; i += 1) { ! VaryingScalarTuple3f npParam = ! new VaryingScalarTuple3f(pParam.getDeclaration(), new float[4 * 3]); ! VaryingArrayFloat nstParam = null; ! if (stParam != null) ! nstParam = new VaryingArrayFloat(stParam.getDeclaration(), new float[4 * 2]); ! VaryingScalarTuple3f nnParam = null; ! if (nParam != null) ! nnParam = new VaryingScalarTuple3f(nParam.getDeclaration(), new float[4 * 3]); ! ParameterList newParameters = new ParameterList(parameters); ! pParam.getValue(0, point); ! npParam.setValue(0, point); ! pParam.getValue(i, point); ! npParam.setValue(1, point); ! pParam.getValue(0, point); ! npParam.setValue(2, point); ! pParam.getValue(i + 1, point); ! npParam.setValue(3, point); ! if (stParam != null) { ! nstParam.setValue(0, 0, stParam.getValue(0, 0)); ! nstParam.setValue(0, 1, stParam.getValue(0, 1)); ! nstParam.setValue(1, 0, stParam.getValue(i, 0)); ! nstParam.setValue(1, 1, stParam.getValue(i, 1)); ! nstParam.setValue(2, 0, stParam.getValue(0, 0)); ! nstParam.setValue(2, 1, stParam.getValue(0, 1)); ! nstParam.setValue(3, 0, stParam.getValue(i + 1, 0)); ! nstParam.setValue(3, 1, stParam.getValue(i + 1, 1)); ! } ! if (nParam != null) { ! nParam.getValue(0, point); ! nnParam.setValue(0, point); ! nParam.getValue(i, point); ! nnParam.setValue(1, point); ! nParam.getValue(0, point); ! nnParam.setValue(2, point); ! nParam.getValue(i + 1, point); ! nnParam.setValue(3, point); ! } ! newParameters.removeParameter(npParam.getDeclaration().getName()); ! newParameters.addParameter(npParam); ! if (stParam != null) { ! newParameters.removeParameter(stParam.getDeclaration().getName()); ! newParameters.addParameter(nstParam); ! } ! if (nParam != null) { ! newParameters.removeParameter(nnParam.getDeclaration().getName()); ! newParameters.addParameter(nnParam); ! } ! addBilinearPatch(newParameters); } } --- 1087,1095 ---- public void addPolygon(final ParameterList parameters) { VaryingScalarTuple3f pParam = (VaryingScalarTuple3f) parameters.getParameter("P"); ! int[] indexes = new int[] { 0, 0, 0, 0 }; ! for (int i = 1; i < pParam.getCount() - 1; i++) { ! indexes[1] = i; ! indexes[3] = i + 1; ! addBilinearPatch(parameters.selectValues(indexes)); } } |
From: Gerardo H. <ma...@us...> - 2004-04-08 21:16:45
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11866/src/org/jrman/util Modified Files: Calc.java Log Message: Refactored parameter selection. Index: Calc.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/util/Calc.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Calc.java 8 Apr 2004 00:53:02 -0000 1.16 --- Calc.java 8 Apr 2004 21:03:33 -0000 1.17 *************** *** 136,169 **** } - public static void interpolate( - Tuple3f a00, - Tuple3f a10, - Tuple3f a01, - Tuple3f a11, - float alphaU, - float alphaV, - Tuple3f result) { - interpolate(a00, a10, alphaU, tmpP0); - interpolate(a01, a11, alphaU, tmpP1); - interpolate(tmpP0, tmpP1, alphaV, result); - } - - public static void interpolate(Tuple4f a, Tuple4f b, float alpha, Tuple4f result) { - result.interpolate(a, b, alpha); - } - - public static void interpolate( - Tuple4f a00, - Tuple4f a10, - Tuple4f a01, - Tuple4f a11, - float alphaU, - float alphaV, - Tuple4f result) { - interpolate(a00, a10, alphaU, tmpHP0); - interpolate(a01, a11, alphaU, tmpHP1); - interpolate(tmpHP0, tmpHP1, alphaV, result); - } - public static Matrix4f interpolate(Matrix4f a, Matrix4f b, float alpha) { return new Matrix4f( --- 136,139 ---- |
From: Gerardo H. <ma...@us...> - 2004-04-08 21:16:44
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11866/src/org/jrman/primitive Modified Files: Primitive.java PointsPolygons.java Log Message: Refactored parameter selection. Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Primitive.java 8 Apr 2004 17:34:38 -0000 1.29 --- Primitive.java 8 Apr 2004 21:03:32 -0000 1.30 *************** *** 21,26 **** import javax.vecmath.Color3f; - import javax.vecmath.Point3f; - import javax.vecmath.Vector3f; import org.jrman.attributes.Attributes; --- 21,24 ---- Index: PointsPolygons.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/PointsPolygons.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PointsPolygons.java 2 Feb 2004 19:30:05 -0000 1.1 --- PointsPolygons.java 8 Apr 2004 21:03:32 -0000 1.2 *************** *** 39,44 **** VaryingScalarTuple3f points; - VaryingScalarTuple3f normals; - public PointsPolygons( int[] nVertices, --- 39,42 ---- *************** *** 52,57 **** points = (VaryingScalarTuple3f) parameters.getParameter("P"); parameters.removeParameter("P"); - normals = (VaryingScalarTuple3f) parameters.getParameter("N"); - parameters.removeParameter("N"); } --- 50,53 ---- *************** *** 69,74 **** int offset = 0; for (int i = 0; i < nVertices.length; i++) { ! result[i] = ! new Polygon(nVertices[i], offset, parameters, attributes); offset += nVertices[i]; } --- 65,69 ---- int offset = 0; for (int i = 0; i < nVertices.length; i++) { ! result[i] = new Polygon(nVertices[i], offset, parameters, attributes); offset += nVertices[i]; } *************** *** 104,140 **** public Primitive[] split() { Primitive[] result = new Primitive[n - 3 + 1]; for (int i = 1; i < n - 1; i++) { ! VaryingScalarTuple3f npoints = ! new VaryingScalarTuple3f(points.getDeclaration(), new float[4 * 3]); ! VaryingScalarTuple3f nnormals = null; ! if (normals != null) ! nnormals = ! new VaryingScalarTuple3f(normals.getDeclaration(), new float[4 * 3]); ! ParameterList newParameters = new ParameterList(parameters); ! points.getValue(vertices[offset], tmpPoint); ! npoints.setValue(0, tmpPoint); ! points.getValue(vertices[offset + i], tmpPoint); ! npoints.setValue(1, tmpPoint); ! points.getValue(vertices[offset], tmpPoint); ! npoints.setValue(2, tmpPoint); ! points.getValue(vertices[offset + i + 1], tmpPoint); ! npoints.setValue(3, tmpPoint); ! if (normals != null) { ! normals.getValue(vertices[offset], tmpPoint); ! nnormals.setValue(0, tmpPoint); ! normals.getValue(vertices[offset + i], tmpPoint); ! nnormals.setValue(1, tmpPoint); ! normals.getValue(vertices[offset], tmpPoint); ! nnormals.setValue(2, tmpPoint); ! normals.getValue(vertices[offset + i + 1], tmpPoint); ! nnormals.setValue(3, tmpPoint); ! } ! newParameters.removeParameter(npoints.getDeclaration().getName()); ! newParameters.addParameter(npoints); ! if (normals != null) { ! newParameters.removeParameter(nnormals.getDeclaration().getName()); ! newParameters.addParameter(nnormals); ! } ! result[i - 1] = new BilinearPatch(newParameters, attributes); } return result; --- 99,109 ---- public Primitive[] split() { Primitive[] result = new Primitive[n - 3 + 1]; + int[] indexes = new int[] { vertices[offset], 0, vertices[offset], 0 }; for (int i = 1; i < n - 1; i++) { ! indexes[1] = vertices[offset + i]; ! indexes[3] = vertices[offset + i + 1]; ! ParameterList pl = parameters.selectValues(indexes); ! pl.addParameter(points.selectValues(indexes)); ! result[i - 1] = new BilinearPatch(pl, attributes); } return result; |
Update of /cvsroot/jrman/drafts/src/org/jrman/parameters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31929/src/org/jrman/parameters Modified Files: VaryingArrayFloat.java UniformArrayHPoint.java UniformArrayTuple3f.java UniformScalarFloat.java UniformScalarHPoint.java VaryingArrayHPoint.java VaryingScalarTuple3f.java UniformArrayString.java UniformScalarInteger.java UniformScalarString.java VaryingArrayTuple3f.java UniformScalarTuple3f.java VaryingScalarHPoint.java VaryingScalarFloat.java UniformArrayFloat.java UniformArrayInteger.java Parameter.java Log Message: Dicing refactoring. Index: UniformScalarTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarTuple3f.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformScalarTuple3f.java 8 Apr 2004 00:53:02 -0000 1.3 --- UniformScalarTuple3f.java 8 Apr 2004 17:34:38 -0000 1.4 *************** *** 22,25 **** --- 22,27 ---- import javax.vecmath.Tuple3f; + import org.jrman.grid.Grid; + public class UniformScalarTuple3f extends Parameter { *************** *** 47,49 **** --- 49,55 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: UniformArrayInteger.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayInteger.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformArrayInteger.java 8 Apr 2004 00:53:02 -0000 1.4 --- UniformArrayInteger.java 8 Apr 2004 17:34:38 -0000 1.5 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.grid.Grid; + public class UniformArrayInteger extends Parameter { *************** *** 37,39 **** --- 39,45 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: UniformArrayTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayTuple3f.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformArrayTuple3f.java 8 Apr 2004 00:53:02 -0000 1.4 --- UniformArrayTuple3f.java 8 Apr 2004 17:34:38 -0000 1.5 *************** *** 22,25 **** --- 22,27 ---- import javax.vecmath.Tuple3f; + import org.jrman.grid.Grid; + public class UniformArrayTuple3f extends Parameter { *************** *** 41,43 **** --- 43,49 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: VaryingScalarFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarFloat.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VaryingScalarFloat.java 8 Apr 2004 00:53:02 -0000 1.4 --- VaryingScalarFloat.java 8 Apr 2004 17:34:38 -0000 1.5 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.grid.FloatGrid; + import org.jrman.grid.Grid; import org.jrman.util.Calc; *************** *** 44,46 **** --- 46,65 ---- } + public void linearDice(Grid grid) { + FloatGrid g = (FloatGrid) grid; + int uSize = Grid.getUSize(); + int vSize = Grid.getVSize(); + float uStep = 1f / (uSize - 1); + float vStep = 1f / (vSize - 1); + float u = 0f; + for (int iu = 0; iu < uSize; iu++) { + float v = 0f; + for (int iv = 0; iv < vSize; iv++) { + g.set(iu, iv, Calc.interpolate(values[0], values[1], values[2], values[3], u, v)); + v += vStep; + } + u += uStep; + } + } + } Index: VaryingScalarHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarHPoint.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VaryingScalarHPoint.java 8 Apr 2004 00:53:02 -0000 1.5 --- VaryingScalarHPoint.java 8 Apr 2004 17:34:38 -0000 1.6 *************** *** 22,25 **** --- 22,26 ---- import javax.vecmath.Tuple4f; + import org.jrman.grid.Grid; import org.jrman.util.Calc; *************** *** 81,83 **** --- 82,88 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Dice hpoint not implemented: " + declaration); + } + } Index: VaryingArrayFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayFloat.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** VaryingArrayFloat.java 8 Apr 2004 00:53:02 -0000 1.6 --- VaryingArrayFloat.java 8 Apr 2004 17:34:37 -0000 1.7 *************** *** 20,23 **** --- 20,24 ---- package org.jrman.parameters; + import org.jrman.grid.Grid; import org.jrman.util.Calc; *************** *** 81,83 **** --- 82,88 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Dice array not implemented: " + declaration); + } + } Index: UniformScalarFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarFloat.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformScalarFloat.java 8 Apr 2004 00:53:02 -0000 1.3 --- UniformScalarFloat.java 8 Apr 2004 17:34:38 -0000 1.4 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.grid.Grid; + public class UniformScalarFloat extends Parameter { *************** *** 37,39 **** --- 39,45 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: UniformArrayString.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayString.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformArrayString.java 8 Apr 2004 00:53:02 -0000 1.4 --- UniformArrayString.java 8 Apr 2004 17:34:38 -0000 1.5 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.grid.Grid; + public class UniformArrayString extends Parameter { *************** *** 37,39 **** --- 39,45 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: UniformScalarHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarHPoint.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformScalarHPoint.java 8 Apr 2004 00:53:02 -0000 1.3 --- UniformScalarHPoint.java 8 Apr 2004 17:34:38 -0000 1.4 *************** *** 22,25 **** --- 22,27 ---- import javax.vecmath.Tuple4f; + import org.jrman.grid.Grid; + public class UniformScalarHPoint extends Parameter { *************** *** 51,53 **** --- 53,59 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: UniformArrayHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayHPoint.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformArrayHPoint.java 8 Apr 2004 00:53:02 -0000 1.4 --- UniformArrayHPoint.java 8 Apr 2004 17:34:38 -0000 1.5 *************** *** 22,25 **** --- 22,27 ---- import javax.vecmath.Tuple4f; + import org.jrman.grid.Grid; + public class UniformArrayHPoint extends Parameter { *************** *** 42,44 **** --- 44,50 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: VaryingArrayHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayHPoint.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VaryingArrayHPoint.java 8 Apr 2004 00:53:02 -0000 1.4 --- VaryingArrayHPoint.java 8 Apr 2004 17:34:38 -0000 1.5 *************** *** 22,25 **** --- 22,26 ---- import javax.vecmath.Tuple4f; + import org.jrman.grid.Grid; import org.jrman.util.Calc; *************** *** 56,58 **** --- 57,63 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Dice array not implemented: " + declaration); + } + } Index: Parameter.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/Parameter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Parameter.java 8 Apr 2004 00:53:02 -0000 1.2 --- Parameter.java 8 Apr 2004 17:34:38 -0000 1.3 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.grid.Grid; + public abstract class Parameter { *************** *** 33,36 **** --- 35,40 ---- public abstract Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax); + + public abstract void linearDice(Grid grid); } Index: VaryingScalarTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarTuple3f.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** VaryingScalarTuple3f.java 8 Apr 2004 00:53:02 -0000 1.6 --- VaryingScalarTuple3f.java 8 Apr 2004 17:34:38 -0000 1.7 *************** *** 20,29 **** --- 20,34 ---- package org.jrman.parameters; + import javax.vecmath.Point3f; import javax.vecmath.Tuple3f; + import org.jrman.grid.Grid; + import org.jrman.grid.Tuple3fGrid; import org.jrman.util.Calc; public class VaryingScalarTuple3f extends Parameter { + private static Point3f tmp = new Point3f(); + final private float[] values; *************** *** 70,72 **** --- 75,97 ---- } + public void linearDice(Grid grid) { + Tuple3fGrid g = (Tuple3fGrid) grid; + int uSize = Grid.getUSize(); + int vSize = Grid.getVSize(); + float uStep = 1f / (uSize - 1); + float vStep = 1f / (vSize - 1); + float u = 0f; + for (int iu = 0; iu < uSize; iu++) { + float v = 0f; + for (int iv = 0; iv < vSize; iv++) { + tmp.x = Calc.interpolate(values[0], values[3], values[6], values[9], u, v); + tmp.y = Calc.interpolate(values[1], values[4], values[7], values[10], u, v); + tmp.z = Calc.interpolate(values[2], values[5], values[8], values[11], u, v); + g.set(iu, iv, tmp); + v += vStep; + } + u += uStep; + } + } + } Index: UniformScalarInteger.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarInteger.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformScalarInteger.java 8 Apr 2004 00:53:02 -0000 1.3 --- UniformScalarInteger.java 8 Apr 2004 17:34:38 -0000 1.4 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.grid.Grid; + public class UniformScalarInteger extends Parameter { *************** *** 37,39 **** --- 39,45 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: UniformScalarString.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarString.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformScalarString.java 8 Apr 2004 00:53:02 -0000 1.3 --- UniformScalarString.java 8 Apr 2004 17:34:38 -0000 1.4 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.grid.Grid; + public class UniformScalarString extends Parameter { *************** *** 37,39 **** --- 39,45 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } Index: VaryingArrayTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayTuple3f.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VaryingArrayTuple3f.java 8 Apr 2004 00:53:02 -0000 1.4 --- VaryingArrayTuple3f.java 8 Apr 2004 17:34:38 -0000 1.5 *************** *** 22,25 **** --- 22,26 ---- import javax.vecmath.Tuple3f; + import org.jrman.grid.Grid; import org.jrman.util.Calc; *************** *** 55,57 **** --- 56,62 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Dice array not implemented: " + declaration); + } + } Index: UniformArrayFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayFloat.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniformArrayFloat.java 8 Apr 2004 00:53:02 -0000 1.4 --- UniformArrayFloat.java 8 Apr 2004 17:34:38 -0000 1.5 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.grid.Grid; + public class UniformArrayFloat extends Parameter { *************** *** 37,39 **** --- 39,45 ---- } + public void linearDice(Grid grid) { + throw new UnsupportedOperationException("Parameter not diceable: " + declaration); + } + } |
From: Gerardo H. <ma...@us...> - 2004-04-08 17:47:49
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31929/src/org/jrman/primitive Modified Files: Primitive.java BilinearPatch.java Log Message: Dicing refactoring. Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Primitive.java 8 Apr 2004 00:53:02 -0000 1.28 --- Primitive.java 8 Apr 2004 17:34:38 -0000 1.29 *************** *** 21,25 **** import javax.vecmath.Color3f; - import javax.vecmath.Point4f; import javax.vecmath.Point3f; import javax.vecmath.Vector3f; --- 21,24 ---- *************** *** 29,37 **** import org.jrman.geom.Bounds2f; import org.jrman.geom.Transform; - import org.jrman.grid.Color3fGrid; - import org.jrman.grid.FloatGrid; import org.jrman.grid.Grid; - import org.jrman.grid.Point3fGrid; - import org.jrman.grid.Vector3fGrid; import org.jrman.parameters.Declaration; import org.jrman.parameters.Parameter; --- 28,32 ---- *************** *** 40,44 **** import org.jrman.parameters.VaryingScalarFloat; import org.jrman.parameters.VaryingScalarTuple3f; - import org.jrman.parameters.VaryingScalarHPoint; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; --- 35,38 ---- *************** *** 51,88 **** 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 Point3f pi0 = 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(); - - private static Point4f t0 = new Point4f(); - - private static Point4f t1 = new Point4f(); - - private static Point4f t2 = new Point4f(); - - private static Point4f t3 = new Point4f(); - protected ParameterList parameters; --- 45,50 ---- *************** *** 198,208 **** 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,166 ---- protected void dice_N(ShaderVariables shaderVariables) { VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("N"); ! if (param != null) ! param.linearDice(shaderVariables.N); ! else shaderVariables.N.set(shaderVariables.Ng); } *************** *** 211,221 **** 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); --- 169,175 ---- VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("Cs"); if (param != null) { ! if (param.getCount() == 4) ! param.linearDice(shaderVariables.Cs); ! else { param.getValue(0, c0); shaderVariables.Cs.set(c0); *************** *** 228,238 **** 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); --- 182,188 ---- VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("Os"); if (param != null) { ! if (param.getCount() == 4) ! param.linearDice(shaderVariables.Os); ! else { param.getValue(0, c0); shaderVariables.Os.set(c0); *************** *** 244,283 **** 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)); } --- 194,213 ---- protected void dice_u(ShaderVariables shaderVariables) { VaryingScalarFloat param = (VaryingScalarFloat) parameters.getParameter("u"); ! param.linearDice(shaderVariables.u); } protected void dice_v(ShaderVariables shaderVariables) { VaryingScalarFloat param = (VaryingScalarFloat) parameters.getParameter("v"); ! param.linearDice(shaderVariables.v); } protected void dice_s(ShaderVariables shaderVariables) { VaryingScalarFloat param = (VaryingScalarFloat) parameters.getParameter("s"); ! param.linearDice(shaderVariables.s); } protected void dice_t(ShaderVariables shaderVariables) { VaryingScalarFloat param = (VaryingScalarFloat) parameters.getParameter("t"); ! param.linearDice(shaderVariables.t); } *************** *** 303,388 **** } - protected void diceFloat(FloatGrid g, float uv00, float uv10, float uv01, float uv11) { - int uSize = Grid.getUSize(); - int vSize = Grid.getVSize(); - float uStep = 1f / (uSize - 1); - float vStep = 1f / (vSize - 1); - float u = 0f; - for (int iu = 0; iu < uSize; iu++) { - float v = 0f; - for (int iv = 0; iv < vSize; iv++) { - g.set(iu, iv, Calc.interpolate(uv00, uv10, uv01, uv11, u, v)); - v += vStep; - } - u += uStep; - } - } - - protected void dicePoint3f( - Point3fGrid g, - Point3f uv00, - Point3f uv10, - Point3f uv01, - Point3f uv11) { - int uSize = Grid.getUSize(); - int vSize = Grid.getVSize(); - float uStep = 1f / (uSize - 1); - float vStep = 1f / (vSize - 1); - float u = 0f; - for (int iu = 0; iu < uSize; iu++) { - float v = 0f; - for (int iv = 0; iv < vSize; iv++) { - Calc.interpolate(uv00, uv10, uv01, uv11, u, v, pi0); - g.set(iu, iv, pi0); - v += vStep; - } - u += uStep; - } - } - - protected void diceVector3f( - Vector3fGrid g, - Vector3f uv00, - Vector3f uv10, - Vector3f uv01, - Vector3f uv11) { - int uSize = Grid.getUSize(); - int vSize = Grid.getVSize(); - float uStep = 1f / (uSize - 1); - float vStep = 1f / (vSize - 1); - float u = 0f; - for (int iu = 0; iu < uSize; iu++) { - float v = 0f; - for (int iv = 0; iv < vSize; iv++) { - Calc.interpolate(uv00, uv10, uv01, uv11, u, v, pi0); - g.set(iu, iv, pi0); - v += vStep; - } - u += uStep; - } - } - - protected void diceColor3f( - Color3fGrid g, - Color3f uv00, - Color3f uv10, - Color3f uv01, - Color3f uv11) { - int uSize = Grid.getUSize(); - int vSize = Grid.getVSize(); - float uStep = 1f / (uSize - 1); - float vStep = 1f / (vSize - 1); - float u = 0f; - for (int iu = 0; iu < uSize; iu++) { - float v = 0f; - for (int iv = 0; iv < vSize; iv++) { - Calc.interpolate(uv00, uv10, uv01, uv11, u, v, pi0); - g.set(iu, iv, pi0); - v += vStep; - } - u += uStep; - } - } - protected void setDefaultParameters() { Parameter parameter = parameters.getParameter("u"); --- 233,236 ---- Index: BilinearPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/BilinearPatch.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BilinearPatch.java 8 Feb 2004 08:54:55 -0000 1.6 --- BilinearPatch.java 8 Apr 2004 17:34:38 -0000 1.7 *************** *** 92,97 **** protected void dice_P(ShaderVariables sv) { ! extractPoints(); ! dicePoint3f(sv.P, P00, P10, P01, P11); } --- 92,97 ---- protected void dice_P(ShaderVariables sv) { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("P"); ! param.linearDice(sv.P); } |
From: Gerardo H. <ma...@us...> - 2004-04-08 17:47:49
|
Update of /cvsroot/jrman/drafts/src/org/jrman/options In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31929/src/org/jrman/options Modified Files: Exposure.java Log Message: Dicing refactoring. Index: Exposure.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/options/Exposure.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Exposure.java 3 May 2003 18:02:48 -0000 1.2 --- Exposure.java 8 Apr 2004 17:34:38 -0000 1.3 *************** *** 44,48 **** } ! public void expose(Color3f color, Color3f out) { out.scale(gain, color); out.x = (float) Math.pow(out.x, oneOverGamma); --- 44,48 ---- } ! public void expose(Color3f color,Color3f out) { out.scale(gain, color); out.x = (float) Math.pow(out.x, oneOverGamma); |
Update of /cvsroot/jrman/drafts/src/org/jrman/parameters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7872/src/org/jrman/parameters Modified Files: VaryingArrayFloat.java UniformArrayHPoint.java UniformArrayTuple3f.java UniformScalarFloat.java UniformScalarHPoint.java VaryingArrayHPoint.java VaryingScalarTuple3f.java UniformArrayString.java UniformScalarInteger.java UniformScalarString.java VaryingArrayTuple3f.java ParameterList.java UniformScalarTuple3f.java VaryingScalarHPoint.java VaryingScalarFloat.java UniformArrayFloat.java UniformArrayInteger.java Parameter.java Log Message: Parameter handling refactoring. Index: UniformScalarTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarTuple3f.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UniformScalarTuple3f.java 9 Dec 2003 04:51:52 -0000 1.2 --- UniformScalarTuple3f.java 8 Apr 2004 00:53:02 -0000 1.3 *************** *** 1,5 **** /* UniformScalarTuple3f.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformScalarTuple3f.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 43,45 **** --- 43,49 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: UniformArrayInteger.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayInteger.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformArrayInteger.java 14 Dec 2003 22:28:28 -0000 1.3 --- UniformArrayInteger.java 8 Apr 2004 00:53:02 -0000 1.4 *************** *** 1,5 **** /* UniformArrayInteger.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformArrayInteger.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 33,35 **** --- 33,39 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: UniformArrayTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayTuple3f.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformArrayTuple3f.java 14 Dec 2003 22:28:28 -0000 1.3 --- UniformArrayTuple3f.java 8 Apr 2004 00:53:02 -0000 1.4 *************** *** 1,5 **** /* UniformArrayTuple3f.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformArrayTuple3f.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 37,39 **** --- 37,43 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: VaryingScalarFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarFloat.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VaryingScalarFloat.java 14 Dec 2003 22:28:28 -0000 1.3 --- VaryingScalarFloat.java 8 Apr 2004 00:53:02 -0000 1.4 *************** *** 1,5 **** /* VaryingScalarFloat.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* VaryingScalarFloat.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parameters; + import org.jrman.util.Calc; + public class VaryingScalarFloat extends Parameter { *************** *** 33,35 **** --- 35,46 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + float[] newValues = new float[4]; + newValues[0] = Calc.interpolate(values[0], values[1], values[2], values[3], uMin, vMin); + newValues[1] = Calc.interpolate(values[0], values[1], values[2], values[3], uMax, vMin); + newValues[2] = Calc.interpolate(values[0], values[1], values[2], values[3], uMin, vMax); + newValues[3] = Calc.interpolate(values[0], values[1], values[2], values[3], uMax, vMax); + return new VaryingScalarFloat(declaration, newValues); + } + } Index: VaryingScalarHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarHPoint.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VaryingScalarHPoint.java 23 Mar 2004 06:29:11 -0000 1.4 --- VaryingScalarHPoint.java 8 Apr 2004 00:53:02 -0000 1.5 *************** *** 1,5 **** /* VaryingScalarHPoint.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* VaryingScalarHPoint.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 22,25 **** --- 22,27 ---- import javax.vecmath.Tuple4f; + import org.jrman.util.Calc; + public class VaryingScalarHPoint extends Parameter { *************** *** 58,60 **** --- 60,83 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + float[] newValues = new float[16]; + newValues[0] = Calc.interpolate(values[0], values[4], values[8], values[12], uMin, vMin); + newValues[1] = Calc.interpolate(values[1], values[5], values[9], values[13], uMin, vMin); + newValues[2] = Calc.interpolate(values[2], values[6], values[10], values[14], uMin, vMin); + newValues[3] = Calc.interpolate(values[3], values[7], values[11], values[15], uMin, vMin); + newValues[4] = Calc.interpolate(values[0], values[4], values[8], values[12], uMax, vMin); + newValues[5] = Calc.interpolate(values[1], values[5], values[9], values[13], uMax, vMin); + newValues[6] = Calc.interpolate(values[2], values[6], values[10], values[14], uMax, vMin); + newValues[7] = Calc.interpolate(values[3], values[7], values[11], values[15], uMax, vMin); + newValues[8] = Calc.interpolate(values[0], values[4], values[8], values[12], uMin, vMax); + newValues[9] = Calc.interpolate(values[1], values[5], values[9], values[13], uMin, vMax); + newValues[10] = Calc.interpolate(values[2], values[6], values[10], values[14], uMin, vMax); + newValues[11] = Calc.interpolate(values[3], values[7], values[11], values[15], uMin, vMax); + newValues[12] = Calc.interpolate(values[0], values[4], values[8], values[12], uMax, vMax); + newValues[13] = Calc.interpolate(values[1], values[5], values[9], values[13], uMax, vMax); + newValues[14] = Calc.interpolate(values[2], values[6], values[10], values[14], uMax, vMax); + newValues[15] = Calc.interpolate(values[3], values[7], values[11], values[15], uMax, vMax); + return new VaryingScalarHPoint(declaration, newValues); + } + } Index: VaryingArrayFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayFloat.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VaryingArrayFloat.java 23 Mar 2004 06:29:11 -0000 1.5 --- VaryingArrayFloat.java 8 Apr 2004 00:53:02 -0000 1.6 *************** *** 1,5 **** /* VaryingArrayFloat.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* VaryingArrayFloat.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 20,25 **** package org.jrman.parameters; public class VaryingArrayFloat extends Parameter { ! final private float[] values; --- 20,27 ---- package org.jrman.parameters; + import org.jrman.util.Calc; + public class VaryingArrayFloat extends Parameter { ! final private float[] values; *************** *** 28,32 **** this.values = values; } ! public float getValue(int index, int arrayIndex) { return values[index * declaration.getCount() + arrayIndex]; --- 30,34 ---- this.values = values; } ! public float getValue(int index, int arrayIndex) { return values[index * declaration.getCount() + arrayIndex]; *************** *** 37,39 **** --- 39,83 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + int n = declaration.getCount(); + int n2 = n * 2; + int n3 = n * 3; + float[] newValues = new float[4 * n]; + for (int i = 0; i < n; i++) { + newValues[i] = + Calc.interpolate( + values[i], + values[n + i], + values[n2 + i], + values[n3 + i], + uMin, + vMin); + newValues[n + i] = + Calc.interpolate( + values[i], + values[n + i], + values[n2 + i], + values[n3 + i], + uMax, + vMin); + newValues[n2 + i] = + Calc.interpolate( + values[i], + values[n + i], + values[n2 + i], + values[n3 + i], + uMin, + vMax); + newValues[n3 + i] = + Calc.interpolate( + values[i], + values[n + i], + values[n2 + i], + values[n3 + i], + uMax, + vMax); + } + return new VaryingArrayFloat(declaration, newValues); + } + } Index: UniformScalarFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarFloat.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UniformScalarFloat.java 9 Dec 2003 04:51:52 -0000 1.2 --- UniformScalarFloat.java 8 Apr 2004 00:53:02 -0000 1.3 *************** *** 1,5 **** /* UniformScalarFloat.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformScalarFloat.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 33,35 **** --- 33,39 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: UniformArrayString.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayString.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformArrayString.java 14 Dec 2003 22:28:28 -0000 1.3 --- UniformArrayString.java 8 Apr 2004 00:53:02 -0000 1.4 *************** *** 1,5 **** /* UniformArrayString.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformArrayString.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 33,35 **** --- 33,39 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: ParameterList.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/ParameterList.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ParameterList.java 23 Mar 2004 06:29:11 -0000 1.4 --- ParameterList.java 8 Apr 2004 00:53:02 -0000 1.5 *************** *** 24,42 **** public class ParameterList { ! 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(Parameter parameter) { list.add(parameter); } ! public Parameter getParameter(String name) { Parameter result = null; --- 24,49 ---- public class ParameterList { ! 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 ParameterList linearInterpolate(float uMin, float uMax, float vMin, float vMax) { ! ParameterList pl = new ParameterList(); ! for (int i = 0; i < getParameterCount(); i++) ! pl.addParameter(getParameter(i).linearInterpolate(uMin, uMax, vMin, vMax)); ! return pl; ! } ! public void addParameter(Parameter parameter) { list.add(parameter); } ! public Parameter getParameter(String name) { Parameter result = null; *************** *** 50,62 **** return result; } ! public int getParameterCount() { return list.size(); } ! public Parameter getParameter(int index) { return (Parameter) list.get(index); } ! public void removeParameter(String name) { for (int i = 0; i < list.size(); i++) { --- 57,69 ---- return result; } ! public int getParameterCount() { return list.size(); } ! public Parameter getParameter(int index) { return (Parameter) list.get(index); } ! public void removeParameter(String name) { for (int i = 0; i < list.size(); i++) { Index: UniformScalarHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarHPoint.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UniformScalarHPoint.java 9 Dec 2003 04:51:52 -0000 1.2 --- UniformScalarHPoint.java 8 Apr 2004 00:53:02 -0000 1.3 *************** *** 1,5 **** /* UniformScalarHPoint.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformScalarHPoint.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 47,49 **** --- 47,53 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: UniformArrayHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayHPoint.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformArrayHPoint.java 14 Dec 2003 22:28:28 -0000 1.3 --- UniformArrayHPoint.java 8 Apr 2004 00:53:02 -0000 1.4 *************** *** 1,5 **** /* UniformArrayHPoint.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformArrayHPoint.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 38,40 **** --- 38,44 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: VaryingArrayHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayHPoint.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VaryingArrayHPoint.java 14 Dec 2003 22:28:28 -0000 1.3 --- VaryingArrayHPoint.java 8 Apr 2004 00:53:02 -0000 1.4 *************** *** 1,5 **** /* VaryingArrayHPoint.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* VaryingArrayHPoint.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 22,25 **** --- 22,27 ---- import javax.vecmath.Tuple4f; + import org.jrman.util.Calc; + public class VaryingArrayHPoint extends Parameter { *************** *** 39,41 **** --- 41,58 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + int n = declaration.getCount(); + int off1 = n * 4; + int off2 = off1 * 2; + int off3 = off1 + off2; + float[] newValues = new float[n * 16]; + for (int i = 0; i < off1; i++) { + newValues[i] = Calc.interpolate(values[i], values[off1 + i], values[off2 + i], values[off3 + i], uMin, vMin); + newValues[off1 + i] = Calc.interpolate(values[i], values[off1 + i], values[off2 + i], values[off3 + i], uMax, vMin); + newValues[off1 + i] = Calc.interpolate(values[i], values[off1 + i], values[off2 + i], values[off3 + i], uMin, vMax); + newValues[off1 + i] = Calc.interpolate(values[i], values[off1 + i], values[off2 + i], values[off3 + i], uMax, vMax); + } + return new VaryingArrayHPoint(declaration, newValues); + } + } Index: Parameter.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/Parameter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Parameter.java 9 Dec 2003 04:51:52 -0000 1.1 --- Parameter.java 8 Apr 2004 00:53:02 -0000 1.2 *************** *** 1,5 **** /* Parameter.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* Parameter.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 20,24 **** package org.jrman.parameters; ! public class Parameter { final protected Declaration declaration; --- 20,24 ---- package org.jrman.parameters; ! public abstract class Parameter { final protected Declaration declaration; *************** *** 31,34 **** --- 31,36 ---- return declaration; } + + public abstract Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax); } Index: VaryingScalarTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarTuple3f.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VaryingScalarTuple3f.java 23 Mar 2004 06:29:11 -0000 1.5 --- VaryingScalarTuple3f.java 8 Apr 2004 00:53:02 -0000 1.6 *************** *** 1,5 **** /* VaryingScalarTuple3f.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* VaryingScalarTuple3f.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 21,25 **** import javax.vecmath.Tuple3f; ! import javax.vecmath.Tuple4f; public class VaryingScalarTuple3f extends Parameter { --- 21,26 ---- import javax.vecmath.Tuple3f; ! ! import org.jrman.util.Calc; public class VaryingScalarTuple3f extends Parameter { *************** *** 52,54 **** --- 53,72 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + float[] newValues = new float[12]; + newValues[0] = Calc.interpolate(values[0], values[3], values[6], values[9], uMin, vMin); + newValues[1] = Calc.interpolate(values[1], values[4], values[7], values[10], uMin, vMin); + newValues[2] = Calc.interpolate(values[2], values[5], values[8], values[11], uMin, vMin); + newValues[3] = Calc.interpolate(values[0], values[3], values[6], values[9], uMax, vMin); + newValues[4] = Calc.interpolate(values[1], values[4], values[7], values[10], uMax, vMin); + newValues[5] = Calc.interpolate(values[2], values[5], values[8], values[11], uMax, vMin); + newValues[6] = Calc.interpolate(values[0], values[3], values[6], values[9], uMin, vMax); + newValues[7] = Calc.interpolate(values[1], values[4], values[7], values[10], uMin, vMax); + newValues[8] = Calc.interpolate(values[2], values[5], values[8], values[11], uMin, vMax); + newValues[9] = Calc.interpolate(values[0], values[3], values[6], values[9], uMax, vMax); + newValues[10] = Calc.interpolate(values[1], values[4], values[7], values[10], uMax, vMax); + newValues[11] = Calc.interpolate(values[2], values[5], values[8], values[11], uMax, vMax); + return new VaryingScalarTuple3f(declaration, newValues); + } + } Index: UniformScalarInteger.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarInteger.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UniformScalarInteger.java 9 Dec 2003 04:51:52 -0000 1.2 --- UniformScalarInteger.java 8 Apr 2004 00:53:02 -0000 1.3 *************** *** 1,5 **** /* UniformScalarInteger.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformScalarInteger.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 33,35 **** --- 33,39 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: UniformScalarString.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformScalarString.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UniformScalarString.java 9 Dec 2003 04:51:52 -0000 1.2 --- UniformScalarString.java 8 Apr 2004 00:53:02 -0000 1.3 *************** *** 1,5 **** /* UniformScalarString.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformScalarString.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 33,35 **** --- 33,39 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } Index: VaryingArrayTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayTuple3f.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VaryingArrayTuple3f.java 14 Dec 2003 22:28:28 -0000 1.3 --- VaryingArrayTuple3f.java 8 Apr 2004 00:53:02 -0000 1.4 *************** *** 1,5 **** /* VaryingArrayTuple3f.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* VaryingArrayTuple3f.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 22,25 **** --- 22,27 ---- import javax.vecmath.Tuple3f; + import org.jrman.util.Calc; + public class VaryingArrayTuple3f extends Parameter { *************** *** 38,40 **** --- 40,57 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + int n = declaration.getCount(); + int off1 = n * 3; + int off2 = off1 * 2; + int off3 = off1 + off2; + float[] newValues = new float[n * 12]; + for (int i = 0; i < off1; i++) { + newValues[i] = Calc.interpolate(values[i], values[off1 + i], values[off2 + i], values[off3 + i], uMin, vMin); + newValues[off1 + i] = Calc.interpolate(values[i], values[off1 + i], values[off2 + i], values[off3 + i], uMax, vMin); + newValues[off1 + i] = Calc.interpolate(values[i], values[off1 + i], values[off2 + i], values[off3 + i], uMin, vMax); + newValues[off1 + i] = Calc.interpolate(values[i], values[off1 + i], values[off2 + i], values[off3 + i], uMax, vMax); + } + return new VaryingArrayTuple3f(declaration, newValues); + } + } Index: UniformArrayFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/UniformArrayFloat.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UniformArrayFloat.java 14 Dec 2003 22:28:28 -0000 1.3 --- UniformArrayFloat.java 8 Apr 2004 00:53:02 -0000 1.4 *************** *** 1,5 **** /* UniformArrayFloat.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* UniformArrayFloat.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 33,35 **** --- 33,39 ---- } + public Parameter linearInterpolate(float uMin, float uMax, float vMin, float vMax) { + return this; + } + } |
From: Gerardo H. <ma...@us...> - 2004-04-08 01:06:06
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7872/src/org/jrman/primitive Modified Files: Primitive.java Log Message: Parameter handling refactoring. Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Primitive.java 7 Apr 2004 22:37:39 -0000 1.27 --- Primitive.java 8 Apr 2004 00:53:02 -0000 1.28 *************** *** 1,5 **** /* Primitive.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* Primitive.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 58,64 **** private static Point3f p3 = new Point3f(); ! private static Point3f pi0 = new Point3f(); ! private static Vector3f v0 = new Vector3f(); --- 58,64 ---- private static Point3f p3 = new Point3f(); ! private static Point3f pi0 = new Point3f(); ! private static Vector3f v0 = new Vector3f(); *************** *** 96,102 **** protected float distance; ! protected Transform objectToCamera; ! protected Primitive() { } --- 96,102 ---- protected float distance; ! protected Transform objectToCamera; ! protected Primitive() { } *************** *** 161,169 **** return 0; } ! public Transform getObjectToCamera() { return objectToCamera; } ! public void setObjectToCamera(Transform objectToCamera) { this.objectToCamera = objectToCamera; --- 161,169 ---- return 0; } ! public Transform getObjectToCamera() { return objectToCamera; } ! public void setObjectToCamera(Transform objectToCamera) { this.objectToCamera = objectToCamera; *************** *** 413,418 **** s[2] = stParam.getValue(2, 0); s[3] = stParam.getValue(3, 0); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("s"), ! s)); } else { float[] s = new float[4]; --- 413,417 ---- s[2] = stParam.getValue(2, 0); s[3] = stParam.getValue(3, 0); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("s"), s)); } else { float[] s = new float[4]; *************** *** 422,427 **** s[2] = uParam.getValue(2); s[3] = uParam.getValue(3); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("s"), ! s)); } } --- 421,425 ---- s[2] = uParam.getValue(2); s[3] = uParam.getValue(3); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("s"), s)); } } *************** *** 435,440 **** t[2] = stParam.getValue(2, 1); t[3] = stParam.getValue(3, 1); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("t"), ! t)); } else { float[] t = new float[4]; --- 433,437 ---- t[2] = stParam.getValue(2, 1); t[3] = stParam.getValue(3, 1); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("t"), t)); } else { float[] t = new float[4]; *************** *** 444,449 **** t[2] = vParam.getValue(2); t[3] = vParam.getValue(3); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("t"), ! t)); } } --- 441,445 ---- t[2] = vParam.getValue(2); t[3] = vParam.getValue(3); ! parameters.addParameter(new VaryingScalarFloat(Global.getDeclaration("t"), t)); } } *************** *** 456,576 **** float vMin, float vMax) { ! ParameterList result = new ParameterList(); ! for (int i = 0; i < parameters.getParameterCount(); i++) { ! Parameter 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; ! if (param.getCount() == 4) { ! VaryingScalarTuple3f sparam = ! new VaryingScalarTuple3f(declaration, new float[4 * 3]); ! param.getValue(0, p0); ! param.getValue(1, p1); ! param.getValue(2, p2); ! param.getValue(3, p3); ! Point3f uv00 = p0; ! Point3f uv10 = p1; ! Point3f uv01 = p2; ! Point3f uv11 = p3; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, pi0); ! sparam.setValue(0, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, pi0); ! sparam.setValue(1, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, pi0); ! sparam.setValue(2, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, pi0); ! sparam.setValue(3, pi0); ! result.addParameter(sparam); ! } ! } else if (type == Declaration.Type.COLOR) { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameter; ! 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; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, pi0); ! sparam.setValue(0, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, pi0); ! sparam.setValue(1, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, pi0); ! sparam.setValue(2, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, pi0); ! sparam.setValue(3, pi0); ! result.addParameter(sparam); ! } else if (type == Declaration.Type.HPOINT) { ! VaryingScalarHPoint param = (VaryingScalarHPoint) parameter; ! VaryingScalarHPoint sparam = ! new VaryingScalarHPoint(declaration, new float[4 * 4]); ! param.getValue(0, t0); ! param.getValue(1, t1); ! param.getValue(2, t2); ! param.getValue(3, t3); ! Point4f uv00 = t0; ! Point4f uv10 = t1; ! Point4f uv01 = t2; ! Point4f uv11 = t3; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, t0); ! sparam.setValue(0, t0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, t0); ! sparam.setValue(1, t0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, t0); ! sparam.setValue(2, t0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, t0); ! sparam.setValue(3, t0); ! 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; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, pi0); ! sparam.setValue(0, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, pi0); ! sparam.setValue(1, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, pi0); ! sparam.setValue(2, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, pi0); ! sparam.setValue(3, pi0); ! result.addParameter(sparam); ! } else ! throw new UnsupportedOperationException("Can't interpolate: " + declaration); ! } ! return result; } --- 452,456 ---- float vMin, float vMax) { ! return parameters.linearInterpolate(uMin, uMax, vMin, vMax); } |
From: Gerardo H. <ma...@us...> - 2004-04-08 01:06:06
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7872/sampleData Modified Files: sphere.rib Log Message: Parameter handling refactoring. Index: sphere.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/sphere.rib,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sphere.rib 14 Jan 2004 03:06:35 -0000 1.10 --- sphere.rib 8 Apr 2004 00:53:03 -0000 1.11 *************** *** 1,4 **** Display "sphere" "framebuffer" "rgba" ! Format 480 360 1 PixelSamples 4 4 Exposure 1 2.2 --- 1,4 ---- Display "sphere" "framebuffer" "rgba" ! Format 800 600 1 PixelSamples 4 4 Exposure 1 2.2 |
From: Gerardo H. <ma...@us...> - 2004-04-08 01:06:06
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7872/src/org/jrman/util Modified Files: Calc.java Log Message: Parameter handling refactoring. Index: Calc.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/util/Calc.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Calc.java 7 Apr 2004 22:37:44 -0000 1.15 --- Calc.java 8 Apr 2004 00:53:02 -0000 1.16 *************** *** 1,5 **** /* Calc.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* Calc.java ! Copyright (C) 2003, 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 20,24 **** package org.jrman.util; - import javax.vecmath.Color3f; import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; --- 20,23 ---- *************** *** 27,31 **** import javax.vecmath.Tuple3f; import javax.vecmath.Tuple4f; - import javax.vecmath.Vector3f; public class Calc { --- 26,29 ---- |
From: Gerardo H. <ma...@us...> - 2004-04-07 22:50:46
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17814/src/org/jrman/util Modified Files: Calc.java Log Message: Interpolate cleanup Index: Calc.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/util/Calc.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Calc.java 23 Mar 2004 06:29:12 -0000 1.14 --- Calc.java 7 Apr 2004 22:37:44 -0000 1.15 *************** *** 25,47 **** import javax.vecmath.Point4f; import javax.vecmath.Tuple2f; import javax.vecmath.Vector3f; public class Calc { ! 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 Point4f p0h = new Point4f(); ! private static Point4f p1h = new Point4f(); ! private static Point4f p2h = new Point4f(); ! private static Point4f p3h = new Point4f(); private Calc() { --- 25,49 ---- import javax.vecmath.Point4f; import javax.vecmath.Tuple2f; + import javax.vecmath.Tuple3f; + import javax.vecmath.Tuple4f; import javax.vecmath.Vector3f; public class Calc { ! private static Tuple3f tmpP0 = new Point3f(); ! private static Tuple3f tmpP1 = new Point3f(); ! private static Tuple3f tmpP2 = new Point3f(); ! private static Tuple3f tmpP3 = new Point3f(); ! private static Tuple4f tmpHP0 = new Point4f(); ! private static Tuple4f tmpHP1 = new Point4f(); ! private static Tuple4f tmpHP2 = new Point4f(); ! private static Tuple4f tmpHP3 = new Point4f(); private Calc() { *************** *** 132,207 **** } ! public static void interpolate(Point3f a, Point3f b, float alpha, Point3f result) { result.interpolate(a, b, alpha); } public static void interpolate( ! Point3f a00, ! Point3f a10, ! Point3f a01, ! Point3f a11, float alphaU, float alphaV, ! Point3f result) { ! interpolate(a00, a10, alphaU, p0); ! interpolate(a01, a11, alphaU, p1); ! interpolate(p0, p1, alphaV, result); ! } ! ! public static Point4f interpolate(Point4f a, Point4f b, float alpha) { ! Point4f result = new Point4f(); ! result.interpolate(a, b, alpha); ! return result; ! } ! ! public static Point4f interpolate( ! Point4f a00, ! Point4f a10, ! Point4f a01, ! Point4f a11, ! float alphaU, ! float alphaV) { ! return interpolate( ! interpolate(a00, a10, alphaU), ! interpolate(a01, a11, alphaU), ! alphaV); ! } ! ! public static Vector3f interpolate(Vector3f a, Vector3f b, float alpha) { ! Vector3f result = new Vector3f(); ! result.interpolate(a, b, alpha); ! return result; ! } ! ! public static Vector3f interpolate( ! Vector3f a00, ! Vector3f a10, ! Vector3f a01, ! Vector3f a11, ! float alphaU, ! float alphaV) { ! return interpolate( ! interpolate(a00, a10, alphaU), ! interpolate(a01, a11, alphaU), ! alphaV); } ! public static Color3f interpolate(Color3f a, Color3f b, float alpha) { ! Color3f result = new Color3f(); result.interpolate(a, b, alpha); - return result; } ! public static Color3f interpolate( ! Color3f a00, ! Color3f a10, ! Color3f a01, ! Color3f a11, float alphaU, ! float alphaV) { ! return interpolate( ! interpolate(a00, a10, alphaU), ! interpolate(a01, a11, alphaU), ! alphaV); } --- 134,169 ---- } ! public static void interpolate(Tuple3f a, Tuple3f b, float alpha, Tuple3f result) { result.interpolate(a, b, alpha); } public static void interpolate( ! Tuple3f a00, ! Tuple3f a10, ! Tuple3f a01, ! Tuple3f a11, float alphaU, float alphaV, ! Tuple3f result) { ! interpolate(a00, a10, alphaU, tmpP0); ! interpolate(a01, a11, alphaU, tmpP1); ! interpolate(tmpP0, tmpP1, alphaV, result); } ! public static void interpolate(Tuple4f a, Tuple4f b, float alpha, Tuple4f result) { result.interpolate(a, b, alpha); } ! public static void interpolate( ! Tuple4f a00, ! Tuple4f a10, ! Tuple4f a01, ! Tuple4f a11, float alphaU, ! float alphaV, ! Tuple4f result) { ! interpolate(a00, a10, alphaU, tmpHP0); ! interpolate(a01, a11, alphaU, tmpHP1); ! interpolate(tmpHP0, tmpHP1, alphaV, result); } *************** *** 275,284 **** public static void bezierInterpolate( ! Point3f p1, ! Point3f p2, ! Point3f p3, ! Point3f p4, float u, ! Point3f result) { result.x = bezierInterpolate(p1.x, p2.x, p3.x, p4.x, u); result.y = bezierInterpolate(p1.y, p2.y, p3.y, p4.y, u); --- 237,246 ---- public static void bezierInterpolate( ! Tuple3f p1, ! Tuple3f p2, ! Tuple3f p3, ! Tuple3f p4, float u, ! Tuple3f result) { result.x = bezierInterpolate(p1.x, p2.x, p3.x, p4.x, u); result.y = bezierInterpolate(p1.y, p2.y, p3.y, p4.y, u); *************** *** 287,296 **** public static void bezierInterpolate( ! Point4f p1, ! Point4f p2, ! Point4f p3, ! Point4f p4, float u, ! Point4f result) { result.x = bezierInterpolate(p1.x, p2.x, p3.x, p4.x, u); result.y = bezierInterpolate(p1.y, p2.y, p3.y, p4.y, u); --- 249,258 ---- public static void bezierInterpolate( ! Tuple4f p1, ! Tuple4f p2, ! Tuple4f p3, ! Tuple4f p4, float u, ! Tuple4f result) { result.x = bezierInterpolate(p1.x, p2.x, p3.x, p4.x, u); result.y = bezierInterpolate(p1.y, p2.y, p3.y, p4.y, u); *************** *** 300,355 **** public static void bezierInterpolate( ! Point3f p00, ! Point3f p10, ! Point3f p20, ! Point3f p30, ! Point3f p01, ! Point3f p11, ! Point3f p21, ! Point3f p31, ! Point3f p02, ! Point3f p12, ! Point3f p22, ! Point3f p32, ! Point3f p03, ! Point3f p13, ! Point3f p23, ! Point3f p33, float u, float v, ! Point3f result) { ! bezierInterpolate(p00, p10, p20, p30, u, p0); ! bezierInterpolate(p01, p11, p21, p31, u, p1); ! bezierInterpolate(p02, p12, p22, p32, u, p2); ! bezierInterpolate(p03, p13, p23, p33, u, p3); ! bezierInterpolate(p0, p1, p2, p3, v, result); } public static void bezierInterpolate( ! Point4f p00, ! Point4f p10, ! Point4f p20, ! Point4f p30, ! Point4f p01, ! Point4f p11, ! Point4f p21, ! Point4f p31, ! Point4f p02, ! Point4f p12, ! Point4f p22, ! Point4f p32, ! Point4f p03, ! Point4f p13, ! Point4f p23, ! Point4f p33, float u, float v, ! Point4f result) { ! bezierInterpolate(p00, p10, p20, p30, u, p0h); ! bezierInterpolate(p01, p11, p21, p31, u, p1h); ! bezierInterpolate(p02, p12, p22, p32, u, p2h); ! bezierInterpolate(p03, p13, p23, p33, u, p3h); ! bezierInterpolate(p0h, p1h, p2h, p3h, v, result); } --- 262,317 ---- public static void bezierInterpolate( ! Tuple3f p00, ! Tuple3f p10, ! Tuple3f p20, ! Tuple3f p30, ! Tuple3f p01, ! Tuple3f p11, ! Tuple3f p21, ! Tuple3f p31, ! Tuple3f p02, ! Tuple3f p12, ! Tuple3f p22, ! Tuple3f p32, ! Tuple3f p03, ! Tuple3f p13, ! Tuple3f p23, ! Tuple3f p33, float u, float v, ! Tuple3f result) { ! bezierInterpolate(p00, p10, p20, p30, u, tmpP0); ! bezierInterpolate(p01, p11, p21, p31, u, tmpP1); ! bezierInterpolate(p02, p12, p22, p32, u, tmpP2); ! bezierInterpolate(p03, p13, p23, p33, u, tmpP3); ! bezierInterpolate(tmpP0, tmpP1, tmpP2, tmpP3, v, result); } public static void bezierInterpolate( ! Tuple4f p00, ! Tuple4f p10, ! Tuple4f p20, ! Tuple4f p30, ! Tuple4f p01, ! Tuple4f p11, ! Tuple4f p21, ! Tuple4f p31, ! Tuple4f p02, ! Tuple4f p12, ! Tuple4f p22, ! Tuple4f p32, ! Tuple4f p03, ! Tuple4f p13, ! Tuple4f p23, ! Tuple4f p33, float u, float v, ! Tuple4f result) { ! bezierInterpolate(p00, p10, p20, p30, u, tmpHP0); ! bezierInterpolate(p01, p11, p21, p31, u, tmpHP1); ! bezierInterpolate(p02, p12, p22, p32, u, tmpHP2); ! bezierInterpolate(p03, p13, p23, p33, u, tmpHP3); ! bezierInterpolate(tmpHP0, tmpHP1, tmpHP2, tmpHP3, v, result); } |
From: Gerardo H. <ma...@us...> - 2004-04-07 22:50:46
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17814/src/org/jrman/primitive Modified Files: Primitive.java Log Message: Interpolate cleanup Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Primitive.java 23 Mar 2004 06:29:12 -0000 1.26 --- Primitive.java 7 Apr 2004 22:37:39 -0000 1.27 *************** *** 355,359 **** float v = 0f; for (int iv = 0; iv < vSize; iv++) { ! g.set(iu, iv, Calc.interpolate(uv00, uv10, uv01, uv11, u, v)); v += vStep; } --- 355,360 ---- float v = 0f; for (int iv = 0; iv < vSize; iv++) { ! Calc.interpolate(uv00, uv10, uv01, uv11, u, v, pi0); ! g.set(iu, iv, pi0); v += vStep; } *************** *** 376,380 **** float v = 0f; for (int iv = 0; iv < vSize; iv++) { ! g.set(iu, iv, Calc.interpolate(uv00, uv10, uv01, uv11, u, v)); v += vStep; } --- 377,382 ---- float v = 0f; for (int iv = 0; iv < vSize; iv++) { ! Calc.interpolate(uv00, uv10, uv01, uv11, u, v, pi0); ! g.set(iu, iv, pi0); v += vStep; } *************** *** 516,523 **** 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.HPOINT) { --- 518,529 ---- Color3f uv01 = c2; Color3f uv11 = c3; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, pi0); ! sparam.setValue(0, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, pi0); ! sparam.setValue(1, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, pi0); ! sparam.setValue(2, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, pi0); ! sparam.setValue(3, pi0); result.addParameter(sparam); } else if (type == Declaration.Type.HPOINT) { *************** *** 533,540 **** Point4f uv01 = t2; Point4f uv11 = t3; ! 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) { --- 539,550 ---- Point4f uv01 = t2; Point4f uv11 = t3; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, t0); ! sparam.setValue(0, t0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, t0); ! sparam.setValue(1, t0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, t0); ! sparam.setValue(2, t0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, t0); ! sparam.setValue(3, t0); result.addParameter(sparam); } else if (type == Declaration.Type.VECTOR || type == Declaration.Type.NORMAL) { *************** *** 550,557 **** 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 --- 560,571 ---- Vector3f uv01 = v2; Vector3f uv11 = v3; ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMin, pi0); ! sparam.setValue(0, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMin, pi0); ! sparam.setValue(1, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMin, vMax, pi0); ! sparam.setValue(2, pi0); ! Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax, pi0); ! sparam.setValue(3, pi0); result.addParameter(sparam); } else |
From: Elmer G. <ega...@us...> - 2004-03-29 16:59:02
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28571/src/org/jrman/primitive Modified Files: BicubicPatch.java Log Message: begined work in nupatch Index: BicubicPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/BicubicPatch.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BicubicPatch.java 23 Mar 2004 06:29:11 -0000 1.10 --- BicubicPatch.java 29 Mar 2004 16:47:31 -0000 1.11 *************** *** 1,5 **** /* BicubicPatch.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* BicubicPatch.java ! Copyright (C) 2004 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or |
From: Elmer G. <ega...@us...> - 2004-03-29 16:59:01
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28571/src/org/jrman/parser/keywords Modified Files: AbstractKeywordParser.java KeywordNuPatch.java Log Message: begined work in nupatch Index: KeywordNuPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordNuPatch.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordNuPatch.java 7 Apr 2003 08:24:31 -0000 1.2 --- KeywordNuPatch.java 29 Mar 2004 16:47:30 -0000 1.3 *************** *** 21,24 **** --- 21,25 ---- import org.jrman.parser.Tokenizer; + import org.jrman.parameters.ParameterList; public class KeywordNuPatch extends MoveableObjectKeywordParser { *************** *** 27,50 **** // Expect nu match(st, TK_NUMBER); // Expect u order match(st, TK_NUMBER); // Expect u knot parseArray(st); // Expect u min match(st, TK_NUMBER); // Expect u max match(st, TK_NUMBER); // Expect nv match(st, TK_NUMBER); // Expect v order match(st, TK_NUMBER); // Expect v knot parseArray(st); // Expect v min match(st, TK_NUMBER); // Expect v max match(st, TK_NUMBER); // Expect parameter list ! parseParameterList(st); } --- 28,76 ---- // Expect nu match(st, TK_NUMBER); + int nu = (int) st.nval; + // Expect u order match(st, TK_NUMBER); + int uorder = (int) st.nval; + // Expect u knot parseArray(st); + float[] uknot = new float[arraySize]; + System.arraycopy(numbers, 0, uknot, 0, arraySize); + // Expect u min match(st, TK_NUMBER); + float umin = (float) st.nval; + // Expect u max match(st, TK_NUMBER); + float umax = (float) st.nval; + // Expect nv match(st, TK_NUMBER); + int nv = (int) st.nval; + // Expect v order match(st, TK_NUMBER); + int vorder = (int) st.nval; + // Expect v knot parseArray(st); + float[] vknot = new float[arraySize]; + System.arraycopy(numbers, 0, vknot, 0, arraySize); + // Expect v min match(st, TK_NUMBER); + float vmin = (float) st.nval; + // Expect v max match(st, TK_NUMBER); + float vmax = (float) st.nval; + // Expect parameter list ! ParameterList parameterList = parseParameterList(st); ! parser.addNuPatch(nu, uorder, uknot, umin, umax, ! nv, vorder, vknot, vmin, vmax, ! parameterList); } Index: AbstractKeywordParser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/AbstractKeywordParser.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AbstractKeywordParser.java 2 Feb 2004 19:30:06 -0000 1.9 --- AbstractKeywordParser.java 29 Mar 2004 16:47:30 -0000 1.10 *************** *** 53,57 **** final static int TK_RBRACE = ']'; ! private static float[] numbers = new float[5000]; protected static int[] integers = new int[5000]; --- 53,57 ---- final static int TK_RBRACE = ']'; ! protected static float[] numbers = new float[5000]; protected static int[] integers = new int[5000]; |
From: Elmer G. <ega...@us...> - 2004-03-29 16:59:01
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28571/src/org/jrman/parser Modified Files: Parser.java Log Message: begined work in nupatch Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** Parser.java 13 Feb 2004 06:46:24 -0000 1.79 --- Parser.java 29 Mar 2004 16:47:30 -0000 1.80 *************** *** 1063,1066 **** --- 1063,1096 ---- } + public void addNuPatch(final int nu, + final int uorder, + final float[] uknot, + final float umin, + final float umax, + final int vu, + final int vorder, + final float[] vknot, + final float vmin, + final float vmax, + final ParameterList parameterList) { + if (inAreaLightSource) + return; + if (!inObject) { + //NuPatch patch = new NuPatch(parameters, getAttributes()); + //renderer.addPrimitive(patch); + } else { + final Transform transform = currentAttributes.getTransform(); + currentObjectInstanceList + .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { + public Primitive create(Attributes attributes) { + //NuPatch patch = + //new NuPatch(parameters, createAttributes(transform, attributes)); + //return patch; + return null; + } + }); + } + } + public void addPointsPolygons( final int[] nVertices, |
From: Elmer G. <ega...@us...> - 2004-03-23 14:14:05
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29988 Modified Files: testBicubic.rib Log Message: Tests rational Index: testBicubic.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/testBicubic.rib,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testBicubic.rib 23 Mar 2004 06:29:11 -0000 1.3 --- testBicubic.rib 23 Mar 2004 14:03:38 -0000 1.4 *************** *** 22,26 **** "Pw" [ -3 -3 0 1 -1 -3 0 1 1 -3 0 1 3 -3 0 1 ! -3 -1 0 1 -1 -1 -5 1 1 -1 1 1 3 -1 0 1 -3 1 0 1 -1 1 1 1 1 1 1 1 3 1 0 1 -3 3 0 1 -1 3 0 1 1 3 -1 1 3 3 0 1 --- 22,26 ---- "Pw" [ -3 -3 0 1 -1 -3 0 1 1 -3 0 1 3 -3 0 1 ! -3 -1 0 1 -1 -1 -5 100 1 -1 1 1 3 -1 0 1 -3 1 0 1 -1 1 1 1 1 1 1 1 3 1 0 1 -3 3 0 1 -1 3 0 1 1 3 -1 1 3 3 0 1 |
From: Elmer G. <ega...@us...> - 2004-03-23 06:39:37
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5096/src/org/jrman/primitive Modified Files: BicubicPatch.java Disk.java Primitive.java Log Message: Added Rational Bicubic Patch support. Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Primitive.java 2 Feb 2004 19:30:05 -0000 1.25 --- Primitive.java 23 Mar 2004 06:29:12 -0000 1.26 *************** *** 21,24 **** --- 21,25 ---- import javax.vecmath.Color3f; + import javax.vecmath.Point4f; import javax.vecmath.Point3f; import javax.vecmath.Vector3f; *************** *** 39,42 **** --- 40,44 ---- import org.jrman.parameters.VaryingScalarFloat; import org.jrman.parameters.VaryingScalarTuple3f; + import org.jrman.parameters.VaryingScalarHPoint; import org.jrman.parser.Global; import org.jrman.render.ShaderVariables; *************** *** 75,78 **** --- 77,88 ---- private static Color3f c3 = new Color3f(); + private static Point4f t0 = new Point4f(); + + private static Point4f t1 = new Point4f(); + + private static Point4f t2 = new Point4f(); + + private static Point4f t3 = new Point4f(); + protected ParameterList parameters; *************** *** 511,514 **** --- 521,541 ---- sparam.setValue(3, Calc.interpolate(uv00, uv10, uv01, uv11, uMax, vMax)); result.addParameter(sparam); + } else if (type == Declaration.Type.HPOINT) { + VaryingScalarHPoint param = (VaryingScalarHPoint) parameter; + VaryingScalarHPoint sparam = + new VaryingScalarHPoint(declaration, new float[4 * 4]); + param.getValue(0, t0); + param.getValue(1, t1); + param.getValue(2, t2); + param.getValue(3, t3); + Point4f uv00 = t0; + Point4f uv10 = t1; + Point4f uv01 = t2; + Point4f uv11 = t3; + 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; Index: Disk.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Disk.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Disk.java 30 Nov 2003 03:23:16 -0000 1.8 --- Disk.java 23 Mar 2004 06:29:12 -0000 1.9 *************** *** 1,4 **** /* ! Cylinder.java Copyright (C) 2003 Gerardo Horvilleur Martinez --- 1,4 ---- /* ! Disk.java Copyright (C) 2003 Gerardo Horvilleur Martinez Index: BicubicPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/BicubicPatch.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BicubicPatch.java 9 Feb 2004 16:49:32 -0000 1.9 --- BicubicPatch.java 23 Mar 2004 06:29:11 -0000 1.10 *************** *** 21,25 **** import javax.vecmath.Point3f; ! import javax.vecmath.Vector3f; import javax.vecmath.Matrix4f; import javax.vecmath.Point4f; --- 21,25 ---- import javax.vecmath.Point3f; ! import javax.vecmath.Vector4f; import javax.vecmath.Matrix4f; import javax.vecmath.Point4f; *************** *** 32,35 **** --- 32,36 ---- import org.jrman.parameters.ParameterList; import org.jrman.parameters.VaryingScalarTuple3f; + import org.jrman.parameters.VaryingScalarHPoint; import org.jrman.render.ShaderVariables; import org.jrman.util.Calc; *************** *** 37,105 **** 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 Point3f PS00 = new Point3f(); ! private static Point3f PS10 = new Point3f(); ! private static Point3f PS20 = new Point3f(); ! private static Point3f PS30 = new Point3f(); ! private static Point3f PS01 = new Point3f(); ! private static Point3f PS11 = new Point3f(); ! private static Point3f PS21 = new Point3f(); ! private static Point3f PS31 = new Point3f(); ! private static Point3f PS02 = new Point3f(); ! private static Point3f PS12 = new Point3f(); ! private static Point3f PS22 = new Point3f(); ! private static Point3f PS32 = new Point3f(); ! private static Point3f PS03 = new Point3f(); ! private static Point3f PS13 = new Point3f(); ! private static Point3f PS23 = new Point3f(); ! private static Point3f PS33 = new Point3f(); ! private static Vector3f vtmp = new Vector3f(); private static Point4f PV0 = new Point4f(); --- 38,108 ---- public class BicubicPatch extends Primitive { ! private static Point4f P00 = new Point4f(); ! private static Point4f P10 = new Point4f(); ! private static Point4f P20 = new Point4f(); ! private static Point4f P30 = new Point4f(); ! private static Point4f P01 = new Point4f(); ! private static Point4f P11 = new Point4f(); ! private static Point4f P21 = new Point4f(); ! private static Point4f P31 = new Point4f(); ! private static Point4f P02 = new Point4f(); ! private static Point4f P12 = new Point4f(); ! private static Point4f P22 = new Point4f(); ! private static Point4f P32 = new Point4f(); ! private static Point4f P03 = new Point4f(); ! private static Point4f P13 = new Point4f(); ! private static Point4f P23 = new Point4f(); ! private static Point4f P33 = new Point4f(); ! private static Point4f PS00 = new Point4f(); ! private static Point4f PS10 = new Point4f(); ! private static Point4f PS20 = new Point4f(); ! private static Point4f PS30 = new Point4f(); ! private static Point4f PS01 = new Point4f(); ! private static Point4f PS11 = new Point4f(); ! private static Point4f PS21 = new Point4f(); ! private static Point4f PS31 = new Point4f(); ! private static Point4f PS02 = new Point4f(); ! private static Point4f PS12 = new Point4f(); ! private static Point4f PS22 = new Point4f(); ! private static Point4f PS32 = new Point4f(); ! private static Point4f PS03 = new Point4f(); ! private static Point4f PS13 = new Point4f(); ! private static Point4f PS23 = new Point4f(); ! private static Point4f PS33 = new Point4f(); ! private static Point3f P3F = new Point3f(); ! ! private static Vector4f vtmp = new Vector4f(); private static Point4f PV0 = new Point4f(); *************** *** 112,136 **** 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); } private void setPoints() { ! VaryingScalarTuple3f param = (VaryingScalarTuple3f) parameters.getParameter("P"); param.setValue(0, P00); param.setValue(1, P10); --- 115,147 ---- private void extractPoints() { ! VaryingScalarTuple3f param3f = (VaryingScalarTuple3f) parameters.getParameter("P"); ! ! if(param3f != null) ! { ! parameters.removeParameter("P"); ! parameters.addParameter(new VaryingScalarHPoint(new Declaration("Pw", "vertex hpoint"), param3f)); ! } ! VaryingScalarHPoint paramHp = (VaryingScalarHPoint) parameters.getParameter("Pw"); ! ! paramHp.getValue(0, P00); ! paramHp.getValue(1, P10); ! paramHp.getValue(2, P20); ! paramHp.getValue(3, P30); ! paramHp.getValue(4, P01); ! paramHp.getValue(5, P11); ! paramHp.getValue(6, P21); ! paramHp.getValue(7, P31); ! paramHp.getValue(8, P02); ! paramHp.getValue(9, P12); ! paramHp.getValue(10, P22); ! paramHp.getValue(11, P32); ! paramHp.getValue(12, P03); ! paramHp.getValue(13, P13); ! paramHp.getValue(14, P23); ! paramHp.getValue(15, P33); } private void setPoints() { ! VaryingScalarHPoint param = (VaryingScalarHPoint) parameters.getParameter("Pw"); param.setValue(0, P00); param.setValue(1, P10); *************** *** 169,178 **** } ! public void applyBasis( ! Point3f p0, ! Point3f p1, ! Point3f p2, ! Point3f p3, ! Matrix4f h) { applyBasis(p0.x, p1.x, p2.x, p3.x, h, PV0); p0.x = PV0.x; --- 180,189 ---- } ! private void applyBasis( ! Point4f p0, ! Point4f p1, ! Point4f p2, ! Point4f p3, ! Matrix4f h) { applyBasis(p0.x, p1.x, p2.x, p3.x, h, PV0); p0.x = PV0.x; *************** *** 190,198 **** p2.z = PV0.z; p3.z = PV0.w; } ! public void applyBasis(float p0, float p1, float p2, float p3, Matrix4f hu, ! Point4f result) { PV1.set(p0, p1, p2, p3); hu.transform(PV1, result); --- 201,214 ---- p2.z = PV0.z; p3.z = PV0.w; + applyBasis(p0.w, p1.w, p2.w, p3.w, h, PV0); + p0.w = PV0.x; + p1.w = PV0.y; + p2.w = PV0.z; + p3.w = PV0.w; } ! private void applyBasis(float p0, float p1, float p2, float p3, Matrix4f hu, ! Point4f result) { PV1.set(p0, p1, p2, p3); hu.transform(PV1, result); *************** *** 204,223 **** ConvexHull3f ch = new ConvexHull3f(); extractPoints(); ! ch.addPoint(P00); ! ch.addPoint(P10); ! ch.addPoint(P20); ! ch.addPoint(P30); ! ch.addPoint(P01); ! ch.addPoint(P11); ! ch.addPoint(P21); ! ch.addPoint(P31); ! ch.addPoint(P02); ! ch.addPoint(P12); ! ch.addPoint(P22); ! ch.addPoint(P32); ! ch.addPoint(P03); ! ch.addPoint(P13); ! ch.addPoint(P23); ! ch.addPoint(P33); return ch; } --- 220,239 ---- ConvexHull3f ch = new ConvexHull3f(); extractPoints(); ! ch.addHpoint(P00); ! ch.addHpoint(P10); ! ch.addHpoint(P20); ! ch.addHpoint(P30); ! ch.addHpoint(P01); ! ch.addHpoint(P11); ! ch.addHpoint(P21); ! ch.addHpoint(P31); ! ch.addHpoint(P02); ! ch.addHpoint(P12); ! ch.addHpoint(P22); ! ch.addHpoint(P32); ! ch.addHpoint(P03); ! ch.addHpoint(P13); ! ch.addHpoint(P23); ! ch.addHpoint(P33); return ch; } *************** *** 257,268 **** protected ParameterList bezierInterpolateParameters( ! float uv00, ! float uv10, ! float uv01, ! float uv11) { ParameterList result = linearInterpolateParameters(uv00, uv10, uv01, uv11); extractPoints(); ! VaryingScalarTuple3f sparam = ! new VaryingScalarTuple3f(new Declaration("P", "vertex point"), new float[16 * 3]); if (uv00 == .5f) { splitUpper(P00, P10, P20, P30, PS00, PS10, PS20, PS30); --- 273,284 ---- protected ParameterList bezierInterpolateParameters( ! float uv00, ! float uv10, ! float uv01, ! float uv11) { ParameterList result = linearInterpolateParameters(uv00, uv10, uv01, uv11); extractPoints(); ! VaryingScalarHPoint sparam = ! new VaryingScalarHPoint(new Declaration("Pw", "vertex hpoint"), new float[16 * 4]); if (uv00 == .5f) { splitUpper(P00, P10, P20, P30, PS00, PS10, PS20, PS30); *************** *** 307,318 **** protected void splitLower( ! Point3f in0, ! Point3f in1, ! Point3f in2, ! Point3f in3, ! Point3f out0, ! Point3f out1, ! Point3f out2, ! Point3f out3) { out0.set(in0); out1.add(in0, in1); --- 323,334 ---- protected void splitLower( ! Point4f in0, ! Point4f in1, ! Point4f in2, ! Point4f in3, ! Point4f out0, ! Point4f out1, ! Point4f out2, ! Point4f out3) { out0.set(in0); out1.add(in0, in1); *************** *** 331,342 **** protected void splitUpper( ! Point3f in0, ! Point3f in1, ! Point3f in2, ! Point3f in3, ! Point3f out0, ! Point3f out1, ! Point3f out2, ! Point3f out3) { out3.set(in3); out2.add(in3, in2); --- 347,358 ---- protected void splitUpper( ! Point4f in0, ! Point4f in1, ! Point4f in2, ! Point4f in3, ! Point4f out0, ! Point4f out1, ! Point4f out2, ! Point4f out3) { out3.set(in3); out2.add(in3, in2); *************** *** 361,384 **** for (int i = 0; i < Grid.getSize(); i++) { Calc.bezierInterpolate( ! P00, ! P10, ! P20, ! P30, ! P01, ! P11, ! P21, ! P31, ! P02, ! P12, ! P22, ! P32, ! P03, ! P13, ! P23, ! P33, ! udata[i], ! vdata[i], ! PS00); ! pdata[i].set(PS00); } } --- 377,403 ---- for (int i = 0; i < Grid.getSize(); i++) { Calc.bezierInterpolate( ! P00, ! P10, ! P20, ! P30, ! P01, ! P11, ! P21, ! P31, ! P02, ! P12, ! P22, ! P32, ! P03, ! P13, ! P23, ! P33, ! udata[i], ! vdata[i], ! PS00); ! P3F.x = PS00.x / PS00.w; ! P3F.y = PS00.y / PS00.w; ! P3F.z = PS00.z / PS00.w; ! pdata[i].set(P3F); } } |
From: Elmer G. <ega...@us...> - 2004-03-23 06:39:37
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5096/src/org/jrman/util Modified Files: Calc.java Log Message: Added Rational Bicubic Patch support. Index: Calc.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/util/Calc.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Calc.java 14 Dec 2003 22:28:28 -0000 1.13 --- Calc.java 23 Mar 2004 06:29:12 -0000 1.14 *************** *** 37,40 **** --- 37,48 ---- private static Point3f p3 = new Point3f(); + private static Point4f p0h = new Point4f(); + + private static Point4f p1h = new Point4f(); + + private static Point4f p2h = new Point4f(); + + private static Point4f p3h = new Point4f(); + private Calc() { } *************** *** 279,282 **** --- 287,303 ---- public static void bezierInterpolate( + Point4f p1, + Point4f p2, + Point4f p3, + Point4f p4, + float u, + Point4f result) { + result.x = bezierInterpolate(p1.x, p2.x, p3.x, p4.x, u); + result.y = bezierInterpolate(p1.y, p2.y, p3.y, p4.y, u); + result.z = bezierInterpolate(p1.z, p2.z, p3.z, p4.z, u); + result.w = bezierInterpolate(p1.w, p2.w, p3.w, p4.w, u); + } + + public static void bezierInterpolate( Point3f p00, Point3f p10, *************** *** 305,308 **** --- 326,357 ---- } + + public static void bezierInterpolate( + Point4f p00, + Point4f p10, + Point4f p20, + Point4f p30, + Point4f p01, + Point4f p11, + Point4f p21, + Point4f p31, + Point4f p02, + Point4f p12, + Point4f p22, + Point4f p32, + Point4f p03, + Point4f p13, + Point4f p23, + Point4f p33, + float u, + float v, + Point4f result) { + bezierInterpolate(p00, p10, p20, p30, u, p0h); + bezierInterpolate(p01, p11, p21, p31, u, p1h); + bezierInterpolate(p02, p12, p22, p32, u, p2h); + bezierInterpolate(p03, p13, p23, p33, u, p3h); + bezierInterpolate(p0h, p1h, p2h, p3h, v, result); + } + public static float fovToFocalLength(float fov) { return (float) (1 / Math.tan(Math.toRadians(fov / 2))); |
From: Elmer G. <ega...@us...> - 2004-03-23 06:39:36
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5096/src/org/jrman/parser Modified Files: Global.java Log Message: Added Rational Bicubic Patch support. Index: Global.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Global.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Global.java 12 Dec 2003 23:50:19 -0000 1.9 --- Global.java 23 Mar 2004 06:29:11 -0000 1.10 *************** *** 66,70 **** declarations.put("P", new Declaration("P", "vertex point")); declarations.put("Pz", new Declaration("Pz", "vertex float")); ! declarations.put("Pw", new Declaration("Pz", "vertex hpoint")); declarations.put("N", new Declaration("N", "varying normal")); declarations.put("Cs", new Declaration("Cs", "varying color")); --- 66,70 ---- declarations.put("P", new Declaration("P", "vertex point")); declarations.put("Pz", new Declaration("Pz", "vertex float")); ! declarations.put("Pw", new Declaration("Pw", "vertex hpoint")); declarations.put("N", new Declaration("N", "varying normal")); declarations.put("Cs", new Declaration("Cs", "varying color")); |
From: Elmer G. <ega...@us...> - 2004-03-23 06:39:36
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parameters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5096/src/org/jrman/parameters Modified Files: ParameterList.java VaryingArrayFloat.java VaryingScalarHPoint.java VaryingScalarTuple3f.java Log Message: Added Rational Bicubic Patch support. Index: VaryingScalarTuple3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarTuple3f.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VaryingScalarTuple3f.java 14 Dec 2003 22:28:28 -0000 1.4 --- VaryingScalarTuple3f.java 23 Mar 2004 06:29:11 -0000 1.5 *************** *** 21,24 **** --- 21,25 ---- import javax.vecmath.Tuple3f; + import javax.vecmath.Tuple4f; public class VaryingScalarTuple3f extends Parameter { *************** *** 42,45 **** --- 43,50 ---- values[index * 3 + 2] = in.z; } + + public float getValue(int index){ + return values[index]; + } public int getCount() { Index: ParameterList.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/ParameterList.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ParameterList.java 9 Dec 2003 04:51:52 -0000 1.3 --- ParameterList.java 23 Mar 2004 06:29:11 -0000 1.4 *************** *** 1,3 **** - /* ParameterList.java --- 1,2 ---- Index: VaryingScalarHPoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingScalarHPoint.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VaryingScalarHPoint.java 14 Dec 2003 22:28:28 -0000 1.3 --- VaryingScalarHPoint.java 23 Mar 2004 06:29:11 -0000 1.4 *************** *** 30,33 **** --- 30,46 ---- this.values = values; } + + public VaryingScalarHPoint(Declaration declaration, VaryingScalarTuple3f param) { + super(declaration); + values = new float[param.getCount() * 4]; + for(int i = 0; i < param.getCount(); i++) + { + values[i * 4] = param.getValue(i * 3); + values[i * 4 + 1] = param.getValue(i * 3 + 1); + values[i * 4 + 2] = param.getValue(i * 3 + 2); + values[i * 4 + 3] = 1; + } + } + public void getValue(int index, Tuple4f out) { *************** *** 37,40 **** --- 50,60 ---- out.w = values[index * 4 + 3]; } + + public void setValue(int index, Tuple4f in) { + values[index * 4] = in.x; + values[index * 4 + 1] = in.y; + values[index * 4 + 2] = in.z; + values[index * 4 + 3] = in.w; + } } Index: VaryingArrayFloat.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/VaryingArrayFloat.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VaryingArrayFloat.java 20 Dec 2003 18:13:32 -0000 1.4 --- VaryingArrayFloat.java 23 Mar 2004 06:29:11 -0000 1.5 *************** *** 1,4 **** /* ! VaryingFloat.java Copyright (C) 2003 Gerardo Horvilleur Martinez --- 1,4 ---- /* ! VaryingArrayFloat.java Copyright (C) 2003 Gerardo Horvilleur Martinez |
From: Elmer G. <ega...@us...> - 2004-03-23 06:39:35
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5096/sampleData Modified Files: testBicubic.rib Log Message: Added Rational Bicubic Patch support. Index: testBicubic.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/testBicubic.rib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testBicubic.rib 13 Feb 2004 06:46:24 -0000 1.2 --- testBicubic.rib 23 Mar 2004 06:29:11 -0000 1.3 *************** *** 1,5 **** Display "bicubic" "framebuffer" "rgba" PixelFilter "gaussian" 2 2 ! Format 800 600 1 PixelSamples 4 4 Exposure 1 2.2 --- 1,5 ---- Display "bicubic" "framebuffer" "rgba" PixelFilter "gaussian" 2 2 ! Format 400 300 1 PixelSamples 4 4 Exposure 1 2.2 *************** *** 17,28 **** AttributeEnd ShadingRate .25 ! Surface "paintedplastic" "texturename" "checkerboard.txr" Basis "bezier" 2 "bezier" 2 Patch "bicubic" ! "P" [ ! -3 -3 0 -1 -3 0 1 -3 0 3 -3 0 ! -3 -1 0 -1 -1 -5 1 -1 1 3 -1 0 ! -3 1 0 -1 1 1 1 1 1 3 1 0 ! -3 3 0 -1 3 0 1 3 -1 3 3 0 ] "s" [0 4 0 4] --- 17,28 ---- AttributeEnd ShadingRate .25 ! # Surface "paintedplastic" "texturename" "checkerboard.txr" Basis "bezier" 2 "bezier" 2 Patch "bicubic" ! "Pw" [ ! -3 -3 0 1 -1 -3 0 1 1 -3 0 1 3 -3 0 1 ! -3 -1 0 1 -1 -1 -5 1 1 -1 1 1 3 -1 0 1 ! -3 1 0 1 -1 1 1 1 1 1 1 1 3 1 0 1 ! -3 3 0 1 -1 3 0 1 1 3 -1 1 3 3 0 1 ] "s" [0 4 0 4] |
From: <ma...@us...> - 2004-02-13 06:51:52
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23606/src/org/jrman/parser Modified Files: Parser.java Log Message: First PatchMesh implementation. Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Parser.java 9 Feb 2004 16:49:32 -0000 1.78 --- Parser.java 13 Feb 2004 06:46:24 -0000 1.79 *************** *** 932,943 **** patch.applyBasis(); renderer.addPrimitive(patch); ! }else { final Transform transform = currentAttributes.getTransform(); currentObjectInstanceList .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { public Primitive create(Attributes attributes) { ! BicubicPatch patch = new BicubicPatch(parameters, ! createAttributes(transform, ! attributes)); patch.applyBasis(); return patch; --- 932,942 ---- patch.applyBasis(); renderer.addPrimitive(patch); ! } else { final Transform transform = currentAttributes.getTransform(); currentObjectInstanceList .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { public Primitive create(Attributes attributes) { ! BicubicPatch patch = ! new BicubicPatch(parameters, createAttributes(transform, attributes)); patch.applyBasis(); return patch; *************** *** 947,950 **** --- 946,1066 ---- } + private int evalIndex(int iu, int nu, int iv, int nv) { + return (iv % nv) * nu + (iu % nu); + } + + public void addBilinearPatchMesh( + int nu, + String uWrap, + int nv, + String vWrap, + ParameterList parameters) { + int nU; + if (uWrap.equals("periodic")) + nU = nu; + else if (uWrap.equals("nonperiodic")) + nU = nu - 1; + else + throw new IllegalArgumentException("Unknown u wrap type: " + uWrap); + int nV; + if (vWrap.equals("periodic")) + nV = nv; + else if (uWrap.equals("nonperiodic")) + nV = nv - 1; + else + throw new IllegalArgumentException("Unknown v wrap type: " + vWrap); + VaryingScalarTuple3f pParam = (VaryingScalarTuple3f) parameters.getParameter("P"); + Point3f tmp = new Point3f(); + for (int i = 0; i < nU; i++) + for (int j = 0; j < nV; j++) { + ParameterList nparameters = new ParameterList(parameters); + nparameters.removeParameter("P"); + VaryingScalarTuple3f npParam = + new VaryingScalarTuple3f(pParam.getDeclaration(), new float[4 * 3]); + pParam.getValue(evalIndex(i, nu, j, nv), tmp); + npParam.setValue(0, tmp); + pParam.getValue(evalIndex(i + 1, nu, j, nv), tmp); + npParam.setValue(1, tmp); + pParam.getValue(evalIndex(i, nu, j + 1, nv), tmp); + npParam.setValue(2, tmp); + pParam.getValue(evalIndex(i + 1, nu, j + 1, nv), tmp); + npParam.setValue(3, tmp); + nparameters.addParameter(npParam); + addBilinearPatch(nparameters); + } + } + + public void addBicubicPatchMesh( + int nu, + String uWrap, + int nv, + String vWrap, + ParameterList parameters) { + int uStep = currentAttributes.getUStep(); + int nU; + if (uWrap.equals("periodic")) + nU = nu / uStep; + else if (uWrap.equals("nonperiodic")) + nU = (nu - 4) / uStep + 1; + else + throw new IllegalArgumentException("Unknown u wrap type: " + uWrap); + int vStep = currentAttributes.getVStep(); + int nV; + if (vWrap.equals("periodic")) + nV = nv / vStep; + else if (uWrap.equals("nonperiodic")) + nV = (nv - 4) / vStep + 1; + else + throw new IllegalArgumentException("Unknown v wrap type: " + vWrap); + VaryingScalarTuple3f pParam = (VaryingScalarTuple3f) parameters.getParameter("P"); + Point3f tmp = new Point3f(); + int i = 0; + for (int ii = 0; ii < nU; ii++) { + int j = 0; + for (int jj = 0; jj < nV; jj++) { + ParameterList nparameters = new ParameterList(parameters); + nparameters.removeParameter("P"); + VaryingScalarTuple3f npParam = + new VaryingScalarTuple3f(pParam.getDeclaration(), new float[16 * 3]); + pParam.getValue(evalIndex(i, nu, j, nv), tmp); + npParam.setValue(0, tmp); + pParam.getValue(evalIndex(i + 1, nu, j, nv), tmp); + npParam.setValue(1, tmp); + pParam.getValue(evalIndex(i + 2, nu, j, nv), tmp); + npParam.setValue(2, tmp); + pParam.getValue(evalIndex(i + 3, nu, j, nv), tmp); + npParam.setValue(3, tmp); + pParam.getValue(evalIndex(i, nu, j + 1, nv), tmp); + npParam.setValue(4, tmp); + pParam.getValue(evalIndex(i + 1, nu, j + 1, nv), tmp); + npParam.setValue(5, tmp); + pParam.getValue(evalIndex(i + 2, nu, j + 1, nv), tmp); + npParam.setValue(6, tmp); + pParam.getValue(evalIndex(i + 3, nu, j + 1, nv), tmp); + npParam.setValue(7, tmp); + pParam.getValue(evalIndex(i, nu, j + 2, nv), tmp); + npParam.setValue(8, tmp); + pParam.getValue(evalIndex(i + 1, nu, j + 2, nv), tmp); + npParam.setValue(9, tmp); + pParam.getValue(evalIndex(i + 2, nu, j + 2, nv), tmp); + npParam.setValue(10, tmp); + pParam.getValue(evalIndex(i + 3, nu, j + 2, nv), tmp); + npParam.setValue(11, tmp); + pParam.getValue(evalIndex(i, nu, j + 3, nv) , tmp); + npParam.setValue(12, tmp); + pParam.getValue(evalIndex(i + 1, nu, j + 3, nv), tmp); + npParam.setValue(13, tmp); + pParam.getValue(evalIndex(i + 2, nu, j + 3, nv), tmp); + npParam.setValue(14, tmp); + pParam.getValue(evalIndex(i + 3, nu, j + 3, nv), tmp); + npParam.setValue(15, tmp); + nparameters.addParameter(npParam); + addBicubicPatch(nparameters); + j += vStep; + } + i += uStep; + } + } + public void addPointsPolygons( final int[] nVertices, *************** *** 971,1021 **** } - public void addPointsPolygon( - float[] nVertices, - float[] vertices, - ParameterList parameters) { - VaryingScalarTuple3f pParam = (VaryingScalarTuple3f) parameters.getParameter("P"); - VaryingArrayFloat stParam = (VaryingArrayFloat) parameters.getParameter("st"); - VaryingScalarTuple3f nParam = (VaryingScalarTuple3f) parameters.getParameter("N"); - int offset = 0; - Point3f point = new Point3f(); - for (int i = 0; i < nVertices.length; i++) { - int n = (int) nVertices[i]; - VaryingScalarTuple3f npParam = - new VaryingScalarTuple3f(pParam.getDeclaration(), new float[n * 3]); - VaryingArrayFloat nstParam = null; - if (stParam != null) - nstParam = new VaryingArrayFloat(stParam.getDeclaration(), new float[n * 2]); - VaryingScalarTuple3f nnParam = null; - if (nParam != null) - nnParam = new VaryingScalarTuple3f(nParam.getDeclaration(), new float[n * 3]); - for (int j = 0; j < n; j++) { - pParam.getValue((int) vertices[offset], point); - npParam.setValue(j, point); - if (stParam != null) { - nstParam.setValue(j, 0, stParam.getValue((int) vertices[offset], 0)); - nstParam.setValue(j, 1, stParam.getValue((int) vertices[offset], 1)); - } - if (nParam != null) { - nParam.getValue((int) vertices[offset], point); - nnParam.setValue(j, point); - } - offset += 1; - } - ParameterList newParameters = new ParameterList(parameters); - newParameters.removeParameter(npParam.getDeclaration().getName()); - newParameters.addParameter(npParam); - if (stParam != null) { - newParameters.removeParameter(stParam.getDeclaration().getName()); - newParameters.addParameter(nstParam); - } - if (nParam != null) { - newParameters.removeParameter(nParam.getDeclaration().getName()); - newParameters.addParameter(nnParam); - } - addPolygon(newParameters); - } - } - public void addPolygon(final ParameterList parameters) { VaryingScalarTuple3f pParam = (VaryingScalarTuple3f) parameters.getParameter("P"); --- 1087,1090 ---- |
From: <ma...@us...> - 2004-02-13 06:51:51
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23606/src/org/jrman/parser/keywords Modified Files: KeywordPatchMesh.java KeywordPatch.java Log Message: First PatchMesh implementation. Index: KeywordPatchMesh.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPatchMesh.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordPatchMesh.java 7 Apr 2003 08:24:30 -0000 1.2 --- KeywordPatchMesh.java 13 Feb 2004 06:46:24 -0000 1.3 *************** *** 20,23 **** --- 20,24 ---- package org.jrman.parser.keywords; + import org.jrman.parameters.ParameterList; import org.jrman.parser.Tokenizer; *************** *** 27,45 **** // Expect type match(st, TK_STRING); ! // Expect nu match(st, TK_NUMBER); ! // Expect u wrap match(st, TK_STRING); ! // Expect nv match(st, TK_NUMBER); ! // Expect v wrap match(st, TK_STRING); ! // Expect parameter list ! parseParameterList(st); } --- 28,52 ---- // Expect type match(st, TK_STRING); ! String type = st.sval; // Expect nu match(st, TK_NUMBER); ! int nu = (int) st.nval; // Expect u wrap match(st, TK_STRING); ! String uWrap = st.sval; // Expect nv match(st, TK_NUMBER); ! int nv = (int) st.nval; // Expect v wrap match(st, TK_STRING); ! String vWrap = st.sval; // Expect parameter list ! ParameterList parameters = parseParameterList(st); ! if (type.equals("bilinear")) ! parser.addBilinearPatchMesh(nu, uWrap, nv, vWrap, parameters); ! else if (type.equals("bicubic")) ! parser.addBicubicPatchMesh(nu, uWrap, nv, vWrap, parameters); ! else ! throw new IllegalArgumentException("Unknown patch mesh type: " + type); } Index: KeywordPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPatch.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** KeywordPatch.java 25 Nov 2003 16:34:08 -0000 1.5 --- KeywordPatch.java 13 Feb 2004 06:46:24 -0000 1.6 *************** *** 36,40 **** parser.addBicubicPatch(parameters); else ! throw new IllegalArgumentException("Unkown patch type: " + type); } --- 36,40 ---- parser.addBicubicPatch(parameters); else ! throw new IllegalArgumentException("Unknown patch type: " + type); } |